Skip to content

Commit 1086af6

Browse files
committed
drm/i915/selftests: Run the perf MI_BB tests on gen4/5
Now that we know the ring timestamp frequency on gen4/5 we can run the perf tests that depend on sampling the timestamp. On g4x/ilk we must read the udw of the 64bit timestamp register. Details in {g4x,gen5)_read_clock_frequency(). When executing the read via the CS i965 doesn't seem to need the double read trick that CPU mmio reads need. Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Lionel Landwerlin <[email protected]>
1 parent 38530a3 commit 1086af6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/gpu/drm/i915/gt/selftest_engine_cs.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ static int perf_end(struct intel_gt *gt)
3939
return igt_flush_test(gt->i915);
4040
}
4141

42+
static i915_reg_t timestamp_reg(struct intel_engine_cs *engine)
43+
{
44+
struct drm_i915_private *i915 = engine->i915;
45+
46+
if (GRAPHICS_VER(i915) == 5 || IS_G4X(i915))
47+
return RING_TIMESTAMP_UDW(engine->mmio_base);
48+
else
49+
return RING_TIMESTAMP(engine->mmio_base);
50+
}
51+
4252
static int write_timestamp(struct i915_request *rq, int slot)
4353
{
4454
struct intel_timeline *tl =
@@ -55,7 +65,7 @@ static int write_timestamp(struct i915_request *rq, int slot)
5565
if (GRAPHICS_VER(rq->engine->i915) >= 8)
5666
cmd++;
5767
*cs++ = cmd;
58-
*cs++ = i915_mmio_reg_offset(RING_TIMESTAMP(rq->engine->mmio_base));
68+
*cs++ = i915_mmio_reg_offset(timestamp_reg(rq->engine));
5969
*cs++ = tl->hwsp_offset + slot * sizeof(u32);
6070
*cs++ = 0;
6171

@@ -125,7 +135,7 @@ static int perf_mi_bb_start(void *arg)
125135
enum intel_engine_id id;
126136
int err = 0;
127137

128-
if (GRAPHICS_VER(gt->i915) < 6) /* for per-engine CS_TIMESTAMP */
138+
if (GRAPHICS_VER(gt->i915) < 4) /* Any CS_TIMESTAMP? */
129139
return 0;
130140

131141
perf_begin(gt);
@@ -252,7 +262,7 @@ static int perf_mi_noop(void *arg)
252262
enum intel_engine_id id;
253263
int err = 0;
254264

255-
if (GRAPHICS_VER(gt->i915) < 6) /* for per-engine CS_TIMESTAMP */
265+
if (GRAPHICS_VER(gt->i915) < 4) /* Any CS_TIMESTAMP? */
256266
return 0;
257267

258268
perf_begin(gt);

0 commit comments

Comments
 (0)