[Mesa-dev] [PATCH v3 13/22] egl: add dri2_egl_surface_destroy_image_front() helper

Rob Herring robh at kernel.org
Wed Oct 4 14:02:10 UTC 2017


On Wed, Oct 4, 2017 at 1:50 AM, Gwan-gyeong Mun <elongbug at gmail.com> wrote:
> To share common destroy dri_image_front code.
>
> Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 14 ++++++++++++++
>  src/egl/drivers/dri2/egl_dri2.h |  3 +++
>  2 files changed, 17 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index e13b13c282..4070a80b23 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -1153,6 +1153,20 @@ dri2_egl_surface_destroy_image_back(struct dri2_egl_surface *dri2_surf)
>  #endif
>  }
>
> +void
> +dri2_egl_surface_destroy_image_front(struct dri2_egl_surface *dri2_surf)
> +{
> +#if defined(HAVE_ANDROID_PLATFORM) || defined(HAVE_TIZEN_PLATFORM)

It seems this function only gets called from the Android and Tizen
specific code, so you don't need the #ifdef.

Plus you can probably also rely on dri_image_front being NULL for
other platforms.

> +   struct dri2_egl_display *dri2_dpy =
> +      dri2_egl_display(dri2_surf->base.Resource.Display);
> +
> +   if (dri2_surf->dri_image_front) {
> +      dri2_dpy->image->destroyImage(dri2_surf->dri_image_front);
> +      dri2_surf->dri_image_front = NULL;
> +   }
> +#endif
> +}
> +
>  /**
>   * 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 a990fa3d83..fbef031fb6 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -509,6 +509,9 @@ dri2_egl_surface_update_buffer_age(struct dri2_egl_surface *dri2_surf);
>  void
>  dri2_egl_surface_destroy_image_back(struct dri2_egl_surface *dri2_surf);
>
> +void
> +dri2_egl_surface_destroy_image_front(struct dri2_egl_surface *dri2_surf);
> +
>  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