mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 02:01:36 +03:00
gpu: host1x: Timestamp syncpoint wait completions
Collect CLOCK_MONOTONIC timestamps in the interrupt handler when a syncpoint wait completes, and report it back in dma_fences and syncpoint wait UAPI. Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Change-Id: I9f783833698df7d96c99c9ffef3205aa82adceb5 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801167 Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
f6865a3c2d
commit
a351c7681e
@@ -9,6 +9,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/dma-fence.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/timekeeping.h>
|
||||
|
||||
#include <trace/events/host1x.h>
|
||||
|
||||
@@ -211,14 +212,15 @@ int host1x_syncpt_incr(struct host1x_syncpt *sp)
|
||||
EXPORT_SYMBOL(host1x_syncpt_incr);
|
||||
|
||||
/**
|
||||
* host1x_syncpt_wait() - wait for a syncpoint to reach a given value
|
||||
* host1x_syncpt_wait_ts() - wait for a syncpoint to reach a given value
|
||||
* @sp: host1x syncpoint
|
||||
* @thresh: threshold
|
||||
* @timeout: maximum time to wait for the syncpoint to reach the given value
|
||||
* @value: return location for the syncpoint value
|
||||
* @ts: return location for completion timestamp
|
||||
*/
|
||||
int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
|
||||
u32 *value)
|
||||
int host1x_syncpt_wait_ts(struct host1x_syncpt *sp, u32 thresh, long timeout, u32 *value,
|
||||
ktime_t *ts)
|
||||
{
|
||||
struct dma_fence *fence;
|
||||
long wait_err;
|
||||
@@ -227,6 +229,8 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
|
||||
|
||||
if (value)
|
||||
*value = host1x_syncpt_load(sp);
|
||||
if (ts)
|
||||
*ts = ktime_get();
|
||||
|
||||
if (host1x_syncpt_is_expired(sp, thresh))
|
||||
return 0;
|
||||
@@ -243,10 +247,13 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
|
||||
wait_err = dma_fence_wait_timeout(fence, true, timeout);
|
||||
if (wait_err == 0)
|
||||
host1x_fence_cancel(fence);
|
||||
dma_fence_put(fence);
|
||||
|
||||
if (value)
|
||||
*value = host1x_syncpt_load(sp);
|
||||
if (ts)
|
||||
*ts = fence->timestamp;
|
||||
|
||||
dma_fence_put(fence);
|
||||
|
||||
if (wait_err == 0)
|
||||
return -EAGAIN;
|
||||
@@ -255,6 +262,19 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(host1x_syncpt_wait_ts);
|
||||
|
||||
/**
|
||||
* host1x_syncpt_wait() - wait for a syncpoint to reach a given value
|
||||
* @sp: host1x syncpoint
|
||||
* @thresh: threshold
|
||||
* @timeout: maximum time to wait for the syncpoint to reach the given value
|
||||
* @value: return location for the syncpoint value
|
||||
*/
|
||||
int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, u32 *value)
|
||||
{
|
||||
return host1x_syncpt_wait_ts(sp, thresh, timeout, value, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL(host1x_syncpt_wait);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user