[gegl] gegl: gegl-operation-point-*.c for flush of cl data before threading



commit dd309e9640e07f794a82b41eb7661a2512fa9c5f
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Nov 14 01:57:11 2017 +0100

    gegl: gegl-operation-point-*.c for flush of cl data before threading
    
    This makes the state consistent, if the same data was evaluated in a single
    thread alone the implicit flushing would have been sufficient.

 gegl/operation/gegl-operation-point-composer.c  |    9 +++++++++
 gegl/operation/gegl-operation-point-composer3.c |    9 +++++++++
 gegl/operation/gegl-operation-point-filter.c    |    4 ++++
 3 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index c32fdfb..b3763fe 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -34,6 +34,7 @@
 #include <string.h>
 
 #include "opencl/gegl-cl.h"
+#include "gegl-buffer-cl-cache.h"
 #include "gegl-buffer-cl-iterator.h"
 
 typedef struct ThreadData
@@ -327,6 +328,7 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
            sub_result.y += sub_result.height * j;
            if (j == threads-1)
              sub_result.height = (result->height + result->y) - sub_result.y;
+
           thread_data[j].klass = point_composer_class;
           thread_data[j].operation = operation;
           thread_data[j].input = input;
@@ -340,8 +342,15 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
           thread_data[j].result = sub_result;
         }
         pending = threads;
+
+        if (input)
+          gegl_buffer_cl_cache_flush (input, result);
+        if (aux)
+          gegl_buffer_cl_cache_flush (aux, result);
+
         for (gint j = 1; j < threads; j++)
           g_thread_pool_push (pool, &thread_data[j], NULL);
+
         thread_process (&thread_data[0], NULL);
         while (g_atomic_int_get (&pending)) {};
 
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index e2faf5b..d1bf967 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -31,6 +31,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <string.h>
+#include "gegl-buffer-cl-cache.h"
 
 typedef struct ThreadData
 {
@@ -256,6 +257,14 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
           thread_data[j].result = sub_result;
         }
         pending = threads;
+
+        if (input)
+          gegl_buffer_cl_cache_flush (input, result);
+        if (aux)
+          gegl_buffer_cl_cache_flush (aux, result);
+        if (aux2)
+          gegl_buffer_cl_cache_flush (aux2, result);
+
         for (gint j = 1; j < threads; j++)
           g_thread_pool_push (pool, &thread_data[j], NULL);
         thread_process (&thread_data[0], NULL);
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index bcdab1c..d0d69dc 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -35,6 +35,7 @@
 
 #include "opencl/gegl-cl.h"
 #include "gegl-buffer-cl-iterator.h"
+#include "gegl-buffer-cl-cache.h"
 
 typedef struct ThreadData
 {
@@ -314,6 +315,9 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
 
         pending = threads;
 
+        if (input)
+          gegl_buffer_cl_cache_flush (input, result);
+
         for (gint j = 1; j < threads; j++)
           g_thread_pool_push (pool, &thread_data[j], NULL);
         thread_process (&thread_data[0], NULL);


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