summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSultan Alsawaf <sultan@kerneltoast.com>2023-01-22 21:02:45 -0800
committerSultan Alsawaf <sultan@kerneltoast.com>2023-02-28 22:43:37 -0800
commit8b5fd556582ba040aad5beeeb4c024e5dae40eba (patch)
tree8cc6a9ba06139ccdcf73af5c94c6f008027c3bfe
parent35975d90546931de10b014a222a6051f34c62e57 (diff)
downloadxserver-8b5fd556582ba040aad5beeeb4c024e5dae40eba.tar.gz
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>
-rw-r--r--hw/xfree86/drivers/modesetting/present.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
index e147f3eda..acc299f3b 100644
--- a/hw/xfree86/drivers/modesetting/present.c
+++ b/hw/xfree86/drivers/modesetting/present.c
@@ -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;