[Mesa-dev] [PATCH v3 05/10] egl: add going out of the loop when color_buffer is set.

Gwan-gyeong Mun elongbug at gmail.com
Tue Oct 24 21:44:59 UTC 2017


If color_buffer is set once, we don't need to set a same native buffer to
remained free slot of color_buffers. So we can go out of the loop when
color_buffer is set first.

Fixes from Emil's review
 - Add setting "updated" and bailing out when the color_buffer is set.[1]

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-October/173129.html

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

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index edb692c7e5..a504978fda 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1105,6 +1105,8 @@ dri2_surface_set_back_buffer(_EGLSurface *surf, void *buffer)
       if (!dri2_surf->color_buffers[i].native_buffer) {
          dri2_surf->color_buffers[i].native_buffer = buffer;
          dri2_surf->color_buffers[i].age = 0;
+         updated = EGL_TRUE;
+         break;
       }
       if (dri2_surf->color_buffers[i].native_buffer == buffer) {
          dri2_surf->back = &dri2_surf->color_buffers[i];
-- 
2.14.2



More information about the mesa-dev mailing list