<div dir="ltr">No plans to merge dri2_surface_destroy_bac<wbr>k_image and dri2_surface_destroy_front<wbr>_image ;-)?  Otherwise, looks consistent with the previous review comments.  Patches 1-6 are:<div><br></div><div><span style="font-size:12.8px">Reviewed-by: Gurchetan Singh <<a href="mailto:gurchetansingh@chromium.org">gurchetansingh@chromium.org</a>></span><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 24, 2017 at 2:45 PM, Gwan-gyeong Mun <span dir="ltr"><<a href="mailto:elongbug@gmail.com" target="_blank">elongbug@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">To share common destroy dri_image_back code.<br>
<br>
In preparation to adding of new platform which uses this helper.<br>
<br>
v2:<br>
 - Move dri_image_back to outside of android ifdef block for removing of<br>
   ifdef magic on dri2_egl_surface_destroy_<wbr>image_back().<br>
 - Fixes from Eric's review:<br>
   a) Split out series of refactor for helpers to a separate series.<br>
   b) Add the new helper function and use them to replace the old code in the<br>
      same patch.<br>
<br>
v3: Fixes from Emil and Gurchetan's review<br>
  - Follow the naming convention which prevents too verbose name of functions.<br>
    a) use a dri2_surface_$action_$object naming convention<br>
    b) change a first argument type "struct dri2_egl_surface" to "_EGLSurface".<br>
<br>
Signed-off-by: Mun Gwan-gyeong <<a href="mailto:elongbug@gmail.com">elongbug@gmail.com</a>><br>
Reviewed-by: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>><br>
---<br>
 src/egl/drivers/dri2/egl_dri2.<wbr>c         | 12 ++++++++++++<br>
 src/egl/drivers/dri2/egl_dri2.<wbr>h         |  6 +++++-<br>
 src/egl/drivers/dri2/platform_<wbr>android.c | 11 ++---------<br>
 3 files changed, 19 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/egl/drivers/dri2/egl_<wbr>dri2.c b/src/egl/drivers/dri2/egl_<wbr>dri2.c<br>
index d381e52e86..dc2aecef88 100644<br>
--- a/src/egl/drivers/dri2/egl_<wbr>dri2.c<br>
+++ b/src/egl/drivers/dri2/egl_<wbr>dri2.c<br>
@@ -1142,6 +1142,18 @@ dri2_surface_update_age(_<wbr>EGLSurface *surf)<br>
       dri2_surf->back->age = 1;<br>
 }<br>
<br>
+void<br>
+dri2_surface_destroy_back_<wbr>image(_EGLSurface *surf)<br>
+{<br>
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(surf-><wbr>Resource.Display);<br>
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);<br>
+<br>
+   if (dri2_surf->dri_image_back) {<br>
+      dri2_dpy->image->destroyImage(<wbr>dri2_surf->dri_image_back);<br>
+      dri2_surf->dri_image_back = NULL;<br>
+   }<br>
+}<br>
+<br>
 /**<br>
  * Called via eglTerminate(), drv->API.Terminate().<br>
  *<br>
diff --git a/src/egl/drivers/dri2/egl_<wbr>dri2.h b/src/egl/drivers/dri2/egl_<wbr>dri2.h<br>
index 58f8082509..f13bdb6d12 100644<br>
--- a/src/egl/drivers/dri2/egl_<wbr>dri2.h<br>
+++ b/src/egl/drivers/dri2/egl_<wbr>dri2.h<br>
@@ -303,10 +303,11 @@ struct dri2_egl_surface<br>
       int                 age;<br>
    } color_buffers[COLOR_BUFFERS_<wbr>SIZE], *back, *current;<br>
<br>
+   __DRIimage *dri_image_back;<br>
+<br>
 #ifdef HAVE_ANDROID_PLATFORM<br>
    struct ANativeWindow *window;<br>
    struct ANativeWindowBuffer *buffer;<br>
-   __DRIimage *dri_image_back;<br>
    __DRIimage *dri_image_front;<br>
 #endif<br>
<br>
@@ -460,6 +461,9 @@ dri2_surface_set_back_buffer(_<wbr>EGLSurface *surf, void *buffer);<br>
 void<br>
 dri2_surface_update_age(_<wbr>EGLSurface *surf);<br>
<br>
+void<br>
+dri2_surface_destroy_back_<wbr>image(_EGLSurface *surf);<br>
+<br>
 EGLBoolean<br>
 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,<br>
         _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean enable_out_fence);<br>
diff --git a/src/egl/drivers/dri2/<wbr>platform_android.c b/src/egl/drivers/dri2/<wbr>platform_android.c<br>
index 45af871555..e0896ed1a0 100644<br>
--- a/src/egl/drivers/dri2/<wbr>platform_android.c<br>
+++ b/src/egl/drivers/dri2/<wbr>platform_android.c<br>
@@ -228,10 +228,7 @@ droid_window_enqueue_buffer(_<wbr>EGLDisplay *disp, struct dri2_egl_surface *dri2_sur<br>
<br>
    mtx_lock(&disp->Mutex);<br>
<br>
-   if (dri2_surf->dri_image_back) {<br>
-      dri2_dpy->image->destroyImage(<wbr>dri2_surf->dri_image_back);<br>
-      dri2_surf->dri_image_back = NULL;<br>
-   }<br>
+   dri2_surface_destroy_back_<wbr>image(&dri2_surf->base);<br>
<br>
    return EGL_TRUE;<br>
 }<br>
@@ -355,11 +352,7 @@ droid_destroy_surface(_<wbr>EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)<br>
       dri2_surf->window->common.<wbr>decRef(&dri2_surf->window-><wbr>common);<br>
    }<br>
<br>
-   if (dri2_surf->dri_image_back) {<br>
-      _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_back", __func__, __LINE__);<br>
-      dri2_dpy->image->destroyImage(<wbr>dri2_surf->dri_image_back);<br>
-      dri2_surf->dri_image_back = NULL;<br>
-   }<br>
+   dri2_surface_destroy_back_<wbr>image(surf);<br>
<br>
    if (dri2_surf->dri_image_front) {<br>
       _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__, __LINE__);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.2<br>
<br>
</font></span></blockquote></div><br></div>