staging: sync: Add timestamps to sync_pts

Add ktime timestamps to sync_pt structure and
update them when signaled

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Added commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Erik Gilling 2013-02-28 16:42:59 -08:00 committed by Greg Kroah-Hartman
parent 9d1906e61d
commit 97a84843ac
2 changed files with 10 additions and 0 deletions

View File

@ -155,12 +155,17 @@ void sync_pt_free(struct sync_pt *pt)
/* call with pt->parent->active_list_lock held */ /* call with pt->parent->active_list_lock held */
static int _sync_pt_has_signaled(struct sync_pt *pt) static int _sync_pt_has_signaled(struct sync_pt *pt)
{ {
int old_status = pt->status;
if (!pt->status) if (!pt->status)
pt->status = pt->parent->ops->has_signaled(pt); pt->status = pt->parent->ops->has_signaled(pt);
if (!pt->status && pt->parent->destroyed) if (!pt->status && pt->parent->destroyed)
pt->status = -ENOENT; pt->status = -ENOENT;
if (pt->status != old_status)
pt->timestamp = ktime_get();
return pt->status; return pt->status;
} }

View File

@ -16,6 +16,7 @@
#include <linux/types.h> #include <linux/types.h>
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/ktime.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/wait.h> #include <linux/wait.h>
@ -90,6 +91,8 @@ struct sync_timeline {
* @fence: sync_fence to which the sync_pt belongs * @fence: sync_fence to which the sync_pt belongs
* @pt_list: membership in sync_fence.pt_list_head * @pt_list: membership in sync_fence.pt_list_head
* @status: 1: signaled, 0:active, <0: error * @status: 1: signaled, 0:active, <0: error
* @timestamp: time which sync_pt status transitioned from active to
* singaled or error.
*/ */
struct sync_pt { struct sync_pt {
struct sync_timeline *parent; struct sync_timeline *parent;
@ -102,6 +105,8 @@ struct sync_pt {
/* protected by parent->active_list_lock */ /* protected by parent->active_list_lock */
int status; int status;
ktime_t timestamp;
}; };
/** /**