Mesa (master): panfrost: Implement panfrost_bo_cache_get

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 15 23:14:22 UTC 2019


Module: Mesa
Branch: master
Commit: f02278ae8735e013206ce32fc825aa05a47ec1cb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f02278ae8735e013206ce32fc825aa05a47ec1cb

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Mon Jul 15 09:08:32 2019 -0700

panfrost: Implement panfrost_bo_cache_get

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_bo_cache.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_bo_cache.c b/src/gallium/drivers/panfrost/pan_bo_cache.c
index 2b7a5d208a6..4cbec51a2c1 100644
--- a/src/gallium/drivers/panfrost/pan_bo_cache.c
+++ b/src/gallium/drivers/panfrost/pan_bo_cache.c
@@ -82,7 +82,22 @@ panfrost_bo_cache_fetch(
                 struct panfrost_screen *screen,
                 size_t size, uint32_t flags)
 {
-        /* Stub */
+        struct list_head *bucket = pan_bucket(screen, size);
+
+        /* TODO: Honour flags? */
+
+        /* Iterate the bucket looking for something suitable */
+        list_for_each_entry_safe(struct panfrost_bo, entry, bucket, link) {
+                if (entry->size >= size) {
+                        /* This one works, splice it out of the cache */
+                        list_del(&entry->link);
+
+                        /* Let's go! */
+                        return entry;
+                }
+        }
+
+        /* We didn't find anything */
         return NULL;
 }
 




More information about the mesa-commit mailing list