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>
This commit is contained in:
Chris Wilson 2015-10-30 15:26:02 +00:00
parent be37488023
commit 0196fa2da8
1 changed files with 15 additions and 6 deletions

View File

@ -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,