xserver: Branch 'master'

Adam Jackson ajax at kemper.freedesktop.org
Tue Feb 27 15:03:42 UTC 2018


 hw/xfree86/drivers/modesetting/vblank.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit efe9e3e9ff96a06f50d94dc93ad2c19085fa3d09
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Feb 27 06:51:59 2018 +0100

    modesetting: Fix fallback for lack of new vblank kernel API.
    
    Turns out that the kernel DRM ioctl handling returns EINVAL
    instead of ENOTTY if one tries to call the new drmCrtcGetSequence()
    or drmCrtcQueueSequence() ioctl's introduced in Linux 4.15 on an
    older kernel where they are missing. This causes the fallback code
    not to fall back to the old drmWaitVblank() ioctl and thereby
    failure of vblank stuff.
    
    E.g., on Linux 4.13, glxgears -info runs unthrottled at 10000 fps
    instead of 60 fps. Also breakage of OML_sync_control extension.
    
    Check for errno != EINVAL before setting has_queue_sequence = TRUE.
    
    Additionally in case of supported drmCrtcQueueSequence(), set
    has_queue_sequence = TRUE on success, or we might get at
    least a temporary failure in ms_queue_vblank().
    
    One slight ambiguity is that we can also get EINVAL if
    drm_crtc_vblank_get() fails in the kernel, so if that
    happened at first invocation of the new api, we'd fall
    back to drmWaitVblank() and then fail there, instead of
    failing in the new api, but the end result would be the
    same.
    
    Fixes: 44d5f2eb8a2f ("xf86-video-modesetting: Support new vblank kernel API [v2]")
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Cc: Keith Packard <keithp at keithp.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
index e7879f504..1d331ccdb 100644
--- a/hw/xfree86/drivers/modesetting/vblank.c
+++ b/hw/xfree86/drivers/modesetting/vblank.c
@@ -189,7 +189,7 @@ ms_get_kernel_ust_msc(xf86CrtcPtr crtc,
 
         ret = drmCrtcGetSequence(ms->fd, drmmode_crtc->mode_crtc->crtc_id,
                                  msc, &ns);
-        if (ret != -1 || errno != ENOTTY) {
+        if (ret != -1 || (errno != ENOTTY && errno != EINVAL)) {
             ms->has_queue_sequence = TRUE;
             if (ret == 0)
                 *ust = ns / 1000;
@@ -246,10 +246,11 @@ ms_queue_vblank(xf86CrtcPtr crtc, ms_queue_flag flags,
             if (ret == 0) {
                 if (msc_queued)
                     *msc_queued = ms_kernel_msc_to_crtc_msc(crtc, kernel_queued);
+                ms->has_queue_sequence = TRUE;
                 return TRUE;
             }
 
-            if (ret != -1 || errno != ENOTTY) {
+            if (ret != -1 || (errno != ENOTTY && errno != EINVAL)) {
                 ms->has_queue_sequence = TRUE;
                 goto check;
             }


More information about the xorg-commit mailing list