From 85a62e0498b9c4f1bd9eaa38be860e0e88210a6f Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sat, 24 Feb 2024 19:46:26 +0100 Subject: [PATCH] rusticl/event: we need to call the CL_COMPLETE callback on errors as well Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10673 Fixes: 47a80d7ff4f ("rusticl/event: proper eventing support") Signed-off-by: Karol Herbst Part-of: (cherry picked from commit 36fb256e9ad0409749c694429eba002fe4099f8d) --- .pick_status.json | 2 +- src/gallium/frontends/rusticl/core/event.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index dc057dec39c..cf4d5264191 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2664,7 +2664,7 @@ "description": "rusticl/event: we need to call the CL_COMPLETE callback on errors as well", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "47a80d7ff4f966e3839640efd5f9d75e36af8906", "notes": null diff --git a/src/gallium/frontends/rusticl/core/event.rs b/src/gallium/frontends/rusticl/core/event.rs index 6f45bb59140..6389d6de831 100644 --- a/src/gallium/frontends/rusticl/core/event.rs +++ b/src/gallium/frontends/rusticl/core/event.rs @@ -117,8 +117,11 @@ impl Event { self.cv.notify_all(); } - if [CL_COMPLETE, CL_RUNNING, CL_SUBMITTED].contains(&(new as u32)) { - if let Some(cbs) = lock.cbs.get_mut(new as usize) { + // on error we need to call the CL_COMPLETE callbacks + let cb_idx = if new < 0 { CL_COMPLETE } else { new as u32 }; + + if [CL_COMPLETE, CL_RUNNING, CL_SUBMITTED].contains(&cb_idx) { + if let Some(cbs) = lock.cbs.get_mut(cb_idx as usize) { cbs.drain(..).for_each(|cb| cb.call(self, new)); } }