modesetting: Introduce ms_tearfree_is_active_on_crtc helper
There is more than one place with the confusing TearFree state check for a CRTC. Instead of open-coding the TearFree check everywhere, introduce a helper, ms_tearfree_is_active_on_crtc, to cover the TearFree state checks. Suggested-by: Martin Roukala <martin.roukala@mupuf.org> Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
This commit is contained in:
parent
8b5fd55658
commit
18b14ea1f6
|
@ -655,8 +655,7 @@ ms_tearfree_do_flips(ScreenPtr pScreen)
|
||||||
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
||||||
drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree;
|
drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree;
|
||||||
|
|
||||||
/* Skip disabled CRTCs and those which aren't using TearFree */
|
if (!ms_tearfree_is_active_on_crtc(crtc))
|
||||||
if (!trf->buf[0].px || !crtc->scrn->vtSema || !xf86_crtc_on(crtc))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Skip if the last flip is still pending, a DRI client is flipping, or
|
/* Skip if the last flip is still pending, a DRI client is flipping, or
|
||||||
|
|
|
@ -249,3 +249,4 @@ Bool ms_do_tearfree_flip(ScreenPtr screen, xf86CrtcPtr crtc);
|
||||||
int ms_flush_drm_events(ScreenPtr screen);
|
int ms_flush_drm_events(ScreenPtr screen);
|
||||||
Bool ms_window_has_variable_refresh(modesettingPtr ms, WindowPtr win);
|
Bool ms_window_has_variable_refresh(modesettingPtr ms, WindowPtr win);
|
||||||
void ms_present_set_screen_vrr(ScrnInfoPtr scrn, Bool vrr_enabled);
|
void ms_present_set_screen_vrr(ScrnInfoPtr scrn, Bool vrr_enabled);
|
||||||
|
Bool ms_tearfree_is_active_on_crtc(xf86CrtcPtr crtc);
|
||||||
|
|
|
@ -529,3 +529,13 @@ no_flip:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
||||||
|
}
|
||||||
|
|
|
@ -334,8 +334,7 @@ no_flip:
|
||||||
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
|
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
|
||||||
drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree;
|
drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree;
|
||||||
|
|
||||||
/* Check if TearFree is active on this CRTC and tell Present about it */
|
if (ms_tearfree_is_active_on_crtc(xf86_crtc)) {
|
||||||
if (trf->buf[0].px && scrn->vtSema && xf86_crtc_on(xf86_crtc)) {
|
|
||||||
if (trf->flip_seq)
|
if (trf->flip_seq)
|
||||||
/* The driver has a TearFree flip pending */
|
/* The driver has a TearFree flip pending */
|
||||||
*reason = PRESENT_FLIP_REASON_DRIVER_TEARFREE_FLIPPING;
|
*reason = PRESENT_FLIP_REASON_DRIVER_TEARFREE_FLIPPING;
|
||||||
|
|
Loading…
Reference in New Issue