diff --git a/src/gallium/frontends/rusticl/api/memory.rs b/src/gallium/frontends/rusticl/api/memory.rs index fa2d471bd05..30a68d77a3f 100644 --- a/src/gallium/frontends/rusticl/api/memory.rs +++ b/src/gallium/frontends/rusticl/api/memory.rs @@ -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(), diff --git a/src/gallium/frontends/rusticl/core/memory.rs b/src/gallium/frontends/rusticl/core/memory.rs index 1019d749a29..16700295cba 100644 --- a/src/gallium/frontends/rusticl/core/memory.rs +++ b/src/gallium/frontends/rusticl/core/memory.rs @@ -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