mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-09 23:08:18 +02:00
zink/bo: check for usage before completion when reclaiming bos
checking completion alone disregards submit_count, which is used to determine the validity of any existing usage pointer. this could lead to large numbers of bos with stale usage and infinite memory ballooning cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41936>
This commit is contained in:
parent
cf1ca02bd0
commit
fa867cf189
1 changed files with 7 additions and 0 deletions
|
|
@ -135,6 +135,13 @@ bo_can_reclaim(struct zink_screen *screen, struct pb_buffer_lean *pbuf)
|
|||
{
|
||||
struct zink_bo *bo = zink_bo(pbuf);
|
||||
|
||||
/* ensure that submit_count is checked to determine if the usage pointer is stale */
|
||||
if (!zink_bo_has_usage(bo)) {
|
||||
/* if (submit_count > 1) then the usage pointer is invalid */
|
||||
bo->reads.u = NULL;
|
||||
bo->writes.u = NULL;
|
||||
return true;
|
||||
}
|
||||
return zink_screen_usage_check_completion(screen, bo->reads.u) && zink_screen_usage_check_completion(screen, bo->writes.u);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue