pvr: Zero tail of cs buffers after linking when dumping cs
authorMatt Coster <matt.coster@imgtec.com>
Tue, 8 Aug 2023 08:28:03 +0000 (09:28 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 30 Aug 2023 14:30:15 +0000 (14:30 +0000)
Dumps already force buffers to zero before they get written to, this
keeps up the pattern of making the contents easier to grok.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24692>

src/imagination/vulkan/pvr_csb.c

index e831f56..d4975e1 100644 (file)
@@ -261,9 +261,11 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb)
 
    /* if this is not the first BO in csb */
    if (csb->pvr_bo) {
+      bool zero_after_move = PVR_IS_DEBUG_SET(DUMP_CONTROL_STREAM);
+      void *new_buffer = pvr_bo->bo->map;
+
       current_state_update_size =
          (uint8_t *)csb->next - (uint8_t *)csb->relocation_mark;
-      void *new_buffer = pvr_bo->bo->map;
 
       assert(csb->relocation_mark != NULL);
       assert(csb->next >= csb->relocation_mark);
@@ -273,10 +275,12 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb)
 #if defined(DEBUG)
       assert(csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_SET);
       csb->relocation_mark_status = PVR_CSB_RELOCATION_MARK_SET_AND_CONSUMED;
-
-      memset(csb->relocation_mark, 0, current_state_update_size);
+      zero_after_move = true;
 #endif
 
+      if (zero_after_move)
+         memset(csb->relocation_mark, 0, current_state_update_size);
+
       csb->next = csb->relocation_mark;
 
       csb->end += stream_link_space;