Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196432
b: refs/heads/master
c: d1ff640
h: refs/heads/master
v: v3
  • Loading branch information
Adam Jackson authored and Dave Airlie committed Apr 6, 2010
1 parent c74d954 commit 1fe9461
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 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: a327f6b806103ee177aba20bb1e42ba7ec7d0f4b
refs/heads/master: d1ff6409b1cd2cd2a65df415648fa38b9fdf4cd8
47 changes: 43 additions & 4 deletions trunk/drivers/gpu/drm/drm_edid.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#include "drmP.h"
#include "drm_edid.h"

#define EDID_EST_TIMINGS 16
#define EDID_STD_TIMINGS 8
#define EDID_DETAILED_TIMINGS 4

/*
* EDID blocks out in the wild have a variety of bugs, try to collect
* them here (note that userspace may work around broken monitors first,
Expand Down Expand Up @@ -670,6 +674,45 @@ static struct drm_display_mode *drm_find_dmt(struct drm_device *dev,
return mode;
}

typedef void detailed_cb(struct detailed_timing *timing, void *closure);

static void
drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)
{
int i;
struct edid *edid = (struct edid *)raw_edid;

if (edid == NULL)
return;

for (i = 0; i < EDID_DETAILED_TIMINGS; i++)
cb(&(edid->detailed_timings[i]), closure);

/* XXX extension block walk */
}

static void
is_rb(struct detailed_timing *t, void *data)
{
u8 *r = (u8 *)t;
if (r[3] == EDID_DETAIL_MONITOR_RANGE)
if (r[15] & 0x10)
*(bool *)data = true;
}

/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */
static bool
drm_monitor_supports_rb(struct edid *edid)
{
if (edid->revision >= 4) {
bool ret;
drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
return ret;
}

return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
}

/*
* 0 is reserved. The spec says 0x01 fill for unused timings. Some old
* monitors fill with ascii space (0x20) instead.
Expand Down Expand Up @@ -952,10 +995,6 @@ static struct drm_display_mode edid_est_modes[] = {
DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x864@75Hz */
};

#define EDID_EST_TIMINGS 16
#define EDID_STD_TIMINGS 8
#define EDID_DETAILED_TIMINGS 4

/**
* add_established_modes - get est. modes from EDID and add them
* @edid: EDID block to scan
Expand Down

0 comments on commit 1fe9461

Please sign in to comment.