All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 11/12] drm/client: Streamline mode selection debugs
Date: Thu,  4 Apr 2024 23:33:35 +0300	[thread overview]
Message-ID: <20240404203336.10454-12-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240404203336.10454-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Get rid of all the redundant debugs and just wait until the end
to print which mode (and of which type) we picked.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_client_modeset.c | 65 +++++++++++++---------------
 1 file changed, 31 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 415d1799337b..ad88c11037d8 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -408,6 +408,8 @@ static bool drm_client_target_preferred(struct drm_device *dev,
 
 retry:
 	for (i = 0; i < connector_count; i++) {
+		const char *mode_type;
+
 		connector = connectors[i];
 
 		if (conn_configured & BIT_ULL(i))
@@ -440,20 +442,20 @@ static bool drm_client_target_preferred(struct drm_device *dev,
 			drm_client_get_tile_offsets(dev, connectors, connector_count, modes, offsets, i,
 						    connector->tile_h_loc, connector->tile_v_loc);
 		}
-		drm_dbg_kms(dev, "looking for cmdline mode on [CONNECTOR:%d:%s]\n",
-			    connector->base.id, connector->name);
 
-		/* got for command line mode first */
+		mode_type = "cmdline";
 		modes[i] = drm_connector_pick_cmdline_mode(connector);
+
 		if (!modes[i]) {
-			drm_dbg_kms(dev, "looking for preferred mode on [CONNECTOR:%d:%s] (tile group: %d)\n",
-				    connector->base.id, connector->name,
-				    connector->tile_group ? connector->tile_group->id : 0);
+			mode_type = "preferred";
 			modes[i] = drm_connector_preferred_mode(connector, width, height);
 		}
-		/* No preferred modes, pick one off the list */
-		if (!modes[i])
+
+		if (!modes[i]) {
+			mode_type = "first";
 			modes[i] = drm_connector_first_mode(connector);
+		}
+
 		/*
 		 * In case of tiled mode if all tiles not present fallback to
 		 * first available non tiled mode.
@@ -468,16 +470,20 @@ static bool drm_client_target_preferred(struct drm_device *dev,
 			    (connector->tile_h_loc == 0 &&
 			     connector->tile_v_loc == 0 &&
 			     !drm_connector_get_tiled_mode(connector))) {
-				drm_dbg_kms(dev, "Falling back to non tiled mode on [CONNECTOR:%d:%s]\n",
-					    connector->base.id, connector->name);
+				mode_type = "non tiled";
 				modes[i] = drm_connector_fallback_non_tiled_mode(connector);
 			} else {
+				mode_type = "tiled";
 				modes[i] = drm_connector_get_tiled_mode(connector);
 			}
 		}
 
-		drm_dbg_kms(dev, "found mode %s\n",
-			    modes[i] ? modes[i]->name : "none");
+		if (!modes[i])
+			mode_type = "no";
+
+		drm_dbg_kms(dev, "[CONNECTOR:%d:%s] found %s mode: %s\n",
+			    connector->base.id, connector->name,
+			    mode_type, modes[i] ? modes[i]->name : "none");
 		conn_configured |= BIT_ULL(i);
 	}
 
@@ -624,6 +630,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 		struct drm_connector *connector;
 		struct drm_encoder *encoder;
 		struct drm_crtc *new_crtc;
+		const char *mode_type;
 
 		connector = connectors[i];
 
@@ -673,29 +680,22 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 		 */
 		for (j = 0; j < count; j++) {
 			if (crtcs[j] == new_crtc) {
-				drm_dbg_kms(dev, "fallback: cloned configuration\n");
+				drm_dbg_kms(dev, "[CONNECTOR:%d:%s] fallback: cloned configuration\n",
+					    connector->base.id, connector->name);
 				goto bail;
 			}
 		}
 
-		drm_dbg_kms(dev, "looking for cmdline mode on [CONNECTOR:%d:%s]\n",
-			    connector->base.id, connector->name);
-
-		/* go for command line mode first */
+		mode_type = "cmdline";
 		modes[i] = drm_connector_pick_cmdline_mode(connector);
 
-		/* try for preferred next */
 		if (!modes[i]) {
-			drm_dbg_kms(dev, "looking for preferred mode on [CONNECTOR:%d:%s] (tiled? %s)\n",
-				    connector->base.id, connector->name,
-				    str_yes_no(connector->has_tile));
+			mode_type = "preferred";
 			modes[i] = drm_connector_preferred_mode(connector, width, height);
 		}
 
-		/* No preferred mode marked by the EDID? Are there any modes? */
-		if (!modes[i] && !list_empty(&connector->modes)) {
-			drm_dbg_kms(dev, "using first mode listed on [CONNECTOR:%d:%s]\n",
-				    connector->base.id, connector->name);
+		if (!modes[i]) {
+			mode_type = "first";
 			modes[i] = drm_connector_first_mode(connector);
 		}
 
@@ -706,28 +706,25 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 			 * is dodgy. Switch to crtc->state->mode, after taking
 			 * care of the resulting locking/lifetime issues.
 			 */
-			drm_dbg_kms(dev, "looking for current mode on [CONNECTOR:%d:%s]\n",
-				    connector->base.id, connector->name);
+			mode_type = "current";
 			modes[i] = &connector->state->crtc->mode;
 		}
+
 		/*
 		 * In case of tiled modes, if all tiles are not present
 		 * then fallback to a non tiled mode.
 		 */
 		if (connector->has_tile &&
 		    num_tiled_conns < connector->num_h_tile * connector->num_v_tile) {
-			drm_dbg_kms(dev, "Falling back to non tiled mode on [CONNECTOR:%d:%s]\n",
-				    connector->base.id, connector->name);
+			mode_type = "non tiled";
 			modes[i] = drm_connector_fallback_non_tiled_mode(connector);
 		}
 		crtcs[i] = new_crtc;
 
-		drm_dbg_kms(dev, "[CONNECTOR:%d:%s] on [CRTC:%d:%s]: %dx%d%s\n",
+		drm_dbg_kms(dev, "[CONNECTOR::%d:%s] on [CRTC:%d:%s] using %s mode: %s\n",
 			    connector->base.id, connector->name,
-			    connector->state->crtc->base.id,
-			    connector->state->crtc->name,
-			    modes[i]->hdisplay, modes[i]->vdisplay,
-			    modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
+			    new_crtc->base.id, new_crtc->name,
+			    mode_type, modes[i]->name);
 
 		fallback = false;
 		conn_configured |= BIT(i);
-- 
2.43.2


  parent reply	other threads:[~2024-04-04 20:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 20:33 [PATCH 00/12] drm/client: Use after free and debug improvements Ville Syrjala
2024-04-04 20:33 ` [PATCH 01/12] drm/client: Fully protect modes[] with dev->mode_config.mutex Ville Syrjala
2024-04-05  3:24   ` Dmitry Baryshkov
2024-04-05 19:17     ` Ville Syrjälä
2024-04-05 20:39       ` Dmitry Baryshkov
2024-04-05 20:57         ` Ville Syrjälä
2024-04-04 20:33 ` [PATCH 02/12] drm/client: s/drm_connector_has_preferred_mode/drm_connector_preferred_mode/ Ville Syrjala
2024-04-05  3:27   ` Dmitry Baryshkov
2024-04-04 20:33 ` [PATCH 03/12] drm/client: Use drm_mode_destroy() Ville Syrjala
2024-04-05  3:28   ` Dmitry Baryshkov
2024-04-04 20:33 ` [PATCH 04/12] drm/client: Add a FIXME around crtc->mode usage Ville Syrjala
2024-04-05  3:32   ` Dmitry Baryshkov
2024-04-05 19:40     ` Ville Syrjälä
2024-04-04 20:33 ` [PATCH 05/12] drm/client: Nuke outdated fastboot comment Ville Syrjala
2024-04-05  3:33   ` Dmitry Baryshkov
2024-04-04 20:33 ` [PATCH 06/12] drm/client: Constify modes Ville Syrjala
2024-04-05  7:01   ` kernel test robot
2024-04-06 21:59   ` kernel test robot
2024-04-04 20:33 ` [PATCH 07/12] drm/client: Use array notation for function arguments Ville Syrjala
2024-04-05  8:02   ` Thomas Zimmermann
2024-04-04 20:33 ` [PATCH 08/12] drm/client: Extract drm_connector_first_mode() Ville Syrjala
2024-04-05  8:26   ` Jani Nikula
2024-04-04 20:33 ` [PATCH 09/12] drm/client: Switch to per-device debugs Ville Syrjala
2024-04-04 20:33 ` [PATCH 10/12] drm/client: Use [CONNECTOR:%d:%s] formatting Ville Syrjala
2024-04-05  8:23   ` Jani Nikula
2024-04-05 20:12     ` Ville Syrjälä
2024-04-04 20:33 ` Ville Syrjala [this message]
2024-04-05  7:49   ` [PATCH 11/12] drm/client: Streamline mode selection debugs Thomas Zimmermann
2024-04-05  7:57   ` Thomas Zimmermann
2024-04-05 19:58     ` Ville Syrjälä
2024-04-08  7:46       ` Thomas Zimmermann
2024-04-08 17:26         ` Ville Syrjälä
2024-04-09  8:01           ` Thomas Zimmermann
2024-04-04 20:33 ` [PATCH 12/12] drm/probe-helper: Switch to per-device debugs Ville Syrjala
2024-04-05  8:25   ` Jani Nikula
2024-04-05  8:30     ` Thomas Zimmermann
2024-04-04 21:10 ` ✗ Fi.CI.CHECKPATCH: warning for drm/client: Use after free and debug improvements Patchwork
2024-04-04 21:10 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-04-04 21:22 ` ✓ Fi.CI.BAT: success " Patchwork
2024-04-05  8:04 ` [PATCH 00/12] " Thomas Zimmermann
2024-04-05 14:02 ` ✗ Fi.CI.IGT: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240404203336.10454-12-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.