mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
rusticl/mem: reimplement has_same_parent and rename it to backing_memory_eq
We actually want to know if the backing memory is the same, it's also easier to implement than checking on the parent memory object. This will also allow for more flexibility if more memory types are supported, e.g. proper SVM allocations. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32581>
This commit is contained in:
parent
787d3b0ffc
commit
944f47f103
2 changed files with 5 additions and 4 deletions
|
|
@ -1165,7 +1165,7 @@ fn enqueue_copy_buffer(
|
|||
// and the source and destination regions overlap or if src_buffer and dst_buffer are different
|
||||
// sub-buffers of the same associated buffer object and they overlap. The regions overlap if
|
||||
// src_offset ≤ dst_offset ≤ src_offset + size - 1 or if dst_offset ≤ src_offset ≤ dst_offset + size - 1.
|
||||
if src.has_same_parent(&dst) {
|
||||
if src.backing_memory_eq(&dst) {
|
||||
let src_offset = src_offset + src.offset();
|
||||
let dst_offset = dst_offset + dst.offset();
|
||||
|
||||
|
|
@ -1520,7 +1520,7 @@ fn enqueue_copy_buffer_rect(
|
|||
// CL_MEM_COPY_OVERLAP if src_buffer and dst_buffer are the same buffer or sub-buffer object and
|
||||
// the source and destination regions overlap or if src_buffer and dst_buffer are different
|
||||
// sub-buffers of the same associated buffer object and they overlap.
|
||||
if src.has_same_parent(&dst)
|
||||
if src.backing_memory_eq(&dst)
|
||||
&& check_copy_overlap(
|
||||
&src_ori,
|
||||
src.offset(),
|
||||
|
|
|
|||
|
|
@ -1030,8 +1030,9 @@ impl MemBase {
|
|||
self.mem_type == CL_MEM_OBJECT_BUFFER
|
||||
}
|
||||
|
||||
pub fn has_same_parent(&self, other: &Self) -> bool {
|
||||
ptr::eq(self.get_parent(), other.get_parent())
|
||||
/// Checks if the backing memory is actually the same memory object.
|
||||
pub fn backing_memory_eq(&self, other: &Self) -> bool {
|
||||
self.alloc.backing_resource_eq(&other.alloc)
|
||||
}
|
||||
|
||||
// this is kinda bogus, because that won't work with system SVM, but the spec wants us to
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue