[PATCH] Add video driver flag to indicate that console access is not needed.

Jamey Sharp jamey at minilop.net
Fri Oct 2 20:32:43 PDT 2009


Existing video drivers will get the console enabled by default.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
On Thu, 01 Oct 2009 14:21:22 -0700 Eric Anholt <eric at anholt.net> wrote:
> Perhaps we need a flag for "this ddx needs console access" as well as
> "this ddx needs io ports and such"

On Fri, Oct 02, 2009 at 12:22:15PM -0700, Jesse Barnes wrote:
> Yeah, that would be an easy enough flag to add to the get hardware
> interfaces function if needed.

Like this? It works for me, together with the obvious patch to
xf86-video-dummy:

@@ -801,7 +801,7 @@ dummyDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
     switch (op) {
 	case GET_REQUIRED_HW_INTERFACES:
 	    flag = (CARD32*)ptr;
-	    (*flag) = 0;
+	    (*flag) = HW_SKIP_CONSOLE;
 	    return TRUE;
 	default:
 	    return FALSE;

 hw/xfree86/common/xf86Init.c |   32 +++++++++++++++++++++-----------
 hw/xfree86/common/xf86str.h  |    1 +
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index c9baff3..de01355 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -97,6 +97,7 @@ static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
 #ifdef XF86PM
 void (*xf86OSPMClose)(void) = NULL;
 #endif
+static Bool xorgHWSkipConsole = TRUE;
 
 /* Common pixmap formats */
 
@@ -601,8 +602,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     if (xf86DoShowOptions)
         DoShowOptions();
 
-    xf86OpenConsole();
-
     /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
     xf86BusProbe();
 
@@ -676,20 +675,29 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
      */
 
     for (i = 0; i < xf86NumDrivers; i++) {
-	xorgHWFlags flags;
-
 	if (xf86DriverList[i]->Identify != NULL)
 	    xf86DriverList[i]->Identify(0);
 
-	if (!xorgHWAccess
-	    && (!xf86DriverList[i]->driverFunc
+	if (!xorgHWAccess || xorgHWSkipConsole) {
+	    xorgHWFlags flags;
+	    if(!xf86DriverList[i]->driverFunc
 		|| !xf86DriverList[i]->driverFunc(NULL,
 						  GET_REQUIRED_HW_INTERFACES,
-						  &flags)
-		|| NEED_IO_ENABLED(flags)))
-	    xorgHWAccess = TRUE;
+						  &flags))
+		flags = HW_IO;
+
+	    if(NEED_IO_ENABLED(flags))
+		xorgHWAccess = TRUE;
+	    if(!(flags & HW_SKIP_CONSOLE))
+		xorgHWSkipConsole = FALSE;
+	}
     }
 
+    if (xorgHWSkipConsole)
+	xf86Info.dontVTSwitch = TRUE;
+    else
+	xf86OpenConsole();
+
     /* Enable full I/O access */
     if (xorgHWAccess)
 	xorgHWAccess = xf86EnableIO();
@@ -966,7 +974,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /*
      * serverGeneration != 1; some OSs have to do things here, too.
      */
-    xf86OpenConsole();
+    if (!xorgHWSkipConsole)
+	xf86OpenConsole();
 
 #ifdef XF86PM
     /*
@@ -1203,7 +1212,8 @@ ddxGiveUp(void)
     DGAShutdown();
 #endif
 
-    xf86CloseConsole();
+    if (!xorgHWSkipConsole)
+	xf86CloseConsole();
 
     xf86CloseLog();
 
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index b9a2e06..7b0b758 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -299,6 +299,7 @@ typedef struct {
 /* GET_REQUIRED_HW_INTERFACES */
 #define HW_IO 1
 #define HW_MMIO 2
+#define HW_SKIP_CONSOLE 4
 #define NEED_IO_ENABLED(x) (x & HW_IO)
 
 typedef CARD32 xorgHWFlags;
-- 
1.6.3.3



More information about the xorg-devel mailing list