[Mesa-dev] [PATCH 2/5] dri: Add a flushSwapBuffers method to the image loader extension

Thomas Hellstrom thellstrom at vmware.com
Wed Jun 28 16:56:54 UTC 2017


On 06/22/2017 12:42 PM, Thomas Hellstrom wrote:
> This method may be used by dri drivers to make sure all outstanding
> buffer swaps have been flushed to hardware. Also add a dri3 implementation.
>
> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> ---
>   include/GL/internal/dri_interface.h | 16 +++++++++++++++-
>   src/glx/dri3_glx.c                  | 29 +++++++++++++++++++++++++++++
>   2 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
> index fc2d4bb..ff70ba0 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -1690,7 +1690,7 @@ struct __DRIimageList {
>   };
>   
>   #define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER"
> -#define __DRI_IMAGE_LOADER_VERSION 1
> +#define __DRI_IMAGE_LOADER_VERSION 2
>   
>   struct __DRIimageLoaderExtensionRec {
>       __DRIextension base;
> @@ -1726,6 +1726,20 @@ struct __DRIimageLoaderExtensionRec {
>        *                       into __DRIdri2ExtensionRec::createNewDrawable
>        */
>       void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
> +
> +    /**
> +     * Flush swap buffers
> +     *
> +     * Make sure any outstanding swap buffers have been submitted to the
> +     * device.
> +     *
> +     * \param driDrawable    Drawable whose swaps need to be flushed
> +     * \param loaderPrivate  Loader's private data that was previously passed
> +     *                       into __DRIdri2ExtensionRec::createNewDrawable
> +     *
> +     * \since 2
> +     */
> +    void (*flushSwapBuffers)(__DRIdrawable *driDrawable, void *loaderPrivate);
>   };
>   
>   /**
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index 5091606..39ffcfa 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -502,6 +502,34 @@ 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;
> +   int64_t ust, msc, sbc;

The above variables are an unused leftover. Will be removed in v2.

/Thomas




More information about the mesa-dev mailing list