[Mesa-dev] [PATCH 7/8] egl/wayland: Implement EGL_EXT_buffer_age

Kristian Høgsberg hoegsberg at gmail.com
Thu Jan 3 14:51:24 PST 2013


On Thu, Dec 20, 2012 at 02:59:09PM -0200, Ander Conselvan de Oliveira wrote:
> The age of the buffers is not reset on dri2_release_buffers() or
> anywhere else, so after a resize the buffer age is not zero. I think
> we should set age to zero on get_back_bo() when the new buffer is
> allocated. Same thing for the gbm backend, although there this would
> be only for clarity, since we don't destroy the third buffer and gbm
> does not support surface resizing.

Yeah, good point.

Kristian

> Cheers,
> Ander
> 
> On 12/14/2012 03:05 AM, Kristian Høgsberg wrote:
> >---
> >  src/egl/drivers/dri2/platform_wayland.c |   21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> >diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> >index 3c6bdd9..6f8f3b0 100644
> >--- a/src/egl/drivers/dri2/platform_wayland.c
> >+++ b/src/egl/drivers/dri2/platform_wayland.c
> >@@ -449,6 +449,10 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
> >                               &wl_buffer_listener, dri2_surf);
> >     }
> >
> >+   for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
> >+      if (dri2_surf->color_buffers[i].dri_buffer)
> >+         dri2_surf->color_buffers[i].age++;
> >+
> >     dri2_surf->back->locked = 1;
> >     dri2_surf->current = dri2_surf->back;
> >     dri2_surf->current->age = 1;
> >@@ -481,6 +485,21 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
> >     return EGL_TRUE;
> >  }
> >
> >+static EGLint
> >+dri2_query_buffer_age(_EGLDriver *drv,
> >+                      _EGLDisplay *disp, _EGLSurface *surface)
> >+{
> >+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
> >+   __DRIbuffer buffer;
> >+
> >+   if (get_back_bo(dri2_surf, &buffer) < 0) {
> >+      _eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
> >+      return 0;
> >+   }
> >+
> >+   return dri2_surf->back->age;
> >+}
> >+
> >  static int
> >  dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
> >  {
> >@@ -618,6 +637,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
> >     drv->API.DestroySurface = dri2_destroy_surface;
> >     drv->API.SwapBuffers = dri2_swap_buffers;
> >     drv->API.Terminate = dri2_terminate;
> >+   drv->API.QueryBufferAge = dri2_query_buffer_age;
> >
> >     dri2_dpy = calloc(1, sizeof *dri2_dpy);
> >     if (!dri2_dpy)
> >@@ -682,6 +702,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
> >     }
> >
> >     disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
> >+   disp->Extensions.EXT_buffer_age = EGL_TRUE;
> >     dri2_dpy->authenticate = dri2_wayland_authenticate;
> >
> >     /* we're supporting EGL 1.4 */
> >
> 


More information about the mesa-dev mailing list