[cairo] [PATCH 69/72] drm: generalized *_surface_flush() functions
Enrico Weigelt, metux IT consult
enrico.weigelt at gr13.net
Tue Dec 29 01:17:47 PST 2015
Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
src/drm/cairo-drm-i915-private.h | 2 +-
src/drm/cairo-drm-i915-surface.c | 2 +-
src/drm/cairo-drm-i965-shader.c | 4 ++--
src/drm/cairo-drm-i965-surface.c | 2 +-
src/drm/cairo-drm-intel-surface.c | 24 +-----------------------
src/drm/cairo-drm-private.h | 4 ++++
src/drm/cairo-drm-radeon-surface.c | 27 +--------------------------
src/drm/cairo-drm-surface.c | 25 +++++++++++++++++++++++++
8 files changed, 36 insertions(+), 54 deletions(-)
diff --git a/src/drm/cairo-drm-i915-private.h b/src/drm/cairo-drm-i915-private.h
index 73f5730..e87a4f8 100644
--- a/src/drm/cairo-drm-i915-private.h
+++ b/src/drm/cairo-drm-i915-private.h
@@ -1302,7 +1302,7 @@ i915_surface_fallback_flush (i915_surface_t *surface)
cairo_status_t status;
if (unlikely (surface->intel.drm.fallback != NULL))
- return intel_surface_flush (&surface->intel, 0);
+ return _cairo_drm_surface_flush (&surface->intel.drm, 0);
status = CAIRO_STATUS_SUCCESS;
if (unlikely (surface->deferred_clear))
diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index 7ff3214..414738c 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -741,7 +741,7 @@ i915_surface_flush (void *abstract_surface,
return i915_surface_batch_flush (surface);
}
- return intel_surface_flush (abstract_surface, flags);
+ return _cairo_drm_surface_flush (abstract_surface, flags);
}
/* rasterisation */
diff --git a/src/drm/cairo-drm-i965-shader.c b/src/drm/cairo-drm-i965-shader.c
index d5eca79..56ff429 100644
--- a/src/drm/cairo-drm-i965-shader.c
+++ b/src/drm/cairo-drm-i965-shader.c
@@ -415,7 +415,7 @@ i965_shader_acquire_surface (i965_shader_t *shader,
int x;
if (s->intel.drm.fallback != NULL) {
- status = intel_surface_flush (s, 0);
+ status = _cairo_drm_surface_flush (&s->intel.drm, 0);
if (unlikely (status))
return status;
}
@@ -489,7 +489,7 @@ i965_shader_acquire_surface (i965_shader_t *shader,
if (s->intel.drm.base.device == shader->target->intel.drm.base.device) {
if (s != shader->target) {
if (s->intel.drm.fallback != NULL) {
- status = intel_surface_flush (s, 0);
+ status = _cairo_surface_drm_surface_flush (&s->intel.drm, 0);
if (unlikely (status))
return status;
}
diff --git a/src/drm/cairo-drm-i965-surface.c b/src/drm/cairo-drm-i965-surface.c
index d395262..a6b14c7 100644
--- a/src/drm/cairo-drm-i965-surface.c
+++ b/src/drm/cairo-drm-i965-surface.c
@@ -703,7 +703,7 @@ i965_surface_flush (void *abstract_surface, unsigned flags)
return CAIRO_STATUS_SUCCESS;
if (surface->intel.drm.fallback != NULL)
- return intel_surface_flush (&(surface->intel), flags);
+ return _cairo_drm_surface_flush (&(surface->intel.drm), flags);
/* Forgo flushing on finish as the user cannot access the surface directly. */
if (! surface->intel.drm.base.finished &&
diff --git a/src/drm/cairo-drm-intel-surface.c b/src/drm/cairo-drm-intel-surface.c
index 05de14a..790e6b9 100644
--- a/src/drm/cairo-drm-intel-surface.c
+++ b/src/drm/cairo-drm-intel-surface.c
@@ -62,28 +62,6 @@ intel_surface_finish (void *abstract_surface)
return _cairo_drm_surface_finish (&surface->drm);
}
-cairo_status_t
-intel_surface_flush (void *abstract_surface, unsigned flags)
-{
- intel_surface_t *surface = cairo_abstract_surface_cast_intel(abstract_surface);
- cairo_status_t status;
-
- if (flags)
- return CAIRO_STATUS_SUCCESS;
-
- if (surface->drm.fallback == NULL)
- return CAIRO_STATUS_SUCCESS;
-
- /* kill any outstanding maps */
- cairo_surface_finish (surface->drm.fallback);
-
- status = cairo_surface_status (surface->drm.fallback);
- cairo_surface_destroy (surface->drm.fallback);
- surface->drm.fallback = NULL;
-
- return status;
-}
-
static const cairo_surface_backend_t intel_surface_backend = {
.type = CAIRO_SURFACE_TYPE_DRM,
.create_context = _cairo_default_context_create,
@@ -93,7 +71,7 @@ static const cairo_surface_backend_t intel_surface_backend = {
.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,
+ .flush = _cairo_drm_surface_flush,
.paint = _cairo_drm_dumb_surface_paint,
.mask = _cairo_drm_dumb_surface_mask,
.stroke = _cairo_drm_dumb_surface_stroke,
diff --git a/src/drm/cairo-drm-private.h b/src/drm/cairo-drm-private.h
index d0916e4..494eea4 100644
--- a/src/drm/cairo-drm-private.h
+++ b/src/drm/cairo-drm-private.h
@@ -292,6 +292,10 @@ _cairo_drm_surface_init (cairo_drm_surface_t *surface,
int width, int height);
cairo_private cairo_status_t
+_cairo_drm_surface_flush (void *abstact_interface,
+ unsigned flags);
+
+cairo_private cairo_status_t
_cairo_drm_surface_finish (void *surface);
cairo_private void
diff --git a/src/drm/cairo-drm-radeon-surface.c b/src/drm/cairo-drm-radeon-surface.c
index 18b4c6a..0bea74a 100644
--- a/src/drm/cairo-drm-radeon-surface.c
+++ b/src/drm/cairo-drm-radeon-surface.c
@@ -54,31 +54,6 @@ radeon_surface_create_similar (void *abstract_surface,
width, height);
}
-static cairo_status_t
-radeon_surface_flush (void *abstract_surface,
- unsigned flags)
-{
- radeon_surface_t *surface = _cairo_surface_cast_radeon(abstract_surface);
- cairo_status_t status;
-
- if (flags)
- return CAIRO_STATUS_SUCCESS;
-
- if (surface->base.fallback == NULL)
- return CAIRO_STATUS_SUCCESS;
-
- /* kill any outstanding maps */
- cairo_surface_finish (surface->base.fallback);
-
- status = cairo_surface_status (surface->base.fallback);
- cairo_surface_destroy (surface->base.fallback);
- surface->base.fallback = NULL;
-
- _cairo_drm_bo_unmap (surface->base.bo);
-
- return status;
-}
-
static const cairo_surface_backend_t radeon_surface_backend = {
.type = CAIRO_SURFACE_TYPE_DRM,
.create_context = _cairo_default_context_create,
@@ -88,7 +63,7 @@ static const cairo_surface_backend_t radeon_surface_backend = {
.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,
+ .flush = _cairo_drm_surface_flush,
.paint = _cairo_drm_dumb_surface_paint,
.mask = _cairo_drm_dumb_surface_mask,
.stroke = _cairo_drm_dumb_surface_stroke,
diff --git a/src/drm/cairo-drm-surface.c b/src/drm/cairo-drm-surface.c
index e7f7872..5609ce3 100644
--- a/src/drm/cairo-drm-surface.c
+++ b/src/drm/cairo-drm-surface.c
@@ -580,3 +580,28 @@ void _cairo_drm_surface_release_source_image (void *abstract_surface,
{
cairo_surface_destroy (&image->base);
}
+
+cairo_status_t
+_cairo_drm_surface_flush (void *abstract_surface,
+ unsigned flags)
+{
+ cairo_drm_surface_t *surface = _cairo_surface_cast_drm (abstract_surface);
+ cairo_status_t status;
+
+ if (flags)
+ return CAIRO_STATUS_SUCCESS;
+
+ if (surface->fallback == NULL)
+ return CAIRO_STATUS_SUCCESS;
+
+ /* kill any outstanding maps */
+ cairo_surface_finish (surface->fallback);
+
+ status = cairo_surface_status (surface->fallback);
+ cairo_surface_destroy (surface->fallback);
+ surface->fallback = NULL;
+
+ _cairo_drm_bo_unmap (surface->bo);
+
+ return status;
+}
--
2.6.4.442.g545299f
More information about the cairo
mailing list