[Intel-gfx] [PATCH 2/7] drm/i915: Extract plane dumping from intel_dump_pipe_config()

Matt Roper matthew.d.roper at intel.com
Thu Dec 3 11:37:37 PST 2015


The plane information isn't important in most of the places where we
dump the pipe config; the one place where it would be valuable is during
initial HW state readout, but currently we dump the pipe config before
FB's are reconstructed, so the data dumped is misleading anyway.  Even
worse, in places where we're dumping an in-flight pipe config, we're
still dumping the already-committed plane state, which is
confusing/misleading.

Extract the plane dumping to its own function that can be called in the
specific place(s) where we actually want to see this information.

A few other changes are made while extracting this dumping logic:
 * show planes that have an FB, but are invisible (e.g., because
   they're offscreen or hidden by other planes) as "not visible" rather
   than "enabled."
 * display the FB format as a human-readable string rather than a hex
   format code
 * List the actual plane type ("Primary," "Overlay," or "Cursor") rather
   than just "STANDARD" or "CURSOR."

Suggested-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 drivers/gpu/drm/drm_crtc.c           |  3 ++
 drivers/gpu/drm/i915/intel_display.c | 75 +++++++++++++++++++-----------------
 include/drm/drm_crtc.h               |  1 +
 3 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 32dd134..dfade9f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -78,6 +78,9 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] = {
 	{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
 };
 
+DRM_ENUM_NAME_FN(drm_get_plane_type, drm_plane_type_enum_list)
+EXPORT_SYMBOL(drm_get_plane_type);
+
 /*
  * Optional properties
  */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e5c0807..84ff881 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12053,10 +12053,6 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
 				   const char *context)
 {
 	struct drm_device *dev = crtc->base.dev;
-	struct drm_plane *plane;
-	struct intel_plane *intel_plane;
-	struct intel_plane_state *state;
-	struct drm_framebuffer *fb;
 
 	DRM_DEBUG_KMS("[CRTC:%d]%s config %p for pipe %c\n", crtc->base.base.id,
 		      context, pipe_config, pipe_name(crtc->pipe));
@@ -12149,40 +12145,41 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
 			      pipe_config->dpll_hw_state.fp0,
 			      pipe_config->dpll_hw_state.fp1);
 	}
+}
 
-	DRM_DEBUG_KMS("planes on this crtc\n");
-	list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
-		intel_plane = to_intel_plane(plane);
-		if (intel_plane->pipe != crtc->pipe)
-			continue;
-
-		state = to_intel_plane_state(plane->state);
-		fb = state->base.fb;
-		if (!fb) {
-			DRM_DEBUG_KMS("%s PLANE:%d plane: %u.%u idx: %d "
-				"disabled, scaler_id = %d\n",
-				plane->type == DRM_PLANE_TYPE_CURSOR ? "CURSOR" : "STANDARD",
-				plane->base.id, intel_plane->pipe,
-				(crtc->base.primary == plane) ? 0 : intel_plane->plane + 1,
-				drm_plane_index(plane), state->scaler_id);
-			continue;
-		}
-
-		DRM_DEBUG_KMS("%s PLANE:%d plane: %u.%u idx: %d enabled",
-			plane->type == DRM_PLANE_TYPE_CURSOR ? "CURSOR" : "STANDARD",
-			plane->base.id, intel_plane->pipe,
-			crtc->base.primary == plane ? 0 : intel_plane->plane + 1,
-			drm_plane_index(plane));
-		DRM_DEBUG_KMS("\tFB:%d, fb = %ux%u format = 0x%x",
-			fb->base.id, fb->width, fb->height, fb->pixel_format);
-		DRM_DEBUG_KMS("\tscaler:%d src (%u, %u) %ux%u dst (%u, %u) %ux%u\n",
-			state->scaler_id,
-			state->src.x1 >> 16, state->src.y1 >> 16,
-			drm_rect_width(&state->src) >> 16,
-			drm_rect_height(&state->src) >> 16,
-			state->dst.x1, state->dst.y1,
-			drm_rect_width(&state->dst), drm_rect_height(&state->dst));
+static void intel_dump_plane_config(struct drm_plane_state *pstate)
+{
+	struct drm_plane *plane = pstate->plane;
+	struct intel_plane *intel_plane = to_intel_plane(plane);
+	struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
+	const char *type = drm_get_plane_type(plane->type);
+	struct drm_framebuffer *fb = pstate->fb;
+	int idx = (plane->type == DRM_PLANE_TYPE_OVERLAY) ?
+		intel_plane->plane + 1 : 0;
+
+	if (!fb) {
+		DRM_DEBUG_KMS("%s PLANE:%d plane: %u.%u idx: %d "
+			"disabled, scaler_id = %d\n",
+			type, plane->base.id, intel_plane->pipe, idx,
+			drm_plane_index(plane), intel_pstate->scaler_id);
+		return;
 	}
+
+	DRM_DEBUG_KMS("%s PLANE:%d plane: %u.%u idx: %d %s",
+		type, plane->base.id, intel_plane->pipe, idx,
+		drm_plane_index(plane),
+		intel_pstate->visible ? "enabled" : "not visible");
+	DRM_DEBUG_KMS("\tFB:%d, fb = %ux%u format = %s",
+		fb->base.id, fb->width, fb->height,
+		drm_get_format_name(fb->pixel_format));
+	DRM_DEBUG_KMS("\tscaler:%d src (%u, %u) %ux%u dst (%u, %u) %ux%u\n",
+		intel_pstate->scaler_id,
+		intel_pstate->src.x1 >> 16, intel_pstate->src.y1 >> 16,
+		drm_rect_width(&intel_pstate->src) >> 16,
+		drm_rect_height(&intel_pstate->src) >> 16,
+		intel_pstate->dst.x1, intel_pstate->dst.y1,
+		drm_rect_width(&intel_pstate->dst),
+		drm_rect_height(&intel_pstate->dst));
 }
 
 static bool check_digital_port_conflicts(struct drm_atomic_state *state)
@@ -15189,6 +15186,7 @@ void intel_modeset_init(struct drm_device *dev)
 	drm_modeset_unlock_all(dev);
 
 	for_each_intel_crtc(dev, crtc) {
+		struct intel_plane *plane;
 		struct intel_initial_plane_config plane_config = {};
 
 		if (!crtc->active)
@@ -15209,6 +15207,11 @@ void intel_modeset_init(struct drm_device *dev)
 		 * just get the first one.
 		 */
 		intel_find_initial_plane_obj(crtc, &plane_config);
+
+		DRM_DEBUG_KMS("Reconstructed BIOS framebuffer for pipe %c\n",
+			      pipe_name(crtc->pipe));
+		for_each_intel_plane_on_crtc(dev, crtc, plane)
+			intel_dump_plane_config(plane->base.state);
 	}
 }
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 4765df3..ccf287d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1286,6 +1286,7 @@ extern void drm_encoder_cleanup(struct drm_encoder *encoder);
 extern const char *drm_get_connector_status_name(enum drm_connector_status status);
 extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
 extern const char *drm_get_dpms_name(int val);
+extern const char *drm_get_plane_type(int val);
 extern const char *drm_get_dvi_i_subconnector_name(int val);
 extern const char *drm_get_dvi_i_select_name(int val);
 extern const char *drm_get_tv_subconnector_name(int val);
-- 
2.1.4



More information about the Intel-gfx mailing list