From c0e5d821e1bc272eebb65b7243da4ef4d0a9d5c2 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 9 Feb 2026 17:01:43 +0100 Subject: [PATCH] rusticl/mesa: only use resource_from_user_memory if the cap is advertised Fixes some buffer tests on some iris configurations. Cc: mesa-stable Reviewed-by: Alyssa Rosenzweig Tested-by: Alyssa Rosenzweig (cherry picked from commit 240bae6b235dbe72937a01bee878c1fe980dca2b) Part-of: --- .pick_status.json | 2 +- src/gallium/frontends/rusticl/mesa/pipe/screen.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 5b4b0f3bf9c..89a7d188a73 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -994,7 +994,7 @@ "description": "rusticl/mesa: only use resource_from_user_memory if the cap is advertised", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs index f504bb52eda..d7c8d076863 100644 --- a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs +++ b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs @@ -243,6 +243,10 @@ impl PipeScreen { tmpl: &pipe_resource, mem: *mut c_void, ) -> Option { + if !self.has_resource_from_user() { + return None; + } + PipeResourceOwned::new( unsafe { self.screen().resource_from_user_memory?(self.pipe(), tmpl, mem) }, true, @@ -560,6 +564,10 @@ impl PipeScreen { pub fn has_semaphore_create(&self) -> bool { self.screen().semaphore_create.is_some() } + + pub fn has_resource_from_user(&self) -> bool { + self.caps().resource_from_user_memory || self.caps().resource_from_user_memory_compute_only + } } impl ToOwned for PipeScreen {