v3dv: fix BO allocation

`cleared_and_retried` variable is not required, as once the cache is
empty, in the second retry it will retry it is already empty so it won't
retry a new allocation.

Fixes: 2adea940f1 ("v3dv/bo: adding a BO cache")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
(cherry picked from commit f6766ccadb)

Conflicts:
	src/broadcom/vulkan/v3dv_bo.c

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32852>
This commit is contained in:
Juan A. Suarez Romero
2024-10-04 10:05:11 +02:00
committed by Dylan Baker
parent e3a186a3ce
commit 1b706b4c90
2 changed files with 6 additions and 10 deletions

View File

@@ -4474,7 +4474,7 @@
"description": "v3dv: fix BO allocation",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "2adea940f1fc155032923cd84fc1cbb51459d0d5",
"notes": null

View File

@@ -244,20 +244,16 @@ v3dv_bo_alloc(struct v3dv_device *device,
}
}
retry:
;
bool cleared_and_retried = false;
struct drm_v3d_create_bo create = {
.size = size
};
int ret = v3dv_ioctl(device->pdevice->render_fd,
DRM_IOCTL_V3D_CREATE_BO, &create);
int ret;
retry:
ret = v3dv_ioctl(device->pdevice->render_fd,
DRM_IOCTL_V3D_CREATE_BO, &create);
if (ret != 0) {
if (!list_is_empty(&device->bo_cache.time_list) &&
!cleared_and_retried) {
cleared_and_retried = true;
if (!list_is_empty(&device->bo_cache.time_list)) {
bo_cache_free_all(device, true);
goto retry;
}