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

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Thu Jun 30 15:46:25 UTC 2016


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 c7e0fef..f6ee67f 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 8343f92..499e53d 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 138e090..ef1629e 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 0f08dc6..d9958d6 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 d62b953..740b7f6 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 c63288e..578f5e7 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 e11b480..08515c3 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.6.4.442.g545299f



More information about the cairo mailing list