[Spice-devel] [PATCH v3 10/10] server: split spice_image_cache from red_worker

Alon Levy alevy at redhat.com
Tue Aug 13 05:51:30 PDT 2013


> On Tue, Aug 13, 2013 at 10:47:29AM +0300, Alon Levy wrote:
> > diff --git a/server/spice_image_cache.h b/server/spice_image_cache.h
> > new file mode 100644
> > index 0000000..f11cebc
> > --- /dev/null
> > +++ b/server/spice_image_cache.h
> > @@ -0,0 +1,39 @@
> > +#ifndef H_SPICE_IMAGE_CACHE
> > +#define H_SPICE_IMAGE_CACHE
> > +
> > +#include <inttypes.h>
> > +
> > +#include "common/pixman_utils.h"
> > +#include "common/canvas_base.h"
> > +
> > +#include "common/ring.h"
> > +
> > +typedef struct ImageCacheItem {
> > +    RingItem lru_link;
> > +    uint64_t id;
> > +#ifdef IMAGE_CACHE_AGE
> > +    uint32_t age;
> > +#endif
> > +    struct ImageCacheItem *next;
> > +    pixman_image_t *image;
> > +} ImageCacheItem;
> > +
> > +#define IMAGE_CACHE_HASH_SIZE 1024
> > +
> > +typedef struct ImageCache {
> > +    SpiceImageCache base;
> > +    ImageCacheItem *hash_table[IMAGE_CACHE_HASH_SIZE];
> > +    Ring lru;
> > +#ifdef IMAGE_CACHE_AGE
> > +    uint32_t age;
> > +#else
> > +    uint32_t num_items;
> > +#endif
> > +} ImageCache;
> 
> It seems it could even be possible to have an image_cache_new() function
> which allocates memory for a new ImageCache, which would allow to make the
> ImageCache/ImageCacheItem structures private (I only took a quick look so I
> may have missed fundamental issues that prevent that from being possible ;)

Probably, do you mind if I leave that for a further patch? this was purely a mechanical move. 

> 
> Christophe
> 


More information about the Spice-devel mailing list