linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] edid-decode: support Microsoft extension for HMDs and specialized monitors
@ 2021-03-11 20:51 Philipp Zabel
  0 siblings, 0 replies; only message in thread
From: Philipp Zabel @ 2021-03-11 20:51 UTC (permalink / raw)
  To: linux-media; +Cc: Philipp Zabel

Add support for parsing VSDBs documented in Microsoft's "EDID extension
for head-mounted and specialized monitors" [1].

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/display/specialized-monitors-edid-extension

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
 parse-cta-block.cpp | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index 075db46..e7ea01b 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -1067,6 +1067,43 @@ static void cta_amd(const unsigned char *x, unsigned length)
 	}
 }
 
+static std::string display_use_case(unsigned char x)
+{
+	switch (x) {
+	case 1: return "Test equipment";
+	case 2: return "Generic display";
+	case 3: return "Television display";
+	case 4: return "Desktop productivity display";
+	case 5: return "Desktop gaming display";
+	case 6: return "Presentation display";
+	case 7: return "Virtual reality headset";
+	case 8: return "Augmented reality";
+	case 16: return "Video wall display";
+	case 17: return "Medical imaging display";
+	case 18: return "Dedicated gaming display";
+	case 19: return "Dedicated video monitor display";
+	case 20: return "Accessory display";
+	default: break;
+	}
+	fail("Unknown Display product primary use case 0x%02x.\n", x);
+	return std::string("Unknown display use case (") + utohex(x) + ")";
+}
+
+static void cta_microsoft(const unsigned char *x, unsigned length)
+{
+	// This VSDB is documented at:
+	// https://docs.microsoft.com/en-us/windows-hardware/drivers/display/specialized-monitors-edid-extension
+	printf("    Version: %u\n", x[0]);
+	if (x[0] > 2) {
+		// In version 1 and 2 these bits should always be set to 0.
+		printf("    Desktop Usage: %u\n", (x[1] >> 6) & 1);
+		printf("    Third-Party Usage: %u\n", (x[1] >> 5) & 1);
+	}
+	printf("    Display Product Primary Use Case: %u (%s)\n", x[1] & 0x1f,
+	       display_use_case(x[1] & 0x1f).c_str());
+	hex_block("    Container ID: ", x + 2, length - 2, false, 16);
+}
+
 static void cta_hdr10plus(const unsigned char *x, unsigned length)
 {
 	printf("    Application Version: %u", x[0]);
@@ -2172,6 +2209,10 @@ void edid_state::cta_block(const unsigned char *x, bool duplicate)
 			cta_amd(x + 4, length - 3);
 			break;
 		}
+		if (oui == 0xca125c && length == 0x15) {
+			cta_microsoft(x + 4, length - 3);
+			break;
+		}
 		hex_block("    ", x + 4, length - 3);
 		break;
 	case 0x04:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-11 20:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 20:51 [PATCH] edid-decode: support Microsoft extension for HMDs and specialized monitors Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).