mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
panfrost: remove BO from cache before closing GEM
If the GEM is closed before setting the BO in the sparse array to zero, a newly allocated GEM may be associated with a stale BO that is left in the cache reusing an old BO. Zero the BO before closing the GEM to make sure that the BO is removed from the cache and won't be associated with a different GEM. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23744>
This commit is contained in:
parent
7a0033a1c9
commit
279d08a18a
1 changed files with 5 additions and 4 deletions
|
|
@ -93,16 +93,17 @@ static void
|
|||
panfrost_bo_free(struct panfrost_bo *bo)
|
||||
{
|
||||
struct drm_gem_close gem_close = {.handle = bo->gem_handle};
|
||||
int fd = bo->dev->fd;
|
||||
int ret;
|
||||
|
||||
ret = drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
|
||||
/* BO will be freed with the sparse array, but zero to indicate free */
|
||||
memset(bo, 0, sizeof(*bo));
|
||||
|
||||
ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
|
||||
if (ret) {
|
||||
fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/* BO will be freed with the sparse array, but zero to indicate free */
|
||||
memset(bo, 0, sizeof(*bo));
|
||||
}
|
||||
|
||||
/* Returns true if the BO is ready, false otherwise.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue