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

Christophe Fergeau cfergeau at redhat.com
Tue Aug 13 02:39:52 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 ;)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130813/679ef65e/attachment-0001.pgp>


More information about the Spice-devel mailing list