xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 8 09:46:46 UTC 2021


 hw/xfree86/drivers/modesetting/drmmode_display.c |    2 +-
 hw/xfree86/drivers/modesetting/modesetting.man   |    7 +++++++
 hw/xfree86/drivers/modesetting/vblank.c          |   11 +++++++++--
 3 files changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 4b75e65766a9ef3a26d4c1c9d7af9fc6d1d7be5b
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Fri Oct 1 09:47:41 2021 +0200

    modesetting: Consider RandR primary output for selectioh of sync crtc.
    
    The "sync crtc" is the crtc used to drive the display timing of a
    drawable under DRI2 and DRI3/Present. If a drawable intersects
    multiple video outputs, then normally the crtc is chosen which has
    the largest intersection area with the drawable.
    
    If multiple outputs / crtc's have exacty the same intersection
    area then the crtc chosen was simply the first one with maximum
    intersection. Iow. the choice was random, depending on plugging
    order of displays.
    
    This adds the ability to choose a preferred output in such a tie
    situation. The RandR output marked as "primary output" is chosen
    on such a tie.
    
    This new behaviour and its implementation is consistent with other
    video ddx drivers. See amdgpu-ddx, ati-ddx and nouveau-ddx for
    reference. This commit is a straightforward port from amdgpu-ddx.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>

diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
index c8da476b5..ea9e7a88c 100644
--- a/hw/xfree86/drivers/modesetting/vblank.c
+++ b/hw/xfree86/drivers/modesetting/vblank.c
@@ -120,7 +120,8 @@ static RRCrtcPtr
 rr_crtc_covering_box(ScreenPtr pScreen, BoxPtr box, Bool screen_is_xf86_hint)
 {
     rrScrPrivPtr pScrPriv;
-    RRCrtcPtr crtc, best_crtc;
+    RROutputPtr primary_output;
+    RRCrtcPtr crtc, best_crtc, primary_crtc;
     int coverage, best_coverage;
     int c;
     BoxRec crtc_box, cover_box;
@@ -136,6 +137,11 @@ rr_crtc_covering_box(ScreenPtr pScreen, BoxPtr box, Bool screen_is_xf86_hint)
     if (!pScrPriv)
         return NULL;
 
+    primary_crtc = NULL;
+    primary_output = RRFirstOutput(pScreen);
+    if (primary_output)
+        primary_crtc = primary_output->crtc;
+
     for (c = 0; c < pScrPriv->numCrtcs; c++) {
         crtc = pScrPriv->crtcs[c];
 
@@ -146,7 +152,8 @@ rr_crtc_covering_box(ScreenPtr pScreen, BoxPtr box, Bool screen_is_xf86_hint)
         rr_crtc_box(crtc, &crtc_box);
         box_intersect(&cover_box, &crtc_box, box);
         coverage = box_area(&cover_box);
-        if (coverage > best_coverage) {
+        if ((coverage > best_coverage) ||
+            (coverage == best_coverage && crtc == primary_crtc)) {
             best_crtc = crtc;
             best_coverage = coverage;
         }
commit 017ce263376aa64a495c4d71a140a24b1dff7054
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Fri Oct 1 08:49:10 2021 +0200

    modesetting: Handle mixed VRR and non-VRR display setups better.
    
    In a setup with both VRR capable and non-VRR capable displays,
    it was so far inconsistent if the driver would allow use of
    VRR support or not, as "is_connector_vrr_capable" was set to
    whatever the capabilities of the last added drm output were.
    Iow. the plugging order of monitors determined the outcome.
    
    Fix this: Now if at least one display is VRR capable, the driver
    will treat an X-Screen as capable for VRR, plugging order no
    longer matters.
    
    Tested with a dual-display setup with one VRR monitor and one
    non-VRR monitor. This is also beneficial with the new Option
    "AsyncFlipSecondaries".
    
    When we are at it, also add some so far missing description of
    the "VariableRefresh" driver option, copied from amdgpu-ddx.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 5dfdd30db..21c9222e1 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -3309,7 +3309,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
         }
     }
 
-    ms->is_connector_vrr_capable =
+    ms->is_connector_vrr_capable |=
 	         drmmode_connector_check_vrr_capable(drmmode->fd,
                                                   drmmode_output->output_id);
     return 1;
diff --git a/hw/xfree86/drivers/modesetting/modesetting.man b/hw/xfree86/drivers/modesetting/modesetting.man
index bb948380b..71790011e 100644
--- a/hw/xfree86/drivers/modesetting/modesetting.man
+++ b/hw/xfree86/drivers/modesetting/modesetting.man
@@ -71,6 +71,13 @@ One of \*qglamor\*q or \*qnone\*q.  Default: glamor.
 Enable DRI3 page flipping.  The default is
 .B on.
 .TP
+.BI "Option \*qVariableRefresh\*q \*q" boolean \*q
+Enables support for enabling variable refresh on the Screen's CRTCs
+when an suitable application is flipping via the Present extension.
+.br
+The default is
+.B off.
+.TP
 .BI "Option \*qAsyncFlipSecondaries\*q \*q" boolean \*q
 Use async flips for secondary video outputs on multi-display setups. If a screen
 has multiple displays attached and DRI3 page flipping is used, then only one of


More information about the xorg-commit mailing list