summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-02 11:46:06 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-02 11:46:06 +0100
commitce85cd1a36e31795a966ea8983c2d6f803a4eccd (patch)
treed656c0f246e3ae8836bb48c38c524aa5818a7589
parente8eb273bd6153c232a9ffc558e3b7fd4beaab01b (diff)
sna: Add some DBG to retreiving EDID
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_display.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 2e1be460..c93f472d 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1072,13 +1072,16 @@ sna_output_attach_edid(xf86OutputPtr output)
struct sna *sna = to_sna(output->scrn);
struct sna_output *sna_output = output->driver_private;
drmModeConnectorPtr koutput = sna_output->mode_output;
- drmModePropertyBlobPtr edid_blob = NULL;
+ void *raw = NULL;
+ int raw_length = 0;
xf86MonPtr mon = NULL;
int i;
/* look for an EDID property */
for (i = 0; i < koutput->count_props; i++) {
struct drm_mode_get_property prop;
+ struct drm_mode_get_blob blob;
+ void *tmp;
VG_CLEAR(prop);
prop.prop_id = koutput->props[i];
@@ -1091,23 +1094,41 @@ sna_output_attach_edid(xf86OutputPtr output)
if (strcmp(prop.name, "EDID"))
continue;
- drmModeFreePropertyBlob(edid_blob);
- edid_blob = drmModeGetPropertyBlob(sna->kgem.fd,
- koutput->prop_values[i]);
- }
+ VG_CLEAR(blob);
+ blob.length = 0;
+ blob.data =0;
+ blob.blob_id = koutput->prop_values[i];
+
+ if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob))
+ continue;
- if (edid_blob) {
- mon = xf86InterpretEDID(output->scrn->scrnIndex,
- edid_blob->data);
+ DBG(("%s: retreiving blob (property %d, id=%d, value=%ld), length=%d\n",
+ __FUNCTION__, i, koutput->props[i], (long)koutput->prop_values[i],
+ blob.length));
- if (mon && edid_blob->length > 128)
+ tmp = malloc(blob.length);
+ if (tmp == NULL)
+ continue;
+
+ blob.data = (uintptr_t)tmp;
+ if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob)) {
+ free(tmp);
+ continue;
+ }
+
+ free(raw);
+ raw = tmp;
+ raw_length = blob.length;
+ }
+
+ if (raw) {
+ mon = xf86InterpretEDID(output->scrn->scrnIndex, raw);
+ if (mon && raw_length > 128)
mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
}
xf86OutputSetEDID(output, mon);
-
- if (0&&edid_blob)
- drmModeFreePropertyBlob(edid_blob);
+ free(raw);
}
static DisplayModePtr