Skip to content

Commit 4966b2a

Browse files
chrschmidtairlied
authored andcommitted
Fix wrong assumptions in cea_for_each_detailed_block v2
The current logic misunderstands the spec about CEA 18byte descriptors. First, the spec doesn't state "detailed timing descriptors" but "18 byte descriptors", so any data record could be stored, mixed timings and other data, just as in the standard EDID. Second, the lower four bit of byte 3 of the CEA record do not contain the number of descriptors, but "the total number of DTDs defining native formats in the whole EDID [...], starting with the first DTD in the DTD list (which starts in the base EDID block)." A device can of course support non-native formats. As such the number can't be used to determine n, and the existing code will filter non-timing 18byte descriptors anyway. Signed-off-by: Christian Schmidt <schmidt@digadd.de> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
1 parent a0ab734 commit 4966b2a

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

drivers/gpu/drm/drm_edid.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -508,25 +508,10 @@ static void
508508
cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure)
509509
{
510510
int i, n = 0;
511-
u8 rev = ext[0x01], d = ext[0x02];
511+
u8 d = ext[0x02];
512512
u8 *det_base = ext + d;
513513

514-
switch (rev) {
515-
case 0:
516-
/* can't happen */
517-
return;
518-
case 1:
519-
/* have to infer how many blocks we have, check pixel clock */
520-
for (i = 0; i < 6; i++)
521-
if (det_base[18*i] || det_base[18*i+1])
522-
n++;
523-
break;
524-
default:
525-
/* explicit count */
526-
n = min(ext[0x03] & 0x0f, 6);
527-
break;
528-
}
529-
514+
n = (127 - d) / 18;
530515
for (i = 0; i < n; i++)
531516
cb((struct detailed_timing *)(det_base + 18 * i), closure);
532517
}

0 commit comments

Comments
 (0)