[cairo] [PATCH v8 44/71] drm: consolidated *_bo_release() functions
Enrico Weigelt, metux IT consult
enrico.weigelt at gr13.net
Thu Jun 30 15:46:22 UTC 2016
Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
src/drm/cairo-drm-intel.c | 17 +----------------
src/drm/cairo-drm-private.h | 3 +++
src/drm/cairo-drm-radeon.c | 12 +-----------
src/drm/cairo-drm.c | 8 ++++++++
4 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
index 515eec9..1bf522b 100644
--- a/src/drm/cairo-drm-intel.c
+++ b/src/drm/cairo-drm-intel.c
@@ -485,21 +485,6 @@ FAIL:
return NULL;
}
-static void
-intel_bo_release (cairo_drm_device_t *_dev, cairo_drm_bo_t *_bo)
-{
- intel_device_t *device = _cairo_drm_device_cast_intel(_dev);
- intel_bo_t *bo = _cairo_drm_bo_cast_intel(_bo);
-
- _cairo_drm_bo_unmap (_bo);
-
- assert (bo->exec == NULL);
- assert (cairo_list_is_empty (&bo->cache_list));
-
- _cairo_drm_bo_close (_dev, _bo);
- _cairo_freepool_free (&device->base.bo_pool, bo);
-}
-
void
intel_bo_set_tiling (const intel_device_t *device,
intel_bo_t *bo)
@@ -720,7 +705,7 @@ intel_device_init (intel_device_t *device, int fd)
device->gradient_cache.size = 0;
- device->base.bo.release = intel_bo_release;
+ device->base.bo.release = _cairo_drm_bo_release;
device->base.bo.map = _cairo_drm_intel_bo_map;
return CAIRO_STATUS_SUCCESS;
diff --git a/src/drm/cairo-drm-private.h b/src/drm/cairo-drm-private.h
index ca295d9..d62b953 100644
--- a/src/drm/cairo-drm-private.h
+++ b/src/drm/cairo-drm-private.h
@@ -193,6 +193,9 @@ _cairo_device_cast_drm_const(const cairo_device_t *device)
cairo_private void
_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);
+
static inline cairo_drm_bo_t *
cairo_drm_bo_reference (cairo_drm_bo_t *bo)
{
diff --git a/src/drm/cairo-drm-radeon.c b/src/drm/cairo-drm-radeon.c
index 72cc0b0..c8905ce 100644
--- a/src/drm/cairo-drm-radeon.c
+++ b/src/drm/cairo-drm-radeon.c
@@ -242,16 +242,6 @@ radeon_bo_create_for_name (radeon_device_t *device,
return &bo->base;
}
-static void
-radeon_bo_release (cairo_drm_device_t *_dev, cairo_drm_bo_t *_bo)
-{
- radeon_device_t *device = _cairo_drm_device_cast_radeon(_dev);
- radeon_bo_t *bo = _cairo_drm_bo_cast_radeon(_bo);
-
- _cairo_drm_bo_close (&device->base, &bo->base);
- _cairo_freepool_free (&device->base.bo_pool, bo);
-}
-
cairo_surface_t *
_cairo_drm_radeon_bo_get_image (const cairo_drm_device_t *drm_dev,
cairo_drm_bo_t *drm_bo,
@@ -299,7 +289,7 @@ radeon_device_init (radeon_device_t *device, int fd)
{
_cairo_freepool_init (&device->base.bo_pool, sizeof (radeon_bo_t));
- device->base.bo.release = radeon_bo_release;
+ device->base.bo.release = _cairo_drm_bo_release;
device->base.bo.map = _cairo_drm_radeon_bo_map;
device->base.bo.get_image = _cairo_drm_radeon_bo_get_image;
diff --git a/src/drm/cairo-drm.c b/src/drm/cairo-drm.c
index d4c1079..42bb041 100644
--- a/src/drm/cairo-drm.c
+++ b/src/drm/cairo-drm.c
@@ -388,3 +388,11 @@ cairo_drm_device_throttle (cairo_device_t *abstract_device)
if (unlikely (status))
_cairo_status_set_error (&device->base.status, status);
}
+
+void
+_cairo_drm_bo_release (cairo_drm_device_t *device, cairo_drm_bo_t *bo)
+{
+ _cairo_drm_bo_unmap (bo);
+ _cairo_drm_bo_close (device, bo);
+ _cairo_freepool_free (&device->bo_pool, bo);
+}
--
2.6.4.442.g545299f
More information about the cairo
mailing list