Skip to contentSkip to conversation

i915/perf: Add test to query CS timestamp

PATCH In review Umesh Nerlige Ramappa 3 participants 4 messages Mar 3, 2021 – Mar 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i915/perf: Add test to query CS timestamp

Add tests to query CS timestamps for different engines.

v2:
- remove flag parameter
- assert for minimum usable values rather than maximum

v3:
- use clock id for cpu timestamps (Lionel)
- check if query is supported (Ashutosh)
- test bad queries

v4: (Chris, Tvrtko)
- cs_timestamp is a misnomer, use cs_cycles instead
- use cs cycle frequency returned in the query
- omit size parameter

v5:
- use __for_each_physical_engine (Lionel)
- check for ENODEV (Umesh)

v6: Use 2 cpu timestamps to calculate reg read time (Lionel)

---
 include/drm-uapi/i915_drm.h |  47 +++++++++
 tests/i915/i915_query.c     | 191 ++++++++++++++++++++++++++++++++++++
 2 files changed, 238 insertions(+)
include/drm-uapi/i915_drm.h +47 -0
index bf9ea471..e95e17f9 100644
@@ -2176,6 +2176,10 @@ struct drm_i915_query_item {
 #define DRM_I915_QUERY_TOPOLOGY_INFO    1
 #define DRM_I915_QUERY_ENGINE_INFO	2
 #define DRM_I915_QUERY_PERF_CONFIG      3
+	/**
+	 * Query Command Streamer timestamp register.
+	 */
+#define DRM_I915_QUERY_CS_CYCLES	4
 /* Must be kept compact -- no holes and well documented */
 
 	/*
@@ -2309,6 +2313,49 @@ struct drm_i915_engine_info {
 	__u64 rsvd1[4];
 };
 
+/**
+ * struct drm_i915_query_cs_cycles
+ *
+ * The query returns the command streamer cycles and the frequency that can be
+ * used to calculate the command streamer timestamp. In addition the query
+ * returns the cpu timestamp that indicates when the command streamer cycle
+ * count was captured.
+ */
+struct drm_i915_query_cs_cycles {
+	/** Engine for which command streamer cycles is queried. */
+	struct i915_engine_class_instance engine;
+
+	/** Must be zero. */
+	__u32 flags;
+
+	/**
+	 * Command streamer cycles as read from the command streamer
+	 * register at 0x358 offset.
+	 */
+	__u64 cs_cycles;
+
+	/** Frequency of the cs cycles in Hz. */
+	__u64 cs_frequency;
+
+	/**
+	 * CPU timestamp in nanoseconds. cpu_timestamp[0] is captured before
+	 * reading the cs_cycles register and cpu_timestamp[1] is captured after
+	 * reading the register.
+	 **/
+	__u64 cpu_timestamp[2];
+
+	/**
+	 * Reference clock id for CPU timestamp. For definition, see
+	 * clock_gettime(2) and perf_event_open(2). Supported clock ids are
+	 * CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME, CLOCK_BOOTTIME,
+	 * CLOCK_TAI.
+	 */
+	__s32 clockid;
+
+	/** Must be zero. */
+	__u32 rsvd;
+};
+
 /**
  * struct drm_i915_query_engine_info
  *
tests/i915/i915_query.c +191 -0

203 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for i915/perf: Add test to query CS timestamp (rev2)

== Series Details ==

== Series Details ==

Series: i915/perf: Add test to query CS timestamp (rev2)
URL : https://patchwork.freedesktop.org/series/87553/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9825 -> IGTPW_5570
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_5570:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@kms_frontbuffer_tracking@basic:
- {fi-rkl-11500t}: [PASS][1] -> [SKIP][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/fi-rkl-11500t/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/fi-rkl-11500t/igt@[email protected]

Known issues
------------

Here are the changes found in IGTPW_5570 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_tiled_fence_blits@basic:
- fi-kbl-8809g: [PASS][3] -> [TIMEOUT][4] ([i915#3145])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/fi-kbl-8809g/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/fi-kbl-8809g/igt@[email protected]

* igt@runner@aborted:
- fi-kbl-r: NOTRUN -> [FAIL][5] ([i915#1569] / [i915#192] / [i915#193] / [i915#194])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/fi-kbl-r/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-glk-dsi: [DMESG-WARN][6] ([i915#3143]) -> [DMESG-WARN][7] ([i915#1982] / [i915#3143])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/fi-glk-dsi/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/fi-glk-dsi/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#1569]: https://gitlab.freedesktop.org/drm/intel/issues/1569
[i915#192]: https://gitlab.freedesktop.org/drm/intel/issues/192
[i915#193]: https://gitlab.freedesktop.org/drm/intel/issues/193
[i915#194]: https://gitlab.freedesktop.org/drm/intel/issues/194
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#3143]: https://gitlab.freedesktop.org/drm/intel/issues/3143
[i915#3145]: https://gitlab.freedesktop.org/drm/intel/issues/3145

Participating hosts (42 -> 36)
------------------------------

Missing (6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-dg1-1 fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6020 -> IGTPW_5570

CI-20190529: 20190529
CI_DRM_9825: 51348fd0276ac3c65e3ba55c5639d26859cddfaa @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_5570: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/index.html
IGT_6020: 8382d9e87bba39ecc6fa879b2491e28c7fb2e3c7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@i915_query@cs-cycles
+igt@i915_query@cs-cycles-invalid

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/index.html

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✗ Fi.CI.IGT: failure for i915/perf: Add test to query CS timestamp (rev2)

In reply to Umesh Nerlige Ramappa
== Series Details ==

== Series Details ==

Series: i915/perf: Add test to query CS timestamp (rev2)
URL : https://patchwork.freedesktop.org/series/87553/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9825_full -> IGTPW_5570_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_5570_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_5570_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_5570_full:

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_capture@capture@bcs0:
- shard-kbl: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-kbl2/igt@gem_exec_capture@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl3/igt@gem_exec_capture@[email protected]

* {igt@i915_query@cs-cycles-invalid} (NEW):
- shard-iclb: NOTRUN -> [SKIP][3] +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb4/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][4] +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb7/igt@[email protected]

#### Warnings ####

* igt@kms_content_protection@lic:
- shard-iclb: [SKIP][5] ([fdo#109300] / [fdo#111066]) -> [FAIL][6] +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-iclb2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb1/igt@[email protected]

New tests
---------

New tests have been introduced between CI_DRM_9825_full and IGTPW_5570_full:

### New IGT tests (2) ###

* igt@i915_query@cs-cycles:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@i915_query@cs-cycles-invalid:
- Statuses : 7 skip(s)
- Exec time: [0.0] s

Known issues
------------

Here are the changes found in IGTPW_5570_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@feature_discovery@display-3x:
- shard-iclb: NOTRUN -> [SKIP][7] ([i915#1839])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb5/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][8] ([i915#1839])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb6/igt@[email protected]

* igt@feature_discovery@psr2:
- shard-iclb: [PASS][9] -> [SKIP][10] ([i915#658])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-iclb2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb6/igt@[email protected]

* igt@gem_ctx_persistence@engines-mixed:
- shard-hsw: NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#1099])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-hsw7/igt@[email protected]

* igt@gem_ctx_persistence@idempotent:
- shard-snb: NOTRUN -> [SKIP][12] ([fdo#109271] / [i915#1099]) +5 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-snb2/igt@[email protected]

* igt@gem_ctx_sseu@invalid-args:
- shard-tglb: NOTRUN -> [SKIP][13] ([i915#280])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb3/igt@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-tglb: [PASS][14] -> [TIMEOUT][15] ([i915#3063])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-tglb8/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb5/igt@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-kbl: NOTRUN -> [FAIL][16] ([i915#2846])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl1/igt@[email protected]
- shard-glk: NOTRUN -> [FAIL][17] ([i915#2846])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk8/igt@[email protected]
- shard-apl: NOTRUN -> [FAIL][18] ([i915#2846])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl2/igt@[email protected]

* igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglb: [PASS][19] -> [FAIL][20] ([i915#2842]) +1 similar issue
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-tglb7/igt@gem_exec_fair@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs0:
- shard-tglb: NOTRUN -> [FAIL][21] ([i915#2842]) +4 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs1:
- shard-iclb: NOTRUN -> [FAIL][22] ([i915#2842]) +4 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb4/igt@gem_exec_fair@[email protected]
- shard-kbl: NOTRUN -> [FAIL][23] ([i915#2842])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl6/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@rcs0:
- shard-kbl: [PASS][24] -> [FAIL][25] ([i915#2842])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-kbl7/igt@gem_exec_fair@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl6/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-kbl: [PASS][26] -> [SKIP][27] ([fdo#109271]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-kbl7/igt@gem_exec_fair@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl6/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vecs0:
- shard-glk: [PASS][28] -> [FAIL][29] ([i915#2842]) +2 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-glk4/igt@gem_exec_fair@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk9/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-iclb: [PASS][30] -> [FAIL][31] ([i915#2849])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-iclb1/igt@gem_exec_fair@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_reloc@basic-wide-active@rcs0:
- shard-kbl: NOTRUN -> [FAIL][32] ([i915#2389]) +4 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl4/igt@gem_exec_reloc@[email protected]

* igt@gem_exec_reloc@basic-wide-active@vcs1:
- shard-iclb: NOTRUN -> [FAIL][33] ([i915#2389]) +1 similar issue
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb2/igt@gem_exec_reloc@[email protected]

* igt@gem_exec_schedule@u-fairslice@rcs0:
- shard-iclb: [PASS][34] -> [DMESG-WARN][35] ([i915#2803])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-iclb7/igt@gem_exec_schedule@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb8/igt@gem_exec_schedule@[email protected]

* igt@gem_exec_whisper@basic-fds-priority:
- shard-glk: [PASS][36] -> [DMESG-WARN][37] ([i915#118] / [i915#95]) +4 similar issues
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-glk6/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk2/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- shard-apl: NOTRUN -> [SKIP][38] ([fdo#109271] / [i915#2190])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl2/igt@[email protected]

* igt@gem_pwrite@basic-exhaustion:
- shard-snb: NOTRUN -> [WARN][39] ([i915#2658])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-snb6/igt@[email protected]

* igt@gem_render_copy@y-tiled-mc-ccs-to-yf-tiled-ccs:
- shard-iclb: NOTRUN -> [SKIP][40] ([i915#768]) +1 similar issue
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb1/igt@[email protected]

* igt@gem_userptr_blits@input-checking:
- shard-apl: NOTRUN -> [DMESG-WARN][41] ([i915#3002])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl3/igt@[email protected]
- shard-snb: NOTRUN -> [DMESG-WARN][42] ([i915#3002])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-snb7/igt@[email protected]

* igt@gem_userptr_blits@mmap-offset-invalidate-idle@gtt:
- shard-tglb: NOTRUN -> [SKIP][43] ([i915#1317]) +3 similar issues
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb5/igt@gem_userptr_blits@[email protected]

* igt@gem_userptr_blits@mmap-offset-invalidate-idle@uc:
- shard-iclb: NOTRUN -> [SKIP][44] ([i915#1317]) +3 similar issues
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb8/igt@gem_userptr_blits@[email protected]

* igt@gem_userptr_blits@mmap-offset-invalidate-idle@wb:
- shard-glk: NOTRUN -> [SKIP][45] ([fdo#109271]) +52 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk1/igt@gem_userptr_blits@[email protected]

* igt@gem_userptr_blits@vma-merge:
- shard-apl: NOTRUN -> [INCOMPLETE][46] ([i915#2502] / [i915#2667])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl7/igt@[email protected]

* igt@gem_vm_create@destroy-race:
- shard-tglb: [PASS][47] -> [TIMEOUT][48] ([i915#2795])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-tglb2/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb1/igt@[email protected]

* igt@gen9_exec_parse@bb-start-param:
- shard-tglb: NOTRUN -> [SKIP][49] ([fdo#112306]) +1 similar issue
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb5/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- shard-hsw: NOTRUN -> [SKIP][50] ([fdo#109271] / [i915#3012])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-hsw2/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [PASS][51] -> [FAIL][52] ([i915#454])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-iclb1/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb7/igt@[email protected]

* igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-dp:
- shard-kbl: NOTRUN -> [SKIP][53] ([fdo#109271] / [i915#1937])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl4/igt@i915_pm_lpsp@[email protected]

* igt@i915_pm_rpm@modeset-pc8-residency-stress:
- shard-tglb: NOTRUN -> [SKIP][54] ([fdo#109506] / [i915#2411])
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb2/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][55] ([fdo#109293] / [fdo#109506])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb4/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- shard-hsw: [PASS][56] -> [INCOMPLETE][57] ([i915#2782])
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-hsw1/igt@i915_selftest@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-hsw7/igt@i915_selftest@[email protected]

* igt@kms_big_fb@x-tiled-32bpp-rotate-90:
- shard-tglb: NOTRUN -> [SKIP][58] ([fdo#111614]) +1 similar issue
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb3/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][59] ([fdo#110725] / [fdo#111614]) +1 similar issue
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb2/igt@[email protected]

* igt@kms_big_joiner@invalid-modeset:
- shard-apl: NOTRUN -> [SKIP][60] ([fdo#109271] / [i915#2705])
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl2/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-after-suspend:
- shard-iclb: NOTRUN -> [SKIP][61] ([fdo#109284] / [fdo#111827]) +3 similar issues
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb2/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-storm:
- shard-kbl: NOTRUN -> [SKIP][62] ([fdo#109271] / [fdo#111827]) +8 similar issues
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl3/igt@[email protected]

* igt@kms_chamelium@vga-edid-read:
- shard-apl: NOTRUN -> [SKIP][63] ([fdo#109271] / [fdo#111827]) +27 similar issues
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl3/igt@[email protected]

* igt@kms_color_chamelium@pipe-a-ctm-negative:
- shard-glk: NOTRUN -> [SKIP][64] ([fdo#109271] / [fdo#111827]) +3 similar issues
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk9/igt@[email protected]

* igt@kms_color_chamelium@pipe-c-ctm-negative:
- shard-hsw: NOTRUN -> [SKIP][65] ([fdo#109271] / [fdo#111827]) +2 similar issues
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-hsw4/igt@[email protected]

* igt@kms_color_chamelium@pipe-invalid-ctm-matrix-sizes:
- shard-snb: NOTRUN -> [SKIP][66] ([fdo#109271] / [fdo#111827]) +19 similar issues
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-snb2/igt@[email protected]

* igt@kms_color_chamelium@pipe-invalid-degamma-lut-sizes:
- shard-tglb: NOTRUN -> [SKIP][67] ([fdo#109284] / [fdo#111827]) +6 similar issues
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb7/igt@[email protected]

* igt@kms_content_protection@atomic-dpms:
- shard-tglb: NOTRUN -> [SKIP][68] ([fdo#111828])
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb7/igt@[email protected]
- shard-kbl: NOTRUN -> [TIMEOUT][69] ([i915#1319])
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl6/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][70] ([fdo#109300] / [fdo#111066])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb4/igt@[email protected]

* igt@kms_content_protection@lic:
- shard-apl: NOTRUN -> [TIMEOUT][71] ([i915#1319]) +2 similar issues
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl7/igt@[email protected]

* igt@kms_content_protection@uevent:
- shard-apl: NOTRUN -> [FAIL][72] ([i915#2105])
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl8/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-suspend:
- shard-kbl: [PASS][73] -> [DMESG-WARN][74] ([i915#180])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-kbl3/igt@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl1/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-suspend:
- shard-kbl: NOTRUN -> [SKIP][75] ([fdo#109271]) +101 similar issues
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl1/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][76] ([fdo#109278]) +8 similar issues
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb6/igt@[email protected]

* igt@kms_cursor_edge_walk@pipe-d-128x128-right-edge:
- shard-snb: NOTRUN -> [SKIP][77] ([fdo#109271]) +337 similar issues
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-snb5/igt@[email protected]

* igt@kms_cursor_legacy@cursora-vs-flipb-atomic-transitions-varying-size:
- shard-iclb: NOTRUN -> [SKIP][78] ([fdo#109274] / [fdo#109278]) +1 similar issue
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb5/igt@kms_cursor_legacy@cursora-vs-flipb-atomic-transitions-varying-size.html

* igt@kms_flip@2x-flip-vs-modeset-vs-hang:
- shard-iclb: NOTRUN -> [SKIP][79] ([fdo#109274]) +5 similar issues
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb8/igt@[email protected]

* igt@kms_flip@2x-flip-vs-rmfb:
- shard-tglb: NOTRUN -> [SKIP][80] ([fdo#111825]) +24 similar issues
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb3/igt@[email protected]

* igt@kms_flip@flip-vs-absolute-wf_vblank@a-edp1:
- shard-tglb: NOTRUN -> [FAIL][81] ([i915#2122])
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb5/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@a-edp1:
- shard-tglb: [PASS][82] -> [FAIL][83] ([i915#2598])
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-tglb7/igt@kms_flip@[email protected]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb5/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs:
- shard-kbl: NOTRUN -> [FAIL][84] ([i915#2641])
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl2/igt@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-64bpp-ytile:
- shard-apl: NOTRUN -> [SKIP][85] ([fdo#109271] / [i915#2642]) +1 similar issue
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl1/igt@[email protected]
- shard-glk: NOTRUN -> [SKIP][86] ([fdo#109271] / [i915#2642])
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk9/igt@[email protected]
- shard-kbl: NOTRUN -> [SKIP][87] ([fdo#109271] / [i915#2642])
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl6/igt@[email protected]

* igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-16bpp-ytile:
- shard-apl: NOTRUN -> [FAIL][88] ([i915#2641])
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl2/igt@[email protected]

* igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytilercccs:
- shard-apl: NOTRUN -> [SKIP][89] ([fdo#109271] / [i915#2672])
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-onoff:
- shard-apl: [PASS][90] -> [FAIL][91] ([i915#49])
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-apl8/igt@[email protected]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl3/igt@[email protected]
- shard-kbl: [PASS][92] -> [FAIL][93] ([i915#49])
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-kbl1/igt@[email protected]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-pwrite:
- shard-hsw: NOTRUN -> [SKIP][94] ([fdo#109271]) +58 similar issues
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-hsw2/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-pwrite.html

* igt@kms_frontbuffer_tracking@fbcpsr-2p-shrfb-fliptrack:
- shard-iclb: NOTRUN -> [SKIP][95] ([fdo#109280]) +10 similar issues
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb6/igt@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- shard-tglb: NOTRUN -> [SKIP][96] ([i915#433])
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb5/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-pipe-d-frame-sequence:
- shard-apl: NOTRUN -> [SKIP][97] ([fdo#109271] / [i915#533]) +3 similar issues
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl7/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-tglb: [PASS][98] -> [DMESG-WARN][99] ([i915#1436] / [i915#1602] / [i915#1887] / [i915#2411])
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-tglb2/igt@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-apl: NOTRUN -> [FAIL][100] ([fdo#108145] / [i915#265])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl1/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-transparent-fb:
- shard-apl: NOTRUN -> [FAIL][101] ([i915#265])
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl7/igt@[email protected]

* igt@kms_plane_multiple@atomic-pipe-b-tiling-yf:
- shard-tglb: NOTRUN -> [SKIP][102] ([fdo#111615])
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb2/igt@[email protected]

* igt@kms_plane_multiple@atomic-pipe-d-tiling-none:
- shard-hsw: NOTRUN -> [SKIP][103] ([fdo#109271] / [i915#533]) +6 similar issues
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-hsw1/igt@[email protected]

* igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping:
- shard-apl: NOTRUN -> [SKIP][104] ([fdo#109271] / [i915#2733])
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl6/igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping.html
- shard-kbl: NOTRUN -> [SKIP][105] ([fdo#109271] / [i915#2733])
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl4/igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping.html
- shard-glk: NOTRUN -> [SKIP][106] ([fdo#109271] / [i915#2733])
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk1/igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping.html

* igt@kms_prime@basic-crc@first-to-second:
- shard-tglb: NOTRUN -> [SKIP][107] ([i915#1836])
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb1/igt@kms_prime@[email protected]

* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-3:
- shard-apl: NOTRUN -> [SKIP][108] ([fdo#109271] / [i915#658]) +6 similar issues
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl6/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area-0:
- shard-iclb: NOTRUN -> [SKIP][109] ([i915#658])
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb7/igt@[email protected]
- shard-glk: NOTRUN -> [SKIP][110] ([fdo#109271] / [i915#658])
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk3/igt@[email protected]
- shard-kbl: NOTRUN -> [SKIP][111] ([fdo#109271] / [i915#658])
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl2/igt@[email protected]

* igt@kms_psr2_su@page_flip:
- shard-iclb: [PASS][112] -> [SKIP][113] ([fdo#109642] / [fdo#111068] / [i915#658])
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-iclb2/igt@kms_psr2_su@page_flip.html
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb4/igt@kms_psr2_su@page_flip.html

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: [PASS][114] -> [SKIP][115] ([fdo#109441]) +2 similar issues
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-iclb2/igt@kms_psr@psr2_cursor_render.html
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb6/igt@kms_psr@psr2_cursor_render.html

* igt@kms_psr@suspend:
- shard-hsw: NOTRUN -> [SKIP][116] ([fdo#109271] / [i915#1072]) +1 similar issue
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-hsw7/igt@[email protected]

* igt@kms_vrr@flip-basic:
- shard-tglb: NOTRUN -> [SKIP][117] ([fdo#109502])
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb8/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][118] ([fdo#109502])
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb6/igt@[email protected]

* igt@nouveau_crc@pipe-b-ctx-flip-skip-current-frame:
- shard-apl: NOTRUN -> [SKIP][119] ([fdo#109271]) +241 similar issues
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl2/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][120] ([i915#2530])
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb6/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][121] ([i915#2530])
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb1/igt@[email protected]

* igt@perf@polling-parameterized:
- shard-tglb: [PASS][122] -> [FAIL][123] ([i915#1542])
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-tglb7/igt@[email protected]
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb3/igt@[email protected]

* igt@prime_nv_api@i915_nv_double_import:
- shard-tglb: NOTRUN -> [SKIP][124] ([fdo#109291]) +2 similar issues
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb7/igt@prime_nv_api@i915_nv_double_import.html

* igt@prime_nv_pcopy@test2:
- shard-iclb: NOTRUN -> [SKIP][125] ([fdo#109291]) +2 similar issues
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-iclb8/igt@[email protected]

* igt@sysfs_clients@busy@vecs0:
- shard-kbl: [PASS][126] -> [FAIL][127] ([i915#3009])
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-kbl4/igt@sysfs_clients@[email protected]
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl2/igt@sysfs_clients@[email protected]

* igt@sysfs_clients@sema-10@rcs0:
- shard-glk: NOTRUN -> [SKIP][128] ([fdo#109271] / [i915#3026]) +1 similar issue
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk7/igt@sysfs_clients@[email protected]

* igt@sysfs_clients@sema-10@vcs0:
- shard-kbl: NOTRUN -> [SKIP][129] ([fdo#109271] / [i915#3026]) +2 similar issues
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl7/igt@sysfs_clients@[email protected]

* igt@sysfs_clients@sema-10@vecs0:
- shard-apl: NOTRUN -> [SKIP][130] ([fdo#109271] / [i915#3026])
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-apl7/igt@sysfs_clients@[email protected]

#### Possible fixes ####

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [FAIL][131] ([i915#2842]) -> [PASS][132]
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-glk2/igt@gem_exec_fair@[email protected]
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-glk2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vecs0:
- shard-kbl: [FAIL][133] ([i915#2842]) -> [PASS][134]
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-kbl7/igt@gem_exec_fair@[email protected]
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-kbl6/igt@gem_exec_fair@[email protected]
- shard-tglb: [FAIL][135] ([i915#2842]) -> [PASS][136]
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9825/shard-tglb7/igt@gem_exec_fair@[email protected]
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/shard-tglb1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_whisper@basic-queues-forked-all:
- shard-glk: [DMESG-WARN][137] ([i915#118] / [i915#95]) -> [PASS][138] +4 similar issues
[137]: https://intel-gfx-ci.01.org/t

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5570/index.html

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Reviewed-by on v1 1/1
#3 lore raw
In reply to Umesh Nerlige Ramappa
Quoted 16 lines · Umesh Nerlige Ramappa

Add tests to query CS timestamps for different engines.

v2:
- remove flag parameter
- assert for minimum usable values rather than maximum

v3:
- use clock id for cpu timestamps (Lionel)
- check if query is supported (Ashutosh)
- test bad queries

v4: (Chris, Tvrtko)
- cs_timestamp is a misnomer, use cs_cycles instead
- use cs cycle frequency returned in the query
- omit size parameter

Quoted 7 lines

v5:
- use __for_each_physical_engine (Lionel)
- check for ENODEV (Umesh)

v6: Use 2 cpu timestamps to calculate reg read time (Lionel)

Looks good:

Thanks!

Quoted 269 lines
---
  include/drm-uapi/i915_drm.h |  47 +++++++++
  tests/i915/i915_query.c     | 191 ++++++++++++++++++++++++++++++++++++
  2 files changed, 238 insertions(+)
include/drm-uapi/i915_drm.h +47 -0
index bf9ea471..e95e17f9 100644
@@ -2176,6 +2176,10 @@ struct drm_i915_query_item {
  #define DRM_I915_QUERY_TOPOLOGY_INFO    1
  #define DRM_I915_QUERY_ENGINE_INFO	2
  #define DRM_I915_QUERY_PERF_CONFIG      3
+	/**
+	 * Query Command Streamer timestamp register.
+	 */
+#define DRM_I915_QUERY_CS_CYCLES	4
  /* Must be kept compact -- no holes and well documented */
 
  	/*
@@ -2309,6 +2313,49 @@ struct drm_i915_engine_info {
  	__u64 rsvd1[4];
  };
 
+/**
+ * struct drm_i915_query_cs_cycles
+ *
+ * The query returns the command streamer cycles and the frequency that can be
+ * used to calculate the command streamer timestamp. In addition the query
+ * returns the cpu timestamp that indicates when the command streamer cycle
+ * count was captured.
+ */
+struct drm_i915_query_cs_cycles {
+	/** Engine for which command streamer cycles is queried. */
+	struct i915_engine_class_instance engine;
+
+	/** Must be zero. */
+	__u32 flags;
+
+	/**
+	 * Command streamer cycles as read from the command streamer
+	 * register at 0x358 offset.
+	 */
+	__u64 cs_cycles;
+
+	/** Frequency of the cs cycles in Hz. */
+	__u64 cs_frequency;
+
+	/**
+	 * CPU timestamp in nanoseconds. cpu_timestamp[0] is captured before
+	 * reading the cs_cycles register and cpu_timestamp[1] is captured after
+	 * reading the register.
+	 **/
+	__u64 cpu_timestamp[2];
+
+	/**
+	 * Reference clock id for CPU timestamp. For definition, see
+	 * clock_gettime(2) and perf_event_open(2). Supported clock ids are
+	 * CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME, CLOCK_BOOTTIME,
+	 * CLOCK_TAI.
+	 */
+	__s32 clockid;
+
+	/** Must be zero. */
+	__u32 rsvd;
+};
+
  /**
   * struct drm_i915_query_engine_info
   *
tests/i915/i915_query.c +184 -0
index 29b938e9..e1c5f93d 100644
@@ -267,6 +267,184 @@ eu_available(const struct drm_i915_query_topology_info *topo_info,
  				eu / 8] >> (eu % 8)) & 1;
  }
 
+static bool query_cs_cycles_supported(int fd)
+{
+	struct drm_i915_query_item item = {
+		.query_id = DRM_I915_QUERY_CS_CYCLES,
+	};
+
+	return __i915_query_items(fd, &item, 1) == 0 && item.length > 0;
+}
+
+static void __query_cs_cycles(int i915, void *data, int err)
+{
+	struct drm_i915_query_item item = {
+		.query_id = DRM_I915_QUERY_CS_CYCLES,
+		.data_ptr = to_user_pointer(data),
+		.length = sizeof(struct drm_i915_query_cs_cycles),
+	};
+
+	i915_query_items(i915, &item, 1);
+
+	if (err)
+		igt_assert(item.length == -err);
+}
+
+static bool engine_has_cs_cycles(int i915, uint16_t class, uint16_t instance)
+{
+	struct drm_i915_query_cs_cycles ts = {};
+	struct drm_i915_query_item item = {
+		.query_id = DRM_I915_QUERY_CS_CYCLES,
+		.data_ptr = to_user_pointer(&ts),
+		.length = sizeof(struct drm_i915_query_cs_cycles),
+	};
+
+	ts.engine.engine_class = class;
+	ts.engine.engine_instance = instance;
+
+	i915_query_items(i915, &item, 1);
+
+	return item.length != -ENODEV;
+}
+
+static void
+__cs_cycles(int i915, struct i915_engine_class_instance *engine)
+{
+	struct drm_i915_query_cs_cycles ts1 = {};
+	struct drm_i915_query_cs_cycles ts2 = {};
+	uint64_t delta_cpu, delta_cs, delta_delta;
+	int i, usable = 0;
+	struct {
+		int32_t id;
+		const char *name;
+	} clock[] = {
+		{ CLOCK_MONOTONIC, "CLOCK_MONOTONIC" },
+		{ CLOCK_MONOTONIC_RAW, "CLOCK_MONOTONIC_RAW" },
+		{ CLOCK_REALTIME, "CLOCK_REALTIME" },
+		{ CLOCK_BOOTTIME, "CLOCK_BOOTTIME" },
+		{ CLOCK_TAI, "CLOCK_TAI" },
+	};
+
+	igt_debug("engine[%u:%u]\n",
+		  engine->engine_class,
+		  engine->engine_instance);
+
+	/* Try a new clock every 10 iterations. */
+#define NUM_SNAPSHOTS 10
+	for (i = 0; i < NUM_SNAPSHOTS * ARRAY_SIZE(clock); i++) {
+		int index = i / NUM_SNAPSHOTS;
+
+		ts1.engine = *engine;
+		ts1.clockid = clock[index].id;
+
+		ts2.engine = *engine;
+		ts2.clockid = clock[index].id;
+
+		__query_cs_cycles(i915, &ts1, 0);
+		__query_cs_cycles(i915, &ts2, 0);
+
+		igt_debug("[1] cpu_ts before %llu, cpu_ts after %llu, reg read time %llu\n",
+			  ts1.cpu_timestamp[0],
+			  ts1.cpu_timestamp[1],
+			  ts1.cpu_timestamp[1] - ts1.cpu_timestamp[0]);
+		igt_debug("[1] cs_ts %llu, freq %llu Hz\n",
+			  ts1.cs_cycles, ts1.cs_frequency);
+
+		igt_debug("[2] cpu_ts before %llu, cpu_ts after %llu, reg read time %llu\n",
+			  ts2.cpu_timestamp[0],
+			  ts2.cpu_timestamp[1],
+			  ts2.cpu_timestamp[1] - ts2.cpu_timestamp[0]);
+		igt_debug("[2] cs_ts %llu, freq %llu Hz\n",
+			  ts2.cs_cycles, ts2.cs_frequency);
+
+		delta_cpu = ts2.cpu_timestamp[0] - ts1.cpu_timestamp[0];
+		delta_cs = (ts2.cs_cycles - ts1.cs_cycles) *
+			   NSEC_PER_SEC / ts1.cs_frequency;
+
+		igt_debug("delta_cpu[%lu], delta_cs[%lu]\n",
+			  delta_cpu, delta_cs);
+
+		delta_delta = delta_cpu > delta_cs ?
+			       delta_cpu - delta_cs :
+			       delta_cs - delta_cpu;
+		igt_debug("delta_delta %lu\n", delta_delta);
+
+		if (delta_delta < 5000)
+			usable++;
+
+		/*
+		 * User needs few good snapshots of the timestamps to
+		 * synchronize cpu time with cs time. Check if we have enough
+		 * usable values before moving to the next clockid.
+		 */
+		if (!((i + 1) % NUM_SNAPSHOTS)) {
+			igt_debug("clock %s\n", clock[index].name);
+			igt_debug("usable %d\n", usable);
+			igt_assert(usable > 2);
+			usable = 0;
+		}
+	}
+}
+
+static void test_cs_cycles(int i915)
+{
+	const struct intel_execution_engine2 *e;
+	struct i915_engine_class_instance engine;
+
+	__for_each_physical_engine(i915, e) {
+		if (engine_has_cs_cycles(i915, e->class, e->instance)) {
+			engine.engine_class = e->class;
+			engine.engine_instance = e->instance;
+			__cs_cycles(i915, &engine);
+		}
+	}
+}
+
+static void test_cs_cycles_invalid(int i915)
+{
+	struct i915_engine_class_instance engine;
+	const struct intel_execution_engine2 *e;
+	struct drm_i915_query_cs_cycles ts = {};
+
+	/* get one engine */
+	__for_each_physical_engine(i915, e)
+		break;
+
+	/* bad engines */
+	ts.engine.engine_class = e->class;
+	ts.engine.engine_instance = -1;
+	__query_cs_cycles(i915, &ts, EINVAL);
+
+	ts.engine.engine_class = -1;
+	ts.engine.engine_instance = e->instance;
+	__query_cs_cycles(i915, &ts, EINVAL);
+
+	ts.engine.engine_class = -1;
+	ts.engine.engine_instance = -1;
+	__query_cs_cycles(i915, &ts, EINVAL);
+
+	/* non zero flags */
+	ts.flags = 1;
+	ts.engine.engine_class = e->class;
+	ts.engine.engine_instance = e->instance;
+	__query_cs_cycles(i915, &ts, EINVAL);
+
+	/* non zero rsvd field */
+	ts.flags = 0;
+	ts.rsvd = 1;
+	__query_cs_cycles(i915, &ts, EINVAL);
+
+	/* bad clockid */
+	ts.rsvd = 0;
+	ts.clockid = -1;
+	__query_cs_cycles(i915, &ts, EINVAL);
+
+	/* sanity check */
+	engine.engine_class = e->class;
+	engine.engine_instance = e->instance;
+	__cs_cycles(i915, &engine);
+}
+
  /*
   * Verify that we get coherent values between the legacy getparam slice/subslice
   * masks and the new topology query.
@@ -783,6 +961,19 @@ igt_main
  			engines(fd);
  	}
 
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(intel_gen(devid) >= 6);
+			igt_require(query_cs_cycles_supported(fd));
+		}
+

tests/i915/i915_query.c igt_main · line 979

Quoted 10 lines
tests/i915/i915_query.c +7 -0
+		igt_subtest("cs-cycles")
+			test_cs_cycles(fd);
+
+		igt_subtest("cs-cycles-invalid")
+			test_cs_cycles_invalid(fd);
+	}
+
  	igt_fixture {
  		close(fd);
  	}

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev