[Mesa-dev] [PATCH v3 12/22] egl: add dri2_egl_surface_destroy_image_back() helper

Gwan-gyeong Mun elongbug at gmail.com
Wed Oct 4 06:50:24 UTC 2017


To share common destroy dri_image_back 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 8f6a8a62cb..e13b13c282 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1139,6 +1139,20 @@ dri2_egl_surface_update_buffer_age(struct dri2_egl_surface *dri2_surf)
 #endif
 }
 
+void
+dri2_egl_surface_destroy_image_back(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_back) {
+      dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
+      dri2_surf->dri_image_back = 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 7d047bf5dd..a990fa3d83 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -506,6 +506,9 @@ dri2_egl_surface_record_buffers_and_update_back_buffer(struct dri2_egl_surface *
 void
 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);
+
 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