Re: [Mesa-dev] [PATCH v2 6/8] egl: add dri2_egl_surface_destroy_image_front() helper (v2)

2017-10-24 Thread Gurchetan Singh
Hi Gwan-gyeong,

You should use dri2_surface_free_image in the next patchset you send out
(should be pretty easy to implement), but can save the polishing of struct
dri2_egl_surface for later.

On Mon, Oct 23, 2017 at 1:46 PM, Mun, Gwan-gyeong 
wrote:

> Hi Gurchetan,
>
> 2017-10-18 6:02 GMT+09:00 Gurchetan Singh :
> > dri2_egl_surface_destroy_image_front and dri2_egl_surface_destroy_
> image_back
> > are almost identical.  Why don't you just create a
> > dri2_surface_free_image(struct dri2_egl_surface *dri2_surf, __DRIimage
> > **img) that you will call with both the front and back images?  In
> addition,
>
> As your opinion, we can rafactor more for dri2_surface_free_image.
>
> Nevertheless however, I'd suggest keeping that as separate series.
> these patches started as a way to minimise the duplication we have in
> drivers/dri2.
> So that new platforms such as Tizen do not need to copy the lot. [1]
>
> > only platform_android has dri_image_back and dri_image_front -- please
> keep
>
> In this patch, dri2_egl_surface_destroy_image_front() helper is only
> used for android
> however it will also be used for new platform (Tizen). [2]
>
> [1] https://lists.freedesktop.org/archives/mesa-dev/2017-
> October/173269.html
> [2] https://lists.freedesktop.org/archives/mesa-dev/2017-
> October/172007.html
>
>
> Thanks,
>
> Gwan-gyeong
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 6/8] egl: add dri2_egl_surface_destroy_image_front() helper (v2)

2017-10-23 Thread Mun, Gwan-gyeong
Hi Gurchetan,

2017-10-18 6:02 GMT+09:00 Gurchetan Singh :
> dri2_egl_surface_destroy_image_front and dri2_egl_surface_destroy_image_back
> are almost identical.  Why don't you just create a
> dri2_surface_free_image(struct dri2_egl_surface *dri2_surf, __DRIimage
> **img) that you will call with both the front and back images?  In addition,

As your opinion, we can rafactor more for dri2_surface_free_image.

Nevertheless however, I'd suggest keeping that as separate series.
these patches started as a way to minimise the duplication we have in
drivers/dri2.
So that new platforms such as Tizen do not need to copy the lot. [1]

> only platform_android has dri_image_back and dri_image_front -- please keep

In this patch, dri2_egl_surface_destroy_image_front() helper is only
used for android
however it will also be used for new platform (Tizen). [2]

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-October/173269.html
[2] https://lists.freedesktop.org/archives/mesa-dev/2017-October/172007.html


Thanks,

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


Re: [Mesa-dev] [PATCH v2 6/8] egl: add dri2_egl_surface_destroy_image_front() helper (v2)

2017-10-17 Thread Gurchetan Singh
dri2_egl_surface_destroy_image_front
and dri2_egl_surface_destroy_image_back are almost identical.  Why don't
you just create a dri2_surface_free_image(struct dri2_egl_surface
*dri2_surf, __DRIimage **img) that you will call with both the front and
back images?  In addition, only platform_android has dri_image_back
and dri_image_front -- please keep the pre-processor checks.  You can,
however, merge the dri_image_front (used by platform_android) and front
(used by platform_surfaceless).

On Fri, Oct 6, 2017 at 2:38 PM, Gwan-gyeong Mun  wrote:

> To share common destroy dri_image_front code.
>
> In preparation to adding of new platform which uses this helper.
>
> v2:
>  - Move dri_image_front to outside of android ifdef block for removing of
>ifdef magic on dri2_egl_surface_destroy_image_front().
>  - Fixes from Eric's review:
>a) Split out series of refactor for helpers to a separate series.
>b) Add the new helper function and use them to replace the old code in
> the
>   same patch.
>
> Signed-off-by: Mun Gwan-gyeong 
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 12 
>  src/egl/drivers/dri2/egl_dri2.h |  5 -
>  src/egl/drivers/dri2/platform_android.c |  7 +--
>  3 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_
> dri2.c
> index bb4944358d..67ae33cdc9 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -1127,6 +1127,18 @@ 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)
> +{
> +   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;
> +   }
> +}
> +
>  /**
>   * 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 165749ebb1..83b9e368b2 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -313,11 +313,11 @@ struct dri2_egl_surface
> } color_buffers[COLOR_BUFFERS_SIZE], *back, *current;
>
> __DRIimage *dri_image_back;
> +   __DRIimage *dri_image_front;
>
>  #ifdef HAVE_ANDROID_PLATFORM
> struct ANativeWindow *window;
> struct ANativeWindowBuffer *buffer;
> -   __DRIimage *dri_image_front;
>  #endif
>
>  #if defined(HAVE_SURFACELESS_PLATFORM)
> @@ -475,6 +475,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);
> diff --git a/src/egl/drivers/dri2/platform_android.c
> b/src/egl/drivers/dri2/platform_android.c
> index 421395b5d7..c98802774c 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -354,12 +354,7 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay
> *disp, _EGLSurface *surf)
> }
>
> dri2_egl_surface_destroy_image_back(dri2_surf);
> -
> -   if (dri2_surf->dri_image_front) {
> -  _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__,
> __LINE__);
> -  dri2_dpy->image->destroyImage(dri2_surf->dri_image_front);
> -  dri2_surf->dri_image_front = NULL;
> -   }
> +   dri2_egl_surface_destroy_image_front(dri2_surf);
>
> dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
>
> --
> 2.14.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 6/8] egl: add dri2_egl_surface_destroy_image_front() helper (v2)

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

In preparation to adding of new platform which uses this helper.

v2:
 - Move dri_image_front to outside of android ifdef block for removing of
   ifdef magic on dri2_egl_surface_destroy_image_front().
 - Fixes from Eric's review:
   a) Split out series of refactor for helpers to a separate series.
   b) Add the new helper function and use them to replace the old code in the
  same patch.

Signed-off-by: Mun Gwan-gyeong 
---
 src/egl/drivers/dri2/egl_dri2.c | 12 
 src/egl/drivers/dri2/egl_dri2.h |  5 -
 src/egl/drivers/dri2/platform_android.c |  7 +--
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index bb4944358d..67ae33cdc9 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1127,6 +1127,18 @@ 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)
+{
+   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;
+   }
+}
+
 /**
  * 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 165749ebb1..83b9e368b2 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -313,11 +313,11 @@ struct dri2_egl_surface
} color_buffers[COLOR_BUFFERS_SIZE], *back, *current;
 
__DRIimage *dri_image_back;
+   __DRIimage *dri_image_front;
 
 #ifdef HAVE_ANDROID_PLATFORM
struct ANativeWindow *window;
struct ANativeWindowBuffer *buffer;
-   __DRIimage *dri_image_front;
 #endif
 
 #if defined(HAVE_SURFACELESS_PLATFORM)
@@ -475,6 +475,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);
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 421395b5d7..c98802774c 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -354,12 +354,7 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf)
}
 
dri2_egl_surface_destroy_image_back(dri2_surf);
-
-   if (dri2_surf->dri_image_front) {
-  _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__, 
__LINE__);
-  dri2_dpy->image->destroyImage(dri2_surf->dri_image_front);
-  dri2_surf->dri_image_front = NULL;
-   }
+   dri2_egl_surface_destroy_image_front(dri2_surf);
 
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
 
-- 
2.14.2

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