diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-10-30 15:26:02 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-10-30 15:46:55 +0000 |
commit | 0196fa2da8140853e9542bf41b63cbd345e857be (patch) | |
tree | 26f740b513f8f3a4499d94dca72a3f23c575f77f | |
parent | be3748802398a741208715233d36935378ceff58 (diff) |
sna: Handle getblob failures gracefully
As the EDID property blob may be lost at time after we perform the
detection probe (as the kernel may recreate the EDID blob at any time with
a new id), presume that if there is no matching property that we can
simply keep using the last known EDID.
References: https://bugs.freedesktop.org/show_bug.cgi?id=92728
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index e2969b63..5cacedcd 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -3250,8 +3250,12 @@ sna_output_attach_edid(xf86OutputPtr output) old = NULL; blob.blob_id = sna_output->prop_values[sna_output->edid_idx]; - DBG(("%s: attaching EDID id=%d, current=%d\n", - __FUNCTION__, blob.blob_id, sna_output->edid_blob_id)); + if (!blob.blob_id) + goto done; + + DBG(("%s(%s): attaching EDID id=%d, current=%d\n", + __FUNCTION__, output->name, + blob.blob_id, sna_output->edid_blob_id)); if (blob.blob_id == sna_output->edid_blob_id && 0) { /* sigh */ if (output->MonInfo) { /* XXX the property keeps on disappearing... */ @@ -3269,11 +3273,14 @@ sna_output_attach_edid(xf86OutputPtr output) } blob.data = (uintptr_t)raw; - if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob)) - goto done; + if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob)) { + DBG(("%s(%s): failed to read blob, reusing previous\n", + __FUNCTION__, output->name)); + goto skip_read; + } - DBG(("%s: retrieving blob id=%d, length=%d\n", - __FUNCTION__, blob.blob_id, blob.length)); + DBG(("%s(%s): retrieving blob id=%d, length=%d\n", + __FUNCTION__, output->name, blob.blob_id, blob.length)); if (blob.length > sna_output->edid_len) { raw = realloc(raw, blob.length); @@ -3300,6 +3307,8 @@ sna_output_attach_edid(xf86OutputPtr output) if (old && blob.length == sna_output->edid_len && memcmp(old, raw, blob.length) == 0) { + DBG(("%s(%s): EDID + MonInfo is unchanged\n", + __FUNCTION__, output->name)); assert(sna_output->edid_raw == raw); sna_output->edid_blob_id = blob.blob_id; RRChangeOutputProperty(output->randr_output, |