public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH 8/9] drm/i915: Print DisplayPort clocks on a single line
Date: Wed, 27 Apr 2016 11:07:01 +0100	[thread overview]
Message-ID: <1461751622-26927-9-git-send-email-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <1461751622-26927-1-git-send-email-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Tidy debug logging a bit and avoid allocating the buffer on the stack,
removing one FIXME tag in the process. Replaces current debug of:

 [    4.236714] [drm:intel_dp_print_rates] source rates: 162000, 270000, 540000
 [    4.236715] [drm:intel_dp_print_rates] sink rates: 162000, 270000
 [    4.236716] [drm:intel_dp_print_rates] common rates: 162000, 270000

With:

 [    4.245597] [drm:intel_dp_print_rates] source=[162k, 270k, 540k]; sink=[162k, 270k]; common=[162k, 270k]

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index c12c41482de7..7274def0fbca 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1349,20 +1349,12 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp,
 			       common_rates);
 }
 
-static void snprintf_int_array(char *str, size_t len,
-			       const int *array, int nelem)
+static void printk_dp_rates(const int *array, unsigned int nelem)
 {
-	int i;
-
-	str[0] = '\0';
+	unsigned int i;
 
-	for (i = 0; i < nelem; i++) {
-		int r = snprintf(str, len, "%s%d", i ? ", " : "", array[i]);
-		if (r >= len)
-			return;
-		str += r;
-		len -= r;
-	}
+	for (i = 0; i < nelem; i++)
+		printk("%s%dk", i ? ", " : "", array[i] / 1000);
 }
 
 static void intel_dp_print_rates(struct intel_dp *intel_dp)
@@ -1370,22 +1362,23 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
 	const int *source_rates, *sink_rates;
 	int source_len, sink_len, common_len;
 	int common_rates[DP_MAX_SUPPORTED_RATES];
-	char str[128]; /* FIXME: too big for stack? */
 
-	if ((drm_debug & DRM_UT_KMS) == 0)
+	if ((drm_debug & DRM_UT_KMS) == 0 )
 		return;
 
 	source_len = intel_dp_source_rates(intel_dp, &source_rates);
-	snprintf_int_array(str, sizeof(str), source_rates, source_len);
-	DRM_DEBUG_KMS("source rates: %s\n", str);
+	DRM_DEBUG_KMS("source=[");
+	printk_dp_rates(source_rates, source_len);
 
 	sink_len = intel_dp_sink_rates(intel_dp, &sink_rates);
-	snprintf_int_array(str, sizeof(str), sink_rates, sink_len);
-	DRM_DEBUG_KMS("sink rates: %s\n", str);
+	printk("]; sink=[");
+	printk_dp_rates(sink_rates, sink_len);
 
 	common_len = intel_dp_common_rates(intel_dp, common_rates);
-	snprintf_int_array(str, sizeof(str), common_rates, common_len);
-	DRM_DEBUG_KMS("common rates: %s\n", str);
+	printk("]; common=[");
+	printk_dp_rates(common_rates, common_len);
+
+	printk("]\n");
 }
 
 static int rate_to_index(int find, const int *rates)
-- 
1.9.1

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

  parent reply	other threads:[~2016-04-27 10:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 10:06 [PATCH 0/9] A little bit of KMS debug logging tidy Tvrtko Ursulin
2016-04-27 10:06 ` [PATCH 1/9] drm: Add drm_mode_debug_printmodeline_raw Tvrtko Ursulin
2016-04-27 12:35   ` Jani Nikula
2016-04-27 12:58     ` Tvrtko Ursulin
2016-04-27 10:06 ` [PATCH 2/9] drm: Recognize invalid (all-zero) modes in drm_mode_debug_printmodeline(_raw) Tvrtko Ursulin
2016-04-27 10:06 ` [PATCH 3/9] drm/i915: Compact modes in intel_dump_pipe_config Tvrtko Ursulin
2016-04-27 12:37   ` Jani Nikula
2016-04-27 10:06 ` [PATCH 4/9] drm/i915: Tidy planes and scaler info " Tvrtko Ursulin
2016-04-27 10:06 ` [PATCH 5/9] drm/i915: Compact intel_dump_pipe_config some more Tvrtko Ursulin
2016-04-27 10:06 ` [PATCH 6/9] drm/i915: Log watermark latencies on a single line per plane Tvrtko Ursulin
2016-04-27 10:07 ` [PATCH 7/9] drm/i915: Compact display clock logging Tvrtko Ursulin
2016-04-27 10:07 ` Tvrtko Ursulin [this message]
2016-04-27 10:07 ` [PATCH 9/9] drm: Quiet down drm_mode_getconnector Tvrtko Ursulin
2016-04-28  8:54   ` Daniel Vetter
2016-04-27 10:54 ` [PATCH 0/9] A little bit of KMS debug logging tidy Jani Nikula
2016-04-27 11:26   ` Tvrtko Ursulin
2016-04-27 11:57 ` ✗ Fi.CI.BAT: warning 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=1461751622-26927-9-git-send-email-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox