xref: /aosp_15_r20/external/edid-decode/parse-vtb-ext-block.cpp (revision 193032a37cc83cffc1526215991f3c21671f4245)
1 // SPDX-License-Identifier: MIT
2 /*
3  * Copyright 2019-2020 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
4  *
5  * Author: Hans Verkuil <[email protected]>
6  */
7 
8 #include "edid-decode.h"
9 
parse_vtb_ext_block(const unsigned char * x)10 void edid_state::parse_vtb_ext_block(const unsigned char *x)
11 {
12 	printf("  Version: %u\n", x[1]);
13 	if (x[1] != 1)
14 		fail("Invalid version %u.\n", x[1]);
15 
16 	unsigned num_dtd = x[2];
17 	unsigned num_cvt = x[3];
18 	unsigned num_st = x[4];
19 
20 	x += 5;
21 	if (num_dtd) {
22 		printf("  Detailed Timing Descriptors:\n");
23 		for (unsigned i = 0; i < num_dtd; i++, x += 18)
24 			detailed_timings("    ", x, false);
25 	}
26 	if (num_cvt) {
27 		printf("  Coordinated Video Timings:\n");
28 		for (unsigned i = 0; i < num_cvt; i++, x += 3)
29 			detailed_cvt_descriptor("    ", x, false);
30 	}
31 	if (num_st) {
32 		// Note: the VTB-EXT standard has a mistake in the example EDID
33 		// that it provides: there the refresh rate (bits 5-0 of the
34 		// second byte) is set to 60 for 60 Hz, but this should be 0
35 		// since the actual refresh rate is the value + 60.
36 		//
37 		// The documentation itself is correct, though.
38 		printf("  Standard Timings:\n");
39 		for (unsigned i = 0; i < num_st; i++, x += 2)
40 			print_standard_timing("    ", x[0], x[1], true);
41 	}
42 }
43