[RFC][PATCH 3/6] xfree86: delete devices probe code (-probe and -probeonly options)

Tiago Vignatti tiago.vignatti at nokia.com
Tue Jul 14 10:06:40 PDT 2009


In a near future KMS drivers will do all device's configuration inside the
kernel. For those that don't want/need/can't do the mode setting inside the
kernel, then we need to design a tool _external_ from the server to do such
work. But here, inside a windowing system, it's not the place to probe for
devices. Goodbye -probe and -probeonly.

WARNING: there's a single call for xf86ServerIsOnlyDetecting on ATI video
driver that might be very trivial to be removed. Also magellan and spaceorb
input drivers are using that as well (for some weird reason).

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 hw/xfree86/common/xf86.h                 |    2 -
 hw/xfree86/common/xf86Globals.c          |    2 -
 hw/xfree86/common/xf86Helper.c           |   18 ----
 hw/xfree86/common/xf86Init.c             |  126 +-----------------------------
 hw/xfree86/common/xf86Priv.h             |    2 -
 hw/xfree86/doc/man/Xorg.man.pre          |    5 -
 hw/xfree86/os-support/solaris/sun_init.c |    3 -
 7 files changed, 1 insertions(+), 157 deletions(-)

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index b6dd645..93bfd84 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -254,8 +254,6 @@ extern _X_EXPORT const char *xf86GetServerName(void);
 extern _X_EXPORT Bool xf86ServerIsExiting(void);
 extern _X_EXPORT Bool xf86ServerIsResetting(void);
 extern _X_EXPORT Bool xf86ServerIsInitialising(void);
-extern _X_EXPORT Bool xf86ServerIsOnlyDetecting(void);
-extern _X_EXPORT Bool xf86ServerIsOnlyProbing(void);
 extern _X_EXPORT Bool xf86CaughtSignal(void);
 extern _X_EXPORT Bool xf86GetVidModeAllowNonLocal(void);
 extern _X_EXPORT Bool xf86GetVidModeEnabled(void);
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 758ac80..abd9313 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -150,7 +150,6 @@ confDRIRec xf86ConfigDRI = {0, };
 XF86ConfigPtr xf86configptr = NULL;
 Bool xf86Resetting = FALSE;
 Bool xf86Initialising = FALSE;
-Bool xf86DoProbe = FALSE;
 Bool xf86DoShowOptions = FALSE;
 DriverPtr *xf86DriverList = NULL;
 int xf86NumDrivers = 0;
@@ -182,7 +181,6 @@ char *xf86LayoutName = NULL;
 char *xf86ScreenName = NULL;
 char *xf86PointerName = NULL;
 char *xf86KeyboardName = NULL;
-Bool xf86ProbeOnly = FALSE;
 int xf86Verbose = DEFAULT_VERBOSE;
 int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
 int xf86FbBpp = -1;
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 183a957..574ff2d 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1460,8 +1460,6 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
     if (sectlist)
 	*sectlist = NULL;
 
-    if (xf86DoProbe) return 1;
-
     /*
      * This is a very important function that matches the device sections
      * as they show up in the config file with the drivers that the server
@@ -1605,7 +1603,6 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
      * Do this calculation and memory allocation once now to eliminate the
      * need for realloc calls inside the loop.
      */
-    if ( !xf86DoProbe ) {
 	unsigned max_entries = numDevs;
 
 	iter = pci_slot_match_iterator_create(NULL);
@@ -1615,7 +1612,6 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
 
 	pci_iterator_destroy(iter);
 	instances = xnfalloc(max_entries * sizeof(struct Inst));
-    }
 
     iter = pci_slot_match_iterator_create(NULL);
     while ((pPci = pci_device_next(iter)) != NULL) {
@@ -2113,20 +2109,6 @@ xf86ServerIsInitialising(void)
 
 
 Bool
-xf86ServerIsOnlyDetecting(void)
-{
-    return xf86DoProbe;
-}
-
-
-Bool
-xf86ServerIsOnlyProbing(void)
-{
-    return xf86ProbeOnly;
-}
-
-
-Bool
 xf86CaughtSignal(void)
 {
     return xf86Info.caughtSignal;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 4df5df4..f8f7427 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -92,7 +92,6 @@
 
 /* forward declarations */
 static Bool probe_devices_from_device_sections(DriverPtr drvp);
-static Bool check_for_matching_devices(DriverPtr drvp);
 
 #ifdef XF86PM
 void (*xf86OSPMClose)(void) = NULL;
@@ -429,31 +428,6 @@ probe_devices_from_device_sections(DriverPtr drvp)
     return foundScreen;
 }
 
-Bool
-check_for_matching_devices(DriverPtr drvp)
-{
-    const struct pci_id_match * const devices = drvp->supported_devices;
-    int j;
-
-
-    for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
-	struct pci_device_iterator *iter;
-	struct pci_device *dev;
-
-	iter = pci_id_match_iterator_create(& devices[j]);
-	dev = pci_device_next(iter);
-	pci_iterator_destroy(iter);
-
-	if (dev != NULL) {
-	    return TRUE;
-	}
-    }
-
-
-    return FALSE;
-}
-
-
 /**
  * Call the driver's correct probe function.
  *
@@ -475,14 +449,8 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
     Bool     foundScreen = FALSE;
 
     if ( drv->PciProbe != NULL ) {
-	if ( xf86DoProbe ) {
-	    assert( detect_only );
-	    foundScreen = check_for_matching_devices( drv );
-	}
-	else {
 	    assert( ! detect_only );
 	    foundScreen = probe_devices_from_device_sections( drv );
-	}
     }
 
     if ( ! foundScreen && (drv->Probe != NULL) ) {
@@ -495,76 +463,6 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
     return foundScreen;
 }
 
-static void
-DoProbe(void)
-{
-    int i;
-    Bool probeResult;
-    Bool ioEnableFailed = FALSE;
-    
-    /* Find the list of video driver modules. */
-    char **list = xf86DriverlistFromCompile();
-    char **l;
-
-    if (list) {
-	ErrorF("List of video driver modules:\n");
-	for (l = list; *l; l++)
-	    ErrorF("\t%s\n", *l);
-    } else {
-	ErrorF("No video driver modules found\n");
-    }
-
-    /* Load all the drivers that were found. */
-    xf86LoadModules(list, NULL);
-
-    /* Disable PCI devices */
-    xf86AccessInit();
-
-    /* Call all of the probe functions, reporting the results. */
-    for (i = 0; i < xf86NumDrivers; i++) {
-	DriverRec * const drv = xf86DriverList[i];
-
-	if (!xorgHWAccess) {
-	    xorgHWFlags flags;
-	    if (!drv->driverFunc
-		|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
-		|| NEED_IO_ENABLED(flags)) {
-		if (ioEnableFailed)
-		    continue;
-		if (!xf86EnableIO()) {
-		    ioEnableFailed = TRUE;
-		    continue;
-		}
-		xorgHWAccess = TRUE;
-	    }
-	}
-	    
-
-	xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n",  drv->driverName);
-
-	probeResult = xf86CallDriverProbe( drv, TRUE );
-	if (!probeResult) {
-	    xf86ErrorF("Probe in driver `%s' returns FALSE\n",
-		drv->driverName);
-	} else {
-	    xf86ErrorF("Probe in driver `%s' returns TRUE\n",
-		drv->driverName);
-
-	    /* If we have a result, then call driver's Identify function */
-	    if (drv->Identify != NULL) {
-		const int verbose = xf86SetVerbosity(1);
-		(*drv->Identify)(0);
-		xf86SetVerbosity(verbose);
-	    }
-	}
-    }
-
-    OsCleanup(TRUE);
-    AbortDDX();
-    fflush(stderr);
-    exit(0);
-}
-
 /*
  * InitOutput --
  *	Initialize screenInfo for all actually accessible framebuffers.
@@ -607,7 +505,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
 	}
 
     /* Read and parse the config file */
-    if (!xf86DoProbe && !xf86DoShowOptions) {
+    if (!xf86DoShowOptions) {
       switch (xf86HandleConfigFile(FALSE)) {
       case CONFIG_OK:
 	break;
@@ -640,9 +538,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
     xf86BusProbe();
 
-    if (xf86DoProbe)
-	DoProbe();
-
     if (autoconfig) {
 	if (!xf86AutoConfig()) {
 	    xf86Msg(X_ERROR, "Auto configuration failed\n");
@@ -876,15 +771,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
       }
     }
 
-    /* XXX Should this be before or after loading dependent modules? */
-    if (xf86ProbeOnly)
-    {
-      OsCleanup(TRUE);
-      AbortDDX();
-      fflush(stderr);
-      exit(0);
-    }
-
     /* Remove (unload) drivers that are not required */
     for (i = 0; i < xf86NumDrivers; i++)
 	if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
@@ -1418,11 +1304,6 @@ ddxProcessArgument(int argc, char **argv, int i)
     xf86ConfigFile = argv[i + 1];
     return 2;
   }
-  if (!strcmp(argv[i],"-probeonly"))
-  {
-    xf86ProbeOnly = TRUE;
-    return 1;
-  }
   if (!strcmp(argv[i],"-flipPixels"))
   {
     xf86FlipPixels = TRUE;
@@ -1638,11 +1519,6 @@ ddxProcessArgument(int argc, char **argv, int i)
     return 1;
   }
 #endif
-  if (!strcmp(argv[i], "-probe"))
-  {
-    xf86DoProbe = TRUE;
-    return 1;
-  }
   if (!strcmp(argv[i], "-showopts"))
   {
     if (getuid() != 0 && geteuid() == 0) {
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 37f0f8a..b80af3f 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -92,8 +92,6 @@ extern _X_EXPORT  xf86CurrentAccessRec xf86CurrentAccess;
 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 xf86ProbeOnly;
-extern _X_EXPORT  Bool xf86DoProbe;
 extern _X_EXPORT  Bool xorgHWAccess;
 
 extern _X_EXPORT  RootWinPropPtr *xf86RegisteredPropertiesTable;
diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index 3d62760..4156e6e 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -342,11 +342,6 @@ section and this option, the first relevant
 .B InputDevice
 section is used for the core pointer.
 .TP 8
-.B \-probeonly
-Causes the server to exit after the device probing stage.  The
-__xconfigfile__(__filemansuffix__) file is still used when this option is
-given, so information that can be auto-detected should be commented out.
-.TP 8
 .B \-quiet
 Suppress most informational messages at startup.  The verbosity level
 is set to zero.
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index f70fca9..8c8943c 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -217,8 +217,6 @@ xf86CloseConsole(void)
 #endif
 
 #if !defined(__i386__) && !defined(__i386) && !defined(__x86)
-
-    if (!xf86DoProbe) {
 	int fd;
 
 	/*
@@ -257,7 +255,6 @@ xf86CloseConsole(void)
 
 	    close(fd);
 	}
-    }
 
 #endif
 
-- 
1.5.6.3



More information about the xorg-devel mailing list