virgl: Skip resource destruction only when there are actually needed references

Suggested by Jan Alexander Steffens in https://gitlab.freedesktop.org/mesa/mesa/-/issues/13844#note_3087461

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13844
Fixes: 6c1c116a0f
cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37346>
(cherry picked from commit 63cd410c29)
This commit is contained in:
Corentin Noël 2025-09-12 23:58:08 +02:00 committed by Eric Engestrom
parent 838d3c13cc
commit bb2c8704b3
2 changed files with 2 additions and 2 deletions

View file

@ -5184,7 +5184,7 @@
"description": "virgl: Skip resource destruction only when there are actually needed references",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "6c1c116a0fb66f2d74976260775ec73025c4a697",
"notes": null

View file

@ -82,7 +82,7 @@ static void virgl_hw_res_destroy(struct virgl_drm_winsys *qdws,
return;
}
if (!--res->needed_references) {
if (--res->needed_references > 0) {
mtx_unlock(&qdws->bo_handles_mutex);
return;
}