summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Wang <Qingqing.Wang@amd.com>2016-02-04 13:52:22 +0800
committerAlex Deucher <alexander.deucher@amd.com>2016-02-04 12:26:43 -0500
commitf884af9b57ff480d3c87870d8b40055d9c8c6cfe (patch)
tree5d129a40a4a27bc04e4156765ce1ff98c3adb123
parent6950af4e8475fa969ba46675fe2665c842fc4b79 (diff)
downloaddrm-f884af9b57ff480d3c87870d8b40055d9c8c6cfe.tar.gz
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,
return -EINVAL;
if (ibs_request->number_of_ibs > AMDGPU_CS_MAX_IBS_PER_SUBMIT)
return -EINVAL;
+ if (ibs_request->number_of_ibs == 0) {
+ ibs_request->seq_no = AMDGPU_NULL_SUBMIT_SEQ;
+ return 0;
+ }
user_fence = (ibs_request->fence_info.handle != NULL);
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,
return -EINVAL;
if (fence->ring >= AMDGPU_CS_MAX_RINGS)
return -EINVAL;
+ if (fence->fence == AMDGPU_NULL_SUBMIT_SEQ) {
+ *expired = true;
+ return 0;
+ }
*expired = false;
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 @@
#define ROUND_DOWN(x, y) ((x) & ~__round_mask(x, y))
#define AMDGPU_INVALID_VA_ADDRESS 0xffffffffffffffff
+#define AMDGPU_NULL_SUBMIT_SEQ 0
struct amdgpu_bo_va_hole {
struct list_head list;