[Mesa-dev] [PATCH v2 4/8] egl: add dri2_egl_surface_update_buffer_age() helper (v2)
Gwan-gyeong Mun
elongbug at gmail.com
Fri Oct 6 21:38:31 UTC 2017
To share common update buffer age code.
This updates old buffer's age and sets current back buffer's age to 1.
In preparation to adding of new platform which uses this helper.
v2:
- Fixes from Eric's review:
a) Split out series of refactor for helpers to a separate series.
b) Add the new helper function and use them to replace the old code in the
same patch.
- Fixes from Rob's review:
Remove unneeded ifdef block
Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
---
src/egl/drivers/dri2/egl_dri2.c | 15 +++++++++++++++
src/egl/drivers/dri2/egl_dri2.h | 3 +++
src/egl/drivers/dri2/platform_android.c | 11 +----------
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 3622d18a24..a0f58ca8e4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1100,6 +1100,21 @@ dri2_egl_surface_record_buffers_and_update_back_buffer(struct dri2_egl_surface *
}
}
+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++;
+ }
+
+ /* "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;
+}
+
/**
* 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 67d7b7f863..fe3880ef89 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -468,6 +468,9 @@ void
dri2_egl_surface_record_buffers_and_update_back_buffer(struct dri2_egl_surface *dri2_surf,
void *buffer);
+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);
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 202db9a883..29ee12b140 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -569,16 +569,7 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
if (dri2_surf->base.Type != EGL_WINDOW_BIT)
return EGL_TRUE;
- 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++;
- }
-
- /* "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;
+ dri2_egl_surface_update_buffer_age(dri2_surf);
dri2_flush_drawable_for_swapbuffers(disp, draw);
--
2.14.2
More information about the mesa-dev
mailing list