[PATCH i-g-t 08/27] tools/intel_vbt_decode: Decode block 10 (Mode Removal Table)

Ville Syrjala ville.syrjala at linux.intel.com
Fri Jun 7 13:57:39 UTC 2024


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

Decode VBT block 10 (Mode Removal Table). Early desktop
platforms have a row size of 8 in the table, early mobile
and all modern parts (hsw+ iirc) have 10 byte rows.

Example output from ALM:
BDB block 10 (153 bytes, min 1 bytes) - Mode removal table:
        0000: 0a 99 00 0a 80 04 60 03  ff ff ff ff ff ff 00 05
        0010: d0 02 ff ff ff ff ff ff  00 05 c0 03 ff ff ff ff
        0020: ff ff 40 06 84 03 ff ff  ff ff ff ff 40 07 70 05
        0030: ff ff ff ff ff ff 80 07  38 04 ff ff ff ff ff ff
        0040: 80 07 b0 04 ff ff ff ff  ff ff 80 07 a0 05 ff ff
        0050: ff ff ff ff 00 08 00 06  ff ff ff ff ff ff 00 00
        0060: 00 00 00 00 00 00 ff ff  00 00 00 00 00 00 00 00
        0070: ff ff 00 00 00 00 00 00  00 00 ff ff 00 00 00 00
        0080: 00 00 00 00 ff ff 00 00  00 00 00 00 00 00 ff ff
        0090: 00 00 00 00 00 00 00 00  ff ff 00 00

        Num entries: 15
        Row size: 10
        Entry #1:
                Resolution: 1152x864
                Bits per pixel: 0xff
                Refresh rate: 0xffff
                Removal flags: 0xff
                Panel flags: 0xffff
	...
        Entry #15:
                Resolution: 0x0
                Bits per pixel: 0x00
                Refresh rate: 0x0000
                Removal flags: 0x00
                Panel flags: 0xffff
        Terminator: 0x0000

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

diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 3997c548d041..c5752d3161a3 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -329,6 +329,8 @@ static size_t block_min_size(const struct context *context, int section_id)
 		return sizeof(struct bdb_reg_table);
 	case BDB_PSR:
 		return sizeof(struct bdb_psr);
+	case BDB_MODE_REMOVAL_TABLE:
+		return sizeof(struct bdb_mode_removal);
 	case BDB_CHILD_DEVICE_TABLE:
 		return sizeof(struct bdb_legacy_child_devices);
 	case BDB_DRIVER_FEATURES:
@@ -1399,6 +1401,33 @@ static void dump_reg_table(struct context *context,
 	       *(const uint16_t *)end);
 }
 
+static void dump_mode_removal_table(struct context *context,
+				    const struct bdb_block *block)
+{
+	const struct bdb_mode_removal *r = block_data(block);
+	int num_entries = (block->size - sizeof(*r) - 2) / r->row_size;
+
+	printf("\tNum entries: %d\n", num_entries);
+	printf("\tRow size: %d\n", r->row_size);
+
+	for (int i = 0; i < num_entries; i++) {
+		const struct mode_removal_table *mode =
+			(const void*)&r->modes[0] + i * r->row_size;
+
+		printf("\tEntry #%d:\n", i + 1);
+		printf("\t\tResolution: %dx%d\n", mode->x_res, mode->y_res);
+		printf("\t\tBits per pixel: 0x%02x\n", mode->bpp);
+		printf("\t\tRefresh rate: 0x%04x\n", mode->refresh_rate);
+		printf("\t\tRemoval flags: 0x%02x\n", mode->removal_flags);
+
+		if (r->row_size >= 10)
+			printf("\t\tPanel flags: 0x%04x\n", mode->panel_flags);
+	}
+
+	printf("\tTerminator: 0x%04x\n",
+	       *(const u16*)(block_data(block) + block->size - 2));
+}
+
 static void dump_legacy_child_devices(struct context *context,
 				      const struct bdb_block *block)
 {
@@ -2913,6 +2942,11 @@ struct dumper dumpers[] = {
 		.name = "PSR block",
 		.dump = dump_psr,
 	},
+	{
+		.id = BDB_MODE_REMOVAL_TABLE,
+		.name = "Mode removal table",
+		.dump = dump_mode_removal_table,
+	},
 	{
 		.id = BDB_CHILD_DEVICE_TABLE,
 		.name = "Legacy child devices block",
-- 
2.44.2



More information about the igt-dev mailing list