From f1580acefb4b3b196432a198f98bc840b97be1e5 Mon Sep 17 00:00:00 2001 From: Frank Binns Date: Thu, 29 Aug 2024 16:52:33 +0100 Subject: [PATCH] pvr: only share scratch buffers when they're the required size When sharing scratch buffers across framebuffers, it reallocates the scratch buffer to ensure the smallest scratch buffer is always in use. However, the check to do this meant that it was possible to end up with a scratch buffer that was too small, leading to page faults or memory corruption. Signed-off-by: Frank Binns Acked-by: Erik Faye-Lund Part-of: --- src/imagination/vulkan/pvr_spm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imagination/vulkan/pvr_spm.c b/src/imagination/vulkan/pvr_spm.c index d448324625a..06dae651fc5 100644 --- a/src/imagination/vulkan/pvr_spm.c +++ b/src/imagination/vulkan/pvr_spm.c @@ -228,7 +228,7 @@ VkResult pvr_spm_scratch_buffer_get_buffer( * framebuffers as the scratch buffer is only used during PRs and only one PR * can ever be executed at any one time. */ - if (store->head_ref && store->head_ref->size <= size) { + if (store->head_ref && store->head_ref->size == size) { buffer = store->head_ref; } else { VkResult result;