[gegl/gsoc2011-opencl: 12/19] GeglTile Locking Messages (Debugging Purposes)
- From: Victor Matheus de Araujo Oliveira <vmaolive src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/gsoc2011-opencl: 12/19] GeglTile Locking Messages (Debugging Purposes)
- Date: Thu, 18 Aug 2011 17:07:24 +0000 (UTC)
commit 18c43ab7bd10469646113f2d2dcbf821dcb35747
Author: Victor Oliveira <victormatheus gmail com>
Date: Mon Aug 1 16:43:21 2011 -0300
GeglTile Locking Messages (Debugging Purposes)
gegl/buffer/gegl-buffer-access.c | 19 +++++++++++++++++--
gegl/buffer/gegl-buffer-iterator.c | 4 ++++
gegl/buffer/gegl-buffer-linear.c | 2 ++
gegl/buffer/gegl-buffer-load.c | 3 +++
gegl/buffer/gegl-buffer.c | 2 ++
gegl/buffer/gegl-tile-handler-zoom.c | 2 ++
gegl/buffer/gegl-tile.h | 9 ++++++++-
7 files changed, 38 insertions(+), 3 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 4cb7d6f..e296e8c 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -191,6 +191,7 @@ gegl_buffer_set_pixel (GeglBuffer *buffer,
gint offsety = gegl_tile_offset (tiledy, tile_height);
guchar *tp;
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_WRITE);
gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
tp = gegl_tile_get_data (tile) +
@@ -200,6 +201,7 @@ gegl_buffer_set_pixel (GeglBuffer *buffer,
else
memcpy (tp, buf, bpx_size);
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
buffer->hot_tile = tile;
}
@@ -269,6 +271,7 @@ gegl_buffer_get_pixel (GeglBuffer *buffer,
gint offsety = gegl_tile_offset (tiledy, tile_height);
guchar *tp;
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_READ);
gegl_tile_lock (tile, GEGL_TILE_LOCK_READ);
tp = gegl_tile_get_data (tile) +
@@ -278,6 +281,7 @@ gegl_buffer_get_pixel (GeglBuffer *buffer,
else
memcpy (buf, tp, px_size);
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
/*gegl_tile_unref (tile);*/
@@ -480,9 +484,15 @@ gegl_buffer_iterate (GeglBuffer *buffer,
}
if (write)
- gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
+ {
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_WRITE);
+ gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
+ }
else
- gegl_tile_lock (tile, GEGL_TILE_LOCK_READ);
+ {
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_READ);
+ gegl_tile_lock (tile, GEGL_TILE_LOCK_READ);
+ }
tile_base = gegl_tile_get_data (tile);
tp = ((guchar *) tile_base) + (offsety * tile_width + offsetx) * px_size;
@@ -572,6 +582,7 @@ gegl_buffer_iterate (GeglBuffer *buffer,
bp += buf_stride;
}
}
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
gegl_tile_unref (tile);
}
@@ -714,6 +725,7 @@ gegl_buffer_cl_iterate (GeglBuffer *buffer,
copy_area_height
};
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_CL_WRITE);
gegl_tile_lock (tile, GEGL_TILE_LOCK_CL_WRITE);
dest = gegl_tile_get_cl_data (tile);
@@ -723,6 +735,7 @@ gegl_buffer_cl_iterate (GeglBuffer *buffer,
tile_offset_x,
tile_offset_y);
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
}
else
@@ -735,6 +748,7 @@ gegl_buffer_cl_iterate (GeglBuffer *buffer,
copy_area_height
};
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_CL_READ);
gegl_tile_lock (tile, GEGL_TILE_LOCK_CL_READ);
src = gegl_tile_get_cl_data (tile);
@@ -744,6 +758,7 @@ gegl_buffer_cl_iterate (GeglBuffer *buffer,
texture_x,
texture_y);
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
}
diff --git a/gegl/buffer/gegl-buffer-iterator.c b/gegl/buffer/gegl-buffer-iterator.c
index a9beb09..a739d91 100644
--- a/gegl/buffer/gegl-buffer-iterator.c
+++ b/gegl/buffer/gegl-buffer-iterator.c
@@ -172,6 +172,7 @@ gulp:
if (direct_access || cl_direct_access)
{
+ TILE_UNLOCK_MSG (i->tile);
gegl_tile_unlock (i->tile);
}
gegl_tile_unref (i->tile);
@@ -222,6 +223,7 @@ gulp:
check for cpu/opencl alignment */
if (direct_access || cl_direct_access)
{
+ TILE_LOCK_MSG (i->tile, i->mode);
gegl_tile_lock (i->tile, i->mode);
}
@@ -658,6 +660,7 @@ gboolean gegl_buffer_iterator_next (GeglBufferIterator *iterator)
if (i->i[no].tile != NULL &&
(i->i[no].tile->read_locks > 0 || i->i[no].tile->write_locks > 0))
{
+ TILE_UNLOCK_MSG (i->i[no].tile);
gegl_tile_unlock (i->i[no].tile);
gegl_tile_unref (i->i[no].tile);
i->i[no].tile = NULL;
@@ -697,6 +700,7 @@ gboolean gegl_buffer_iterator_next (GeglBufferIterator *iterator)
if (i->i[no].tile != NULL &&
(i->i[no].tile->read_locks > 0 || i->i[no].tile->write_locks > 0))
{
+ TILE_UNLOCK_MSG (i->i[no].tile);
gegl_tile_unlock (i->i[no].tile);
gegl_tile_unref (i->i[no].tile);
i->i[no].tile = NULL;
diff --git a/gegl/buffer/gegl-buffer-linear.c b/gegl/buffer/gegl-buffer-linear.c
index 4e4e3da..fee95ec 100644
--- a/gegl/buffer/gegl-buffer-linear.c
+++ b/gegl/buffer/gegl-buffer-linear.c
@@ -150,6 +150,7 @@ gegl_buffer_linear_open (GeglBuffer *buffer,
tile = gegl_tile_source_get_tile ((GeglTileSource*) (buffer),
0,0,0);
g_assert (tile);
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_WRITE);
gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
g_object_set_data (G_OBJECT (buffer), "linear-tile", tile);
@@ -212,6 +213,7 @@ gegl_buffer_linear_close (GeglBuffer *buffer,
tile = g_object_get_data (G_OBJECT (buffer), "linear-tile");
if (tile)
{
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
gegl_tile_unref (tile);
g_object_set_data (G_OBJECT (buffer), "linear-tile", NULL);
diff --git a/gegl/buffer/gegl-buffer-load.c b/gegl/buffer/gegl-buffer-load.c
index b6f5ae2..78efb32 100644
--- a/gegl/buffer/gegl-buffer-load.c
+++ b/gegl/buffer/gegl-buffer-load.c
@@ -320,6 +320,8 @@ gegl_buffer_load (const gchar *path)
g_assert (tile);
+
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_WRITE);
gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
data = gegl_tile_get_data (tile);
@@ -332,6 +334,7 @@ gegl_buffer_load (const gchar *path)
}
/*g_assert (info->offset == entry->offset + info->tile_size);*/
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
gegl_tile_unref (tile);
i++;
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index 5434e58..22dc29f 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -740,8 +740,10 @@ gegl_buffer_get_tile (GeglTileSource *source,
{
if (!tile->tile_storage)
{
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_WRITE);
gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
tile->tile_storage = buffer->tile_storage;
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
}
tile->x = x;
diff --git a/gegl/buffer/gegl-tile-handler-zoom.c b/gegl/buffer/gegl-tile-handler-zoom.c
index 60b034c..e8c8016 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.c
+++ b/gegl/buffer/gegl-tile-handler-zoom.c
@@ -267,6 +267,7 @@ get_tile (GeglTileSource *gegl_tile_source,
if (zoom->cache)
gegl_tile_handler_cache_insert (zoom->cache, tile, x, y, z);
}
+ TILE_LOCK_MSG (tile, GEGL_TILE_LOCK_WRITE);
gegl_tile_lock (tile, GEGL_TILE_LOCK_WRITE);
for (i = 0; i < 2; i++)
@@ -282,6 +283,7 @@ get_tile (GeglTileSource *gegl_tile_source,
set_blank (tile, tile_width, tile_height, format, i, j);
}
}
+ TILE_UNLOCK_MSG (tile);
gegl_tile_unlock (tile);
}
diff --git a/gegl/buffer/gegl-tile.h b/gegl/buffer/gegl-tile.h
index 62ce611..f00fa2c 100644
--- a/gegl/buffer/gegl-tile.h
+++ b/gegl/buffer/gegl-tile.h
@@ -38,7 +38,6 @@ void gegl_tile_lock (GeglTile *tile,
*/
void gegl_tile_unlock (GeglTile *tile);
-
void gegl_tile_mark_as_stored (GeglTile *tile);
gboolean gegl_tile_is_stored (GeglTile *tile);
gboolean gegl_tile_store (GeglTile *tile);
@@ -55,4 +54,12 @@ gboolean gegl_tile_cl_enable (GeglTile *tile,
gint width,
gint height);
+#if 0
+#define TILE_LOCK_MSG(tile, lock_mode) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "TILE LOCK:\t%p %d (%s:%d %s)", tile, lock_mode, __FILE__, __LINE__, __func__); } while(0)
+#define TILE_UNLOCK_MSG(tile) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "TILE UNLOCK:\t%p %d (%s:%d %s)", tile, tile->lock_mode, __FILE__, __LINE__, __func__); } while(0)
+#else
+#define TILE_LOCK_MSG(tile, lock_mode)
+#define TILE_UNLOCK_MSG(tile)
+#endif
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]