diff mbox series

[09/11] edid-decode: allow undefined aspect ratio

Message ID 20210914121129.51451-10-joevt@shaw.ca (mailing list archive)
State New, archived
Headers show
Series edid-decode: bug fixes, additions, changes | expand

Commit Message

joevt Sept. 14, 2021, 12:11 p.m. UTC
Distinguish between "undefined" and "reserved" aspect ratios. See examples apple-xdr-6k-tile0, lg-ultrafine-5k-v1-thunderbolt-dp1-tile0, asus-xg438q-dp
"undefined" is for an aspect ratio that doesn't exist in the list of known aspect ratios. This does not deserve a fail.
"reserved" should not be used and still deserves the fail.

Signed-off-by: Joe van Tunen <joevt@shaw.ca>
---
 parse-displayid-block.cpp | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp
index 9713c46..8f4e366 100644
--- a/parse-displayid-block.cpp
+++ b/parse-displayid-block.cpp
@@ -270,10 +270,12 @@  void edid_state::parse_displayid_type_1_7_timing(const unsigned char *x,
 		t.hratio = 256;
 		t.vratio = 135;
 		break;
-	default:
+	case 8:
 		s += "undefined";
-		if ((x[3] & 0xf) > (dispid.version <= 0x12 ? 7 : 8))
-			fail("Unknown aspect 0x%02x.\n", x[3] & 0xf);
+		break;
+	default:
+		s += "reserved";
+		fail("Unknown aspect 0x%02x.\n", x[3] & 0xf);
 		break;
 	}
 	switch ((x[3] >> 5) & 0x3) {
@@ -455,10 +457,12 @@  void edid_state::parse_displayid_type_3_timing(const unsigned char *x)
 		t.hratio = 256;
 		t.vratio = 135;
 		break;
-	default:
+	case 8:
 		s += "undefined";
-		if ((x[3] & 0xf) > (dispid.version <= 0x12 ? 7 : 8))
-			fail("Unknown aspect 0x%02x.\n", x[3] & 0xf);
+		break;
+	default:
+		s += "reserved";
+		fail("Unknown aspect 0x%02x.\n", x[0] & 0xf);
 		break;
 	}