Skip to content
Snippets Groups Projects
Commit 77d04989 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig Committed by Marge Bot
Browse files

panfrost: Fix major flaw in BO cache


BOs in the cache are chronological, so we try oldest BOs first. That
means if we find the oldest BO is busy, likely every BO is busy, and we
should bail early. This dramatically reduces the useless cycles spent in
bo_wait.

I studied the BO cache of the following drivers, all of which handle
this correctly: iris, lima, etnaviv, freedreno, vc4, v3d, v3dv.

Signed-off-by: default avatarAlyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <mesa/mesa!10794>
parent 22a75046
No related branches found
No related tags found
No related merge requests found
...@@ -201,9 +201,11 @@ panfrost_bo_cache_fetch(struct panfrost_device *dev, ...@@ -201,9 +201,11 @@ panfrost_bo_cache_fetch(struct panfrost_device *dev,
if (entry->size < size || entry->flags != flags) if (entry->size < size || entry->flags != flags)
continue; continue;
/* If the oldest BO in the cache is busy, likely so is
* everything newer, so bail. */
if (!panfrost_bo_wait(entry, dontwait ? 0 : INT64_MAX, if (!panfrost_bo_wait(entry, dontwait ? 0 : INT64_MAX,
PAN_BO_ACCESS_RW)) PAN_BO_ACCESS_RW))
continue; break;
struct drm_panfrost_madvise madv = { struct drm_panfrost_madvise madv = {
.handle = entry->gem_handle, .handle = entry->gem_handle,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment