[cairo] backend's acquire_source_image question

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 29 13:37:15 PDT 2011

On Wed, 28 Sep 2011 12:47:02 -0700 (PDT), S Boucher <stbya at yahoo.com> wrote:
> Playing with backends (my own homegrown backend), I'm seeing acquire_source_image being called twice on a given surface, before the acquired images are released.
> I see this while running the test clear-source (more specifically, it is in the mask_self part of the test).
> What is the contract that the backend is required to respect for acquire_source_image and acquire_dest_image? cairoint.h is note particularly verbose on that.

acquire_source is expected to return an image surface whose contents will
only be read and must remain valid until the corresponding release. (That
release will be immedate upon finishing the operation, if it is required
for longer a snapshot will be taken instead.) As you correctly noticed,
acquire_source may be called for each channel (source and mask, and if
we're being extremely wacky clip). acquire_source is a fallback path and
should also be avoided (unless you have a very cheap, no-copy/readback
acquire source).

acquire_dest is deprecated. Backends are expected to handle fallbacks
themselves, but the common code will only acquire the fallback image
destination once for an operation.

self-copies are ill-defined. So at the moment it is legal to return the
same image for both source and destination fallbacks...

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list