]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/i915: Dump both the uapi and hw states for crtcs and planes
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 29 Nov 2019 18:54:33 +0000 (20:54 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 2 Dec 2019 16:38:40 +0000 (18:38 +0200)
Let's make the display info more useful by dumping both
the uapi and hw states for each crtc/plane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191129185434.25549-9-ville.syrjala@linux.intel.com
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
drivers/gpu/drm/i915/i915_debugfs.c

index 4dffbff1b8bd2604c395b7f5f30fe3a11eec372a..414da0a542d6c616e81f9e68c8a4d3ed34a82972 100644 (file)
@@ -2556,45 +2556,68 @@ static void plane_rotation(char *buf, size_t bufsize, unsigned int rotation)
                 rotation);
 }
 
-static void intel_plane_info(struct seq_file *m, struct intel_crtc *crtc)
+static void intel_plane_uapi_info(struct seq_file *m, struct intel_plane *plane)
 {
-       struct drm_i915_private *dev_priv = node_to_i915(m->private);
-       struct drm_device *dev = &dev_priv->drm;
-       struct intel_plane *plane;
+       const struct intel_plane_state *plane_state =
+               to_intel_plane_state(plane->base.state);
+       const struct drm_framebuffer *fb = plane_state->uapi.fb;
+       struct drm_format_name_buf format_name;
+       struct drm_rect src, dst;
+       char rot_str[48];
 
-       for_each_intel_plane_on_crtc(dev, crtc, plane) {
-               const struct intel_plane_state *plane_state =
-                       to_intel_plane_state(plane->base.state);
-               const struct drm_framebuffer *fb;
-               struct drm_format_name_buf format_name;
-               struct drm_rect src, dst;
-               char rot_str[48];
+       src = drm_plane_state_src(&plane_state->uapi);
+       dst = drm_plane_state_dest(&plane_state->uapi);
 
-               if (!plane_state) {
-                       seq_puts(m, "plane->state is NULL!\n");
-                       continue;
-               }
+       if (fb)
+               drm_get_format_name(fb->format->format, &format_name);
+
+       plane_rotation(rot_str, sizeof(rot_str),
+                      plane_state->uapi.rotation);
+
+       seq_printf(m, "\t\tuapi: fb=%d,%s,%dx%d, src=" DRM_RECT_FP_FMT ", dst=" DRM_RECT_FMT ", rotation=%s\n",
+                  fb ? fb->base.id : 0, fb ? format_name.str : "n/a",
+                  fb ? fb->width : 0, fb ? fb->height : 0,
+                  DRM_RECT_FP_ARG(&src),
+                  DRM_RECT_ARG(&dst),
+                  rot_str);
+}
+
+static void intel_plane_hw_info(struct seq_file *m, struct intel_plane *plane)
+{
+       const struct intel_plane_state *plane_state =
+               to_intel_plane_state(plane->base.state);
+       const struct drm_framebuffer *fb = plane_state->hw.fb;
+       struct drm_format_name_buf format_name;
+       char rot_str[48];
 
-               src = drm_plane_state_src(&plane_state->uapi);
-               dst = drm_plane_state_dest(&plane_state->uapi);
+       if (!fb)
+               return;
+
+       drm_get_format_name(fb->format->format, &format_name);
 
-               fb = plane_state->uapi.fb;
-               if (fb)
-                       drm_get_format_name(fb->format->format, &format_name);
+       plane_rotation(rot_str, sizeof(rot_str),
+                      plane_state->hw.rotation);
 
-               plane_rotation(rot_str, sizeof(rot_str),
-                              plane_state->uapi.rotation);
+       seq_printf(m, "\t\thw: fb=%d,%s,%dx%d, visible=%s, src=" DRM_RECT_FP_FMT ", dst=" DRM_RECT_FMT ", rotation=%s\n",
+                  fb ? fb->base.id : 0, fb ? format_name.str : "n/a",
+                  fb ? fb->width : 0, fb ? fb->height : 0,
+                  yesno(plane_state->uapi.visible),
+                  DRM_RECT_FP_ARG(&plane_state->uapi.src),
+                  DRM_RECT_ARG(&plane_state->uapi.dst),
+                  rot_str);
+}
 
-               seq_printf(m, "\t[PLANE:%d:%s]: type=%s, fb=%d,%s,%dx%d, src=" DRM_RECT_FP_FMT ", dst=" DRM_RECT_FMT ", rotation=%s\n",
+static void intel_plane_info(struct seq_file *m, struct intel_crtc *crtc)
+{
+       struct drm_i915_private *dev_priv = node_to_i915(m->private);
+       struct intel_plane *plane;
+
+       for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
+               seq_printf(m, "\t[PLANE:%d:%s]: type=%s\n",
                           plane->base.base.id, plane->base.name,
-                          plane_type(plane->base.type),
-                          fb ? fb->base.id : 0,
-                          fb ? format_name.str : "n/a",
-                          fb ? fb->width : 0,
-                          fb ? fb->height : 0,
-                          DRM_RECT_FP_ARG(&src),
-                          DRM_RECT_ARG(&dst),
-                          rot_str);
+                          plane_type(plane->base.type));
+               intel_plane_uapi_info(m, plane);
+               intel_plane_hw_info(m, plane);
        }
 }
 
@@ -2631,26 +2654,33 @@ static void intel_crtc_info(struct seq_file *m, struct intel_crtc *crtc)
        const struct intel_crtc_state *crtc_state =
                to_intel_crtc_state(crtc->base.state);
 
-       seq_printf(m, "[CRTC:%d:%s]: active=%s, (size=%dx%d), dither=%s, bpp=%d\n",
-                  crtc->base.base.id, crtc->base.name,
-                  yesno(crtc_state->hw.active),
-                  crtc_state->pipe_src_w, crtc_state->pipe_src_h,
-                  yesno(crtc_state->dither), crtc_state->pipe_bpp);
+       seq_printf(m, "[CRTC:%d:%s]:\n",
+                  crtc->base.base.id, crtc->base.name);
+
+       seq_printf(m, "\tuapi: enable=%s, active=%s, mode=" DRM_MODE_FMT "\n",
+                  yesno(crtc_state->uapi.enable),
+                  yesno(crtc_state->uapi.active),
+                  DRM_MODE_ARG(&crtc_state->uapi.mode));
 
-       if (crtc_state->hw.active) {
-               const struct drm_display_mode *mode =
-                       &crtc_state->hw.mode;
+       if (crtc_state->hw.enable) {
                struct intel_encoder *encoder;
 
-               seq_printf(m, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
+               seq_printf(m, "\thw: active=%s, adjusted_mode=" DRM_MODE_FMT "\n",
+                          yesno(crtc_state->hw.active),
+                          DRM_MODE_ARG(&crtc_state->hw.adjusted_mode));
+
+               seq_printf(m, "\tpipe src size=%dx%d, dither=%s, bpp=%d\n",
+                          crtc_state->pipe_src_w, crtc_state->pipe_src_h,
+                          yesno(crtc_state->dither), crtc_state->pipe_bpp);
 
                for_each_encoder_on_crtc(&dev_priv->drm, &crtc->base, encoder)
                        intel_encoder_info(m, crtc, encoder);
 
                intel_scaler_info(m, crtc);
-               intel_plane_info(m, crtc);
        }
 
+       intel_plane_info(m, crtc);
+
        seq_printf(m, "\tunderrun reporting: cpu=%s pch=%s\n",
                   yesno(!crtc->cpu_fifo_underrun_disabled),
                   yesno(!crtc->pch_fifo_underrun_disabled));