[igt-dev] [PATCH i-g-t 07/14] tools/intel_vbt_decode: Extract panel_fitting[]

Ville Syrjala ville.syrjala at linux.intel.com
Fri Jul 15 20:25:13 UTC 2022


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

Extract the panel_fitting string representation into an array.
Less clutter in the code this way.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tools/intel_vbt_decode.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index cffc385306f2..b5b60723baa8 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -530,26 +530,20 @@ static int decode_ssc_freq(struct context *context, bool alternate)
 	}
 }
 
+static const char * const panel_fitting[] = {
+	[0] = "disabled",
+	[1] = "text only",
+	[2] = "graphics only",
+	[3] = "text & graphics",
+};
+
 static void dump_general_features(struct context *context,
 				  const struct bdb_block *block)
 {
 	const struct bdb_general_features *features = block_data(block);
 
-	printf("\tPanel fitting: ");
-	switch (features->panel_fitting) {
-	case 0:
-		printf("disabled\n");
-		break;
-	case 1:
-		printf("text only\n");
-		break;
-	case 2:
-		printf("graphics only\n");
-		break;
-	case 3:
-		printf("text & graphics\n");
-		break;
-	}
+	printf("\tPanel fitting: %s (0x%x)\n",
+	       panel_fitting[features->panel_fitting], features->panel_fitting);
 	printf("\tFlexaim: %s\n", YESNO(features->flexaim));
 	printf("\tMessage: %s\n", YESNO(features->msg_enable));
 	printf("\tClear screen: %d\n", features->clear_screen);
-- 
2.35.1



More information about the igt-dev mailing list