[gimp/gimp-2-10] app: disable parallel asynchronous operations when GEGL_THREADS=1
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: disable parallel asynchronous operations when GEGL_THREADS=1
- Date: Sun, 15 Jul 2018 07:45:54 +0000 (UTC)
commit 1c435f313b18ad8b815e9ce8000cf0cfd42ea584
Author: Ell <ell_se yahoo com>
Date: Sun Jul 15 03:36:45 2018 -0400
app: disable parallel asynchronous operations when GEGL_THREADS=1
When GEGL_THREADS=1, concurrent access to the same buffer is not
safe, which can result in errors if asynchronous operations are
allowed to run in parallel to the main thread (see
https://gitlab.gnome.org/GNOME/gimp/issues/1721#note_265898.)
Disable parallel execution of asynchronous operations when
GEGL_THREADS=1 for now, to fix this. Ultimately, GEGL should be
able to remain thread-safe even when GEGL_THREADS=1. Note that we
want to execute asynchronous operations on a separate thread even
when GEGL_THREADS=1, since the goal here is mainly to avoid
blocking the main thread during their execution, rather than
speeding their execution up (in particular, it's benecifical to run
asynchronous operations in parallel even on a single-core machine,
while parallelizing GEGL operations generally isn't.)
(cherry picked from commit 408540659f215785fd6c01ead54d134bffaf167e)
app/core/gimp-parallel.cc | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/app/core/gimp-parallel.cc b/app/core/gimp-parallel.cc
index 929db1589d..5846dadb05 100644
--- a/app/core/gimp-parallel.cc
+++ b/app/core/gimp-parallel.cc
@@ -468,6 +468,16 @@ gimp_parallel_run_async_set_n_threads (gint n_threads)
{
gint i;
+ /* FIXME: when the number of GEGL threads is 1, GEGL disables some thread-
+ * safety mechanisms, such that, in particular, concurrent access to the same
+ * buffer is not safe. ultimately, it should be possible to configure GEGL
+ * to remain thread-safe independently of the number of threads it uses, but
+ * for now, we simply disable parallel asynchronous operations when the
+ * number of threads is 1.
+ */
+ if (n_threads == 1)
+ n_threads = 0;
+
n_threads = CLAMP (n_threads, 0, GIMP_PARALLEL_RUN_ASYNC_MAX_THREADS);
if (n_threads > gimp_parallel_run_async_n_threads) /* need more threads */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]