[gegl/gsoc2011-opencl: 40/46] changed gegl_tile_lock (tile) to gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE) and minor changes



commit 3df728a9691f85b0cded3d60af72f5d32cc9cac8
Author: Victor Oliveira <victormatheus gmail com>
Date:   Mon Jun 13 15:31:21 2011 -0300

    changed gegl_tile_lock (tile) to gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE) and minor changes

 gegl/buffer/gegl-buffer-access.c     |    4 ++--
 gegl/buffer/gegl-buffer-backend.h    |    2 ++
 gegl/buffer/gegl-buffer-iterator.c   |    2 +-
 gegl/buffer/gegl-buffer-linear.c     |    2 +-
 gegl/buffer/gegl-buffer-load.c       |    2 +-
 gegl/buffer/gegl-buffer-private.h    |    4 ++--
 gegl/buffer/gegl-buffer.c            |    2 +-
 gegl/buffer/gegl-tile-handler-zoom.c |    2 +-
 gegl/buffer/gegl-tile.c              |   13 ++++++-------
 9 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 9440ee4..3356614 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -195,7 +195,7 @@ gegl_buffer_set_pixel (GeglBuffer *buffer,
             gint    offsety = gegl_tile_offset (tiledy, tile_height);
             guchar *tp;
 
-            gegl_tile_lock (tile);
+            gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
 
             tp = gegl_tile_get_data (tile) +
                  (offsety * tile_width + offsetx) * px_size;
@@ -486,7 +486,7 @@ gegl_buffer_iterate (GeglBuffer          *buffer,
                   }
 
                 if (write)
-                  gegl_tile_lock (tile);
+                  gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
 
                 tile_base = gegl_tile_get_data (tile);
                 tp        = ((guchar *) tile_base) + (offsety * tile_width + offsetx) * px_size;
diff --git a/gegl/buffer/gegl-buffer-backend.h b/gegl/buffer/gegl-buffer-backend.h
index 40342ac..7edca0c 100644
--- a/gegl/buffer/gegl-buffer-backend.h
+++ b/gegl/buffer/gegl-buffer-backend.h
@@ -29,6 +29,8 @@ typedef struct _GeglTileBackendPrivate    GeglTileBackendPrivate;
 
 typedef struct _GeglTile                  GeglTile;
 
+typedef enum _GeglTileLockMode            GeglTileLockMode;
+
 #include "gegl-types.h"
 #include "gegl-tile-backend.h"
 #include "gegl-tile-source.h"
diff --git a/gegl/buffer/gegl-buffer-iterator.c b/gegl/buffer/gegl-buffer-iterator.c
index e0f8681..70d1760 100644
--- a/gegl/buffer/gegl-buffer-iterator.c
+++ b/gegl/buffer/gegl-buffer-iterator.c
@@ -186,7 +186,7 @@ gulp:
                                                0);
          if (i->write && tile_width==i->subrect.width)
            {
-             gegl_tile_lock (i->tile);
+             gegl_tile_lock (i->tile, GEGL_TILE_LOCK_WRITE);
            }
          i->data = gegl_tile_get_data (i->tile);
 
diff --git a/gegl/buffer/gegl-buffer-linear.c b/gegl/buffer/gegl-buffer-linear.c
index 739fc16..478a6f2 100644
--- a/gegl/buffer/gegl-buffer-linear.c
+++ b/gegl/buffer/gegl-buffer-linear.c
@@ -148,7 +148,7 @@ gegl_buffer_linear_open (GeglBuffer          *buffer,
       tile = gegl_tile_source_get_tile ((GeglTileSource*) (buffer),
                                         0,0,0);
       g_assert (tile);
-      gegl_tile_lock (tile);
+      gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
 
       g_object_set_data (G_OBJECT (buffer), "linear-tile", tile);
 
diff --git a/gegl/buffer/gegl-buffer-load.c b/gegl/buffer/gegl-buffer-load.c
index 8a7300b..b6f5ae2 100644
--- a/gegl/buffer/gegl-buffer-load.c
+++ b/gegl/buffer/gegl-buffer-load.c
@@ -320,7 +320,7 @@ gegl_buffer_load (const gchar *path)
 
 
         g_assert (tile);
-        gegl_tile_lock (tile);
+        gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
 
         data = gegl_tile_get_data (tile);
         g_assert (data);
diff --git a/gegl/buffer/gegl-buffer-private.h b/gegl/buffer/gegl-buffer-private.h
index 53d8e3b..dea9bfd 100644
--- a/gegl/buffer/gegl-buffer-private.h
+++ b/gegl/buffer/gegl-buffer-private.h
@@ -137,7 +137,7 @@ void            gegl_buffer_sampler           (GeglBuffer     *buffer,
 
 
 
-typedef enum
+enum _GeglTileLockMode
 {
   GEGL_TILE_LOCK_NONE         = 0,
   GEGL_TILE_LOCK_READ         = (1 << 0),
@@ -154,7 +154,7 @@ typedef enum
                                 | GEGL_TILE_LOCK_CL_WRITE,
   GEGL_TILE_LOCK_ALL          = GEGL_TILE_LOCK_READWRITE
                                 | GEGL_TILE_LOCK_CL_READWRITE,
-} GeglTileLockMode;
+};
 
 /* the instance size of a GeglTile is a bit large, and should if possible be
  * trimmed down
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index 3e54417..0a3b9df 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -741,7 +741,7 @@ gegl_buffer_get_tile (GeglTileSource *source,
       {
         if (!tile->tile_storage)
           {
-            gegl_tile_lock (tile);
+            gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
             tile->tile_storage = buffer->tile_storage;
             gegl_tile_unlock (tile);
           }
diff --git a/gegl/buffer/gegl-tile-handler-zoom.c b/gegl/buffer/gegl-tile-handler-zoom.c
index c94cb73..60b034c 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.c
+++ b/gegl/buffer/gegl-tile-handler-zoom.c
@@ -267,7 +267,7 @@ get_tile (GeglTileSource *gegl_tile_source,
         if (zoom->cache)
           gegl_tile_handler_cache_insert (zoom->cache, tile, x, y, z);
       }
-    gegl_tile_lock (tile);
+    gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
 
     for (i = 0; i < 2; i++)
       for (j = 0; j < 2; j++)
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index f48f5b1..dc0c8fd 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -195,8 +195,7 @@ gegl_tile_unclone (GeglTile *tile)
       tile->next_shared              = tile;
 
       if (gegl_cl_is_accelerated ())
-          tile->cl_data = gegl_cl_texture_dup (tile->cl_data);
-
+          tile->cl_data = gegl_cl_texture_dup (tile->cl_data, tile->size);
     }
 }
 #if 0
@@ -222,7 +221,7 @@ gegl_tile_lock (GeglTile *tile,
     {
       if (lock_mode & GEGL_TILE_LOCK_ALL_WRITE)
         {
-          g_warning ("strange tile lock count: %i", tile->write_lock);
+          g_warning ("strange tile lock count: %i", tile->write_locks);
           gegl_bt ();
         }
       if (lock_mode & GEGL_TILE_LOCK_ALL_READ)
@@ -237,7 +236,7 @@ gegl_tile_lock (GeglTile *tile,
     {
       if (lock_mode & GEGL_TILE_LOCK_ALL_READ)
         {
-          g_warning ("strange tile lock count: %i", tile->read_lock);
+          g_warning ("strange tile lock count: %i", tile->read_locks);
           gegl_bt ();
         }
       if (lock_mode & GEGL_TILE_LOCK_ALL_WRITE)
@@ -254,10 +253,10 @@ gegl_tile_lock (GeglTile *tile,
 #endif
 
   if (lock_mode & GEGL_TILE_LOCK_ALL_READ) 
-    tile->read_lock++;
+    tile->read_locks++;
 
   if (lock_mode & GEGL_TILE_LOCK_ALL_WRITE) 
-    tile->write_lock++;
+    tile->write_locks++;
 
   /*fprintf (stderr, "global tile locking: %i %i\n", locks, unlocks);*/
 
@@ -333,7 +332,7 @@ gegl_tile_unlock (GeglTile *tile)
             {
               tile->cl_rev = MAX(tile->rev, tile->cl_rev)+1; //cl is updated
               if (tile->lock_mode & GEGL_TILE_LOCK_WRITE)
-                tile->rev = cl_rev; //cl and cpu are in sync
+                tile->rev = tile->cl_rev; //cl and cpu are in sync
             }
           else 
             tile->rev++;



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