edid: Don't half parse (and wrongly print) more detailed timings

The EDID parsing code continued to update _some_ fields of the output
edid but not others if "did_detailed_timing" was already set.  It also
then went on to print out this halfway mix of modes each time, despite
the fact that it didn't really update everything.

Let's fix that.  We'll reduce code changes by using a temporary copy of
data in detailed_block() and then we'll copy it back if we decide we
should update.

BRANCH=none
BUG=chrome-os-partner:46998
TEST=No more bogus printouts

Change-Id: Idbfa233e0997244c22ef21c892c4473a91621821
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 4d69999cdd7ce3cd2c9332ab3f22ea8eb4b6f2e9
Original-Change-Id: Ia72cac7fda2772f26477e43237678fa30feca584
Original-Signed-off-by: Douglas Anderson <dianders@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/309541
Original-Reviewed-on: https://chromium-review.googlesource.com/309609
Original-Commit-Ready: David Hendricks <dhendrix@chromium.org>
Original-Tested-by: David Hendricks <dhendrix@chromium.org>
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: http://review.coreboot.org/12444
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Douglas Anderson 2015-10-28 09:18:28 -07:00 committed by Patrick Georgi
parent 78e226cf36
commit bca67fb7dc
1 changed files with 66 additions and 57 deletions

View File

@ -91,6 +91,8 @@ static struct {
const char *stereo; const char *stereo;
} extra_info; } extra_info;
static struct edid tmp_edid;
static int vbe_valid; static int vbe_valid;
static struct lb_framebuffer edid_fb; static struct lb_framebuffer edid_fb;
@ -197,9 +199,10 @@ extract_string(unsigned char *x, int *valid_termination, int len)
/* 1 means valid data */ /* 1 means valid data */
static int static int
detailed_block(struct edid *out, unsigned char *x, int in_extension, detailed_block(struct edid *result_edid, unsigned char *x, int in_extension,
struct edid_context *c) struct edid_context *c)
{ {
struct edid *out = &tmp_edid;
int i; int i;
#if 1 #if 1
printk(BIOS_SPEW, "Hex of detail: "); printk(BIOS_SPEW, "Hex of detail: ");
@ -208,6 +211,9 @@ detailed_block(struct edid *out, unsigned char *x, int in_extension,
printk(BIOS_SPEW, "\n"); printk(BIOS_SPEW, "\n");
#endif #endif
/* Result might already have some valid fields like mode_is_supported */
*out = *result_edid;
if (x[0] == 0 && x[1] == 0) { if (x[0] == 0 && x[1] == 0) {
/* Monitor descriptor block, not detailed timing descriptor. */ /* Monitor descriptor block, not detailed timing descriptor. */
if (x[2] != 0) { if (x[2] != 0) {
@ -443,7 +449,6 @@ detailed_block(struct edid *out, unsigned char *x, int in_extension,
c->has_valid_descriptor_ordering = 0; c->has_valid_descriptor_ordering = 0;
} }
if (! c->did_detailed_timing){
/* Edid contains pixel clock in terms of 10KHz */ /* Edid contains pixel clock in terms of 10KHz */
out->mode.pixel_clock = (x[0] + (x[1] << 8)) * 10; out->mode.pixel_clock = (x[0] + (x[1] << 8)) * 10;
/* /*
@ -497,9 +502,6 @@ detailed_block(struct edid *out, unsigned char *x, int in_extension,
out->bytes_per_line = ALIGN(out->mode.ha * out->bytes_per_line = ALIGN(out->mode.ha *
((out->framebuffer_bits_per_pixel + 7)/8), ((out->framebuffer_bits_per_pixel + 7)/8),
64); 64);
printk(BIOS_SPEW, "Did detailed timing\n");
}
c->did_detailed_timing = 1;
switch ((x[17] & 0x18) >> 3) { switch ((x[17] & 0x18) >> 3) {
case 0x00: case 0x00:
extra_info.syncmethod = " analog composite"; extra_info.syncmethod = " analog composite";
@ -556,6 +558,13 @@ detailed_block(struct edid *out, unsigned char *x, int in_extension,
out->mode.phsync, out->mode.pvsync, out->mode.phsync, out->mode.pvsync,
extra_info.syncmethod, x[17] & 0x80 ?" interlaced" : "", extra_info.syncmethod, x[17] & 0x80 ?" interlaced" : "",
extra_info.stereo); extra_info.stereo);
if (! c->did_detailed_timing) {
printk(BIOS_SPEW, "Did detailed timing\n");
c->did_detailed_timing = 1;
*result_edid = *out;
}
return 1; return 1;
} }