mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
This commit is contained in:
parent
de8b2f108e
commit
2c2c06b93e
1 changed files with 5 additions and 2 deletions
|
|
@ -489,6 +489,10 @@ impl Allocation {
|
|||
host_ptr as _
|
||||
}
|
||||
|
||||
fn is_user_alloc_for_dev(&self, dev: &Device) -> CLResult<bool> {
|
||||
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<bool> {
|
||||
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<T>(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue