drm/i915/fbc: Register per-crtc debugfs files
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 13 Dec 2021 15:14:35 +0000 (17:14 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 15 Dec 2021 15:02:40 +0000 (17:02 +0200)
Expose FBC debugfs files for each crtc. These may or may not point
to the same FBC instance depending on the platform.

We leave the old global debugfs files in place until
igt catches up to the new per-crtc approach.

v2: Take a trip via intel_crtc_debugfs_add() (Jani)

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211213151435.9700-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_display_debugfs.c
drivers/gpu/drm/i915/display/intel_fbc.c
drivers/gpu/drm/i915/display/intel_fbc.h

index 572445299b04c07bba8ddc4831e376c42ad1cf14..f4de004d470f09f82a97e3634ecac475e82c1a2b 100644 (file)
@@ -2402,6 +2402,9 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector)
  */
 void intel_crtc_debugfs_add(struct drm_crtc *crtc)
 {
-       if (crtc->debugfs_entry)
-               crtc_updates_add(crtc);
+       if (!crtc->debugfs_entry)
+               return;
+
+       crtc_updates_add(crtc);
+       intel_fbc_crtc_debugfs_add(to_intel_crtc(crtc));
 }
index 796453e1c10176cbe1213dca1320880d29800eaa..8b9acedcdfc1b34f3fdb761922a850f4e706f830 100644 (file)
@@ -1798,25 +1798,32 @@ DEFINE_SIMPLE_ATTRIBUTE(intel_fbc_debugfs_false_color_fops,
                        intel_fbc_debugfs_false_color_set,
                        "%llu\n");
 
-static void intel_fbc_debugfs_add(struct intel_fbc *fbc)
+static void intel_fbc_debugfs_add(struct intel_fbc *fbc,
+                                 struct dentry *parent)
 {
-       struct drm_i915_private *i915 = fbc->i915;
-       struct drm_minor *minor = i915->drm.primary;
-
-       debugfs_create_file("i915_fbc_status", 0444,
-                           minor->debugfs_root, fbc,
-                           &intel_fbc_debugfs_status_fops);
+       debugfs_create_file("i915_fbc_status", 0444, parent,
+                           fbc, &intel_fbc_debugfs_status_fops);
 
        if (fbc->funcs->set_false_color)
-               debugfs_create_file("i915_fbc_false_color", 0644,
-                                   minor->debugfs_root, fbc,
-                                   &intel_fbc_debugfs_false_color_fops);
+               debugfs_create_file("i915_fbc_false_color", 0644, parent,
+                                   fbc, &intel_fbc_debugfs_false_color_fops);
 }
 
+void intel_fbc_crtc_debugfs_add(struct intel_crtc *crtc)
+{
+       struct intel_plane *plane = to_intel_plane(crtc->base.primary);
+
+       if (plane->fbc)
+               intel_fbc_debugfs_add(plane->fbc, crtc->base.debugfs_entry);
+}
+
+/* FIXME: remove this once igt is on board with per-crtc stuff */
 void intel_fbc_debugfs_register(struct drm_i915_private *i915)
 {
-       struct intel_fbc *fbc = i915->fbc[INTEL_FBC_A];
+       struct drm_minor *minor = i915->drm.primary;
+       struct intel_fbc *fbc;
 
+       fbc = i915->fbc[INTEL_FBC_A];
        if (fbc)
-               intel_fbc_debugfs_add(fbc);
+               intel_fbc_debugfs_add(fbc, minor->debugfs_root);
 }
index 7b7631aec52701050760f0726cca6d11f94dc763..8c5a7339a27f8b87dcf4bd87d36f91e95d00ad07 100644 (file)
@@ -42,6 +42,7 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv,
 void intel_fbc_add_plane(struct intel_fbc *fbc, struct intel_plane *plane);
 void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *i915);
 void intel_fbc_reset_underrun(struct drm_i915_private *i915);
+void intel_fbc_crtc_debugfs_add(struct intel_crtc *crtc);
 void intel_fbc_debugfs_register(struct drm_i915_private *i915);
 
 #endif /* __INTEL_FBC_H__ */