gegl r2308 - in trunk: . gegl gegl/graph gegl/process



Author: ok
Date: Sat May 17 20:23:00 2008
New Revision: 2308
URL: http://svn.gnome.org/viewvc/gegl?rev=2308&view=rev

Log:
Removed initial broken thread enabled processing from GEGL,
paralellization should be attempted through multiple processes instead
of multiple threads instead.
* configure.ac: 
* gegl/gegl-init.c:
* gegl/graph/gegl-node.c:
* gegl/process/gegl-eval-mgr.c:
* gegl/process/gegl-processor.c:


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/gegl/gegl-init.c
   trunk/gegl/graph/gegl-node.c
   trunk/gegl/process/gegl-eval-mgr.c
   trunk/gegl/process/gegl-processor.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sat May 17 20:23:00 2008
@@ -332,21 +332,6 @@
 #AC_PROG_YACC
 #AM_PROG_LEX
 
-#############################
-# Threads and multi processor 
-#############################
-
-AC_ARG_ENABLE(mp, [  --enable-mp             enable experimental support for multiple processors], ,
-enable_mp=no
-)
-
-if test "x$enable_mp" != "xno"; then
-  AC_DEFINE(ENABLE_MP, 1,
-               [Define to 1 to enable support for multiple processors.])
-fi
-
-
-
 
 ########################
 # Check for MMX assembly
@@ -844,7 +829,6 @@
   GEGL docs:      $enable_docs
   Build workshop: $enable_workshop
   Build website:  $have_asciidoc
-  Multiprocessor: $enable_mp
   SIMD:           sse:$enable_sse mmx:$enable_mmx
 
 Optional dependencies:

Modified: trunk/gegl/gegl-init.c
==============================================================================
--- trunk/gegl/gegl-init.c	(original)
+++ trunk/gegl/gegl-init.c	Sat May 17 20:23:00 2008
@@ -132,11 +132,6 @@
   if (config)
     return;
 
-#if ENABLE_MP
-  if (!g_thread_supported())
-    g_thread_init (NULL);
-#endif
-
   /*  If any command-line actions are ever added to GEGL, then the commented
    *  out code below should be used.  Until then, we simply call the parse hook
    *  directly.

Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c	(original)
+++ trunk/gegl/graph/gegl-node.c	Sat May 17 20:23:00 2008
@@ -40,10 +40,8 @@
 
 #include "process/gegl-eval-mgr.h"
 #include "process/gegl-have-visitor.h"
-#if ENABLE_MP
 #include "process/gegl-lock-visitor.h"
 #include "process/gegl-unlock-visitor.h"
-#endif
 #include "process/gegl-prepare-visitor.h"
 #include "process/gegl-finish-visitor.h"
 #include "process/gegl-processor.h"
@@ -196,10 +194,6 @@
                                             GEGL_TYPE_NODE,
                                             GeglNodePrivate);
 
-#if ENABLE_MP
-  self->mutex = g_mutex_new ();
-#endif
-
   priv = GEGL_NODE_GET_PRIVATE (self);
 
   self->pads        = NULL;
@@ -287,14 +281,6 @@
       g_free (priv->name);
     }
 
-#if ENABLE_MP
-  if (self->mutex)
-    {
-      g_mutex_free (self->mutex);
-      self->mutex = NULL;
-    }
-#endif
-
   G_OBJECT_CLASS (gegl_node_parent_class)->finalize (gobject);
 }
 
@@ -538,7 +524,6 @@
   g_return_if_fail (GEGL_IS_NODE (node));
   g_return_if_fail (rect != NULL);
 
-  gegl_node_lock (node);
   if (node->cache)
     {
       gegl_cache_invalidate (node->cache, rect);
@@ -546,7 +531,6 @@
 
   g_signal_emit (node, gegl_node_signals[INVALIDATED], 0,
                  rect, NULL);
-  gegl_node_unlock (node);
 }
 
 static void
@@ -1500,10 +1484,6 @@
   GeglVisitor  *prepare_visitor;
   GeglVisitor  *have_visitor;
   GeglVisitor  *finish_visitor;
-#if ENABLE_MP
-  GeglVisitor  *lock_visitor;
-  GeglVisitor  *unlock_visitor;
-#endif
 
   guchar       *id;
   gint          i;
@@ -1523,12 +1503,6 @@
 
   id = g_malloc (1);
 
-#if ENABLE_MP
-  lock_visitor = g_object_new (GEGL_TYPE_LOCK_VISITOR, "id", id, NULL);
-  gegl_visitor_dfs_traverse (lock_visitor, GEGL_VISITABLE (root));
-  g_object_unref (lock_visitor);
-#endif
-
   for (i = 0; i < 2; i++)
     {
       prepare_visitor = g_object_new (GEGL_TYPE_PREPARE_VISITOR, "id", id, NULL);
@@ -1544,12 +1518,6 @@
   gegl_visitor_dfs_traverse (finish_visitor, GEGL_VISITABLE (root));
   g_object_unref (finish_visitor);
 
-#if ENABLE_MP
-  unlock_visitor = g_object_new (GEGL_TYPE_UNLOCK_VISITOR, "id", id, NULL);
-  gegl_visitor_dfs_traverse (unlock_visitor, GEGL_VISITABLE (root));
-  g_object_unref (unlock_visitor);
-#endif
-
   g_object_unref (root);
   g_free (id);
 
@@ -2161,23 +2129,3 @@
 {
   return g_object_new (GEGL_TYPE_NODE, NULL);
 }
-
-void
-gegl_node_lock (GeglNode *node)
-{
-#if ENABLE_MP
-  g_return_if_fail (GEGL_IS_NODE (node));
-  g_print ("locking %s %p\n", gegl_node_get_debug_name (node), node->mutex);
-  g_mutex_lock (node->mutex);
-#endif
-}
-
-void
-gegl_node_unlock (GeglNode *node)
-{
-#if ENABLE_MP
-  g_return_if_fail (GEGL_IS_NODE (node));
-  g_print ("unlocking %s %p\n", gegl_node_get_debug_name (node), node->mutex);
-  g_mutex_unlock (node->mutex);
-#endif
-}

Modified: trunk/gegl/process/gegl-eval-mgr.c
==============================================================================
--- trunk/gegl/process/gegl-eval-mgr.c	(original)
+++ trunk/gegl/process/gegl-eval-mgr.c	Sat May 17 20:23:00 2008
@@ -29,10 +29,6 @@
 #include "gegl-cr-visitor.h"
 #include "gegl-have-visitor.h"
 #include "gegl-need-visitor.h"
-#if ENABLE_MP
-#include "gegl-lock-visitor.h"
-#include "gegl-unlock-visitor.h"
-#endif
 #include "gegl-instrument.h"
 #include "graph/gegl-node.h"
 #include "gegl-prepare-visitor.h"
@@ -103,12 +99,6 @@
     root = pad->node;
   g_object_ref (root);
 
-#if ENABLE_MP
-      GeglVisitor *lock_visitor = g_object_new (GEGL_TYPE_LOCK_VISITOR, "id", context_id, NULL);
-      gegl_visitor_dfs_traverse (lock_visitor, GEGL_VISITABLE (root));
-      g_object_unref (lock_visitor);
-#endif
-
   for (i = 0; i < 2; i++)
     {
       prepare_visitor = g_object_new (GEGL_TYPE_PREPARE_VISITOR, "id", context_id, NULL);
@@ -120,13 +110,6 @@
   gegl_visitor_dfs_traverse (have_visitor, GEGL_VISITABLE (root));
   g_object_unref (have_visitor);
 
-#if ENABLE_MP
-    GeglVisitor *unlock_visitor = g_object_new (GEGL_TYPE_UNLOCK_VISITOR, "id", context_id, NULL);
-    gegl_visitor_dfs_traverse (unlock_visitor, GEGL_VISITABLE (root));
-    g_object_unref (unlock_visitor);
-#endif
-
-
   g_assert (root);
 
   if (self->roi.width == -1 &&
@@ -210,4 +193,3 @@
     }
   return buffer;
 }
-

Modified: trunk/gegl/process/gegl-processor.c
==============================================================================
--- trunk/gegl/process/gegl-processor.c	(original)
+++ trunk/gegl/process/gegl-processor.c	Sat May 17 20:23:00 2008
@@ -587,86 +587,6 @@
   return !gegl_processor_is_rendered (processor);
 }
 
-
-#if ENABLE_MP
-
-gpointer render_thread (gpointer data)
-{
-  GeglProcessor *processor = data;
-
-  while (gegl_processor_render (processor, &processor->rectangle, &processor->progress));
-  processor->thread_done = TRUE;
-  return NULL;
-}
-
-gboolean
-gegl_processor_work (GeglProcessor *processor,
-                     gdouble       *progress)
-{
-  gboolean   more_work = FALSE;
-  GeglCache *cache;
-
-  if (!processor->thread)
-    {
-      processor->thread = g_thread_create (render_thread,
-                                           processor,
-                                           FALSE,
-                                           NULL);
-      processor->thread_done = FALSE;
-      if (progress)
-        *progress = processor->progress;
-      more_work = !processor->thread_done;
-    }
-  else
-    {
-      if (progress)
-        *progress = processor->progress;
-      if (processor->thread_done)
-        {
-          processor->thread = NULL;
-        }
-      more_work = !processor->thread_done;
-    }
-
-  /*more_work = gegl_processor_render (processor, &processor->rectangle, progress);*/
-
-  if (more_work)
-    {
-      return TRUE;
-    }
-
-  if (GEGL_IS_OPERATION_SINK (processor->node->operation) &&
-      !gegl_operation_sink_needs_full (processor->node->operation))
-    {
-      if (progress)
-        *progress = 1.0;
-      return FALSE;
-    }
-
-  cache = gegl_node_get_cache (processor->input);
-
-  if (processor->context)
-    {
-      gegl_operation_process (processor->node->operation,
-                              processor->context,
-                              "output"  /* ignored output_pad */,
-                              &processor->context->result_rect
-                              );
-      gegl_node_remove_context (processor->node, cache);
-      processor->context = NULL;
-      if (progress)
-        *progress = 1.0;
-      return TRUE;
-    }
-
-  if (progress)
-    *progress = 1.0;
-
-  return FALSE;
-}
-
-#else
-
 gboolean
 gegl_processor_work (GeglProcessor *processor,
                      gdouble       *progress)
@@ -700,7 +620,6 @@
 
   return FALSE;
 }
-#endif
 
 void
 gegl_processor_destroy (GeglProcessor *processor)



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