rusticl: reset VMA address of resource inside SVMAlloc::drop
If we want to use of the internal refcounting of pipe_resources, we have to stop setting the resources's SVM address to 0 inside PipeResource::drop. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35812>
This commit is contained in:
@@ -68,6 +68,12 @@ impl Drop for SVMAlloc {
|
||||
debug_assert_eq!(0, ret);
|
||||
}
|
||||
|
||||
for (dev, res) in &self.alloc.get_real_resource().res {
|
||||
if !dev.system_svm_supported() {
|
||||
dev.screen().resource_assign_vma(res, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Platform::get()
|
||||
.vm
|
||||
.as_ref()
|
||||
|
||||
@@ -499,7 +499,7 @@ impl Allocation {
|
||||
}
|
||||
|
||||
/// Follows the sub-allocation chain until it hits a real GPU allocation.
|
||||
fn get_real_resource(&self) -> &ResourceAllocation {
|
||||
pub fn get_real_resource(&self) -> &ResourceAllocation {
|
||||
match self {
|
||||
Allocation::SubAlloc(sub) => sub.mem.alloc.get_real_resource(),
|
||||
Allocation::Resource(res) => res,
|
||||
|
||||
@@ -285,15 +285,6 @@ impl PipeResource {
|
||||
impl Drop for PipeResource {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
let pipe = self.pipe.as_ref();
|
||||
let screen = pipe.screen.as_ref().unwrap();
|
||||
|
||||
if pipe.flags & PIPE_RESOURCE_FLAG_FRONTEND_VM != 0 {
|
||||
if let Some(resource_assign_vma) = screen.resource_assign_vma {
|
||||
resource_assign_vma(pipe.screen, self.pipe(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
pipe_resource_reference(&mut self.pipe.as_ptr(), ptr::null_mut());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user