[Mesa-dev] [PATCH v3 07/22] egl: add dri2_egl_surface_update_buffer_age() helper

Gwan-gyeong Mun elongbug at gmail.com
Wed Oct 4 06:50:19 UTC 2017


To share common update buffer age code.
This updates old buffer's age and sets current back buffer's age to 1.

Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
---
 src/egl/drivers/dri2/egl_dri2.c | 19 +++++++++++++++++++
 src/egl/drivers/dri2/egl_dri2.h |  3 +++
 2 files changed, 22 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 807403dc51..8f6a8a62cb 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1120,6 +1120,25 @@ dri2_egl_surface_record_buffers_and_update_back_buffer(struct dri2_egl_surface *
 #endif
 }
 
+void
+dri2_egl_surface_update_buffer_age(struct dri2_egl_surface *dri2_surf)
+{
+   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+      if (dri2_surf->color_buffers[i].age > 0)
+         dri2_surf->color_buffers[i].age++;
+   }
+
+#ifdef HAVE_ANDROID_PLATFORM
+   /* "XXX: we don't use get_back_bo() since it causes regressions in
+    * several dEQP tests.
+    */
+   if (dri2_surf->back)
+      dri2_surf->back->age = 1;
+#else
+   dri2_surf->back->age = 1;
+#endif
+}
+
 /**
  * Called via eglTerminate(), drv->API.Terminate().
  *
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index c3529589ab..6f9d936ca5 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -494,6 +494,9 @@ void
 dri2_egl_surface_record_buffers_and_update_back_buffer(struct dri2_egl_surface *dri2_surf,
                                                        void *buf);
 
+void
+dri2_egl_surface_update_buffer_age(struct dri2_egl_surface *dri2_surf);
+
 EGLBoolean
 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
         _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean enable_out_fence);
-- 
2.14.2



More information about the mesa-dev mailing list