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:
Mikko Perttunen
2022-11-01 12:01:19 +02:00
committed by Laxman Dewangan
parent 35730e5e7b
commit 09c1b1e9da
2 changed files with 16 additions and 1 deletions

View File

@@ -1057,6 +1057,13 @@ struct drm_tegra_syncpoint_wait {
__u32 value;
__u32 padding;
/**
* @timestamp: [out]
*
* CLOCK_MONOTONIC timestamp in nanoseconds taken when the wait completes.
*/
__u64 timestamp;
};
#define DRM_IOCTL_TEGRA_CHANNEL_OPEN DRM_IOWR(DRM_COMMAND_BASE + 0x10, struct drm_tegra_channel_open)

View File

@@ -345,6 +345,8 @@ int tegra_drm_ioctl_syncpoint_wait(struct drm_device *drm, void *data, struct dr
struct drm_tegra_syncpoint_wait *args = data;
signed long timeout_jiffies;
struct host1x_syncpt *sp;
ktime_t ts;
int err;
if (args->padding != 0)
return -EINVAL;
@@ -355,5 +357,11 @@ int tegra_drm_ioctl_syncpoint_wait(struct drm_device *drm, void *data, struct dr
timeout_jiffies = drm_timeout_abs_to_jiffies(args->timeout_ns);
return host1x_syncpt_wait(sp, args->threshold, timeout_jiffies, &args->value);
err = host1x_syncpt_wait_ts(sp, args->threshold, timeout_jiffies, &args->value, &ts);
if (err)
return err;
args->timestamp = ktime_to_ns(ts);
return 0;
}