Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 1/5] tools/intel_vbt_decode: Extract dump_panel()
Date: Fri, 22 Mar 2024 18:32:47 +0200	[thread overview]
Message-ID: <20240322163251.11102-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240322163251.11102-1-ville.syrjala@linux.intel.com>

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

Pull the repeated "dump this panel?" expression
into a small helper.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tools/intel_vbt_decode.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index fd8118772845..9a65a67b42bf 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -84,6 +84,12 @@ struct context {
 	bool hexdump;
 };
 
+static bool dump_panel(const struct context *context, int panel_type)
+{
+	return panel_type == context->panel_type ||
+		context->dump_all_panel_types;
+}
+
 /* Get BDB block size given a pointer to Block ID. */
 static uint32_t _get_blocksize(const uint8_t *block_base)
 {
@@ -607,7 +613,7 @@ static void dump_backlight_info(struct context *context,
 	}
 
 	for (i = 0; i < ARRAY_SIZE(backlight->data); i++) {
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tPanel %d%s\n", i,
@@ -1222,7 +1228,7 @@ static void dump_lvds_options(struct context *context,
 	for (int i = 0; i < 16; i++) {
 		unsigned int val;
 
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tPanel %d%s\n", i, context->panel_type == i ? " *" : "");
@@ -1289,7 +1295,7 @@ static void dump_lvds_ptr_data(struct context *context,
 	printf("\tNumber of entries: %d\n", ptrs->lvds_entries);
 
 	for (int i = 0; i < 16; i++) {
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tPanel %d%s\n", i, context->panel_type == i ? " *" : "");
@@ -1361,7 +1367,7 @@ static void dump_lvds_data(struct context *context,
 			block_data(block) + ptrs->panel_name.offset;
 		char mfg[4];
 
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		hdisplay = _H_ACTIVE(timing_data);
@@ -1571,7 +1577,7 @@ static void dump_edp(struct context *context,
 	int i;
 
 	for (i = 0; i < 16; i++) {
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tPanel %d%s\n", i, context->panel_type == i ? " *" : "");
@@ -1714,7 +1720,7 @@ static void dump_psr(struct context *context,
 	for (i = 0; i < 16; i++) {
 		const struct psr_table *psr = &psr_block->psr_table[i];
 
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tPanel %d%s\n", i, context->panel_type == i ? " *" : "");
@@ -1791,7 +1797,7 @@ static void dump_lfp_power(struct context *context,
 		return;
 
 	for (i = 0; i < 16; i++) {
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tPanel %d%s\n", i, context->panel_type == i ? " *" : "");
@@ -1923,7 +1929,7 @@ static void dump_mipi_config(struct context *context,
 		const struct edp_pwm_delays *pwm_delays =
 			&start->pwm_delays[context->panel_type];
 
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tPanel %d%s\n", i,
@@ -2372,7 +2378,7 @@ static void dump_mipi_sequence(struct context *context,
 		uint32_t seq_size;
 		int index = 0;
 
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		data = find_panel_sequence_block(sequence, i,
@@ -2467,7 +2473,7 @@ static void dump_compression_parameters(struct context *context,
 		/* FIXME: need to handle sizeof(*data) != dsc->entry_size */
 		data = &dsc->data[i];
 
-		if (i != context->panel_type && !context->dump_all_panel_types)
+		if (!dump_panel(context, i))
 			continue;
 
 		printf("\tDSC block %d%s\n", i,
-- 
2.43.2


  reply	other threads:[~2024-03-22 16:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 16:32 [PATCH i-g-t 0/5] tools/intel_vbt_decode: Improve panel type handling Ville Syrjala
2024-03-22 16:32 ` Ville Syrjala [this message]
2024-03-25 14:56   ` [PATCH i-g-t 1/5] tools/intel_vbt_decode: Extract dump_panel() Jani Nikula
2024-03-22 16:32 ` [PATCH i-g-t 2/5] tools/intel_vbt_decode: Extract panel_str() Ville Syrjala
2024-03-25 14:56   ` Jani Nikula
2024-03-22 16:32 ` [PATCH i-g-t 3/5] tools/intel_vbt_decode: Change panel indicator from * to (1) Ville Syrjala
2024-03-25 14:57   ` Jani Nikula
2024-03-22 16:32 ` [PATCH i-g-t 4/5] tools/intel_vbt_decode: Also dump the second panel (panel_type2) Ville Syrjala
2024-03-25 15:04   ` Jani Nikula
2024-03-25 15:08     ` Ville Syrjälä
2024-03-25 16:33   ` [PATCH i-g-t v2 " Ville Syrjala
2024-03-22 16:32 ` [PATCH i-g-t 5/5] tools/intel_vbt_decode: Optionally determine panel type from EDID Ville Syrjala
2024-03-25 15:08   ` Jani Nikula
2024-03-25 15:16     ` Ville Syrjälä
2024-03-25 16:36   ` [PATCH i-g-t v2 " Ville Syrjala
2024-03-22 18:51 ` ✓ CI.xeBAT: success for tools/intel_vbt_decode: Improve panel type handling Patchwork
2024-03-22 18:56 ` ✓ Fi.CI.BAT: " Patchwork
2024-03-23 21:17 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-03-25 19:39 ` ✗ Fi.CI.BAT: failure for tools/intel_vbt_decode: Improve panel type handling (rev3) Patchwork
2024-03-25 19:42 ` ✓ CI.xeBAT: success " 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=20240322163251.11102-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@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