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>
This commit is contained in:
Adam Jackson 2018-08-27 16:42:42 -04:00 committed by Adam Jackson
parent 3d06d111b2
commit d791c8e5ab
4 changed files with 1 additions and 33 deletions

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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();