[Mesa-dev] [PATCH v3 17/22] egl/android: apply dri2_egl_surface_record_buffers_and_update_back_buffer() helper

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


Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
---
 src/egl/drivers/dri2/platform_android.c | 25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 0acbb38bd8..d5ce48a34c 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -191,29 +191,8 @@ droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf)
    /* Record all the buffers created by ANativeWindow and update back buffer
     * for updating buffer's age in swap_buffers.
     */
-   EGLBoolean updated = EGL_FALSE;
-   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-      if (!dri2_surf->color_buffers[i].buffer) {
-         dri2_surf->color_buffers[i].buffer = dri2_surf->buffer;
-      }
-      if (dri2_surf->color_buffers[i].buffer == dri2_surf->buffer) {
-         dri2_surf->back = &dri2_surf->color_buffers[i];
-         updated = EGL_TRUE;
-         break;
-      }
-   }
-
-   if (!updated) {
-      /* In case of all the buffers were recreated by ANativeWindow, reset
-       * the color_buffers
-       */
-      for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-         dri2_surf->color_buffers[i].buffer = NULL;
-         dri2_surf->color_buffers[i].age = 0;
-      }
-      dri2_surf->color_buffers[0].buffer = dri2_surf->buffer;
-      dri2_surf->back = &dri2_surf->color_buffers[0];
-   }
+   dri2_egl_surface_record_buffers_and_update_back_buffer(dri2_surf,
+                                                          dri2_surf->buffer);
 
    return EGL_TRUE;
 }
-- 
2.14.2



More information about the mesa-dev mailing list