panfrost: Fix crashes with small BOs
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 21 Apr 2020 22:23:00 +0000 (18:23 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Apr 2020 01:01:18 +0000 (01:01 +0000)
Affects Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4671>

src/panfrost/encoder/pan_bo.c

index aca4f8f38483d6843eb86cc0446fee7a6e0f2a12..9e5ea7ed21e2708812ad2500914a4a68233a2c3b 100644 (file)
@@ -270,7 +270,7 @@ panfrost_bo_cache_put(struct panfrost_bo *bo)
                 return false;
 
         pthread_mutex_lock(&dev->bo_cache.lock);
-        struct list_head *bucket = pan_bucket(dev, bo->size);
+        struct list_head *bucket = pan_bucket(dev, MAX2(bo->size, 4096));
         struct drm_panfrost_madvise madv;
         struct timespec time;