Mesa (main): winsys/amdgpu: don't clear RADEON_USAGE_SYNCHRONIZED for last_added_bo_usage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 07:13:33 UTC 2021


Module: Mesa
Branch: main
Commit: a5118bc97dc009c486157b193dca484587fdb591
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a5118bc97dc009c486157b193dca484587fdb591

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Oct 22 00:52:40 2021 -0400

winsys/amdgpu: don't clear RADEON_USAGE_SYNCHRONIZED for last_added_bo_usage

It was breaking the early return path.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13478>

---

 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 2152890774d..6fb8099ce52 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -665,29 +665,32 @@ static unsigned amdgpu_cs_add_buffer(struct radeon_cmdbuf *rcs,
 
          buffer = &cs->slab_buffers[index];
          buffer->usage |= usage;
+         cs->last_added_bo_usage = buffer->usage;
 
-         usage &= ~RADEON_USAGE_SYNCHRONIZED;
          index = buffer->slab_real_idx;
+         buffer = &cs->real_buffers[index];
+         buffer->usage |= usage & ~RADEON_USAGE_SYNCHRONIZED;
       } else {
          index = amdgpu_lookup_or_add_real_buffer(rcs, cs, bo);
          if (index < 0)
             return 0;
-      }
 
-      buffer = &cs->real_buffers[index];
+         buffer = &cs->real_buffers[index];
+         buffer->usage |= usage;
+         cs->last_added_bo_usage = buffer->usage;
+      }
    } else {
       index = amdgpu_lookup_or_add_sparse_buffer(rcs, cs, bo);
       if (index < 0)
          return 0;
 
       buffer = &cs->sparse_buffers[index];
+      buffer->usage |= usage;
+      cs->last_added_bo_usage = buffer->usage;
    }
 
-   buffer->usage |= usage;
-
    cs->last_added_bo = bo;
    cs->last_added_bo_index = index;
-   cs->last_added_bo_usage = buffer->usage;
    return index;
 }
 



More information about the mesa-commit mailing list