From: Erik Gilling Date: Fri, 1 Mar 2013 00:42:59 +0000 (-0800) Subject: staging: sync: Add timestamps to sync_pts X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=97a84843ac4a1b81c36ccf35ee26cd19c5b8d873;p=deliverable%2Flinux.git staging: sync: Add timestamps to sync_pts Add ktime timestamps to sync_pt structure and update them when signaled Cc: Maarten Lankhorst Cc: Erik Gilling Cc: Daniel Vetter Cc: Rob Clark Cc: Sumit Semwal Cc: dri-devel@lists.freedesktop.org Cc: Android Kernel Team Signed-off-by: Erik Gilling [jstultz: Added commit message] Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 4a9e63df83e9..88d7e6625868 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -155,12 +155,17 @@ void sync_pt_free(struct sync_pt *pt) /* call with pt->parent->active_list_lock held */ static int _sync_pt_has_signaled(struct sync_pt *pt) { + int old_status = pt->status; + if (!pt->status) pt->status = pt->parent->ops->has_signaled(pt); if (!pt->status && pt->parent->destroyed) pt->status = -ENOENT; + if (pt->status != old_status) + pt->timestamp = ktime_get(); + return pt->status; } diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 388acd1ff412..a8e289d50ae0 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -16,6 +16,7 @@ #include #ifdef __KERNEL__ +#include #include #include #include @@ -90,6 +91,8 @@ struct sync_timeline { * @fence: sync_fence to which the sync_pt belongs * @pt_list: membership in sync_fence.pt_list_head * @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_timeline *parent; @@ -102,6 +105,8 @@ struct sync_pt { /* protected by parent->active_list_lock */ int status; + + ktime_t timestamp; }; /**