[RFC PATCH] Only open the console if the video driver needs hardware access.

Jamey Sharp jamey at minilop.net
Thu Oct 1 11:50:42 PDT 2009


xf86OpenConsole fails as non-root, at least on Linux. Since the
xf86-video-dummy driver works fine without root privileges or console
access, just don't open the console.
---
I wanted to see how to replace Xvfb and Xfake with an appropriate video
driver for the xfree86 DDX, and needing root privileges was obnoxious.
Aside from that problem, the existing dummy driver seems well on the way
to doing the job.

But I'm guessing this is the wrong way to solve this problem.
Suggestions?

 hw/xfree86/common/xf86Init.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index c9baff3..dc8fb53 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -601,8 +601,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();
 
@@ -692,7 +690,11 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
 
     /* Enable full I/O access */
     if (xorgHWAccess)
+    {
 	xorgHWAccess = xf86EnableIO();
+	xf86OpenConsole();
+    }
+
 
     /*
      * Locate bus slot that had register IO enabled at server startup
@@ -966,7 +968,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /*
      * serverGeneration != 1; some OSs have to do things here, too.
      */
-    xf86OpenConsole();
+    if (xorgHWAccess)
+	xf86OpenConsole();
 
 #ifdef XF86PM
     /*
@@ -1203,7 +1206,8 @@ ddxGiveUp(void)
     DGAShutdown();
 #endif
 
-    xf86CloseConsole();
+    if (xorgHWAccess)
+	xf86CloseConsole();
 
     xf86CloseLog();
 
-- 
1.6.3.3



More information about the xorg-devel mailing list