From 367aad4f335a30b190bc45a679729462775bb961 Mon Sep 17 00:00:00 2001 From: Matt Coster Date: Tue, 8 Aug 2023 09:28:03 +0100 Subject: [PATCH] pvr: Don't override commands copied to new buffer when extending cs The next pointer wasn't advanced past the start of the new buffer, meaning anything overflowed into the new buffer would be overwritten on the next emit. Signed-off-by: Matt Coster Reviewed-by: Luigi Santivetti Part-of: --- src/imagination/vulkan/pvr_csb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/imagination/vulkan/pvr_csb.c b/src/imagination/vulkan/pvr_csb.c index 170227b8810..e831f568e39 100644 --- a/src/imagination/vulkan/pvr_csb.c +++ b/src/imagination/vulkan/pvr_csb.c @@ -232,6 +232,7 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb) stream_link_space + PVRX(VDMCTRL_GUARD_SIZE_DEFAULT); const uint32_t cache_line_size = rogue_get_slc_cache_line_size(&csb->device->pdevice->dev_info); + size_t current_state_update_size = 0; struct pvr_bo *pvr_bo; VkResult result; @@ -260,7 +261,7 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb) /* if this is not the first BO in csb */ if (csb->pvr_bo) { - const size_t current_state_update_size = + current_state_update_size = (uint8_t *)csb->next - (uint8_t *)csb->relocation_mark; void *new_buffer = pvr_bo->bo->map; @@ -291,7 +292,7 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb) * sure we don't run out of space when a stream link is required. */ csb->end = csb->start + pvr_bo->bo->size - stream_reserved_space; - csb->next = csb->start; + csb->next = csb->start + current_state_update_size; list_addtail(&pvr_bo->link, &csb->pvr_bo_list);