Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174492
b: refs/heads/master
c: 862b89c
h: refs/heads/master
v: v3
  • Loading branch information
Adam Jackson authored and Dave Airlie committed Nov 24, 2009
1 parent 267fab6 commit b7369a6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 47ee4ccf745ea88ee1aadcf5895d91af3b73ea64
refs/heads/master: 862b89c069cafded4e31029be511f2e0b58d9c5f
22 changes: 16 additions & 6 deletions trunk/drivers/gpu/drm/drm_edid.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,33 @@ static const u8 edid_header[] = {
*/
static bool edid_is_valid(struct edid *edid)
{
int i;
int i, score = 0;
u8 csum = 0;
u8 *raw_edid = (u8 *)edid;

if (memcmp(edid->header, edid_header, sizeof(edid_header)))
goto bad;
if (edid->version != 1) {
DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version);
for (i = 0; i < sizeof(edid_header); i++)
if (raw_edid[i] == edid_header[i])
score++;

if (score == 8) ;
else if (score >= 6) {
DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
memcpy(raw_edid, edid_header, sizeof(edid_header));
} else
goto bad;
}

for (i = 0; i < EDID_LENGTH; i++)
csum += raw_edid[i];
if (csum) {
DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum);
goto bad;
}

if (edid->version != 1) {
DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version);
goto bad;
}

if (edid->revision > 4)
DRM_DEBUG("EDID minor > 4, assuming backward compatibility\n");

Expand Down

0 comments on commit b7369a6

Please sign in to comment.