From 7337f558d8bae26e626305fc478d070368bd86cd Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 31 May 2016 09:32:31 +0100 Subject: sna: Use physical output size from the kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have a conflict between Xorg and the kernel, once again, over the meaning of the EDID. Since the kernel supplies us with the physical size of the connector, let's place the burden of trust on the kernel and ignore the quirky behaviour of Xorg. Suggested-by: Ville Syrjälä References: https://bugs.freedesktop.org/show_bug.cgi?id=96255 Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 9c1d8fda..3a627a46 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -3445,6 +3445,8 @@ sna_output_detect(xf86OutputPtr output) switch (compat_conn.conn.connection) { case DRM_MODE_CONNECTED: sna_output->status = XF86OutputStatusConnected; + output->mm_width = compat_conn.conn.mm_width; + output->mm_height = compat_conn.conn.mm_height; break; case DRM_MODE_DISCONNECTED: sna_output->status = XF86OutputStatusDisconnected; @@ -3487,6 +3489,27 @@ sna_output_mode_valid(xf86OutputPtr output, DisplayModePtr mode) return MODE_OK; } +static void sna_output_set_parsed_edid(xf86OutputPtr output, xf86MonPtr mon) +{ + unsigned conn_mm_width, conn_mm_height; + + /* We set the output size based on values from the kernel */ + conn_mm_width = output->mm_width; + conn_mm_height = output->mm_height; + + xf86OutputSetEDID(output, mon); + + if (output->mm_width != conn_mm_width || output->mm_height != conn_mm_height) { + DBG(("%s)%s): kernel and Xorg disagree over physical size: kernel=%dx%dmm, Xorg=%dx%dmm\n", + __FUNCION__, output->name, + conn_mm_width, conn_mm_height, + output->mm_width, output->mm_height)); + } + + output->mm_width = conn_mm_width; + output->mm_height = conn_mm_height; +} + static void sna_output_attach_edid(xf86OutputPtr output) { @@ -3594,7 +3617,7 @@ skip_read: } done: - xf86OutputSetEDID(output, mon); + sna_output_set_parsed_edid(output, mon); if (raw) { sna_output->edid_raw = raw; sna_output->edid_len = blob.length; -- cgit v1.2.3