aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Wang2016-02-03 23:52:22 -0600
committerAlex Deucher2016-02-04 11:26:43 -0600
commitf884af9b57ff480d3c87870d8b40055d9c8c6cfe (patch)
tree5d129a40a4a27bc04e4156765ce1ff98c3adb123
parent6950af4e8475fa969ba46675fe2665c842fc4b79 (diff)
downloadlibdrm-f884af9b57ff480d3c87870d8b40055d9c8c6cfe.tar.gz
libdrm-f884af9b57ff480d3c87870d8b40055d9c8c6cfe.tar.xz
libdrm-f884af9b57ff480d3c87870d8b40055d9c8c6cfe.zip
amdgpu: fix for submition with no ibs
Avoid a crash if no IBs are specified. Signed-off-by: Ken Wang <Qingqing.Wang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--amdgpu/amdgpu_cs.c8
-rw-r--r--amdgpu/amdgpu_internal.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index b4f41b0e..fb5b3a8c 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -190,6 +190,10 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,
190 return -EINVAL; 190 return -EINVAL;
191 if (ibs_request->number_of_ibs > AMDGPU_CS_MAX_IBS_PER_SUBMIT) 191 if (ibs_request->number_of_ibs > AMDGPU_CS_MAX_IBS_PER_SUBMIT)
192 return -EINVAL; 192 return -EINVAL;
193 if (ibs_request->number_of_ibs == 0) {
194 ibs_request->seq_no = AMDGPU_NULL_SUBMIT_SEQ;
195 return 0;
196 }
193 user_fence = (ibs_request->fence_info.handle != NULL); 197 user_fence = (ibs_request->fence_info.handle != NULL);
194 198
195 size = ibs_request->number_of_ibs + (user_fence ? 2 : 1) + 1; 199 size = ibs_request->number_of_ibs + (user_fence ? 2 : 1) + 1;
@@ -422,6 +426,10 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence,
422 return -EINVAL; 426 return -EINVAL;
423 if (fence->ring >= AMDGPU_CS_MAX_RINGS) 427 if (fence->ring >= AMDGPU_CS_MAX_RINGS)
424 return -EINVAL; 428 return -EINVAL;
429 if (fence->fence == AMDGPU_NULL_SUBMIT_SEQ) {
430 *expired = true;
431 return 0;
432 }
425 433
426 *expired = false; 434 *expired = false;
427 435
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 557ba1f1..4f039b68 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -44,6 +44,7 @@
44#define ROUND_DOWN(x, y) ((x) & ~__round_mask(x, y)) 44#define ROUND_DOWN(x, y) ((x) & ~__round_mask(x, y))
45 45
46#define AMDGPU_INVALID_VA_ADDRESS 0xffffffffffffffff 46#define AMDGPU_INVALID_VA_ADDRESS 0xffffffffffffffff
47#define AMDGPU_NULL_SUBMIT_SEQ 0
47 48
48struct amdgpu_bo_va_hole { 49struct amdgpu_bo_va_hole {
49 struct list_head list; 50 struct list_head list;