[cairo] invalid size error, nth ping
Chris Wilson
chris at chris-wilson.co.uk
Mon Jan 12 13:41:51 PST 2009
On Mon, 2009-01-12 at 22:16 +0100, Paolo Bonzini wrote:
> >> However, first question
> >> is, can or can't we do that automatically?
> >> Cairo should just work.
> >
> > Yes, we can. I'm not sure it would not cause useless resource waste.
> > Maybe we can define a default policy (more than 1500 pixels => enable
> > caching; shamelessly stolen from Chris's xshm patch).
>
> Blah, I'm rusty on my own code. Sorry.
>
> We cannot, because if you modify the image data of a cacheable surface
> "from the outside" (touching the pixels directly), you need to call
> cairo_surface_flush.
What I'm playing with at the moment are drm surfaces and borrowing from
them the concept of mapping a surface back from the GPU domain to the
CPU domain. It currently looks like:
cairo_surface_t *cairo_drm_surface_map (cairo_surface_t *);
void cairo_drm_surface_unmap (cairo_surface_t *drm,
cairo_surface_t *image);
where mapping returns an image surface, which you can directly
manipulate to your hearts content. Whilst the surface is mapped, all
rendering to the drm surface is actually performed on the image surface
by the CPU. I added it simply because I need to sync the perf suite
(obviously, mapping a surface causes a read-back from the GPU) but it
also satisfies the acquire-surface-for-pixel-manipulation required for
fast image loading with the raster backends, i.e.
cairo_win32_surface_get_image() or the once-upon-a-time proposed
cairo_surface_acquire_image_surface().
Another avenue I'm looking at is cairo_surface_create_similar_image()
that is a generic version of cairo_quartz_image_surface_create() but
specifically written so that the mime-surface could return a
XShm-backend image surface for the image loaders to fill. The epiphany
that I had a while ago and have done nothing about was that the
mime-surface, with it's lazy decoding, is a caching-surface and that we
could generalise this proxy surface style to provide an easy interface
for lazy caching.
Please excuse the brain dump. ;-)
-ickle
More information about the cairo
mailing list