Skip to contentSkip to conversation

amdgpu: fix for submition with no ibs

PATCH New Alex Deucher 1 participant 1 message Feb 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amdgpu: fix for submition with no ibs

From: Ken Wang <[email protected]>

Avoid a crash if no IBs are specified.

---
 amdgpu/amdgpu_cs.c       | 8 ++++++++
 amdgpu/amdgpu_internal.h | 1 +
 2 files changed, 9 insertions(+)
amdgpu/amdgpu_cs.c +8 -0
index b4f41b0..fb5b3a8 100644
@@ -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;
 
amdgpu/amdgpu_internal.h +1 -0
index 557ba1f..4f039b6 100644
@@ -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;
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel