drm/i915/debugfs: Print PSR selective update status register values
authorJosé Roberto de Souza <jose.souza@intel.com>
Thu, 17 Jan 2019 20:55:48 +0000 (12:55 -0800)
committerJosé Roberto de Souza <jose.souza@intel.com>
Wed, 23 Jan 2019 00:33:13 +0000 (16:33 -0800)
The value of this registers will be used to test if PSR2 is doing
selective update and if the number of blocks match with the expected.

v2:
- Using new macros
- Changed the string output

v3:
- reading PSR2_SU_STATUS registers together(Dhinakaran)
- printing SU blocks of frames with 0 updates(Dhinakaran)

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190117205548.28378-4-jose.souza@intel.com
drivers/gpu/drm/i915/i915_debugfs.c

index fb59874fed99b0f112b70af48088864dac8dfb0d..9a9e1da496dc8624aed4a17292d3eb2e1def56e7 100644 (file)
@@ -2608,6 +2608,29 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
                seq_printf(m, "Last exit at: %lld\n", psr->last_exit);
        }
 
+       if (psr->psr2_enabled) {
+               u32 su_frames_val[3];
+               int frame;
+
+               /*
+                * Reading all 3 registers before hand to minimize crossing a
+                * frame boundary between register reads
+                */
+               for (frame = 0; frame < PSR2_SU_STATUS_FRAMES; frame += 3)
+                       su_frames_val[frame / 3] = I915_READ(PSR2_SU_STATUS(frame));
+
+               seq_puts(m, "Frame:\tPSR2 SU blocks:\n");
+
+               for (frame = 0; frame < PSR2_SU_STATUS_FRAMES; frame++) {
+                       u32 su_blocks;
+
+                       su_blocks = su_frames_val[frame / 3] &
+                                   PSR2_SU_STATUS_MASK(frame);
+                       su_blocks = su_blocks >> PSR2_SU_STATUS_SHIFT(frame);
+                       seq_printf(m, "%d\t%d\n", frame, su_blocks);
+               }
+       }
+
 unlock:
        mutex_unlock(&psr->lock);
        intel_runtime_pm_put(dev_priv, wakeref);