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

2017-10-03 Thread Gwan-gyeong Mun
To share common destroy dri_image_front code.

Signed-off-by: Mun Gwan-gyeong 
---
 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)
+   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

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-10-04 Thread Rob Herring
On Wed, Oct 4, 2017 at 1:50 AM, Gwan-gyeong Mun  wrote:
> To share common destroy dri_image_front code.
>
> Signed-off-by: Mun Gwan-gyeong 
> ---
>  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
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-10-04 Thread Rob Herring
On Wed, Oct 4, 2017 at 9:02 AM, Rob Herring  wrote:
> On Wed, Oct 4, 2017 at 1:50 AM, Gwan-gyeong Mun  wrote:
>> To share common destroy dri_image_front code.
>>
>> Signed-off-by: Mun Gwan-gyeong 
>> ---
>>  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.

NM, I guess it is needed as dri_image_front is still conditional.
Perhaps it should not be?

Rob
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev