modesetting: Improve TearFree state check in ms_present_check_flip

Check that the VT is owned and that the CRTC is on before exporting info to
Present stating that TearFree is available. Also, since `trf->buf[0].px` is
checked, the `ms->drmmode.tearfree_enable` check is redundant and can
therefore be removed.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
This commit is contained in:
Sultan Alsawaf 2023-01-22 21:02:45 -08:00
parent 35975d9054
commit 8b5fd55658

View File

@ -329,12 +329,13 @@ ms_present_check_flip(RRCrtcPtr crtc,
no_flip:
/* Export some info about TearFree if Present can't flip anyway */
if (reason && ms->drmmode.tearfree_enable) {
if (reason) {
xf86CrtcPtr xf86_crtc = crtc->devPrivate;
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree;
if (trf->buf[0].px) {
/* 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 (trf->flip_seq)
/* The driver has a TearFree flip pending */
*reason = PRESENT_FLIP_REASON_DRIVER_TEARFREE_FLIPPING;