[Mesa-dev] [PATCH v3 05/22] egl: add dri2_egl_surface_free_outdated_buffers_and_update_size() helper

Eric Engestrom eric.engestrom at imgtec.com
Wed Oct 4 14:55:56 UTC 2017


On Wednesday, 2017-10-04 06:50:17 +0000, Gwan-gyeong Mun wrote:
> To share common free outdated buffers and update size code.
> This compares width and height arguments with current egl surface dimension,
> if the compared surface dimension is differ, then it free local buffers and
> updates dimension.

Can you split out these refactors into a separate series, and then
mention in your next spin of your tizen patches that the latter depends
on the former?

As for the refactor themselves, can you add the new functions and use
them to replace the old code in the same patches?

It's much easier to review "this code block has been moved into
a separate function and is now called here" rather than having to juggle
multiple patches to see if the code is identical or if you're changing
something and why.

Cheers,
  Eric

> 
> Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 12 ++++++++++++
>  src/egl/drivers/dri2/egl_dri2.h |  3 +++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 89e18b6331..8d4bfa8c1a 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -1066,6 +1066,18 @@ dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf)
>     }
>  }
>  
> +void
> +dri2_egl_surface_free_outdated_buffers_and_update_size(struct dri2_egl_surface *dri2_surf,
> +                                                       int width, int height)
> +{
> +   /* free outdated buffers and update the surface size */
> +   if (dri2_surf->base.Width != width || dri2_surf->base.Height != height) {
> +      dri2_egl_surface_free_local_buffers(dri2_surf);
> +      dri2_surf->base.Width = width;
> +      dri2_surf->base.Height = height;
> +   }
> +}
> +
>  /**
>   * Called via eglTerminate(), drv->API.Terminate().
>   *
> diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
> index d3cd9e1fef..4d2348e584 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -486,6 +486,9 @@ dri2_egl_surface_alloc_local_buffer(struct dri2_egl_surface *dri2_surf,
>  void
>  dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf);
>  
> +void
> +dri2_egl_surface_free_outdated_buffers_and_update_size(struct dri2_egl_surface *dri2_surf,
> +                                                       int width, int height);
>  EGLBoolean
>  dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
>          _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean enable_out_fence);
> -- 
> 2.14.2
> 


More information about the mesa-dev mailing list