[niepce] ncr: Only disable opencl if there is DISABLE_OPENCL env set to something



commit 58afcb49514df83885e9f2ed885988022906d602
Author: Hubert Figuière <hub figuiere net>
Date:   Mon Mar 13 23:48:23 2017 -0400

    ncr: Only disable opencl if there is DISABLE_OPENCL env set to something

 src/ncr/init.cpp |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/ncr/init.cpp b/src/ncr/init.cpp
index 0ef410e..b23f10d 100644
--- a/src/ncr/init.cpp
+++ b/src/ncr/init.cpp
@@ -18,22 +18,28 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "init.hpp"
+#include <stdlib.h>
+#include <stdio.h>
 
 #include <gegl.h>
 
+#include "init.hpp"
+
 namespace ncr {
 
 void init()
 {
-  // Disable OpenCL for now, it causes hang on my system.
-  // XXX evaluate a better way to enable-disable as needed
-  // XXX my system == old laptop requiring nouveau gfx driver.
-  GeglConfig *config = gegl_config();
-  GValue value = G_VALUE_INIT;
-  g_value_init(&value, G_TYPE_BOOLEAN);
-  g_value_set_boolean(&value, FALSE);
-  g_object_set_property(G_OBJECT(config), "use-opencl", &value);
+  if (getenv("DISABLE_OPENCL")) {
+    // Disable OpenCL for when it causes hang on your system.
+    // XXX evaluate a better way to enable-disable as needed
+    // XXX my old system == old laptop requiring nouveau gfx driver.
+    GeglConfig *config = gegl_config();
+    GValue value = G_VALUE_INIT;
+    g_value_init(&value, G_TYPE_BOOLEAN);
+    g_value_set_boolean(&value, FALSE);
+    fprintf(stderr, "Disabling opencl\n");
+    g_object_set_property(G_OBJECT(config), "use-opencl", &value);
+  }
   gegl_init(0, nullptr);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]