From 652c632fb211cede74cef3813c7d6e8099d02089 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 25 Jul 2012 17:03:54 +0100 Subject: [PATCH] gl: Fallback for copy_boxes if src/dst do not belong to the same device If the source and destination are on difference devices (GL contexts) we can not simply texture from one to the other, and must either import the source into the destination context (which has not yet been done) or fallback through an image copy. This patch is based on the work by Henry Song, but moving the check from the common compositor layer down into the GL backend. This should have the same effect... Fixes gl-surface-source Suggested-by: Henry Song Signed-off-by: Chris Wilson --- src/cairo-gl-spans-compositor.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cairo-gl-spans-compositor.c b/src/cairo-gl-spans-compositor.c index 171aee4cc..62da1eb5f 100644 --- a/src/cairo-gl-spans-compositor.c +++ b/src/cairo-gl-spans-compositor.c @@ -313,11 +313,13 @@ draw_image_boxes (void *_dst, } static cairo_int_status_t copy_boxes (void *_dst, - cairo_surface_t *src, + cairo_surface_t *_src, cairo_boxes_t *boxes, const cairo_rectangle_int_t *extents, int dx, int dy) { + cairo_gl_surface_t *dst = _dst; + cairo_gl_surface_t *src = (cairo_gl_surface_t *)_src; cairo_gl_composite_t setup; cairo_gl_context_t *ctx; cairo_int_status_t status; @@ -326,11 +328,14 @@ static cairo_int_status_t copy_boxes (void *_dst, if (! _cairo_gl_surface_is_texture (src)) return CAIRO_INT_STATUS_UNSUPPORTED; + if (src->base.device != dst->base.device) + return CAIRO_INT_STATUS_UNSUPPORTED; + status = _cairo_gl_composite_init (&setup, CAIRO_OPERATOR_SOURCE, _dst, FALSE); if (unlikely (status)) goto FAIL; - _cairo_gl_composite_set_source_operand (&setup, source_to_operand (src)); + _cairo_gl_composite_set_source_operand (&setup, &src->operand); _cairo_gl_operand_translate (&setup.src, -dx, -dy); status = _cairo_gl_composite_begin (&setup, &ctx);