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 <frank.binns@imgtec.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
Frank Binns 2024-08-29 16:52:33 +01:00 committed by Marge Bot
parent cbf58fea6f
commit f1580acefb

View file

@ -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;