[Mesa-dev] [PATCH] egl/drm: fix assert checking of dri2_surf->buffer_count

Gwan-gyeong Mun elongbug at gmail.com
Mon Jul 17 15:47:22 UTC 2017


This adds an increment of buffer_count and changes a border value with
ARRAY_SIZE() macro.

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

diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index d18c73cb33..4176fde7d1 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -326,7 +326,7 @@ dri2_drm_get_buffers_with_format(__DRIdrawable *driDrawable,
    dri2_surf->buffer_count = 0;
    for (i = 0, j = 0; i < 2 * count; i += 2, j++) {
       assert(attachments[i] < __DRI_BUFFER_COUNT);
-      assert(dri2_surf->buffer_count < 5);
+      assert(dri2_surf->buffer_count < ARRAY_SIZE(dri2_surf->buffers));
 
       switch (attachments[i]) {
       case __DRI_BUFFER_BACK_LEFT:
@@ -344,6 +344,7 @@ dri2_drm_get_buffers_with_format(__DRIdrawable *driDrawable,
 	 }
 	 break;
       }
+      dri2_surf->buffer_count++;
    }
 
    *out_count = j;
-- 
2.13.3



More information about the mesa-dev mailing list