summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Khatri <sunilkh@codeaurora.org>2017-07-20 18:42:53 +0530
committerSunil Khatri <sunilkh@codeaurora.org>2017-07-24 15:36:48 +0530
commit5b1f525950bf1d78b725282dc1c49284a3050e1f (patch)
treec6b69a59f66da84f2d3c172c3ac4b98c8e37e426
parent7aa065cbc4f86125895f6c7c6a5ac1fdda231505 (diff)
msm: kgsl: Fix the syncpoint_fence trace
We should have a corresponding syncpoint_fence trace for every syncpoint_fence_expire trace. In case the fence is already signaled then make sure to have syncpoint_fence trace before syncpoint_fence_expire trace. Also take an extra refcount for fence which will make sure that the fence pointer is valid in the trace even if the fence is signaled. Change-Id: I2fd8f91c800f89a4a64813a6908eaa0445cf548b Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
-rw-r--r--drivers/gpu/msm/kgsl_drawobj.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/gpu/msm/kgsl_drawobj.c b/drivers/gpu/msm/kgsl_drawobj.c
index f8f0e7ccb0d3..8dc2ebd26cf9 100644
--- a/drivers/gpu/msm/kgsl_drawobj.c
+++ b/drivers/gpu/msm/kgsl_drawobj.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -348,7 +348,13 @@ static int drawobj_add_sync_fence(struct kgsl_device *device,
struct kgsl_cmd_syncpoint_fence *sync = priv;
struct kgsl_drawobj *drawobj = DRAWOBJ(syncobj);
struct kgsl_drawobj_sync_event *event;
+ struct sync_fence *fence = NULL;
unsigned int id;
+ int ret = 0;
+
+ fence = sync_fence_fdget(sync->fd);
+ if (fence == NULL)
+ return -EINVAL;
kref_get(&drawobj->refcount);
@@ -364,11 +370,13 @@ static int drawobj_add_sync_fence(struct kgsl_device *device,
set_bit(event->id, &syncobj->pending);
+ trace_syncpoint_fence(syncobj, fence->name);
+
event->handle = kgsl_sync_fence_async_wait(sync->fd,
drawobj_sync_fence_func, event);
if (IS_ERR_OR_NULL(event->handle)) {
- int ret = PTR_ERR(event->handle);
+ ret = PTR_ERR(event->handle);
clear_bit(event->id, &syncobj->pending);
event->handle = NULL;
@@ -376,18 +384,16 @@ static int drawobj_add_sync_fence(struct kgsl_device *device,
drawobj_put(drawobj);
/*
- * If ret == 0 the fence was already signaled - print a trace
- * message so we can track that
+ * Print a syncpoint_fence_expire trace if
+ * the fence is already signaled or there is
+ * a failure in registering the fence waiter.
*/
- if (ret == 0)
- trace_syncpoint_fence_expire(syncobj, "signaled");
-
- return ret;
+ trace_syncpoint_fence_expire(syncobj, (ret < 0) ?
+ "error" : fence->name);
}
- trace_syncpoint_fence(syncobj, event->handle->name);
-
- return 0;
+ sync_fence_put(fence);
+ return ret;
}
/* drawobj_add_sync_timestamp() - Add a new sync point for a sync obj