[PATCH i-g-t v2 5/7] tests/intel/xe_query: Look up GT reference clock correctly
Matt Roper
matthew.d.roper at intel.com
Wed Jul 2 19:33:00 UTC 2025
The open-coded GT loop should be replaced by a direct GT ID lookup to
obtain the reference clock in order to ensure this continues to work on
future platforms where GT ID != index in the GT query list.
Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
tests/intel/xe_query.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/tests/intel/xe_query.c b/tests/intel/xe_query.c
index 9c7bf1d6f..96352da2c 100644
--- a/tests/intel/xe_query.c
+++ b/tests/intel/xe_query.c
@@ -675,18 +675,13 @@ query_engine_cycles(int fd, struct drm_xe_query_engine_cycles *resp)
static uint32_t
__engine_reference_clock(int fd, int gt_id)
{
- uint32_t reference_clock = 0;
struct xe_device *xe_dev = xe_device_get(fd);
+ const struct drm_xe_gt *gt = drm_xe_get_gt(xe_dev, gt_id);
- for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++) {
- if (gt == gt_id) {
- reference_clock = xe_dev->gt_list->gt_list[gt].reference_clock;
- break;
- }
- }
- igt_assert(reference_clock);
+ igt_assert(gt);
+ igt_assert(gt->reference_clock);
- return reference_clock;
+ return gt->reference_clock;
}
static void
--
2.49.0
More information about the igt-dev
mailing list