diff options
author | Thomas Hellstrom <[email protected]> | 2017-08-02 13:53:54 +0200 |
---|---|---|
committer | Thomas Hellstrom <[email protected]> | 2017-08-03 08:00:25 +0200 |
commit | ad5136ac826a9e34d1f789398016a018c42a27ca (patch) | |
tree | ead47d5d30dd03ec445c2d67e0d9dac63a5c6c7b /src/glx/dri3_glx.c | |
parent | ae93d534a864e407cb452a675ee4b135d40bdb30 (diff) |
glx/dri3: Implement the flush_swapbuffers method
Provide a dri3 implementation for the image loader extension method.
Signed-off-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Sinclair Yeh <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/glx/dri3_glx.c')
-rw-r--r-- | src/glx/dri3_glx.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index cc110370d3a..64c0b9e7b9c 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -495,6 +495,33 @@ dri3_flush_front_buffer(__DRIdrawable *driDrawable, void *loaderPrivate) loader_dri3_wait_gl(draw); } +/** + * Make sure all pending swapbuffers have been submitted to hardware + * + * \param driDrawable[in] Pointer to the dri drawable whose swaps we are + * flushing. + * \param loaderPrivate[in] Pointer to the corresponding struct + * loader_dri_drawable. + */ +static void +dri3_flush_swap_buffers(__DRIdrawable *driDrawable, void *loaderPrivate) +{ + struct loader_dri3_drawable *draw = loaderPrivate; + struct dri3_drawable *pdraw = loader_drawable_to_dri3_drawable(draw); + struct dri3_screen *psc; + + if (!pdraw) + return; + + if (!pdraw->base.psc) + return; + + psc = (struct dri3_screen *) pdraw->base.psc; + + (void) __glXInitialize(psc->base.dpy); + loader_dri3_swapbuffer_barrier(draw); +} + static void dri_set_background_context(void *loaderPrivate) { @@ -514,10 +541,11 @@ dri_is_thread_safe(void *loaderPrivate) /* The image loader extension record for DRI3 */ static const __DRIimageLoaderExtension imageLoaderExtension = { - .base = { __DRI_IMAGE_LOADER, 1 }, + .base = { __DRI_IMAGE_LOADER, 3 }, .getBuffers = loader_dri3_get_buffers, .flushFrontBuffer = dri3_flush_front_buffer, + .flushSwapBuffers = dri3_flush_swap_buffers, }; const __DRIuseInvalidateExtension dri3UseInvalidate = { |