[Mesa-dev] [PATCH 2/4] glx/dri3: Implement the flush_swapbuffers method

Emil Velikov emil.l.velikov at gmail.com
Wed Aug 2 16:31:27 UTC 2017


On 2 August 2017 at 13:23, Thomas Hellstrom <thellstrom at vmware.com> wrote:
> Provide a dri3 implementation for the image loader extension method.
>
> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> ---
>  src/glx/dri3_glx.c | 30 +++++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index cc11037..64c0b9e 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,
I think I'll add the v2 .getCap() for posterity - as a follow-up.

The series looks great, but admittedly I'm not the biggest expert on the topic.
Perhaps Michel can take a look?

FWIW for the lot
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

-Emil


More information about the mesa-dev mailing list