From 4b5a8db16c849e77b7f73d3149d3947e2b6104e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20PIERRE?= Date: Fri, 17 Jan 2025 01:45:53 +0100 Subject: [PATCH] =?UTF-8?q?Pipeline=20early=20killswitch:=20release=20the?= =?UTF-8?q?=20GPU=C2=A0device=20when=20exiting=20early?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks @jiyone --- src/develop/pixelpipe_hb.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/develop/pixelpipe_hb.c b/src/develop/pixelpipe_hb.c index 8ecf21ff7316..d5b1f6074069 100644 --- a/src/develop/pixelpipe_hb.c +++ b/src/develop/pixelpipe_hb.c @@ -2306,6 +2306,11 @@ static int dt_dev_pixelpipe_process_rec_and_backcopy(dt_dev_pixelpipe_t *pipe, d #define KILL_SWITCH_PIPE \ if(dt_atomic_get_int(&pipe->shutdown)) \ { \ + if(pipe->devid >= 0) \ + { \ + dt_opencl_unlock_device(pipe->devid); \ + pipe->devid = -1; \ + } \ pipe->status = DT_DEV_PIXELPIPE_DIRTY; \ dt_iop_nap(200); \ return 1; \ @@ -2393,10 +2398,15 @@ restart:; dt_print(DT_DEBUG_OPENCL, "[opencl] frequent opencl errors encountered; disabling opencl for this session!\n"); dt_control_log( - _("ansel discovered problems with your OpenCL setup; disabling OpenCL for this session!")); + _("Ansel discovered problems with your OpenCL setup; disabling OpenCL for this session!")); // also remove "opencl" from capabilities so that the preference entry is greyed out dt_capabilities_remove("opencl"); } + else + { + dt_print(DT_DEBUG_OPENCL, + "[opencl] opencl errors encountered; disabling opencl for this pipeline!\n"); + } dt_dev_pixelpipe_flush_caches(pipe); dt_dev_pixelpipe_change(pipe, dev);