[gegl] buffer: allow disabling tile allocator through GEGL_TILE_ALLOC env var
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: allow disabling tile allocator through GEGL_TILE_ALLOC env var
- Date: Sun, 26 Apr 2020 11:24:24 +0000 (UTC)
commit bd4caacaa1fef5c6d8ec8efa0ea0e5150ff8b3b3
Author: Ell <ell_se yahoo com>
Date: Sun Apr 26 11:18:35 2020 +0300
buffer: allow disabling tile allocator through GEGL_TILE_ALLOC env var
In gegl-tile-alloc, allow disabling the tile allocator, and using
plaing gegl_malloc() for tiles instead, by setting the
GEGL_TILE_ALLOC environment variable to 0. This is useful for
troubleshooting.
gegl/buffer/gegl-tile-alloc.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/gegl/buffer/gegl-tile-alloc.c b/gegl/buffer/gegl-tile-alloc.c
index 5745bec9c..c7cf44ec3 100644
--- a/gegl/buffer/gegl-tile-alloc.c
+++ b/gegl/buffer/gegl-tile-alloc.c
@@ -19,6 +19,7 @@
#include "config.h"
#include <math.h>
+#include <stdlib.h>
#include <string.h>
#ifdef HAVE_MALLOC_TRIM
@@ -256,6 +257,22 @@ gegl_tile_alloc_fallback (gsize size)
return gegl_tile_buffer_to_data (buffer);
}
+static gboolean
+gegl_tile_alloc_enabled (void)
+{
+ static gint enabled = -1;
+
+ if (enabled < 0)
+ {
+ if (g_getenv ("GEGL_TILE_ALLOC"))
+ enabled = atoi (g_getenv ("GEGL_TILE_ALLOC")) ? TRUE : FALSE;
+ else
+ enabled = TRUE;
+ }
+
+ return enabled;
+}
+
/* public functions */
@@ -270,7 +287,7 @@ gegl_tile_alloc (gsize size)
gint i;
gint j;
- if (size > GEGL_TILE_MAX_SIZE)
+ if (size > GEGL_TILE_MAX_SIZE || ! gegl_tile_alloc_enabled ())
return gegl_tile_alloc_fallback (size);
size = MAX (size, GEGL_TILE_MIN_SIZE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]