[Mesa-dev] [PATCH v3 07/22] egl: add dri2_egl_surface_update_buffer_age() helper

Rob Herring robh at kernel.org
Wed Oct 4 14:18:04 UTC 2017


On Wed, Oct 4, 2017 at 1:50 AM, Gwan-gyeong Mun <elongbug at gmail.com> wrote:
> To share common update buffer age code.
> This updates old buffer's age and sets current back buffer's age to 1.
>
> Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 19 +++++++++++++++++++
>  src/egl/drivers/dri2/egl_dri2.h |  3 +++
>  2 files changed, 22 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 807403dc51..8f6a8a62cb 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -1120,6 +1120,25 @@ dri2_egl_surface_record_buffers_and_update_back_buffer(struct dri2_egl_surface *
>  #endif
>  }
>
> +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++;
> +   }
> +
> +#ifdef HAVE_ANDROID_PLATFORM
> +   /* "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;
> +#else
> +   dri2_surf->back->age = 1;

No need for the ifdef here. The only difference is in the !ANDROID
case you would crash if back is NULL. Is that somehow desired or
necessary behavior?

Rob


More information about the mesa-dev mailing list