From e19d17a41b299124cfdc0fe4cc9e658e74224ae92de153a0db01fe8297ab09d9 Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Thu, 11 Nov 2021 09:29:13 +0000 Subject: [PATCH] - U_hw-xfree86-Propagate-physical-dimensions-from-DRM-co.patch * reverse apply this one to go back to fixed 96 dpi (gitlab fdo/xserver issue#1241) - N_fix-dpi-values.diff * back to version for xserver < 21.1.0 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=806 --- N_fix-dpi-values.diff | 8 +- ...gate-physical-dimensions-from-DRM-co.patch | 136 ++++++++++++++++++ xorg-x11-server.changes | 9 ++ xorg-x11-server.spec | 3 + 4 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 U_hw-xfree86-Propagate-physical-dimensions-from-DRM-co.patch diff --git a/N_fix-dpi-values.diff b/N_fix-dpi-values.diff index 0197ff2..7963943 100644 --- a/N_fix-dpi-values.diff +++ b/N_fix-dpi-values.diff @@ -6,7 +6,7 @@ Index: hw/xfree86/common/xf86Helper.c =================================================================== --- hw/xfree86/common/xf86Helper.c.orig +++ hw/xfree86/common/xf86Helper.c -@@ -883,12 +883,22 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int +@@ -875,12 +875,22 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) { from = X_CONFIG; if (pScrn->widthmm > 0) { @@ -33,9 +33,9 @@ Index: hw/xfree86/common/xf86Helper.c } if (pScrn->xDpi > 0 && pScrn->yDpi <= 0) pScrn->yDpi = pScrn->xDpi; -@@ -927,12 +937,22 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int - pScrn->widthmm = probedWidthmm; - pScrn->heightmm = probedHeightmm; +@@ -919,12 +929,22 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int + pScrn->widthmm = ddcWidthmm; + pScrn->heightmm = ddcHeightmm; if (pScrn->widthmm > 0) { - pScrn->xDpi = - (int) ((double) pScrn->virtualX * MMPERINCH / pScrn->widthmm); diff --git a/U_hw-xfree86-Propagate-physical-dimensions-from-DRM-co.patch b/U_hw-xfree86-Propagate-physical-dimensions-from-DRM-co.patch new file mode 100644 index 0000000..bbaa418 --- /dev/null +++ b/U_hw-xfree86-Propagate-physical-dimensions-from-DRM-co.patch @@ -0,0 +1,136 @@ +From 05b3c681ea2f478c0cb941c2f8279919cf78de6d Mon Sep 17 00:00:00 2001 +From: Daniel Strnad +Date: Tue, 19 May 2020 15:52:35 +0200 +Subject: [PATCH] hw/xfree86: Propagate physical dimensions from DRM connector + +Physical dimmension of display can be obtained not just by configuration or +DDC, but also directly from kernel via drmModeGetConnector(). Until now +xserver silently discarded these values even when no configuration nor EDID +were present and fallbacked to default DPI. +--- + hw/xfree86/common/xf86Helper.c | 30 ++++++++++++++++++------------ + hw/xfree86/modes/xf86Crtc.c | 6 ++++-- + hw/xfree86/modes/xf86RandR12.c | 6 ++++++ + 3 files changed, 28 insertions(+), 14 deletions(-) + +diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c +index 0389945a7..d03382d26 100644 +--- a/hw/xfree86/common/xf86Helper.c ++++ b/hw/xfree86/common/xf86Helper.c +@@ -55,6 +55,7 @@ + #include "xf86Xinput.h" + #include "xf86InPriv.h" + #include "mivalidate.h" ++#include "xf86Crtc.h" + + /* For xf86GetClocks */ + #if defined(CSRG_BASED) || defined(__GNU__) +@@ -851,8 +852,9 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int y) + { + MessageType from = X_DEFAULT; + xf86MonPtr DDC = (xf86MonPtr) (pScrn->monitor->DDC); +- int ddcWidthmm, ddcHeightmm; ++ int probedWidthmm, probedHeightmm; + int widthErr, heightErr; ++ xf86OutputPtr compat = xf86CompatOutput(pScrn); + + /* XXX Maybe there is no need for widthmm/heightmm in ScrnInfoRec */ + pScrn->widthmm = pScrn->monitor->widthmm; +@@ -862,11 +864,15 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int y) + /* DDC gives display size in mm for individual modes, + * but cm for monitor + */ +- ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */ +- ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */ ++ probedWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */ ++ probedHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */ ++ } ++ else if (compat && compat->mm_width > 0 && compat->mm_height > 0) { ++ probedWidthmm = compat->mm_width; ++ probedHeightmm = compat->mm_height; + } + else { +- ddcWidthmm = ddcHeightmm = 0; ++ probedWidthmm = probedHeightmm = 0; + } + + if (monitorResolution > 0) { +@@ -892,15 +898,15 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int y) + pScrn->widthmm, pScrn->heightmm); + + /* Warn if config and probe disagree about display size */ +- if (ddcWidthmm && ddcHeightmm) { ++ if (probedWidthmm && probedHeightmm) { + if (pScrn->widthmm > 0) { +- widthErr = abs(ddcWidthmm - pScrn->widthmm); ++ widthErr = abs(probedWidthmm - pScrn->widthmm); + } + else { + widthErr = 0; + } + if (pScrn->heightmm > 0) { +- heightErr = abs(ddcHeightmm - pScrn->heightmm); ++ heightErr = abs(probedHeightmm - pScrn->heightmm); + } + else { + heightErr = 0; +@@ -909,17 +915,17 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int y) + /* Should include config file name for monitor here */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n", +- ddcWidthmm, ddcHeightmm, pScrn->widthmm, ++ probedWidthmm, probedHeightmm, pScrn->widthmm, + pScrn->heightmm); + } + } + } +- else if (ddcWidthmm && ddcHeightmm) { ++ else if (probedWidthmm && probedHeightmm) { + from = X_PROBED; + xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n", +- ddcWidthmm, ddcHeightmm); +- pScrn->widthmm = ddcWidthmm; +- pScrn->heightmm = ddcHeightmm; ++ probedWidthmm, probedHeightmm); ++ pScrn->widthmm = probedWidthmm; ++ pScrn->heightmm = probedHeightmm; + if (pScrn->widthmm > 0) { + pScrn->xDpi = + (int) ((double) pScrn->virtualX * MMPERINCH / pScrn->widthmm); +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index c6e89e66f..202791774 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -3256,8 +3256,10 @@ xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon) + free(output->MonInfo); + + output->MonInfo = edid_mon; +- output->mm_width = 0; +- output->mm_height = 0; ++ if (edid_mon) { ++ output->mm_width = 0; ++ output->mm_height = 0; ++ } + + if (debug_modes) { + xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n", +diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c +index 50cbd043e..d4651f4e8 100644 +--- a/hw/xfree86/modes/xf86RandR12.c ++++ b/hw/xfree86/modes/xf86RandR12.c +@@ -806,6 +806,12 @@ xf86RandR12CreateScreenResources(ScreenPtr pScreen) + mmWidth = output->conf_monitor->mon_width; + mmHeight = output->conf_monitor->mon_height; + } ++ else if (output && ++ (output->mm_width > 0 && ++ output->mm_height > 0)) { ++ mmWidth = output->mm_width; ++ mmHeight = output->mm_height; ++ } + else { + /* + * Otherwise, just set the screen to DEFAULT_DPI +-- +2.26.2 + diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index fdf3a5e..08624d2 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Nov 11 08:35:39 UTC 2021 - Stefan Dirsch + +- U_hw-xfree86-Propagate-physical-dimensions-from-DRM-co.patch + * reverse apply this one to go back to fixed 96 dpi (gitlab + fdo/xserver issue#1241) +- N_fix-dpi-values.diff + * back to version for xserver < 21.1.0 + ------------------------------------------------------------------- Sun Nov 7 09:22:47 UTC 2021 - Stefan Dirsch diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index d8ffd59..1ca2153 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -207,6 +207,7 @@ Patch1: N_default-module-path.diff Patch2: N_zap_warning_xserver.diff Patch3: N_driver-autoconfig.diff Patch4: N_fix_fglrx_screendepth_issue.patch +Patch5: U_hw-xfree86-Propagate-physical-dimensions-from-DRM-co.patch Patch6: N_fix-dpi-values.diff Patch7: N_Install-Avoid-failure-on-wrapper-installation.patch Patch8: u_xorg-wrapper-Drop-supplemental-group-IDs.patch @@ -361,6 +362,8 @@ sh %{SOURCE92} --verify . %{SOURCE91} %patch2 -p1 %patch3 -p0 %patch4 -p0 +# back to 96 dpi fix +%patch5 -p1 -R %patch6 -p0 %patch7 -p1 %patch8 -p1