[cairo] [PATCH 38/71] drm: generalized framebuffer-based surface operations
Enrico Weigelt, metux IT consult
enrico.weigelt at gr13.net
Mon Apr 17 16:57:17 UTC 2017
Several driver specific backend functions just proxy to the underlying
image surface, which then renders directly into the framebuffer.
These functions dont need t be driver specific and thus can be generalized.
Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
src/drm/cairo-drm-intel-surface.c | 80 ++------------------------------
src/drm/cairo-drm-private.h | 46 ++++++++++++++++++
src/drm/cairo-drm-radeon-surface.c | 80 ++------------------------------
src/drm/cairo-drm-surface.c | 95 ++++++++++++++++++++++++++++++++++++++
4 files changed, 151 insertions(+), 150 deletions(-)
diff --git a/src/drm/cairo-drm-intel-surface.c b/src/drm/cairo-drm-intel-surface.c
index 0c61ca0f2..3000f2ac3 100644
--- a/src/drm/cairo-drm-intel-surface.c
+++ b/src/drm/cairo-drm-intel-surface.c
@@ -146,76 +146,6 @@ intel_surface_flush (void *abstract_surface, unsigned flags)
return status;
}
-static cairo_int_status_t
-intel_surface_paint (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_paint (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, clip);
-}
-
-static cairo_int_status_t
-intel_surface_mask (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_pattern_t *mask,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_mask (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, mask, clip);
-}
-
-static cairo_int_status_t
-intel_surface_stroke (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_path_fixed_t *path,
- const cairo_stroke_style_t *stroke_style,
- const cairo_matrix_t *ctm,
- const cairo_matrix_t *ctm_inverse,
- double tolerance,
- cairo_antialias_t antialias,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_stroke (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, path, stroke_style, ctm, ctm_inverse,
- tolerance, antialias, clip);
-}
-
-static cairo_int_status_t
-intel_surface_fill (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_fill (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, path, fill_rule,
- tolerance, antialias, clip);
-}
-
-static cairo_int_status_t
-intel_surface_glyphs (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_scaled_font_t *scaled_font,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_show_text_glyphs (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source,
- NULL, 0,
- glyphs, num_glyphs,
- NULL, 0, 0,
- scaled_font, clip);
-}
-
static const cairo_surface_backend_t intel_surface_backend = {
.type = CAIRO_SURFACE_TYPE_DRM,
.create_context = _cairo_default_context_create,
@@ -226,11 +156,11 @@ static const cairo_surface_backend_t intel_surface_backend = {
.get_extents = _cairo_drm_surface_get_extents,
.get_font_options = _cairo_drm_surface_get_font_options,
.flush = intel_surface_flush,
- .paint = intel_surface_paint,
- .mask = intel_surface_mask,
- .stroke = intel_surface_stroke,
- .fill = intel_surface_fill,
- .show_glyphs = intel_surface_glyphs,
+ .paint = _cairo_drm_surface_paint,
+ .mask = _cairo_drm_surface_mask,
+ .stroke = _cairo_drm_surface_stroke,
+ .fill = _cairo_drm_surface_fill,
+ .show_glyphs = _cairo_drm_surface_glyphs,
};
void
diff --git a/src/drm/cairo-drm-private.h b/src/drm/cairo-drm-private.h
index b7fd9bdf9..3917447bd 100644
--- a/src/drm/cairo-drm-private.h
+++ b/src/drm/cairo-drm-private.h
@@ -320,6 +320,52 @@ _cairo_drm_device_fini (cairo_drm_device_t *device);
cairo_private cairo_surface_t *
_cairo_drm_surface_map_to_image (void *abstract_surface);
+/* default / dumb framebuffer backend ops */
+
+cairo_private cairo_int_status_t
+_cairo_drm_surface_paint (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_clip_t *clip);
+
+cairo_private cairo_int_status_t
+_cairo_drm_surface_mask (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_pattern_t *mask,
+ const cairo_clip_t *clip);
+
+cairo_private cairo_int_status_t
+_cairo_drm_surface_stroke (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_path_fixed_t *path,
+ const cairo_stroke_style_t *stroke_style,
+ const cairo_matrix_t *ctm,
+ const cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias,
+ const cairo_clip_t *clip);
+
+cairo_private cairo_int_status_t
+_cairo_drm_surface_fill (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias,
+ const cairo_clip_t *clip);
+
+cairo_private cairo_int_status_t
+_cairo_drm_surface_glyphs (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font,
+ const cairo_clip_t *clip);
+
/* h/w specific backends */
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 c941e877b..72d222af8 100644
--- a/src/drm/cairo-drm-radeon-surface.c
+++ b/src/drm/cairo-drm-radeon-surface.c
@@ -137,76 +137,6 @@ radeon_surface_flush (void *abstract_surface,
return status;
}
-static cairo_int_status_t
-radeon_surface_paint (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_paint (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, clip);
-}
-
-static cairo_int_status_t
-radeon_surface_mask (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_pattern_t *mask,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_mask (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, mask, clip);
-}
-
-static cairo_int_status_t
-radeon_surface_stroke (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_path_fixed_t *path,
- const cairo_stroke_style_t *stroke_style,
- const cairo_matrix_t *ctm,
- const cairo_matrix_t *ctm_inverse,
- double tolerance,
- cairo_antialias_t antialias,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_stroke (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, path, stroke_style, ctm, ctm_inverse,
- tolerance, antialias, clip);
-}
-
-static cairo_int_status_t
-radeon_surface_fill (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_fill (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source, path, fill_rule,
- tolerance, antialias, clip);
-}
-
-static cairo_int_status_t
-radeon_surface_glyphs (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_scaled_font_t *scaled_font,
- const cairo_clip_t *clip)
-{
- return _cairo_surface_show_text_glyphs (_cairo_drm_surface_map_to_image (abstract_surface),
- op, source,
- NULL, 0,
- glyphs, num_glyphs,
- NULL, 0, 0,
- scaled_font, clip);
-}
-
static const cairo_surface_backend_t radeon_surface_backend = {
.type = CAIRO_SURFACE_TYPE_DRM,
.create_context = _cairo_default_context_create,
@@ -217,11 +147,11 @@ static const cairo_surface_backend_t radeon_surface_backend = {
.get_extents = _cairo_drm_surface_get_extents,
.get_font_options = _cairo_drm_surface_get_font_options,
.flush = radeon_surface_flush,
- .paint = radeon_surface_paint,
- .mask = radeon_surface_mask,
- .stroke = radeon_surface_stroke,
- .fill = radeon_surface_fill,
- .show_glyphs = radeon_surface_glyphs,
+ .paint = _cairo_drm_surface_paint,
+ .mask = _cairo_drm_surface_mask,
+ .stroke = _cairo_drm_surface_stroke,
+ .fill = _cairo_drm_surface_fill,
+ .show_glyphs = _cairo_drm_surface_glyphs,
};
static void
diff --git a/src/drm/cairo-drm-surface.c b/src/drm/cairo-drm-surface.c
index c93fb94f9..217eb5797 100644
--- a/src/drm/cairo-drm-surface.c
+++ b/src/drm/cairo-drm-surface.c
@@ -406,3 +406,98 @@ _cairo_drm_surface_map_to_image (void *abstract_surface)
return surface->fallback;
}
+
+/* drm surface default callbacks - operating on dumb framebuffer */
+
+cairo_int_status_t
+_cairo_drm_surface_paint (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_clip_t *clip)
+{
+ return _cairo_surface_paint (_cairo_drm_surface_map_to_image (abstract_surface),
+ op,
+ source,
+ clip);
+}
+
+cairo_int_status_t
+_cairo_drm_surface_mask (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_pattern_t *mask,
+ const cairo_clip_t *clip)
+{
+ return _cairo_surface_mask (_cairo_drm_surface_map_to_image (abstract_surface),
+ op,
+ source,
+ mask,
+ clip);
+}
+
+cairo_int_status_t
+_cairo_drm_surface_stroke (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_path_fixed_t *path,
+ const cairo_stroke_style_t *stroke_style,
+ const cairo_matrix_t *ctm,
+ const cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias,
+ const cairo_clip_t *clip)
+{
+ return _cairo_surface_stroke (_cairo_drm_surface_map_to_image (abstract_surface),
+ op,
+ source,
+ path,
+ stroke_style,
+ ctm,
+ ctm_inverse,
+ tolerance,
+ antialias,
+ clip);
+}
+
+cairo_int_status_t
+_cairo_drm_surface_fill (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias,
+ const cairo_clip_t *clip)
+{
+ return _cairo_surface_fill (_cairo_drm_surface_map_to_image (abstract_surface),
+ op,
+ source,
+ path,
+ fill_rule,
+ tolerance,
+ antialias,
+ clip);
+}
+
+cairo_int_status_t
+_cairo_drm_surface_glyphs (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font,
+ const cairo_clip_t *clip)
+{
+ return _cairo_surface_show_text_glyphs (_cairo_drm_surface_map_to_image (abstract_surface),
+ op,
+ source,
+ NULL,
+ 0,
+ glyphs,
+ num_glyphs,
+ NULL,
+ 0,
+ 0,
+ scaled_font,
+ clip);
+}
--
2.11.0.rc0.7.gbe5a750
More information about the cairo
mailing list