mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 14:30:22 +01:00
panfrost: fix potential memory leak
In the very unlikely case that the packed AFBC image will not save (enough) memory, we abort packing. In this case we should free the BO associated with the metadata. Fixes:5a928f7563("panfrost: Add env variable for max AFBC packing ratio") Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> (cherry picked from commitf8bc6c8663) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32730>
This commit is contained in:
parent
0f01543ac1
commit
8f7b85e8cd
2 changed files with 4 additions and 3 deletions
|
|
@ -34,7 +34,7 @@
|
|||
"description": "panfrost: fix potential memory leak",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "5a928f7563af8ed18617210b95208ea63c157e2f",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1672,9 +1672,10 @@ panfrost_pack_afbc(struct panfrost_context *ctx,
|
|||
unsigned old_size = panfrost_bo_size(prsrc->bo);
|
||||
unsigned ratio = 100 * new_size / old_size;
|
||||
|
||||
if (ratio > screen->max_afbc_packing_ratio)
|
||||
if (ratio > screen->max_afbc_packing_ratio) {
|
||||
panfrost_bo_unreference(metadata_bo);
|
||||
return;
|
||||
|
||||
}
|
||||
perf_debug(ctx, "%i%%: %i KB -> %i KB\n", ratio, old_size / 1024,
|
||||
new_size / 1024);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue