diff options
author | Benjamin Otte <otte@redhat.com> | 2010-05-26 11:36:22 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-06-07 13:37:46 +0200 |
commit | 9c6e1338a1c7d61b4cc84bcdc5c38573a34cd561 (patch) | |
tree | 13f30651e72d56c8761f0c8ae30d1f0a27bef0d6 | |
parent | 60f0cb9c60556f94af903dd6f9da0628a05a1f7f (diff) |
gl: Make cairo_gl_composite_t not require a gl context anymore
First patch in a series.
The idea is to make all gl operations in Cairo work like this:
1) prepare cairo_gl_composite_t
2) acquire device
3) begin composite operation
4) emit vertexes
5) end operation
6) release device
7) cleanup composite operation
This both reduces the time required with the device locked, cleans the
API and more importantly avoids ABBA deadlocks, as we currently call
acquire_pattern() with the device lock held.
-rw-r--r-- | src/cairo-gl-composite.c | 6 | ||||
-rw-r--r-- | src/cairo-gl-glyphs.c | 7 | ||||
-rw-r--r-- | src/cairo-gl-private.h | 6 | ||||
-rw-r--r-- | src/cairo-gl-surface.c | 19 |
4 files changed, 15 insertions, 23 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c index 4a1267f7..7dc2a60e 100644 --- a/src/cairo-gl-composite.c +++ b/src/cairo-gl-composite.c @@ -1331,16 +1331,14 @@ _cairo_gl_composite_end (cairo_gl_context_t *ctx, } void -_cairo_gl_composite_fini (cairo_gl_context_t *ctx, - cairo_gl_composite_t *setup) +_cairo_gl_composite_fini (cairo_gl_composite_t *setup) { _cairo_gl_operand_destroy (&setup->src); _cairo_gl_operand_destroy (&setup->mask); } cairo_status_t -_cairo_gl_composite_init (cairo_gl_context_t *ctx, - cairo_gl_composite_t *setup, +_cairo_gl_composite_init (cairo_gl_composite_t *setup, cairo_operator_t op, cairo_gl_surface_t *dst, cairo_bool_t assume_component_alpha, diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c index 42527102..28a72645 100644 --- a/src/cairo-gl-glyphs.c +++ b/src/cairo-gl-glyphs.c @@ -240,8 +240,7 @@ _render_glyphs (cairo_gl_surface_t *dst, _cairo_scaled_font_freeze_cache (scaled_font); - status = _cairo_gl_composite_init (ctx, &setup, - op, dst, + status = _cairo_gl_composite_init (&setup, op, dst, TRUE, glyph_extents); if (unlikely (status)) @@ -350,10 +349,10 @@ _render_glyphs (cairo_gl_surface_t *dst, _cairo_gl_composite_end (ctx, &setup); _cairo_scaled_font_thaw_cache (scaled_font); - _cairo_gl_composite_fini (ctx, &setup); - _cairo_gl_context_release (ctx); + _cairo_gl_composite_fini (&setup); + *remaining_glyphs = num_glyphs - i; return status; } diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h index 960865c8..ef5ce160 100644 --- a/src/cairo-gl-private.h +++ b/src/cairo-gl-private.h @@ -279,16 +279,14 @@ cairo_private cairo_bool_t _cairo_gl_operator_is_supported (cairo_operator_t op); cairo_private cairo_status_t -_cairo_gl_composite_init (cairo_gl_context_t *ctx, - cairo_gl_composite_t *setup, +_cairo_gl_composite_init (cairo_gl_composite_t *setup, cairo_operator_t op, cairo_gl_surface_t *dst, cairo_bool_t has_component_alpha, const cairo_rectangle_int_t *rect); cairo_private void -_cairo_gl_composite_fini (cairo_gl_context_t *ctx, - cairo_gl_composite_t *setup); +_cairo_gl_composite_fini (cairo_gl_composite_t *setup); cairo_private void _cairo_gl_composite_set_clip_region (cairo_gl_context_t *ctx, diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index d1066ef1..b549ab29 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -917,8 +917,7 @@ _cairo_gl_surface_composite (cairo_operator_t op, if (unlikely (status)) return status; - status = _cairo_gl_composite_init (ctx, &setup, - op, dst, + status = _cairo_gl_composite_init (&setup, op, dst, mask && mask->has_component_alpha, &rect); if (unlikely (status)) @@ -966,8 +965,8 @@ _cairo_gl_surface_composite (cairo_operator_t op, _cairo_gl_composite_end (ctx, &setup); CLEANUP: - _cairo_gl_composite_fini (ctx, &setup); _cairo_gl_context_release (ctx); + _cairo_gl_composite_fini (&setup); return status; } @@ -1045,8 +1044,7 @@ _cairo_gl_surface_fill_rectangles (void *abstract_dst, if (unlikely (status)) return status; - status = _cairo_gl_composite_init (ctx, &setup, - op, dst, + status = _cairo_gl_composite_init (&setup, op, dst, FALSE, /* XXX */ NULL); if (unlikely (status)) @@ -1083,8 +1081,8 @@ _cairo_gl_surface_fill_rectangles (void *abstract_dst, _cairo_gl_composite_end (ctx, &setup); CLEANUP: - _cairo_gl_composite_fini (ctx, &setup); _cairo_gl_context_release (ctx); + _cairo_gl_composite_fini (&setup); return status; } @@ -1178,10 +1176,10 @@ _cairo_gl_surface_span_renderer_destroy (void *abstract_renderer) if (!renderer) return; - _cairo_gl_composite_fini (renderer->ctx, &renderer->setup); - _cairo_gl_context_release (renderer->ctx); + _cairo_gl_composite_fini (&renderer->setup); + free (renderer); } @@ -1246,8 +1244,7 @@ _cairo_gl_surface_create_span_renderer (cairo_operator_t op, return _cairo_span_renderer_create_in_error (status); } - status = _cairo_gl_composite_init (renderer->ctx, - &renderer->setup, + status = _cairo_gl_composite_init (&renderer->setup, op, dst, FALSE, extents); if (unlikely (status)) @@ -1272,8 +1269,8 @@ _cairo_gl_surface_create_span_renderer (cairo_operator_t op, FAIL: - _cairo_gl_composite_fini (renderer->ctx, &renderer->setup); _cairo_gl_context_release (renderer->ctx); + _cairo_gl_composite_fini (&renderer->setup); free (renderer); return _cairo_span_renderer_create_in_error (status); } |