[PATCH i-g-t 16/20] tools/intel_vbt_decode: Track the SDVO panel type

Ville Syrjala ville.syrjala at linux.intel.com
Fri May 31 14:23:50 UTC 2024


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

Just like we do for the LFP panel types, let's keep track of
the SDVO panel type.

I suppose technically we should also check h40_set_panel_type,
and if set then derive the panel type via some VBIOS call or
some such crazyness. We'll just ignore that and assume the VBT
specified panel type is correct. Could also add a comman line
override, but meh.

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

diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 167b5751ad16..04520973aae1 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -69,6 +69,7 @@ struct context {
 
 	uint32_t devid;
 	int panel_type, panel_type2;
+	int sdvo_panel_type;
 	bool dump_all_panel_types;
 	bool hexdump;
 };
@@ -101,6 +102,14 @@ static const char *panel_str(const struct context *context, int panel_type)
 	return "";
 }
 
+static const char *sdvo_panel_str(const struct context *context, int sdvo_panel_type)
+{
+	if (sdvo_panel_type == context->sdvo_panel_type)
+		return " (*)";
+
+	return "";
+}
+
 /* Get BDB block size given a pointer to Block ID. */
 static uint32_t _get_blocksize(const uint8_t *block_base)
 {
@@ -1935,7 +1944,7 @@ static void dump_sdvo_lvds_dtd(struct context *context,
 	const struct bdb_sdvo_lvds_dtd *t = block_data(block);
 
 	for (int n = 0; n < ARRAY_SIZE(t->dtd); n++) {
-		printf("%d:\n", n);
+		printf("\tSDVO Panel %d%s\n", n, sdvo_panel_str(context, n));
 		print_detail_timing_data(&t->dtd[n]);
 	}
 }
@@ -2623,6 +2632,25 @@ static int get_panel_type(struct context *context, bool is_panel_type2)
 	return panel_type;
 }
 
+/* get SDVO panel type from SDVO options block, or -1 if block not found */
+static int get_sdvo_panel_type(struct context *context)
+{
+	const struct bdb_sdvo_lvds_options *options;
+	struct bdb_block *block;
+	int panel_type = -1;
+
+	block = find_section(context, BDB_SDVO_LVDS_OPTIONS);
+	if (!block)
+		return -1;
+
+	options = block_data(block);
+	panel_type = options->panel_type;
+
+	free(block);
+
+	return panel_type;
+}
+
 static int
 get_device_id(unsigned char *bios, int size)
 {
@@ -2933,6 +2961,7 @@ int main(int argc, char **argv)
 	struct context context = {
 		.panel_type = -1,
 		.panel_type2 = -1,
+		.sdvo_panel_type = -1,
 	};
 	const char *panel_edid = NULL, *panel_edid2 = NULL;
 	char *endp;
@@ -3134,6 +3163,9 @@ int main(int argc, char **argv)
 		context.panel_type2 = -1;
 	}
 
+	if (context.sdvo_panel_type == -1)
+		context.sdvo_panel_type = get_sdvo_panel_type(&context);
+
 	if (describe) {
 		print_description(&context);
 	} else if (header_only) {
-- 
2.44.1



More information about the igt-dev mailing list