mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
v3dv: fix debug dump on BO free
We were resetting the BO struct right before dumping its data. Fix
this by moving the reset later.
Fixes: 44fa8304d4 ('v3dv: add a refcount mechanism to BOs')
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19672>
This commit is contained in:
parent
947e183ff5
commit
2c44597181
1 changed files with 7 additions and 8 deletions
|
|
@ -135,16 +135,9 @@ bo_free(struct v3dv_device *device,
|
||||||
assert(p_atomic_read(&bo->refcnt) == 0);
|
assert(p_atomic_read(&bo->refcnt) == 0);
|
||||||
assert(bo->map == NULL);
|
assert(bo->map == NULL);
|
||||||
|
|
||||||
/* Our BO structs are stored in a sparse array in the physical device,
|
|
||||||
* so we don't want to free the BO pointer, instead we want to reset it
|
|
||||||
* to 0, to signal that array entry as being free.
|
|
||||||
*/
|
|
||||||
uint32_t handle = bo->handle;
|
|
||||||
memset(bo, 0, sizeof(*bo));
|
|
||||||
|
|
||||||
struct drm_gem_close c;
|
struct drm_gem_close c;
|
||||||
memset(&c, 0, sizeof(c));
|
memset(&c, 0, sizeof(c));
|
||||||
c.handle = handle;
|
c.handle = bo->handle;
|
||||||
int ret = v3dv_ioctl(device->pdevice->render_fd, DRM_IOCTL_GEM_CLOSE, &c);
|
int ret = v3dv_ioctl(device->pdevice->render_fd, DRM_IOCTL_GEM_CLOSE, &c);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
fprintf(stderr, "close object %d: %s\n", bo->handle, strerror(errno));
|
fprintf(stderr, "close object %d: %s\n", bo->handle, strerror(errno));
|
||||||
|
|
@ -160,6 +153,12 @@ bo_free(struct v3dv_device *device,
|
||||||
bo_dump_stats(device);
|
bo_dump_stats(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Our BO structs are stored in a sparse array in the physical device,
|
||||||
|
* so we don't want to free the BO pointer, instead we want to reset it
|
||||||
|
* to 0, to signal that array entry as being free.
|
||||||
|
*/
|
||||||
|
memset(bo, 0, sizeof(*bo));
|
||||||
|
|
||||||
return ret == 0;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue