[cairo] [PATCH v8 65/71] drm: generalized *_bo_create_for_name()

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


Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
 src/drm/cairo-drm-bo.c             | 20 ++++++++++++++++++++
 src/drm/cairo-drm-private.h        |  3 +++
 src/drm/cairo-drm-radeon-private.h |  3 ---
 src/drm/cairo-drm-radeon-surface.c |  3 +--
 src/drm/cairo-drm-radeon.c         | 21 ---------------------
 5 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/src/drm/cairo-drm-bo.c b/src/drm/cairo-drm-bo.c
index 532700e..957d0bf 100644
--- a/src/drm/cairo-drm-bo.c
+++ b/src/drm/cairo-drm-bo.c
@@ -114,3 +114,23 @@ _cairo_drm_bo_unmap (cairo_drm_bo_t *bo)
     munmap (bo->mapped, bo->size);
     bo->mapped = NULL;
 }
+
+cairo_drm_bo_t *
+_cairo_drm_bo_create_for_name (cairo_drm_device_t *device,
+			       uint32_t name)
+{
+    cairo_status_t status;
+    cairo_drm_bo_t *bo = _cairo_drm_bo_from_pool (device);
+
+    if (unlikely (bo == NULL))
+        return NULL;
+
+    status = _cairo_drm_bo_open_for_name (device, bo, name);
+    if (unlikely (status)) {
+        _cairo_freepool_free (&device->bo_pool, bo);
+        return NULL;
+    }
+
+    CAIRO_REFERENCE_COUNT_INIT (&bo->ref_count, 1);
+    return bo;
+}
diff --git a/src/drm/cairo-drm-private.h b/src/drm/cairo-drm-private.h
index c49264f..b2b83d3 100644
--- a/src/drm/cairo-drm-private.h
+++ b/src/drm/cairo-drm-private.h
@@ -196,6 +196,9 @@ _cairo_drm_bo_unmap (cairo_drm_bo_t *bo);
 cairo_private void
 _cairo_drm_bo_release (cairo_drm_device_t *device, cairo_drm_bo_t *bo);
 
+cairo_private cairo_drm_bo_t *
+_cairo_drm_bo_create_for_name (cairo_drm_device_t *device, uint32_t name);
+
 static inline cairo_drm_bo_t *
 cairo_drm_bo_reference (cairo_drm_bo_t *bo)
 {
diff --git a/src/drm/cairo-drm-radeon-private.h b/src/drm/cairo-drm-radeon-private.h
index 0c9240b..08ff1ac 100644
--- a/src/drm/cairo-drm-radeon-private.h
+++ b/src/drm/cairo-drm-radeon-private.h
@@ -185,9 +185,6 @@ radeon_bo_create (radeon_device_t *dev,
 		  uint32_t size,
 		  uint32_t initial_domain);
 
-cairo_private cairo_drm_bo_t *
-radeon_bo_create_for_name (radeon_device_t *dev, uint32_t name);
-
 cairo_private cairo_surface_t *
 _cairo_drm_radeon_bo_get_image (const cairo_drm_device_t *device,
 				cairo_drm_bo_t *bo,
diff --git a/src/drm/cairo-drm-radeon-surface.c b/src/drm/cairo-drm-radeon-surface.c
index 61fad9b..57446e8 100644
--- a/src/drm/cairo-drm-radeon-surface.c
+++ b/src/drm/cairo-drm-radeon-surface.c
@@ -172,8 +172,7 @@ radeon_surface_create_for_name (cairo_drm_device_t *device,
     if (width && height) {
 	surface->base.stride = stride;
 
-	surface->base.bo = radeon_bo_create_for_name (_cairo_drm_device_cast_radeon(device),
-						      name);
+	surface->base.bo = _cairo_drm_bo_create_for_name (device, name);
 
 	if (unlikely (surface->base.bo == NULL)) {
 	    status = _cairo_drm_surface_finish (&surface->base);
diff --git a/src/drm/cairo-drm-radeon.c b/src/drm/cairo-drm-radeon.c
index 1bc67df..b1cbaf9 100644
--- a/src/drm/cairo-drm-radeon.c
+++ b/src/drm/cairo-drm-radeon.c
@@ -213,27 +213,6 @@ radeon_bo_create (radeon_device_t *device,
     return &bo->base;
 }
 
-cairo_drm_bo_t *
-radeon_bo_create_for_name (radeon_device_t *device,
-			   uint32_t name)
-{
-    radeon_bo_t *bo;
-    cairo_status_t status;
-
-    bo = _cairo_drm_bo_cast_radeon (_cairo_drm_bo_from_pool (&device->base));
-    if (unlikely (bo == NULL))
-	return NULL;
-
-    status = _cairo_drm_bo_open_for_name (&device->base, &bo->base, name);
-    if (unlikely (status)) {
-	_cairo_freepool_free (&device->base.bo_pool, bo);
-	return NULL;
-    }
-
-    CAIRO_REFERENCE_COUNT_INIT (&bo->base.ref_count, 1);
-    return &bo->base;
-}
-
 cairo_surface_t *
 _cairo_drm_radeon_bo_get_image (const cairo_drm_device_t *drm_dev,
 	             cairo_drm_bo_t *drm_bo,
-- 
2.6.4.442.g545299f



More information about the cairo mailing list