<div dir="ltr"><div>This patch series was intended to:<br></div><div><div><br></div><div>a) de-duplicate code across various platforms.</div><div>b) do preparatory work for platform_tizen.<br><div><br></div><div>There was some confusion[1] on how we want to move forward with platform_tizen.  Until we can figure that out, I suggest we drop patches that move stuff out of platform_android in preparation for platform_tizen [patches {1, 3, 4,  6}] for now.  I would change this suggestion if other platforms (platform_wayland, platform_drm) start using the new dri2_surface_* functions and advertising the associated extensions by the end of the series, i.e EXT_buffer_age.</div><div><br></div><div>I think patch 5 can be it's own standalone patch in platform_android for now.  You can also justify patch 8 if platform_surfaceless starts using dri2_surface_get_front_image.  </div><div><br></div><div>So in conclusion, I think we can go forward with patches {2, 5, 7, 8, 9}, with the appropriate changes.</div><div><div><br></div><div>[1] <a href="https://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg173164.html" target="_blank">https://www.mail-archive.c<wbr>om/mesa-dev@lists.freedesktop.<wbr>org/msg173164.html</a> </div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 24, 2017 at 2:44 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">From: "Mun, Gwan-gyeong" <<a href="mailto:elongbug@gmail.com">elongbug@gmail.com</a>><br>
<br>
To share common free outdated buffers and update size code.<br>
This compares width and height arguments with current egl surface dimension,<br>
if the compared surface dimension is differ, then it free local buffers and<br>
updates dimension.<br>
<br>
In preparation to adding of new platform which uses this helper.<br>
<br>
v2: 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         | 13 +++++++++++++<br>
 src/egl/drivers/dri2/egl_dri2.<wbr>h         |  3 +++<br>
 src/egl/drivers/dri2/platform_<wbr>android.c |  8 ++------<br>
 3 files changed, 18 insertions(+), 6 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 503450542e..238e299aed 100644<br>
--- a/src/egl/drivers/dri2/egl_<wbr>dri2.c<br>
+++ b/src/egl/drivers/dri2/egl_<wbr>dri2.c<br>
@@ -1079,6 +1079,19 @@ dri2_egl_surface_free_local_<wbr>buffers(struct dri2_egl_surface *dri2_surf)<br>
    }<br>
 }<br>
<br>
+void<br>
+dri2_surface_fixup(_<wbr>EGLSurface *surf, int width, int height)<br>
+{<br>
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);<br>
+<br>
+   /* free outdated buffers and update the surface size */<br>
+   if (surf->Width != width || surf->Height != height) {<br>
+      dri2_egl_surface_free_local_<wbr>buffers(dri2_surf);<br>
+      surf->Width = width;<br>
+      surf->Height = height;<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 cd2487ab22..208a03d73a 100644<br>
--- a/src/egl/drivers/dri2/egl_<wbr>dri2.h<br>
+++ b/src/egl/drivers/dri2/egl_<wbr>dri2.h<br>
@@ -455,6 +455,9 @@ dri2_egl_surface_alloc_local_<wbr>buffer(struct dri2_egl_surface *dri2_surf,<br>
 void<br>
 dri2_egl_surface_free_local_<wbr>buffers(struct dri2_egl_surface *dri2_surf);<br>
<br>
+void<br>
+dri2_surface_fixup(_<wbr>EGLSurface *surf, int width, int height);<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 e390365b8b..d00a3333a2 100644<br>
--- a/src/egl/drivers/dri2/<wbr>platform_android.c<br>
+++ b/src/egl/drivers/dri2/<wbr>platform_android.c<br>
@@ -414,12 +414,8 @@ update_buffers(struct dri2_egl_surface *dri2_surf)<br>
    }<br>
<br>
    /* free outdated buffers and update the surface size */<br>
-   if (dri2_surf->base.Width != dri2_surf->buffer->width ||<br>
-       dri2_surf->base.Height != dri2_surf->buffer->height) {<br>
-      dri2_egl_surface_free_local_<wbr>buffers(dri2_surf);<br>
-      dri2_surf->base.Width = dri2_surf->buffer->width;<br>
-      dri2_surf->base.Height = dri2_surf->buffer->height;<br>
-   }<br>
+   dri2_surface_fixup(&dri2_surf-<wbr>>base, dri2_surf->buffer->width,<br>
+                      dri2_surf->buffer->height);<br>
<br>
    return 0;<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.2<br>
<br>
</font></span></blockquote></div><br></div>