164 lines
6.0 KiB
Diff
164 lines
6.0 KiB
Diff
From d9ea0f90f87c3cf2d8382a1e8a6ae30e58a419b3 Mon Sep 17 00:00:00 2001
|
|
From: Adam Jackson <ajax@redhat.com>
|
|
Date: Tue, 26 Jun 2012 14:32:31 -0400
|
|
Subject: [PATCH 3/3] xfree86: Change the semantics of
|
|
driverFunc(GET_REQUIRED_HW_INTERFACES)
|
|
|
|
This is a really awkward interface, since we're calling it well before
|
|
the driver knows what device it's going to drive. Drivers with both KMS
|
|
and UMS support therefore don't know whether to say they need I/O port
|
|
access or not, and have to assume they do.
|
|
|
|
With this change we now call it only to query whether port access might
|
|
be needed; we don't use that to determine whether to call a driver's
|
|
probe function or not, instead we call them unconditionally. If the
|
|
driver doesn't check whether port access was enabled, they might crash
|
|
ungracefully. To accomodate this, we move xorgHWAccess to be explicitly
|
|
intentionally exported (sigh xf86Priv.h) so that drivers can check that
|
|
before they attempt port access.
|
|
|
|
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
|
---
|
|
hw/xfree86/common/xf86.h | 1 +
|
|
hw/xfree86/common/xf86Bus.c | 11 -----------
|
|
hw/xfree86/common/xf86Configure.c | 27 +--------------------------
|
|
hw/xfree86/common/xf86Init.c | 23 +++++++++++------------
|
|
hw/xfree86/common/xf86Priv.h | 1 -
|
|
5 files changed, 13 insertions(+), 50 deletions(-)
|
|
|
|
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
|
|
index 129660d..913f206 100644
|
|
--- a/hw/xfree86/common/xf86.h
|
|
+++ b/hw/xfree86/common/xf86.h
|
|
@@ -55,6 +55,7 @@
|
|
extern _X_EXPORT int xf86DoConfigure;
|
|
extern _X_EXPORT int xf86DoShowOptions;
|
|
extern _X_EXPORT Bool xf86DoConfigurePass1;
|
|
+extern _X_EXPORT Bool xorgHWAccess;
|
|
|
|
extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
|
|
|
|
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
|
|
index 6c86f5e..4ea88aa 100644
|
|
--- a/hw/xfree86/common/xf86Bus.c
|
|
+++ b/hw/xfree86/common/xf86Bus.c
|
|
@@ -119,17 +119,6 @@ xf86BusConfig(void)
|
|
* instance of the hardware found.
|
|
*/
|
|
for (i = 0; i < xf86NumDrivers; i++) {
|
|
- xorgHWFlags flags;
|
|
-
|
|
- if (!xorgHWAccess) {
|
|
- if (!xf86DriverList[i]->driverFunc
|
|
- || !xf86DriverList[i]->driverFunc(NULL,
|
|
- GET_REQUIRED_HW_INTERFACES,
|
|
- &flags)
|
|
- || NEED_IO_ENABLED(flags))
|
|
- continue;
|
|
- }
|
|
-
|
|
xf86CallDriverProbe(xf86DriverList[i], FALSE);
|
|
}
|
|
|
|
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
|
|
index 6f69117..6c5e359 100644
|
|
--- a/hw/xfree86/common/xf86Configure.c
|
|
+++ b/hw/xfree86/common/xf86Configure.c
|
|
@@ -545,41 +545,16 @@ DoConfigure(void)
|
|
|
|
free(vlist);
|
|
|
|
- for (i = 0; i < xf86NumDrivers; i++) {
|
|
- xorgHWFlags flags;
|
|
-
|
|
- if (!xf86DriverList[i]->driverFunc
|
|
- || !xf86DriverList[i]->driverFunc(NULL,
|
|
- GET_REQUIRED_HW_INTERFACES,
|
|
- &flags)
|
|
- || NEED_IO_ENABLED(flags)) {
|
|
- xorgHWAccess = TRUE;
|
|
- break;
|
|
- }
|
|
- }
|
|
- /* Enable full I/O access */
|
|
- if (xorgHWAccess) {
|
|
- if (!xf86EnableIO())
|
|
- /* oops, we have failed */
|
|
- xorgHWAccess = FALSE;
|
|
- }
|
|
+ xorgHWAccess = xf86EnableIO();
|
|
|
|
/* Create XF86Config file structure */
|
|
xf86config = calloc(1, sizeof(XF86ConfigRec));
|
|
|
|
/* Call all of the probe functions, reporting the results. */
|
|
for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
|
|
- xorgHWFlags flags;
|
|
Bool found_screen;
|
|
DriverRec *const drv = xf86DriverList[CurrentDriver];
|
|
|
|
- if (!xorgHWAccess) {
|
|
- if (!drv->driverFunc
|
|
- || !drv->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags)
|
|
- || NEED_IO_ENABLED(flags))
|
|
- continue;
|
|
- }
|
|
-
|
|
found_screen = xf86CallDriverProbe(drv, TRUE);
|
|
if (found_screen && drv->Identify) {
|
|
(*drv->Identify) (0);
|
|
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
|
|
index ca6efd4..581579e 100644
|
|
--- a/hw/xfree86/common/xf86Init.c
|
|
+++ b/hw/xfree86/common/xf86Init.c
|
|
@@ -527,23 +527,22 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
|
|
*/
|
|
|
|
for (i = 0; i < xf86NumDrivers; i++) {
|
|
+ xorgHWFlags flags = HW_IO;
|
|
+
|
|
if (xf86DriverList[i]->Identify != NULL)
|
|
xf86DriverList[i]->Identify(0);
|
|
|
|
- if (!xorgHWAccess || !xorgHWOpenConsole) {
|
|
- xorgHWFlags flags;
|
|
+ if (xf86DriverList[i]->driverFunc)
|
|
+ xf86DriverList[i]->driverFunc(NULL,
|
|
+ GET_REQUIRED_HW_INTERFACES,
|
|
+ &flags);
|
|
|
|
- if (!xf86DriverList[i]->driverFunc
|
|
- || !xf86DriverList[i]->driverFunc(NULL,
|
|
- GET_REQUIRED_HW_INTERFACES,
|
|
- &flags))
|
|
- flags = HW_IO;
|
|
+ /* this is "do we want it" at this point */
|
|
+ if (NEED_IO_ENABLED(flags))
|
|
+ xorgHWAccess = TRUE;
|
|
|
|
- if (NEED_IO_ENABLED(flags))
|
|
- xorgHWAccess = TRUE;
|
|
- if (!(flags & HW_SKIP_CONSOLE))
|
|
- xorgHWOpenConsole = TRUE;
|
|
- }
|
|
+ if (!(flags & HW_SKIP_CONSOLE))
|
|
+ xorgHWOpenConsole = TRUE;
|
|
}
|
|
|
|
if (xorgHWOpenConsole)
|
|
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
|
|
index 42a3b30..aeca2a9 100644
|
|
--- a/hw/xfree86/common/xf86Priv.h
|
|
+++ b/hw/xfree86/common/xf86Priv.h
|
|
@@ -91,7 +91,6 @@ extern _X_EXPORT int xf86NumScreens;
|
|
extern _X_EXPORT const char *xf86VisualNames[];
|
|
extern _X_EXPORT int xf86Verbose; /* verbosity level */
|
|
extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */
|
|
-extern _X_EXPORT Bool xorgHWAccess;
|
|
|
|
extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
|
|
|
|
--
|
|
1.7.7.6
|
|
|