From 2c2c06b93eb1f1e2211e8411d56a30f972227bc6 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 10 Dec 2024 00:14:14 +0100 Subject: [PATCH] rusticl/mem: add Allocation::is_user_alloc_for_dev get_res_of_dev will entirely be reworked, but there is one user only wanting to know if the allocation is a user_ptr one. Part-of: --- src/gallium/frontends/rusticl/core/memory.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/rusticl/core/memory.rs b/src/gallium/frontends/rusticl/core/memory.rs index 197c2ed84aa..911a45a8fcb 100644 --- a/src/gallium/frontends/rusticl/core/memory.rs +++ b/src/gallium/frontends/rusticl/core/memory.rs @@ -489,6 +489,10 @@ impl Allocation { host_ptr as _ } + fn is_user_alloc_for_dev(&self, dev: &Device) -> CLResult { + Ok(self.get_res_of_dev(dev)?.is_user()) + } + fn offset(&self) -> usize { match self { Allocation::Resource(res) => res.offset, @@ -1061,10 +1065,9 @@ impl MemBase { } fn is_pure_user_memory(&self, d: &Device) -> CLResult { - let r = self.get_res_of_dev(d)?; // 1Dbuffer objects are weird. The parent memory object can be a host_ptr thing, but we are // not allowed to actually return a pointer based on the host_ptr when mapping. - Ok(r.is_user() && !self.host_ptr().is_null()) + Ok(self.alloc.is_user_alloc_for_dev(d)? && !self.host_ptr().is_null()) } fn map(