[PATCH i-g-t 23/27] tools/intel_vbt_decode: Decode block 55 (RGB Palette Table)
Ville Syrjala
ville.syrjala at linux.intel.com
Fri Jun 7 13:57:54 UTC 2024
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Decode VBT block 55 (RGB Palette Table). Just a 256 entry
8bpc LUT.
Thought I had a VBT with this, but can't find it now. So no example
output I'm afraid.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
tools/intel_vbt_decode.c | 64 +++++++++++++++++++++++++++-------------
1 file changed, 43 insertions(+), 21 deletions(-)
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index c42585e4ab18..85f31f449130 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -81,6 +81,27 @@ struct edid {
/* ... */
} __packed;
+static void hex_dump(const void *data, uint32_t size)
+{
+ int i;
+ const uint8_t *p = data;
+
+ for (i = 0; i < size; i++) {
+ if (i % 16 == 0)
+ printf("\t%04x: ", i);
+ printf("%02x", p[i]);
+ if (i % 16 == 15) {
+ if (i + 1 < size)
+ printf("\n");
+ } else if (i % 8 == 7) {
+ printf(" ");
+ } else {
+ printf(" ");
+ }
+ }
+ printf("\n\n");
+}
+
static bool dump_panel(const struct context *context, int panel_type)
{
return panel_type == context->panel_type ||
@@ -393,6 +414,8 @@ static size_t block_min_size(const struct context *context, int section_id)
return sizeof(struct bdb_mipi_config);
case BDB_MIPI_SEQUENCE:
return sizeof(struct bdb_mipi_sequence);
+ case BDB_RGB_PALETTE:
+ return sizeof(struct bdb_rgb_palette);
case BDB_COMPRESSION_PARAMETERS:
return sizeof(struct bdb_compression_parameters);
case BDB_GENERIC_DTD:
@@ -3294,6 +3317,21 @@ static void dump_mipi_sequence(struct context *context,
}
}
+static void dump_rgb_palette(struct context *context,
+ const struct bdb_block *block)
+{
+ const struct bdb_rgb_palette *pal = block_data(block);
+
+ printf("\tIs enabled: %s (0x%02x)\n", YESNO(pal->is_enabled), pal->is_enabled);
+
+ printf("\tRed:\n");
+ hex_dump(pal->red, sizeof(pal->red));
+ printf("\tGreen:\n");
+ hex_dump(pal->green, sizeof(pal->green));
+ printf("\tBlue:\n");
+ hex_dump(pal->blue, sizeof(pal->blue));
+}
+
#define KB(x) ((x) * 1024)
static int dsc_buffer_block_size(u8 buffer_block_size)
@@ -3713,6 +3751,11 @@ struct dumper dumpers[] = {
.name = "MIPI sequence block",
.dump = dump_mipi_sequence,
},
+ {
+ .id = BDB_RGB_PALETTE,
+ .name = "RGB palette",
+ .dump = dump_rgb_palette,
+ },
{
.id = BDB_COMPRESSION_PARAMETERS,
.name = "Compression parameters block",
@@ -3720,27 +3763,6 @@ struct dumper dumpers[] = {
},
};
-static void hex_dump(const void *data, uint32_t size)
-{
- int i;
- const uint8_t *p = data;
-
- for (i = 0; i < size; i++) {
- if (i % 16 == 0)
- printf("\t%04x: ", i);
- printf("%02x", p[i]);
- if (i % 16 == 15) {
- if (i + 1 < size)
- printf("\n");
- } else if (i % 8 == 7) {
- printf(" ");
- } else {
- printf(" ");
- }
- }
- printf("\n\n");
-}
-
static void hex_dump_block(const struct bdb_block *block)
{
hex_dump(block->data, 3 + block->size);
--
2.44.2
More information about the igt-dev
mailing list