aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchana Sriram <apsrir@codeaurora.org>2019-10-15 10:36:26 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2019-11-22 07:42:08 -0800
commit3f3e3bd35ea829c9074b72348dc869f6a774432f (patch)
treeb781a60ca809251a13c856d9c29e76510b50f113
parent8c270a5bf5a8e6c771b61724fc6fbacc017e9e46 (diff)
msm: kgsl: Check user generated timestamp before queuing drawobjsLA.AU.0.1.1-03010-gen3meta.0
In ioctls like kgsl_ioctl_submit_commands(), if both syncobj type and cmd/marker/sparseobj type are submitted, the syncobj is queued first followed by the other obj type. After syncobj is successfully queued, in case of failure in get_timestamp while queuing the other obj, both the command objs are destroyed. As sync obj is already queued, accessing this later would cause a crash. Compare the user generated timestamp with the drawctxt timestamp and return early in case of error. This avoids unnecessary queuing of drawobjs. Change-Id: I336c95c42ab1075d7653cba02772f92c918c884c Signed-off-by: Archana Sriram <apsrir@codeaurora.org> Signed-off-by: Harshitha Sai Neelati <hsaine@codeaurora.org>
-rw-r--r--drivers/gpu/msm/adreno_dispatch.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c
index e2d0298325e1..4e4be1e64cef 100644
--- a/drivers/gpu/msm/adreno_dispatch.c
+++ b/drivers/gpu/msm/adreno_dispatch.c
@@ -1396,6 +1396,22 @@ int adreno_dispatcher_queue_cmds(struct kgsl_device_private *dev_priv,
user_ts = *timestamp;
+ /*
+ * If there is only one drawobj in the array and it is of
+ * type SYNCOBJ_TYPE, skip comparing user_ts as it can be 0
+ */
+ if (!(count == 1 && drawobj[0]->type == SYNCOBJ_TYPE) &&
+ (drawctxt->base.flags & KGSL_CONTEXT_USER_GENERATED_TS)) {
+ /*
+ * User specified timestamps need to be greater than the last
+ * issued timestamp in the context
+ */
+ if (timestamp_cmp(drawctxt->timestamp, user_ts) >= 0) {
+ spin_unlock(&drawctxt->lock);
+ return -ERANGE;
+ }
+ }
+
for (i = 0; i < count; i++) {
switch (drawobj[i]->type) {