diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index df1abea17..fde65e0e5 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -1220,6 +1220,14 @@ PreInit(ScrnInfoPtr pScrn, int flags) #endif } + /* + * Use "atomic modesetting disable" request to detect if the kms driver is + * atomic capable, regardless if we will actually use atomic modesetting. + * This is effectively a no-op, we only care about the return status code. + */ + ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 0); + ms->atomic_modeset_capable = (ret == 0); + if (xf86ReturnOptValBool(ms->drmmode.Options, OPTION_ATOMIC, FALSE)) { ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 1); ms->atomic_modeset = (ret == 0); diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h index 114971048..6217a0e64 100644 --- a/hw/xfree86/drivers/modesetting/driver.h +++ b/hw/xfree86/drivers/modesetting/driver.h @@ -116,6 +116,7 @@ typedef struct _modesettingRec { * Page flipping stuff. * @{ */ + Bool atomic_modeset_capable; Bool atomic_modeset; Bool pending_modeset; /** @} */ diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c index 916a15303..b90a1b8ac 100644 --- a/hw/xfree86/drivers/modesetting/present.c +++ b/hw/xfree86/drivers/modesetting/present.c @@ -267,8 +267,11 @@ ms_present_check_unflip(RRCrtcPtr crtc, if (num_crtcs_on == 0) return FALSE; - /* Check stride, can't change that on flip */ - if (!ms->atomic_modeset && + /* + * Check stride, can't change that reliably on flip on some drivers, unless + * the kms driver is atomic_modeset_capable. + */ + if (!ms->atomic_modeset_capable && pixmap->devKind != drmmode_bo_get_pitch(&ms->drmmode.front_bo)) return FALSE;