[gegl] Keep the state of use-opencl in one location
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Keep the state of use-opencl in one location
- Date: Sat, 2 Nov 2013 23:36:55 +0000 (UTC)
commit abc8a665511a2a3da71b2ee924cb1f2a9af0566f
Author: Daniel Sabo <DanielSabo gmail com>
Date: Tue Oct 15 18:06:07 2013 -0700
Keep the state of use-opencl in one location
The real value is always the one in gegl-cl-init, instead of
being combined with the value in gegl_config().
gegl/gegl-config.c | 2 +-
gegl/gegl-init.c | 29 +++++++++++++++--------------
gegl/opencl/gegl-cl-init.c | 3 +--
3 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/gegl/gegl-config.c b/gegl/gegl-config.c
index 8cc5dde..eb3e82b 100644
--- a/gegl/gegl-config.c
+++ b/gegl/gegl-config.c
@@ -91,7 +91,7 @@ gegl_config_get_property (GObject *gobject,
break;
case PROP_USE_OPENCL:
- g_value_set_boolean (value, config->use_opencl);
+ g_value_set_boolean (value, gegl_cl_is_accelerated());
break;
case PROP_QUEUE_SIZE:
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index 0df75ed..cff6edd 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -176,24 +176,25 @@ gegl_config_use_opencl_notify (GObject *gobject,
gpointer user_data)
{
GeglConfig *cfg = GEGL_CONFIG (gobject);
- gboolean use_opencl = cfg->use_opencl;
- if (use_opencl)
- {
- g_signal_handlers_block_by_func (gobject,
- gegl_config_use_opencl_notify,
- NULL);
+ g_signal_handlers_block_by_func (gobject,
+ gegl_config_use_opencl_notify,
+ NULL);
- use_opencl = gegl_cl_init (NULL);
+ if (cfg->use_opencl)
+ {
+ gegl_cl_init (NULL);
+ }
+ else
+ {
+ gegl_cl_disable ();
+ }
- g_object_set (gobject,
- "use-opencl", use_opencl,
- NULL);
+ cfg->use_opencl = gegl_cl_is_accelerated();
- g_signal_handlers_unblock_by_func (gobject,
- gegl_config_use_opencl_notify,
- NULL);
- }
+ g_signal_handlers_unblock_by_func (gobject,
+ gegl_config_use_opencl_notify,
+ NULL);
}
static void
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 0fc257c..cbbe10f 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -36,7 +36,6 @@
#include "opencl/random.cl.h"
#include "gegl/gegl-debug.h"
-#include "gegl-config.h"
GQuark gegl_opencl_error_quark (void);
@@ -155,7 +154,7 @@ static GHashTable *cl_program_hash = NULL;
gboolean
gegl_cl_is_accelerated (void)
{
- return cl_state.is_accelerated && gegl_config()->use_opencl;
+ return cl_state.is_accelerated;
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]