[cairo] [PATCH 44/71] drm: consolidated *_release_source_image() surface functions

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Mon Apr 17 16:57:23 UTC 2017


The individual driver-specific backends all have their own
release_source_image functions, which are all doing the same,
so consolidate into one generic function.

Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
 src/drm/cairo-drm-i915-surface.c   |  2 +-
 src/drm/cairo-drm-i965-surface.c   |  2 +-
 src/drm/cairo-drm-intel-private.h  |  5 -----
 src/drm/cairo-drm-intel-surface.c  | 10 +---------
 src/drm/cairo-drm-private.h        |  8 ++++++++
 src/drm/cairo-drm-radeon-surface.c | 10 +---------
 src/drm/cairo-drm-surface.c        |  7 +++++++
 7 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index c7e0fef55..f6ee67f86 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -2360,7 +2360,7 @@ static const cairo_surface_backend_t i915_surface_backend = {
     .create_similar		= i915_surface_create_similar,
     .finish			= i915_surface_finish,
     .acquire_source_image	= _cairo_drm_surface_acquire_source_image,
-    .release_source_image	= intel_surface_release_source_image,
+    .release_source_image	= _cairo_drm_surface_release_source_image,
     .get_extents		= _cairo_drm_surface_get_extents,
     .get_font_options		= _cairo_drm_surface_get_font_options,
     .flush			= i915_surface_flush,
diff --git a/src/drm/cairo-drm-i965-surface.c b/src/drm/cairo-drm-i965-surface.c
index 8343f9223..499e53de0 100644
--- a/src/drm/cairo-drm-i965-surface.c
+++ b/src/drm/cairo-drm-i965-surface.c
@@ -1497,7 +1497,7 @@ static const cairo_surface_backend_t i965_surface_backend = {
     .create_similar		= i965_surface_create_similar,
     .finish			= i965_surface_finish,
     .acquire_source_image	= _cairo_drm_surface_acquire_source_image,
-    .release_source_image	= intel_surface_release_source_image,
+    .release_source_image	= _cairo_drm_surface_release_source_image,
     .get_extents		= _cairo_drm_surface_get_extents,
     .get_font_options		= _cairo_drm_surface_get_font_options,
     .flush			= i965_surface_flush,
diff --git a/src/drm/cairo-drm-intel-private.h b/src/drm/cairo-drm-intel-private.h
index 138e0909e..ef1629e5a 100644
--- a/src/drm/cairo-drm-intel-private.h
+++ b/src/drm/cairo-drm-intel-private.h
@@ -424,11 +424,6 @@ intel_snapshot_cache_thaw (intel_device_t *device);
 cairo_private void
 intel_throttle (intel_device_t *device);
 
-cairo_private void
-intel_surface_release_source_image (void *abstract_surface,
-				    cairo_image_surface_t *image,
-				    void *image_extra);
-
 cairo_private cairo_status_t
 intel_surface_flush (void *abstract_surface,
 		     unsigned flags);
diff --git a/src/drm/cairo-drm-intel-surface.c b/src/drm/cairo-drm-intel-surface.c
index 0f08dc62a..d9958d64a 100644
--- a/src/drm/cairo-drm-intel-surface.c
+++ b/src/drm/cairo-drm-intel-surface.c
@@ -61,14 +61,6 @@ intel_surface_finish (void *abstract_surface)
     return _cairo_drm_surface_finish (&surface->drm);
 }
 
-void
-intel_surface_release_source_image (void *abstract_surface,
-				    cairo_image_surface_t *image,
-				    void *image_extra)
-{
-    cairo_surface_destroy (&image->base);
-}
-
 cairo_status_t
 intel_surface_flush (void *abstract_surface, unsigned flags)
 {
@@ -97,7 +89,7 @@ static const cairo_surface_backend_t intel_surface_backend = {
     .create_similar		= intel_surface_create_similar,
     .finish			= intel_surface_finish,
     .acquire_source_image	= _cairo_drm_surface_acquire_source_image,
-    .release_source_image	= intel_surface_release_source_image,
+    .release_source_image	= _cairo_drm_surface_release_source_image,
     .get_extents		= _cairo_drm_surface_get_extents,
     .get_font_options		= _cairo_drm_surface_get_font_options,
     .flush			= intel_surface_flush,
diff --git a/src/drm/cairo-drm-private.h b/src/drm/cairo-drm-private.h
index d62b953aa..740b7f6e3 100644
--- a/src/drm/cairo-drm-private.h
+++ b/src/drm/cairo-drm-private.h
@@ -325,6 +325,11 @@ _cairo_drm_device_fini (cairo_drm_device_t *device);
 cairo_private cairo_surface_t *
 _cairo_drm_surface_map_to_image (void *abstract_surface);
 
+cairo_private void
+_cairo_drm_surface_release_source_image (void *abstract_surface,
+					 cairo_image_surface_t *image,
+					 void *image_extra);
+
 /* default / dumb framebuffer backend ops */
 
 cairo_private cairo_int_status_t
@@ -379,6 +384,9 @@ _cairo_drm_surface_acquire_source_image (void *abstract_surface,
 /* h/w specific backends */
 
 cairo_private cairo_drm_device_t *
+_cairo_drm_basic_device_create (int fd, dev_t dev, int vendor_id, int chip_id);
+
+cairo_private cairo_drm_device_t *
 _cairo_drm_intel_device_create (int fd, dev_t dev, int vendor_id, int chip_id);
 
 cairo_private cairo_drm_device_t *
diff --git a/src/drm/cairo-drm-radeon-surface.c b/src/drm/cairo-drm-radeon-surface.c
index c63288ec9..578f5e748 100644
--- a/src/drm/cairo-drm-radeon-surface.c
+++ b/src/drm/cairo-drm-radeon-surface.c
@@ -54,14 +54,6 @@ radeon_surface_create_similar (void			*abstract_surface,
 				       width, height);
 }
 
-static void
-radeon_surface_release_source_image (void *abstract_surface,
-				     cairo_image_surface_t *image,
-				     void *image_extra)
-{
-    cairo_surface_destroy (&image->base);
-}
-
 static cairo_status_t
 radeon_surface_flush (void *abstract_surface,
 		      unsigned flags)
@@ -93,7 +85,7 @@ static const cairo_surface_backend_t radeon_surface_backend = {
     .create_similar		= radeon_surface_create_similar,
     .finish			= _cairo_drm_surface_finish,
     .acquire_source_image	= _cairo_drm_surface_acquire_source_image,
-    .release_source_image	= radeon_surface_release_source_image,
+    .release_source_image	= _cairo_drm_surface_release_source_image,
     .get_extents		= _cairo_drm_surface_get_extents,
     .get_font_options		= _cairo_drm_surface_get_font_options,
     .flush			= radeon_surface_flush,
diff --git a/src/drm/cairo-drm-surface.c b/src/drm/cairo-drm-surface.c
index e11b4801b..08515c3d0 100644
--- a/src/drm/cairo-drm-surface.c
+++ b/src/drm/cairo-drm-surface.c
@@ -573,3 +573,10 @@ DONE:
     *image_extra = NULL;
     return CAIRO_STATUS_SUCCESS;
 }
+
+void _cairo_drm_surface_release_source_image (void *abstract_surface,
+					      cairo_image_surface_t *image,
+					      void *image_extra)
+{
+    cairo_surface_destroy (&image->base);
+}
-- 
2.11.0.rc0.7.gbe5a750



More information about the cairo mailing list