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

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 17 16:04:15 UTC 2017


On 17 July 2017 at 16:47, Gwan-gyeong Mun <elongbug at gmail.com> wrote:
> 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++;

I'm struggling to see any actual use case of ::buffer_count variable.
Perhaps there was some in the past, but currently it's useless.
Can we rip out out instead?

Thanks
Emil


More information about the mesa-dev mailing list