[gegl] operation, transform: use indirect input buffer on main thread as well
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] operation, transform: use indirect input buffer on main thread as well
- Date: Sun, 5 May 2019 13:06:14 +0000 (UTC)
commit 8a5dd58291ff5efc3160f24f6bbd80bc3fad842d
Author: Ell <ell_se yahoo com>
Date: Sun May 5 08:47:22 2019 -0400
operation, transform: use indirect input buffer on main thread as well
In the various GeglOperation subclasses that use a per-thread
indirect input-buffer, backed by the actual input buffer, during
multithreaded processing, use an indirect buffer for the main
thread as well, instead of using the input buffer directly
(unless the main thread processes the entire output).
This avoids a deadlock when multiple threads gegl_buffer_copy()
from their input buffer to the output buffer concurrently: if a
worker thread acquires both the (indirect) input-buffer and output-
buffer locks, while the main thread acquires the (direct) input-
buffer lock and waits on the output-buffer lock, as soon as the
GeglTileBackendBuffer of the worker-thread's input buffer forwards
a command to the underlying input buffer, it will deadlock while
waiting for the input-buffer's lock (which is held by the main
thread). See issue #157.
Furthermore, this should reduce contention over the underlying
input buffer between the main thread and the worker threads.
gegl/operation/gegl-operation-composer.c | 2 +-
gegl/operation/gegl-operation-composer3.c | 2 +-
gegl/operation/gegl-operation-filter.c | 2 +-
operations/transform/transform-core.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer.c b/gegl/operation/gegl-operation-composer.c
index 526d40b23..da5949197 100644
--- a/gegl/operation/gegl-operation-composer.c
+++ b/gegl/operation/gegl-operation-composer.c
@@ -116,7 +116,7 @@ thread_process (const GeglRectangle *area,
{
GeglBuffer *input;
- if (area->x == data->roi->x && area->y == data->roi->y)
+ if (gegl_rectangle_equal (area, data->roi))
{
input = g_object_ref (data->input);
}
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index 91691ee47..6ef945ba0 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -126,7 +126,7 @@ thread_process (const GeglRectangle *area,
{
GeglBuffer *input;
- if (area->x == data->roi->x && area->y == data->roi->y)
+ if (gegl_rectangle_equal (area, data->roi))
{
input = g_object_ref (data->input);
}
diff --git a/gegl/operation/gegl-operation-filter.c b/gegl/operation/gegl-operation-filter.c
index 5a43f9e1b..dca83e14f 100644
--- a/gegl/operation/gegl-operation-filter.c
+++ b/gegl/operation/gegl-operation-filter.c
@@ -133,7 +133,7 @@ thread_process (const GeglRectangle *area,
{
GeglBuffer *input;
- if (area->x == data->roi->x && area->y == data->roi->y)
+ if (gegl_rectangle_equal (area, data->roi))
{
input = g_object_ref (data->input);
}
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 0b87c438d..a09153e51 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -1085,7 +1085,7 @@ thread_process (const GeglRectangle *area,
{
GeglBuffer *input;
- if (area->x == data->roi->x && area->y == data->roi->y)
+ if (gegl_rectangle_equal (area, data->roi))
{
input = g_object_ref (data->input);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]