[cairo] Solid pattern caching revisited

Behdad Esfahbod behdad at behdad.org
Wed Apr 18 14:01:49 PDT 2007


On Wed, 2007-04-18 at 16:56 -0400, Owen Taylor wrote:
> On Wed, 2007-04-18 at 15:11 -0400, Behdad Esfahbod wrote:
> > On Wed, 2007-04-18 at 10:00 -0400, Owen Taylor wrote:
> > > 
> > > Can we back up here and discuss why it wouldn't be simpler and better
> > > to use a per-display solid-surface cache? 
> > 
> > That may be easier, yes, but that would need either a new backend
> > function, or special-casing on pattern type in the xlib/xcb backends.
> > 
> > But a better answer to your question is that we need the workqueue
> > anyway.  For the scaled-font global cache for example.  Or for freeing
> > server resources when a surface is destroyed (which may be from another
> > thread at a much later time...).  So it's not like we are introducing it
> > just for solid-surface cache.
> 
> Well, my take would generally be that 
> 
>  - All caches of X specific objects should be stored per-display
> 
>  - If the cached object is a backend-specific instantiation of a
>    non-backend-specific object (like a cached glyph), then when
>    the non-backend-specific object is deleted, you "unlink" the
>    element in the cache from it
> 
>  - But the object is not freed until it is evicted by the cache
>    and replaced by something else (or when the display is closed
>    and the cache is deleted)

How does this last step happen?  Are you suggesting that we have a
separate xlib scaled font cache that has its own eviction, separate from
global scaled font cache?  I don't follow.


> I don't know if there is a big practical difference between that and
> the work-queue approach. The memory utilization should be similar
> either way. It seems conceptually easier to manage to me without
> a work queue, but if Chris now has tested, working work queue code, 
> then that may not matter much...

For me it's the other way.  The workqueue is conceptually very simple:
if we cannot contact the server right now, queue the work for later.
That's all.  It doesn't really have anything to do with caching.  It
just happens that cache evictions are main candidates to use the queue
given their unexpected nature.

> 					- Owen

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list