From db1326cd6625747e4036e6cdc75bc7a0e1b0426b Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Thu, 26 Jan 2017 18:13:53 +0800 Subject: [PATCH] present: disable page flip only when a slave crtc is active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents the tearing of moving window in a composite WM desktop when output slave is attached but none of its crtc is really active. [1.19: Also fix DMX_LIBS= in configure.ac so it still links - ajax] Signed-off-by: Qiang Yu Reviewed-by: Michel Dänzer (cherry picked from commit bb9128fdc86decd6f6e3b0e145011a8c08b1d2b5) --- configure.ac | 2 +- present/present.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index a265ab566..e9fa1c721 100644 --- a/configure.ac +++ b/configure.ac @@ -2334,7 +2334,7 @@ if test "x$DMX" = xyes; then fi DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC" XDMX_CFLAGS="$DMXMODULES_CFLAGS" - XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $RANDR_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB" + XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $PRESENT_LIB $RANDR_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $DRI3_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB" XDMX_SYS_LIBS="$DMXMODULES_LIBS" AC_SUBST([XDMX_CFLAGS]) AC_SUBST([XDMX_LIBS]) diff --git a/present/present.c b/present/present.c index ef8904537..c9c68dcba 100644 --- a/present/present.c +++ b/present/present.c @@ -117,6 +117,18 @@ present_flip_pending_pixmap(ScreenPtr screen) return screen_priv->flip_pending->pixmap; } +static Bool +present_check_output_slaves_active(ScreenPtr pScreen) +{ + ScreenPtr pSlave; + + xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) { + if (RRHasScanoutPixmap(pSlave)) + return TRUE; + } + return FALSE; +} + static Bool present_check_flip(RRCrtcPtr crtc, WindowPtr window, @@ -145,7 +157,7 @@ present_check_flip(RRCrtcPtr crtc, return FALSE; /* Fail to flip if we have slave outputs */ - if (screen->output_slaves) + if (screen->output_slaves && present_check_output_slaves_active(screen)) return FALSE; /* Make sure the window hasn't been redirected with Composite */