This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 0d4b41e7f7e0e3df0c3c05e5bdb4ef4aa7f1a678 (commit) via c5be07c4673b42da89470346a5db21e74897e2cf (commit) from c1a5214d616c7d155bd00f602c1b4f861b5ca7ef (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/0d4b41e7f7e0e3df0c3c05e5bdb4ef4aa7f1a...
commit 0d4b41e7f7e0e3df0c3c05e5bdb4ef4aa7f1a678 Author: Cyril Hrubis metan@ucw.cz Date: Wed Dec 11 22:47:46 2013 +0100
spiv: Fix image cache limits.
The problem was that one part of the code was expecting the limits as kilo-bytes while the second as bytes. (I'm very ashamed that I have done such lousy mistake.)
Resulting in excessively large image cache limit (larger than actual ram) which triggered swapping after large number of images was viewed.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/image_cache.c b/demos/spiv/image_cache.c index 509d507..c030405 100644 --- a/demos/spiv/image_cache.c +++ b/demos/spiv/image_cache.c @@ -66,7 +66,7 @@ size_t image_cache_get_ram_size(void)
fclose(f);
- return ret * 1024 / 10; + return ret; }
/* @@ -83,7 +83,7 @@ static size_t image_size(struct image *img) return image_size2(img->ctx, img->path); }
-struct image_cache *image_cache_create(unsigned int max_size_bytes) +struct image_cache *image_cache_create(unsigned int max_size_kbytes) { struct image_cache *self;
@@ -92,13 +92,13 @@ struct image_cache *image_cache_create(unsigned int max_size_bytes) if (self == NULL) return NULL;
- self->max_size = max_size_bytes; + self->max_size = max_size_kbytes * 1024; self->cur_size = sizeof(struct image_cache);
self->root = NULL; self->end = NULL;
- GP_DEBUG(1, "Created image cache size %u bytes", self->max_size); + GP_DEBUG(1, "Created image cache max size %ukB", max_size_kbytes);
return self; } diff --git a/demos/spiv/image_cache.h b/demos/spiv/image_cache.h index 84cec1d..b08ed48 100644 --- a/demos/spiv/image_cache.h +++ b/demos/spiv/image_cache.h @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -37,9 +37,9 @@ struct image_cache; size_t image_cache_get_ram_size(void);
/* - * Creates an image cache with maximal memory size. + * Creates an image cache with maximal memory size of max_size_kbytes. */ -struct image_cache *image_cache_create(unsigned int max_size_bytes); +struct image_cache *image_cache_create(unsigned int max_size_kbytes);
/* * Returns cached image, or NULL. diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 74a45a4..b3139d9 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -651,6 +651,9 @@ static void init_backend(const char *backend_opts) } }
+#define RESIZED_CACHE_MAX 400 * 1024 +#define ORIG_CACHE_MAX 80 * 1024 + /* * Figure out cache size depending on the size of RAM. * @@ -659,13 +662,17 @@ static void init_backend(const char *backend_opts) static int init_loader(struct loader_params *params, const char **argv) { size_t size = image_cache_get_ram_size(); - unsigned int resized_size = (1024 * size)/10; - unsigned int orig_size = (1024 * size)/50; + size_t resized_size = size/10; + size_t orig_size = size/50; + + if (resized_size > RESIZED_CACHE_MAX) + resized_size = RESIZED_CACHE_MAX;
- if (resized_size > 100 * 1024 * 1024) - resized_size = 100 * 1024 * 1024; + if (orig_size > ORIG_CACHE_MAX) + orig_size = ORIG_CACHE_MAX;
- GP_DEBUG(1, "Resized cache size = %u", resized_size); + GP_DEBUG(1, "Resized cache size = %zukB", resized_size); + GP_DEBUG(1, "Orig cache size = %zukB", orig_size);
if (image_loader_init(argv, orig_size)) return 1;
http://repo.or.cz/w/gfxprim.git/commit/c5be07c4673b42da89470346a5db21e74897e...
commit c5be07c4673b42da89470346a5db21e74897e2cf Author: Cyril Hrubis metan@ucw.cz Date: Wed Dec 11 21:52:01 2013 +0100
backends: X11: Fix window bitmap buffer init
The w and h may be modified upon the window creation so we must use wreq.w and wreq.h instead of the user requested w and h.
This fixes bug for X11 backend when root window is used and the image size was wrongly initialized to whatever user supplied instead of the root window size.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c index bda3bac..14f6ec2 100644 --- a/libs/backends/GP_X11.c +++ b/libs/backends/GP_X11.c @@ -613,8 +613,8 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y, backend->context = NULL;
if ((flags & GP_X11_DISABLE_SHM || !x11_conn.local) - || create_shm_ximage(backend, w, h)) { - if (create_ximage(backend, w, h)) + || create_shm_ximage(backend, wreq.w, wreq.h)) { + if (create_ximage(backend, wreq.w, wreq.h)) goto err1; }
-----------------------------------------------------------------------
Summary of changes: demos/spiv/image_cache.c | 8 ++++---- demos/spiv/image_cache.h | 6 +++--- demos/spiv/spiv.c | 17 ++++++++++++----- libs/backends/GP_X11.c | 4 ++-- 4 files changed, 21 insertions(+), 14 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.