summaryrefslogtreecommitdiff
path: root/hw/xfree86/common
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-11-20 14:28:13 -0500
committerAdam Jackson <ajax@redhat.com>2018-09-28 16:25:12 -0400
commita23eba2a91024d27da45e5aee1f4215f7ec2ae82 (patch)
treefeca8c7ccfdf82d5fa7a5f588d47e793a21df04b /hw/xfree86/common
parentd78ac2f15913bf6f00e06986cc7db0ade9ebd806 (diff)
dix: Merge AbortDDX into ddxGiveUp
These are so close to identical that most DDXes implement one in terms of the other. All the relevant cases can be distinguished by the error code, so merge the functions together to make things simpler. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r--hw/xfree86/common/xf86Configure.c4
-rw-r--r--hw/xfree86/common/xf86Init.c65
2 files changed, 25 insertions, 44 deletions
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 44e759166..4347f6d2f 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -822,7 +822,7 @@ DoConfigure(void)
bail:
OsCleanup(TRUE);
- AbortDDX(EXIT_ERR_CONFIGURE);
+ ddxGiveUp(EXIT_ERR_CONFIGURE);
fflush(stderr);
exit(0);
}
@@ -875,7 +875,7 @@ DoShowOptions(void)
}
bail:
OsCleanup(TRUE);
- AbortDDX(EXIT_ERR_DRIVERS);
+ ddxGiveUp(EXIT_ERR_DRIVERS);
fflush(stderr);
exit(0);
}
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ef8d4faf6..6c25eda73 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -809,6 +809,29 @@ ddxGiveUp(enum ExitCode error)
{
int i;
+ if (error == EXIT_ERR_ABORT) {
+ input_lock();
+
+ /* try to restore the original video state */
+#ifdef DPMSExtension /* Turn screens back on */
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(serverClient, DPMSModeOn);
+#endif
+ if (xf86Screens) {
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->vtSema) {
+ /*
+ * if we are aborting before ScreenInit() has finished we
+ * might not have been wrapped yet. Therefore enable screen
+ * explicitly.
+ */
+ xf86VGAarbiterLock(xf86Screens[i]);
+ (xf86Screens[i]->LeaveVT) (xf86Screens[i]);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ }
+ }
+ }
+
xf86VGAarbiterFini();
if (xf86OSPMClose)
@@ -832,48 +855,6 @@ ddxGiveUp(enum ExitCode error)
xf86CloseLog(error);
}
-/*
- * AbortDDX --
- * DDX - specific abort routine. Called by AbortServer(). The attempt is
- * made to restore all original setting of the displays. Also all devices
- * are closed.
- */
-
-void
-AbortDDX(enum ExitCode error)
-{
- int i;
-
- input_lock();
-
- /*
- * try to restore the original video state
- */
-#ifdef DPMSExtension /* Turn screens back on */
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(serverClient, DPMSModeOn);
-#endif
- if (xf86Screens) {
- for (i = 0; i < xf86NumScreens; i++)
- if (xf86Screens[i]->vtSema) {
- /*
- * if we are aborting before ScreenInit() has finished
- * we might not have been wrapped yet. Therefore enable
- * screen explicitely.
- */
- xf86VGAarbiterLock(xf86Screens[i]);
- (xf86Screens[i]->LeaveVT) (xf86Screens[i]);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- }
- }
-
- /*
- * This is needed for an abnormal server exit, since the normal exit stuff
- * MUST also be performed (i.e. the vt must be left in a defined state)
- */
- ddxGiveUp(error);
-}
-
void
OsVendorFatalError(const char *f, va_list args)
{