From 0b87b0c49a5208383e7472b58d36d3a558144496 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 21 Oct 2013 11:06:30 +0100 Subject: sna: Suppress log messages for unchanging EDID Whenever we reprobe an unchanging output and re-read its EDID, we emit a useless log message. Previously this was squelched by trying to spot when an EDID was unchanged through the use of its blob.id, however we need to do a complete check on the contents in case the kernel returns us a new EDID with the old id. So make a temporary copy of the current EDID data and only squelch the log messages if the new EDID is an exact match. Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 6da56be8..a7957eb9 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -1951,7 +1951,7 @@ sna_output_attach_edid(xf86OutputPtr output) struct sna *sna = to_sna(output->scrn); struct sna_output *sna_output = output->driver_private; struct drm_mode_get_blob blob; - void *raw = NULL; + void *old, *raw = NULL; xf86MonPtr mon = NULL; if (sna_output->edid_idx == -1) @@ -1960,6 +1960,12 @@ sna_output_attach_edid(xf86OutputPtr output) raw = sna_output->edid_raw; blob.length = sna_output->edid_len; + if (blob.length && output->MonInfo) { + old = alloca(blob.length); + memcpy(old, raw, blob.length); + } else + 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)); @@ -1997,6 +2003,20 @@ sna_output_attach_edid(xf86OutputPtr output) goto done; } + if (old && + blob.length == sna_output->edid_len && + memcmp(old, raw, blob.length) == 0) { + assert(sna_output->edid_raw == raw); + sna_output->edid_blob_id = blob.blob_id; + RRChangeOutputProperty(output->randr_output, + MakeAtom("EDID", strlen("EDID"), TRUE), + XA_INTEGER, 8, PropModeReplace, + sna_output->edid_len, + sna_output->edid_raw, + FALSE, FALSE); + return; + } + skip_read: if (raw) { mon = xf86InterpretEDID(output->scrn->scrnIndex, raw); -- cgit v1.2.3