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 25/27] tools/intel_vbt_decode: Decode block 58 (Generic DTD Block)
Date: Fri,  7 Jun 2024 16:57:56 +0300	[thread overview]
Message-ID: <20240607135758.31421-26-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240607135758.31421-1-ville.syrjala@linux.intel.com>

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

Decode VBT block 58 (Generic DTD Block). Spec says this has max
24 entries (implying it can be variable?), 16 entries for LFPs,
and 8 entries for EFPs.

Example output from ADL:
BDB block 58 (674 bytes, min 2 bytes) - Generic DTD:
        0000: 3a a2 02 1c 00 ee 67 04  00 00 0a 1a 01 52 00 0c
        0010: 00 40 06 52 00 14 00 04  00 f7 00 9a 00 c0 00 00
        0020: 00 d6 6d 02 00 b0 04 8c  00 3c 00 04 00 80 07 3c
        0030: 00 22 00 02 00 88 00 d9  00 c0 00 00 00 e8 fd 00
        ...
        0270: 00 80 02 90 00 08 00 60  00 e0 01 1d 00 02 00 02
        0280: 00 00 00 00 00 c0 00 00  00 5c 62 00 00 80 02 90
        0290: 00 08 00 60 00 e0 01 1d  00 02 00 02 00 00 00 00
        02a0: 00 c0 00 00 00

        Entry size: 28
        Entry #1 (LFP #1): (LFP1)
                hdisplay: 2560
                hsync [2642, 2654] +sync
                htotal: 2842
                vdisplay: 1600
                vsync [1620, 1624] +sync
                vtotal: 1682
                clock: 2887500
        ...
        Entry #24 (EFP #8):
                hdisplay: 640
                hsync [648, 744] +sync
                htotal: 784
                vdisplay: 480
                vsync [482, 484] +sync
                vtotal: 509
                clock: 251800

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

diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 58bdba0e96d2..83c90083e1b9 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -421,7 +421,6 @@ static size_t block_min_size(const struct context *context, int section_id)
 	case BDB_VSWING_PREEMPH:
 		return sizeof(struct bdb_vswing_preemph);
 	case BDB_GENERIC_DTD:
-		/* FIXME check spec */
 		return sizeof(struct bdb_generic_dtd);
 	default:
 		return 0;
@@ -3449,6 +3448,52 @@ static void dump_vswing_preemphasis(struct context *context,
 	}
 }
 
+static void dump_generic_dtd_entry(const struct generic_dtd_entry *dtd,
+				   const char *prefix)
+{
+	printf("%shdisplay: %d\n", prefix, dtd->hactive);
+	printf("%shsync [%d, %d] %s\n", prefix,
+	       dtd->hactive + dtd->hfront_porch,
+	       dtd->hactive + dtd->hfront_porch + dtd->hsync,
+	       dtd->hsync_positive_polarity ? "+sync" : "-sync");
+	printf("%shtotal: %d\n", prefix, dtd->hactive + dtd->hblank);
+
+	printf("%svdisplay: %d\n", prefix, dtd->vactive);
+	printf("%svsync [%d, %d] %s\n", prefix,
+	       dtd->vactive + dtd->vfront_porch,
+	       dtd->vactive + dtd->vfront_porch + dtd->vsync,
+	       dtd->vsync_positive_polarity ? "+sync" : "-sync");
+	printf("%svtotal: %d\n", prefix, dtd->vactive + dtd->vblank);
+
+	printf("%sclock: %d\n", prefix, dtd->pixel_clock * 10);
+}
+
+static void dump_generic_dtd(struct context *context,
+			     const struct bdb_block *block)
+{
+	const struct bdb_generic_dtd *gdtd = block_data(block);
+	int num_entries;
+
+	if (sizeof(gdtd->dtd[0]) != gdtd->gdtd_size) {
+		printf("\tDTD struct sizes don't match (expected %zu, got %u), skipping\n",
+		       sizeof(gdtd->dtd[0]), gdtd->gdtd_size);
+		return;
+	}
+
+	num_entries = (block->size - sizeof(*gdtd)) / gdtd->gdtd_size;
+
+	printf("\tEntry size: %d\n", gdtd->gdtd_size);
+
+	for (int i = 0; i < num_entries; i++) {
+		if (i < 16 && !dump_panel(context, i))
+			continue;
+
+		printf("\tEntry #%d (%s #%d):%s\n", i+1, i < 16 ? "LFP" : "EFP",
+		       i % 16 + 1, i < 16 ? panel_str(context, i) : "");
+		dump_generic_dtd_entry(&gdtd->dtd[i], "\t\t");
+	}
+}
+
 static int get_panel_type_pnpid(const struct context *context,
 				const char *edid_file)
 {
@@ -3802,6 +3847,11 @@ struct dumper dumpers[] = {
 		.name = "Vswing Preemph",
 		.dump = dump_vswing_preemphasis,
 	},
+	{
+		.id = BDB_GENERIC_DTD,
+		.name = "Generic DTD",
+		.dump = dump_generic_dtd,
+	},
 };
 
 static void hex_dump_block(const struct bdb_block *block)
-- 
2.44.2


  parent reply	other threads:[~2024-06-07 13:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 13:57 [PATCH i-g-t 00/27] tools/intel_vbt_decode: Decode almost everything Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 01/27] tools/intel_vbt_decode: sync intel_vbt_defs.h with kernel commit 80c414772d93 Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 02/27] tools/intel_vbt_decode: sync intel_vbt_defs.h with kernel commit 3e8daf14c47d Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 03/27] tools/intel_vbt_decode: Dump MIPI config for the correct panel Ville Syrjala
2024-06-13  9:13   ` Jani Nikula
2024-06-07 13:57 ` [PATCH i-g-t 04/27] tools/intel_vbt_decode: Decode block 3 (Display Toggle Option) Ville Syrjala
2024-06-13  9:14   ` Jani Nikula
2024-06-13 17:19     ` Ville Syrjälä
2024-06-07 13:57 ` [PATCH i-g-t 05/27] tools/intel_vbt_decode: Decode block 4 (Mode Support List) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 06/27] tools/intel_vbt_decode: Decode block 5 (Generic Mode Table) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 07/27] tools/intel_vbt_decode: Decode blocks 6, 7, 8 (register tables) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 08/27] tools/intel_vbt_decode: Decode block 10 (Mode Removal Table) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 09/27] tools/intel_vbt_decode: Decode block 12 (Driver Persistent Algorithm) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 10/27] tools/intel_vbt_decode: Decode block 15 (Dot Clock Override Table) and block 9 (ALM only) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 11/27] tools/intel_vbt_decode: Decode blocks 16, 29, 31 (Toggle List) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 12/27] tools/intel_vbt_decode: Decode blocks 19, 30, 32 (Display Configuration Removal Table) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 13/27] tools/intel_vbt_decode: Decode block 18 (Driver Rotation) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 14/27] tools/intel_vbt_decode: Decode block 20 (OEM Customizable Modes) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 15/27] tools/intel_vbt_decode: Decode block 21 (EFP List) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 16/27] tools/intel_vbt_decode: Decode block 24 (SDVO LVDS PnP ID) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 17/27] tools/intel_vbt_decode: Decode block 25 (SDVO LVDS PPS) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 18/27] tools/intel_vbt_decode: Decode block 26 (TV Options) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 19/27] tools/intel_vbt_decode: Decode block 28 (EFP DTD) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 20/27] tools/intel_vbt_decode: Decode block 45 (eDP BFI) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 21/27] tools/intel_vbt_decode: Decode block 46 (Chromaticity For Narrow Gamut Panel) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 22/27] tools/intel_vbt_decode: Decode block 51 (Fixed Set Mode Table) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 23/27] tools/intel_vbt_decode: Decode block 55 (RGB Palette Table) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 24/27] tools/intel_vbt_decode: Decode block 57 (Vswing PreEmphasis Table) Ville Syrjala
2024-06-07 13:57 ` Ville Syrjala [this message]
2024-06-07 13:57 ` [PATCH i-g-t 26/27] tools/intel_vbt_decode: Decode block 253 (PRD Table) Ville Syrjala
2024-06-07 13:57 ` [PATCH i-g-t 27/27] tools/intel_vbt_decode: Name a few more VBT blocks Ville Syrjala
2024-06-07 22:08 ` ✓ CI.xeBAT: success for tools/intel_vbt_decode: Decode almost everything Patchwork
2024-06-07 22:13 ` ✓ Fi.CI.BAT: " Patchwork
2024-06-08 12:30 ` ✗ CI.xeFULL: failure " Patchwork
2024-06-11 15:37   ` Kamil Konieczny
2024-06-08 13:08 ` ✗ Fi.CI.IGT: " Patchwork
2024-06-11 15:36   ` Kamil Konieczny
2024-06-13  9:17 ` [PATCH i-g-t 00/27] " Jani Nikula

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=20240607135758.31421-26-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