diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index 3f185489e..5176b6d40 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -655,8 +655,7 @@ ms_tearfree_do_flips(ScreenPtr pScreen) drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree; - /* Skip disabled CRTCs and those which aren't using TearFree */ - if (!trf->buf[0].px || !crtc->scrn->vtSema || !xf86_crtc_on(crtc)) + if (!ms_tearfree_is_active_on_crtc(crtc)) continue; /* Skip if the last flip is still pending, a DRI client is flipping, or diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h index 605fd8530..a54bf28ff 100644 --- a/hw/xfree86/drivers/modesetting/driver.h +++ b/hw/xfree86/drivers/modesetting/driver.h @@ -249,3 +249,4 @@ Bool ms_do_tearfree_flip(ScreenPtr screen, xf86CrtcPtr crtc); int ms_flush_drm_events(ScreenPtr screen); Bool ms_window_has_variable_refresh(modesettingPtr ms, WindowPtr win); void ms_present_set_screen_vrr(ScrnInfoPtr scrn, Bool vrr_enabled); +Bool ms_tearfree_is_active_on_crtc(xf86CrtcPtr crtc); diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c index 94437c0f3..a804841fa 100644 --- a/hw/xfree86/drivers/modesetting/pageflip.c +++ b/hw/xfree86/drivers/modesetting/pageflip.c @@ -529,3 +529,13 @@ no_flip: return TRUE; } #endif + +Bool +ms_tearfree_is_active_on_crtc(xf86CrtcPtr crtc) +{ + drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree; + + /* If TearFree is enabled, XServer owns the VT, and the CRTC is active */ + return trf->buf[0].px && crtc->scrn->vtSema && xf86_crtc_on(crtc); +} diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c index acc299f3b..89fca1a9c 100644 --- a/hw/xfree86/drivers/modesetting/present.c +++ b/hw/xfree86/drivers/modesetting/present.c @@ -334,8 +334,7 @@ no_flip: drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private; drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree; - /* Check if TearFree is active on this CRTC and tell Present about it */ - if (trf->buf[0].px && scrn->vtSema && xf86_crtc_on(xf86_crtc)) { + if (ms_tearfree_is_active_on_crtc(xf86_crtc)) { if (trf->flip_seq) /* The driver has a TearFree flip pending */ *reason = PRESENT_FLIP_REASON_DRIVER_TEARFREE_FLIPPING;