[Why]
It's useful to know the dithering state for IGT testing.

[How]
Expose the dithering state for the crtc via a debugfs file "dither".

Example usage: cat /sys/kernel/debug/dri/0/crtc-0/dither

Cc: Uma Shankar <uma.shan...@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.mo...@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 784219962193..7174fce05e6e 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1650,13 +1650,30 @@ static const struct i915_debugfs_files {
 #endif
 };
 
+static int dither_state_show(struct seq_file *m, void *data)
+{
+       struct intel_crtc *crtc = to_intel_crtc(m->private);
+       struct intel_crtc_state *crtc_state = 
to_intel_crtc_state(crtc->base.state);
+
+       seq_printf(m, "Dither: %u\n", crtc_state->dither);
+
+       return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(dither_state);
+
 void i915_debugfs_register(struct drm_i915_private *dev_priv)
 {
        struct drm_minor *minor = dev_priv->drm.primary;
+       struct drm_device *dev = &dev_priv->drm;
+       struct drm_crtc *crtc;
        int i;
 
        i915_debugfs_params(dev_priv);
 
+       drm_for_each_crtc(crtc, dev)
+               debugfs_create_file("dither", S_IRUGO, crtc->debugfs_entry, 
crtc,
+                               &dither_state_fops);
+
        debugfs_create_file("i915_forcewake_user", S_IRUSR, minor->debugfs_root,
                            to_i915(minor->dev), &i915_forcewake_fops);
        for (i = 0; i < ARRAY_SIZE(i915_debugfs_files); i++) {
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to