From d791c8e5abc174ae589d954b0beb51d232f60019 Mon Sep 17 00:00:00 2001 From: Adam Jackson <ajax@redhat.com> Date: Mon, 27 Aug 2018 16:42:42 -0400 Subject: [PATCH] dga: Make shutdown less magical and/or terrifying DGAShutdown() walks every screen and attempts to reset the mode. That's maybe a reasonable thing to do, although the explicit loop is certainly a bad smell. In ddxGiveUp it's called after we've torn down the vga arbiter - and in fact most of the rest of screen state - which is... very very bad. The other place it's called is from the Control-Alt-BackSpace handler, where we don't even attempt to do vga arb setup, and where in any case we're going to escape the main loop eventually anyway. Move all that cleanup work inside DGACloseScreen. This means it happens earlier in server teardown than previously, but not in a way you're ever going to be upset about. Signed-off-by: Adam Jackson <ajax@redhat.com> --- hw/xfree86/common/dgaproc.h | 1 - hw/xfree86/common/xf86DGA.c | 23 +---------------------- hw/xfree86/common/xf86Events.c | 3 --- hw/xfree86/common/xf86Init.c | 7 ------- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/hw/xfree86/common/dgaproc.h b/hw/xfree86/common/dgaproc.h index 7925bd4838..b9f0030560 100644 --- a/hw/xfree86/common/dgaproc.h +++ b/hw/xfree86/common/dgaproc.h @@ -56,7 +56,6 @@ typedef struct { extern Bool DGAScreenAvailable(ScreenPtr pScreen); extern Bool DGAActive(int Index); -extern void DGAShutdown(void); extern Bool DGAVTSwitch(void); extern Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index, diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index de805c4c05..fa70ba2f03 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -268,7 +268,7 @@ DGACloseScreen(ScreenPtr pScreen) DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); mieqSetHandler(ET_DGAEvent, NULL); - + pScreenPriv->pScrn->SetDGAMode(pScreenPriv->pScrn, 0, NULL); FreeMarkedVisuals(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; @@ -276,9 +276,6 @@ DGACloseScreen(ScreenPtr pScreen) pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->UninstallColormap = pScreenPriv->UninstallColormap; - /* DGAShutdown() should have ensured that no DGA - screen were active by here */ - free(pScreenPriv); return ((*pScreen->CloseScreen) (pScreen)); @@ -576,24 +573,6 @@ DGAActive(int index) return FALSE; } -/* Called by the event code in case the server is abruptly terminated */ - -void -DGAShutdown(void) -{ - ScrnInfoPtr pScrn; - int i; - - if (!DGAScreenKeyRegistered) - return; - - for (i = 0; i < screenInfo.numScreens; i++) { - pScrn = xf86Screens[i]; - - (void) (*pScrn->SetDGAMode) (pScrn, 0, NULL); - } -} - /* Called by the extension to initialize a mode */ static int diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 455a0eccbd..80676c6694 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -166,9 +166,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) case ACTION_TERMINATE: if (!xf86Info.dontZap) { xf86Msg(X_INFO, "Server zapped. Shutting down.\n"); -#ifdef XFreeXDGA - DGAShutdown(); -#endif GiveUp(0); } break; diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 8773a47e86..2ec15f027e 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -57,9 +57,6 @@ #include "systemd-logind.h" #include "loaderProcs.h" -#ifdef XFreeXDGA -#include "dgaproc.h" -#endif #define XF86_OS_PRIVS #include "xf86.h" @@ -884,10 +881,6 @@ ddxGiveUp(enum ExitCode error) xf86Screens[i]->vtSema = FALSE; } -#ifdef XFreeXDGA - DGAShutdown(); -#endif - if (xorgHWOpenConsole) xf86CloseConsole(); -- GitLab