]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: Add timestamp_ms to LRC snapshot
authorMatthew Brost <matthew.brost@intel.com>
Thu, 7 May 2026 16:20:19 +0000 (09:20 -0700)
committerUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Fri, 8 May 2026 20:48:39 +0000 (13:48 -0700)
Add a timestamp in milliseconds to the LRC snapshot to make it easier to
reason about how long the LRC has been running and the average duration
of each job.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Link: https://patch.msgid.link/20260507162016.3888309-15-umesh.nerlige.ramappa@intel.com
drivers/gpu/drm/xe/xe_lrc.c
drivers/gpu/drm/xe/xe_lrc.h

index 570ff9f55849f704f525a621f712a67db92b31a2..66682a678cc250051253ed6a4459d51996d53b86 100644 (file)
@@ -23,6 +23,7 @@
 #include "xe_drm_client.h"
 #include "xe_exec_queue_types.h"
 #include "xe_gt.h"
+#include "xe_gt_clock.h"
 #include "xe_gt_printk.h"
 #include "xe_hw_fence.h"
 #include "xe_map.h"
@@ -2463,6 +2464,8 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
        snapshot->replay_size = lrc->replay_size;
        snapshot->lrc_snapshot = NULL;
        snapshot->ctx_timestamp = xe_lrc_ctx_timestamp(lrc);
+       snapshot->ctx_timestamp_ms =
+               xe_gt_clock_interval_to_ms(lrc->gt, xe_lrc_ctx_timestamp(lrc));
        snapshot->ctx_job_timestamp = xe_lrc_ctx_job_timestamp(lrc);
        return snapshot;
 }
@@ -2516,6 +2519,7 @@ void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer
        drm_printf(p, "\tStart seqno: (memory) %d\n", snapshot->start_seqno);
        drm_printf(p, "\tSeqno: (memory) %d\n", snapshot->seqno);
        drm_printf(p, "\tTimestamp: 0x%016llx\n", snapshot->ctx_timestamp);
+       drm_printf(p, "\tTimestamp ms: %llu\n", snapshot->ctx_timestamp_ms);
        drm_printf(p, "\tJob Timestamp: 0x%08x\n", snapshot->ctx_job_timestamp);
 
        if (!snapshot->lrc_snapshot)
index bef7af9a578bfe8b09f3537ec586f083d66e4733..d280e657239839e7ba8414aa80b45df61f9b4c5f 100644 (file)
@@ -38,6 +38,7 @@ struct xe_lrc_snapshot {
        u32 start_seqno;
        u32 seqno;
        u64 ctx_timestamp;
+       u64 ctx_timestamp_ms;
        u32 ctx_job_timestamp;
 };