summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/winsys/amdgpu
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-07-26 03:25:24 +0100
committerDave Airlie <[email protected]>2017-07-26 23:38:23 +0100
commitd4b079e708b8e4dab45f2f8467b2a8a4c37bbfa6 (patch)
treed59b8c9eae4280a5a80da711cd8002e596726a6c /src/amd/vulkan/winsys/amdgpu
parenta81e99f50a718790de379087c9f5a636e32b2a28 (diff)
radv/winsys: fix padding command stream for SI
We were adding pad to size after creating the object, so we could submit a CS bigger than the bo created for it. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/winsys/amdgpu')
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
index 0d89b950d2e..ad4b0b3f9dc 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -841,7 +841,7 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx,
uint32_t *ptr;
unsigned cnt = 0;
unsigned size = 0;
-
+ unsigned pad_words = 0;
if (preamble_cs)
size += preamble_cs->cdw;
@@ -850,6 +850,10 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx,
++cnt;
}
+ while(!size || (size & 7)) {
+ size++;
+ pad_words++;
+ }
assert(cnt);
bo = ws->buffer_create(ws, 4 * size, 4096, RADEON_DOMAIN_GTT, RADEON_FLAG_CPU_ACCESS);
@@ -867,10 +871,8 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx,
}
- while(!size || (size & 7)) {
+ for (unsigned j = 0; j < pad_words; ++j)
*ptr++ = pad_word;
- ++size;
- }
memset(&request, 0, sizeof(request));