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 <henry.song@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-07-25 17:03:54 +01:00
parent f3abb1079a
commit 652c632fb2

View file

@ -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);