diff --git a/configure.ac b/configure.ac index 445a80b3c..196d78b96 100644 --- a/configure.ac +++ b/configure.ac @@ -2207,7 +2207,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 $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 $RENDER_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB" XDMX_SYS_LIBS="$DMXMODULES_LIBS" AC_SUBST([XDMX_CFLAGS]) AC_SUBST([XDMX_LIBS]) diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c index 504e5a00b..5b860481c 100644 --- a/hw/dmx/dmxextension.c +++ b/hw/dmx/dmxextension.c @@ -68,9 +68,6 @@ * _any_ header files. */ extern FontPtr defaultFont; -/* Hack to get Present to build (present requires RandR) */ -RESTYPE RRCrtcType; - /** This routine provides information to the DMX protocol extension * about a particular screen. */ Bool diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index 07f147ceb..e0bb3b704 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -109,8 +109,6 @@ Bool dmxGLXSyncSwap = FALSE; Bool dmxGLXFinishSwap = FALSE; #endif -RESTYPE RRProviderType = 0; - Bool dmxIgnoreBadFontPaths = FALSE; Bool dmxAddRemoveScreens = FALSE; diff --git a/present/present_scmd.c b/present/present_scmd.c index efe1fd698..c8c701d72 100644 --- a/present/present_scmd.c +++ b/present/present_scmd.c @@ -634,8 +634,9 @@ present_scmd_update_window_crtc(WindowPtr window, RRCrtcPtr crtc, uint64_t new_m return; } - /* Crtc may have been turned off, just use whatever previous MSC we'd seen from this CRTC. */ - if (present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success) + /* Crtc may have been turned off or be destroyed, just use whatever previous MSC we'd seen from this CRTC. */ + if (!RRCrtcExists(window->drawable.pScreen, window_priv->crtc) || + present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success) old_msc = window_priv->msc; window_priv->msc_offset += new_msc - old_msc; diff --git a/randr/randrstr.h b/randr/randrstr.h index 44076f496..8f427a48e 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -642,6 +642,11 @@ extern _X_EXPORT void */ extern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate); +/* + * Tests if findCrtc belongs to pScreen or secondary screens + */ +extern _X_EXPORT Bool RRCrtcExists(ScreenPtr pScreen, RRCrtcPtr findCrtc); + /* * Set the allowed rotations on a CRTC */ diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index c8626b982..3a9b620ab 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -27,7 +27,7 @@ #include -RESTYPE RRCrtcType; +RESTYPE RRCrtcType = 0; /* * Notify the CRTC of some change @@ -960,6 +960,47 @@ RRCrtcGammaGet(RRCrtcPtr crtc) return ret; } +static Bool RRCrtcInScreen(ScreenPtr pScreen, RRCrtcPtr findCrtc) +{ + rrScrPrivPtr pScrPriv; + int c; + + if (pScreen == NULL) + return FALSE; + + if (findCrtc == NULL) + return FALSE; + + if (!dixPrivateKeyRegistered(rrPrivKey)) + return FALSE; + + pScrPriv = rrGetScrPriv(pScreen); + for (c = 0; c < pScrPriv->numCrtcs; c++) { + if (pScrPriv->crtcs[c] == findCrtc) + return TRUE; + } + + return FALSE; +} + +Bool RRCrtcExists(ScreenPtr pScreen, RRCrtcPtr findCrtc) +{ + ScreenPtr secondary= NULL; + + if (RRCrtcInScreen(pScreen, findCrtc)) + return TRUE; + + xorg_list_for_each_entry(secondary, &pScreen->secondary_list, secondary_head) { + if (!secondary->is_output_secondary) + continue; + if (RRCrtcInScreen(secondary, findCrtc)) + return TRUE; + } + + return FALSE; +} + + /* * Notify the extension that the Crtc gamma has been changed * The driver calls this whenever it has changed the gamma values diff --git a/randr/rrprovider.c b/randr/rrprovider.c index 617185cf7..d628a20d4 100644 --- a/randr/rrprovider.c +++ b/randr/rrprovider.c @@ -28,7 +28,7 @@ #include -RESTYPE RRProviderType; +RESTYPE RRProviderType = 0; /* * Initialize provider type error value