xserver: Branch 'master' - 15 commits

Keith Packard keithp at kemper.freedesktop.org
Wed May 19 22:44:17 PDT 2010


 hw/xfree86/common/xf86.h          |    3 
 hw/xfree86/common/xf86Bus.c       |  283 ++++++++++++++++++----------------
 hw/xfree86/common/xf86Configure.c |    2 
 hw/xfree86/common/xf86Init.c      |  313 --------------------------------------
 hw/xfree86/common/xf86Priv.h      |    3 
 hw/xfree86/common/xf86pciBus.c    |  160 +++++++++++++++++++
 hw/xfree86/common/xf86pciBus.h    |    3 
 include/inputstr.h                |    8 
 render/animcur.c                  |   66 ++------
 9 files changed, 352 insertions(+), 489 deletions(-)

New commits:
commit 103507af0c0ce7d7482a67163249864af36a2374
Merge: 8bd8d81... 99fcf65...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed May 19 22:27:53 2010 -0700

    Merge remote branch 'vignatti/bus-cleanup'

commit 8bd8d81dc473bf72ea108b1896a55e32defa02e2
Merge: c620a1c... 66d5ecc...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed May 19 22:27:20 2010 -0700

    Merge remote branch 'vignatti/animcursor-state-fix'

commit 66d5ecc5fd36e21715531a39ac83dc2b6b988a7e
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue May 18 13:53:29 2010 +0300

    render: set anim cursor state for pointer enabled devices only
    
    The structure containing the state of animated cursor was amended within
    SpriteInfoRec, removing all previously privates logic to keep such state.
    
    API change: It was removed MAXDEVICES dependency \o/
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/include/inputstr.h b/include/inputstr.h
index 6da3f38..c5b9ff7 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -477,6 +477,14 @@ typedef struct _SpriteInfoRec {
     DeviceIntPtr        paired;      /* The paired device. Keyboard if
                                         spriteOwner is TRUE, otherwise the
                                         pointer that owns the sprite. */ 
+
+    /* keep states for animated cursor */
+    struct {
+        CursorPtr       pCursor;
+        ScreenPtr       pScreen;
+        int             elt;
+        CARD32          time;
+    } anim;
 } SpriteInfoRec, *SpriteInfoPtr;
 
 /* device types */
diff --git a/render/animcur.c b/render/animcur.c
index 83211cc..ad126fb 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -70,24 +70,12 @@ typedef struct _AnimScrPriv {
     RecolorCursorProcPtr	RecolorCursor;
 } AnimCurScreenRec, *AnimCurScreenPtr;
 
-typedef struct _AnimCurState {
-    CursorPtr			pCursor;
-    ScreenPtr			pScreen;
-    int				elt;
-    CARD32			time;
-} AnimCurStateRec, *AnimCurStatePtr;
-
-/* What a waste. But we need an API change to alloc it per device only. */
-static AnimCurStateRec animCurState[MAXDEVICES];
-
 static unsigned char empty[4];
 
 static CursorBits   animCursorBits = {
     empty, empty, 2, 1, 1, 0, 0, 1
 };
 
-static int AnimCurGeneration;
-
 static int AnimCurScreenPrivateKeyIndex;
 static DevPrivateKey AnimCurScreenPrivateKey = &AnimCurScreenPrivateKeyIndex;
 
@@ -167,14 +155,14 @@ AnimCurScreenBlockHandler (int screenNum,
 
     for (dev = inputInfo.devices; dev; dev = dev->next)
     {
-	if (IsPointerDevice(dev) && pScreen == animCurState[dev->id].pScreen)
+	if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen)
 	{
 	    if (!now) now = GetTimeInMillis (); 
 
-	    if ((INT32) (now - animCurState[dev->id].time) >= 0)
+	    if ((INT32) (now - dev->spriteInfo->anim.time) >= 0)
 	    {
-		AnimCurPtr ac  = GetAnimCur(animCurState[dev->id].pCursor);
-		int        elt = (animCurState[dev->id].elt + 1) % ac->nelt;
+		AnimCurPtr ac  = GetAnimCur(dev->spriteInfo->anim.pCursor);
+		int        elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt;
 		DisplayCursorProcPtr DisplayCursor;
 
 		/*
@@ -190,12 +178,12 @@ AnimCurScreenBlockHandler (int screenNum,
 		as->DisplayCursor = pScreen->DisplayCursor;
 		pScreen->DisplayCursor = DisplayCursor;
 
-		animCurState[dev->id].elt = elt;
-		animCurState[dev->id].time = now + ac->elts[elt].delay;
+		dev->spriteInfo->anim.elt = elt;
+		dev->spriteInfo->anim.time = now + ac->elts[elt].delay;
 	    }
 
-	    if (soonest > animCurState[dev->id].time)
-		soonest = animCurState[dev->id].time;
+	    if (soonest > dev->spriteInfo->anim.time)
+		soonest = dev->spriteInfo->anim.time;
 	}
     }
 
@@ -218,7 +206,7 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
     Unwrap (as, pScreen, DisplayCursor);
     if (IsAnimCur(pCursor))
     {
-	if (pCursor != animCurState[pDev->id].pCursor)
+	if (pCursor != pDev->spriteInfo->anim.pCursor)
 	{
 	    AnimCurPtr		ac = GetAnimCur(pCursor);
 
@@ -226,10 +214,10 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
                 (pDev, pScreen, ac->elts[0].pCursor);
 	    if (ret)
 	    {
-		animCurState[pDev->id].elt = 0;
-		animCurState[pDev->id].time = GetTimeInMillis () + ac->elts[0].delay;
-		animCurState[pDev->id].pCursor = pCursor;
-		animCurState[pDev->id].pScreen = pScreen;
+		pDev->spriteInfo->anim.elt = 0;
+		pDev->spriteInfo->anim.time = GetTimeInMillis () + ac->elts[0].delay;
+		pDev->spriteInfo->anim.pCursor = pCursor;
+		pDev->spriteInfo->anim.pScreen = pScreen;
 	    }
 	}
 	else
@@ -237,8 +225,8 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
     }
     else
     {
-        animCurState[pDev->id].pCursor = 0;
-	animCurState[pDev->id].pScreen = 0;
+	pDev->spriteInfo->anim.pCursor = 0;
+	pDev->spriteInfo->anim.pScreen = 0;
 	ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
     }
     Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor);
@@ -256,8 +244,8 @@ AnimCurSetCursorPosition (DeviceIntPtr pDev,
     Bool		ret;
     
     Unwrap (as, pScreen, SetCursorPosition);
-    if (animCurState[pDev->id].pCursor)
-	animCurState[pDev->id].pScreen = pScreen;
+    if (pDev->spriteInfo->anim.pCursor)
+	pDev->spriteInfo->anim.pScreen = pScreen;
     ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
     Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
     return ret;
@@ -322,7 +310,7 @@ AnimCurRecolorCursor (DeviceIntPtr pDev,
         for (i = 0; i < ac->nelt; i++)
 	    (*pScreen->RecolorCursor) (pDev, pScreen, ac->elts[i].pCursor,
 				       displayed && 
-				       animCurState[pDev->id].elt == i);
+				       pDev->spriteInfo->anim.elt == i);
     }
     else
 	(*pScreen->RecolorCursor) (pDev, pScreen, pCursor, displayed);
@@ -334,17 +322,6 @@ AnimCurInit (ScreenPtr pScreen)
 {
     AnimCurScreenPtr    as;
 
-    if (AnimCurGeneration != serverGeneration)
-    {
-        int i;
-	AnimCurGeneration = serverGeneration;
-        for (i = 0; i < MAXDEVICES; i++) {
-            animCurState[i].pCursor = 0;
-            animCurState[i].pScreen = 0;
-            animCurState[i].elt = 0;
-            animCurState[i].time = 0;
-        }
-    }
     as = (AnimCurScreenPtr) malloc(sizeof (AnimCurScreenRec));
     if (!as)
 	return FALSE;
commit 99fcf655bdc96f7e5b2249b05da51ba4fc9190c7
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 22:34:44 2010 +0300

    xfree86: remove PCI dependency from InitOutput
    
    All functions that touch PCI and BUS were moved to their own files, organizing
    the mess inside the InitOutput. Now, inside InitOutput, mostly accesses to
    buses are coordinated by the new xf86BusConfig.
    
    Two PCI probe functions just changed the name and a procedure to receive the
    isolate devices parameters was created also, named xf86PciIsolateDevice.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 153fc74..8a73925 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -58,6 +58,140 @@ static int xf86EntityPrivateCount = 0;
 
 BusRec primaryBus = { BUS_NONE, { 0 } };
 
+/**
+ * Call the driver's correct probe function.
+ *
+ * If the driver implements the \c DriverRec::PciProbe entry-point and an
+ * appropriate PCI device (with matching Device section in the xorg.conf file)
+ * is found, it is called.  If \c DriverRec::PciProbe or no devices can be
+ * successfully probed with it (e.g., only non-PCI devices are available),
+ * the driver's \c DriverRec::Probe function is called.
+ *
+ * \param drv   Driver to probe
+ *
+ * \return
+ * If a device can be successfully probed by the driver, \c TRUE is
+ * returned.  Otherwise, \c FALSE is returned.
+ */
+Bool
+xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
+{
+    Bool     foundScreen = FALSE;
+
+    if (drv->PciProbe != NULL) {
+        if (xf86DoConfigure && xf86DoConfigurePass1) {
+            assert(detect_only);
+            foundScreen = xf86PciAddMatchingDev(drv);
+        }
+        else {
+            assert(! detect_only);
+            foundScreen = xf86PciProbeDev(drv);
+        }
+    }
+
+    if (!foundScreen && (drv->Probe != NULL)) {
+        xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
+                             drv->driverName);
+        foundScreen = (*drv->Probe)(drv, (detect_only) ? PROBE_DETECT
+                                    : PROBE_DEFAULT);
+    }
+
+    return foundScreen;
+}
+
+/**
+ * @return TRUE if all buses are configured and set up correctly and FALSE
+ * otherwise.
+ */
+Bool
+xf86BusConfig(void)
+{
+    screenLayoutPtr layout;
+    int i, j;
+
+    /* Enable full I/O access */
+    if (xorgHWAccess)
+        xorgHWAccess = xf86EnableIO();
+
+    /* Locate bus slot that had register IO enabled at server startup */
+    if (xorgHWAccess)
+        xf86FindPrimaryDevice();
+
+    /*
+     * Now call each of the Probe functions.  Each successful probe will
+     * result in an extra entry added to the xf86Screens[] list for each
+     * 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);
+    }
+
+    /* If nothing was detected, return now */
+    if (xf86NumScreens == 0) {
+        xf86Msg(X_ERROR, "No devices detected.\n");
+        return FALSE;
+    }
+
+    xf86VGAarbiterInit();
+
+    /*
+     * Match up the screens found by the probes against those specified
+     * in the config file.  Remove the ones that won't be used.  Sort
+     * them in the order specified.
+     *
+     * What is the best way to do this?
+     *
+     * For now, go through the screens allocated by the probes, and
+     * look for screen config entry which refers to the same device
+     * section as picked out by the probe.
+     *
+     */
+    for (i = 0; i < xf86NumScreens; i++) {
+        for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
+             layout++) {
+            Bool found = FALSE;
+            for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+
+                GDevPtr dev = xf86GetDevFromEntity(
+                                xf86Screens[i]->entityList[j],
+                                xf86Screens[i]->entityInstanceList[j]);
+                if (dev == layout->screen->device) {
+                    /* A match has been found */
+                    xf86Screens[i]->confScreen = layout->screen;
+                    found = TRUE;
+                    break;
+                }
+            }
+            if (found) break;
+        }
+        if (layout->screen == NULL) {
+            /* No match found */
+            xf86Msg(X_ERROR,
+            "Screen %d deleted because of no matching config section.\n", i);
+            xf86DeleteScreen(i--, 0);
+        }
+    }
+
+    /* If no screens left, return now.  */
+    if (xf86NumScreens == 0) {
+        xf86Msg(X_ERROR,
+        "Device(s) detected, but none match those in the config file.\n");
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
 /*
  * Call the bus probes relevant to the architecture.
  *
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 15b6bdc..db88f70 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -76,6 +76,7 @@
 #include "xf86InPriv.h"
 #include "picturestr.h"
 
+#include "xf86Bus.h"
 #include "xf86VGAarbiter.h"
 #include "globals.h"
 
@@ -83,16 +84,8 @@
 #include <X11/extensions/dpmsconst.h>
 #include "dpmsproc.h"
 #endif
-
-#include <pciaccess.h>
-#include "Pci.h"
-#include "xf86Bus.h"
-
 #include <hotplug.h>
 
-/* forward declarations */
-static Bool probe_devices_from_device_sections(DriverPtr drvp);
-static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
 
 #ifdef XF86PM
 void (*xf86OSPMClose)(void) = NULL;
@@ -335,201 +328,6 @@ InstallSignalHandlers(void)
     }
 }
 
-
-#define END_OF_MATCHES(m) \
-    (((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0))
-
-Bool
-probe_devices_from_device_sections(DriverPtr drvp)
-{
-    int i, j;
-    struct pci_device * pPci;
-    Bool foundScreen = FALSE;
-    const struct pci_id_match * const devices = drvp->supported_devices;
-    GDevPtr *devList;
-    const unsigned numDevs = xf86MatchDevice(drvp->driverName, & devList);
-
-
-    for ( i = 0 ; i < numDevs ; i++ ) {
-	struct pci_device_iterator *iter;
-	unsigned device_id;
-
-
-	/* Find the pciVideoRec associated with this device section.
-	 */
-	iter = pci_id_match_iterator_create(NULL);
-	while ((pPci = pci_device_next(iter)) != NULL) {
-	    if (devList[i]->busID && *devList[i]->busID) {
-		if (xf86ComparePciBusString(devList[i]->busID,
-					    ((pPci->domain << 8)
-					     | pPci->bus),
-					    pPci->dev,
-					    pPci->func)) {
-		    break;
-		}
-	    }
-	    else if (xf86IsPrimaryPci(pPci)) {
-		break;
-	    }
-	}
-
-	pci_iterator_destroy(iter);
-
-	if (pPci == NULL) {
-	    continue;
-	}
-
-	device_id = (devList[i]->chipID > 0)
-	  ? devList[i]->chipID : pPci->device_id;
-
-
-	/* Once the pciVideoRec is found, determine if the device is supported
-	 * by the driver.  If it is, probe it!
-	 */
-	for ( j = 0 ; ! END_OF_MATCHES( devices[j] ) ; j++ ) {
-	    if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
-		 && PCI_ID_COMPARE( devices[j].device_id, device_id )
-		 && ((devices[j].device_class_mask & pPci->device_class)
-		      == devices[j].device_class) ) {
-		int  entry;
-
-		/* Allow the same entity to be used more than once for
-		 * devices with multiple screens per entity.  This assumes
-		 * implicitly that there will be a screen == 0 instance.
-		 *
-		 * FIXME Need to make sure that two different drivers don't
-		 * FIXME claim the same screen > 0 instance.
-		 */
-		if ( (devList[i]->screen == 0) && !xf86CheckPciSlot( pPci ) )
-		  continue;
-
-		DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
-		       drvp->driverName, pPci->bus, pPci->dev, pPci->func);
-
-		/* Allocate an entry in the lists to be returned */
-		entry = xf86ClaimPciSlot(pPci, drvp, device_id,
-					  devList[i], devList[i]->active);
-
-		if ((entry == -1) && (devList[i]->screen > 0)) {
-		    unsigned k;
-
-		    for ( k = 0; k < xf86NumEntities; k++ ) {
-			EntityPtr pEnt = xf86Entities[k];
-			if (pEnt->bus.type != BUS_PCI)
-			  continue;
-
-			if (pEnt->bus.id.pci == pPci) {
-			    entry = k;
-			    xf86AddDevToEntity(k, devList[i]);
-			    break;
-			}
-		    }
-		}
-
-		if (entry != -1) {
-		    if ((*drvp->PciProbe)(drvp, entry, pPci,
-					  devices[j].match_data)) {
-			foundScreen = TRUE;
-		    } else
-			xf86UnclaimPciSlot(pPci);
-		}
-
-		break;
-	    }
-	}
-    }
-    free(devList);
-
-    return foundScreen;
-}
-
-
-Bool
-add_matching_devices_to_configure_list(DriverPtr drvp)
-{
-    const struct pci_id_match * const devices = drvp->supported_devices;
-    int j;
-    struct pci_device *pPci;
-    struct pci_device_iterator *iter;
-    int numFound = 0;
-
-
-    iter = pci_id_match_iterator_create(NULL);
-    while ((pPci = pci_device_next(iter)) != NULL) {
-	/* Determine if this device is supported by the driver.  If it is,
-	 * add it to the list of devices to configure.
-	 */
-	for (j = 0 ; ! END_OF_MATCHES(devices[j]) ; j++) {
-	    if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
-		 && PCI_ID_COMPARE( devices[j].device_id, pPci->device_id )
-		 && ((devices[j].device_class_mask & pPci->device_class)
-		     == devices[j].device_class) ) {
-		if (xf86CheckPciSlot(pPci)) {
-		    GDevPtr pGDev = xf86AddBusDeviceToConfigure(
-					drvp->driverName, BUS_PCI, pPci, -1);
-		    if (pGDev != NULL) {
-			/* After configure pass 1, chipID and chipRev are
-			 * treated as over-rides, so clobber them here.
-			 */
-			pGDev->chipID = -1;
-			pGDev->chipRev = -1;
-		    }
-
-		    numFound++;
-		}
-
-		break;
-	    }
-	}
-    }
-
-    pci_iterator_destroy(iter);
-
-
-    return (numFound != 0);
-}
-
-/**
- * Call the driver's correct probe function.
- *
- * If the driver implements the \c DriverRec::PciProbe entry-point and an
- * appropriate PCI device (with matching Device section in the xorg.conf file)
- * is found, it is called.  If \c DriverRec::PciProbe or no devices can be
- * successfully probed with it (e.g., only non-PCI devices are available),
- * the driver's \c DriverRec::Probe function is called.
- *
- * \param drv   Driver to probe
- *
- * \return
- * If a device can be successfully probed by the driver, \c TRUE is
- * returned.  Otherwise, \c FALSE is returned.
- */
-Bool
-xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
-{
-    Bool     foundScreen = FALSE;
-
-    if ( drv->PciProbe != NULL ) {
-	if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
-	    assert( detect_only );
-	    foundScreen = add_matching_devices_to_configure_list( drv );
-	}
-	else {
-	    assert( ! detect_only );
-	    foundScreen = probe_devices_from_device_sections( drv );
-	}
-    }
-
-    if ( ! foundScreen && (drv->Probe != NULL) ) {
-	xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
-		 drv->driverName );
-	foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT
-				     : PROBE_DEFAULT );
-    }
-
-    return foundScreen;
-}
-
 /*
  * InitOutput --
  *	Initialize screenInfo for all actually accessible framebuffers.
@@ -542,7 +340,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
   int                    i, j, k, scr_index;
   char                   **modulelist;
   pointer                *optionlist;
-  screenLayoutPtr	 layout;
   Pix24Flags		 screenpix24, pix24;
   MessageType		 pix24From = X_DEFAULT;
   Bool			 pix24Fail = FALSE;
@@ -693,97 +490,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     else
 	xf86Info.dontVTSwitch = TRUE;
 
-    /* Enable full I/O access */
-    if (xorgHWAccess)
-	xorgHWAccess = xf86EnableIO();
-
-    /*
-     * Locate bus slot that had register IO enabled at server startup
-     */
-    if (xorgHWAccess)
-        xf86FindPrimaryDevice();
-    /*
-     * Now call each of the Probe functions.  Each successful probe will
-     * result in an extra entry added to the xf86Screens[] list for each
-     * 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 );
-    }
-
-    /*
-     * If nothing was detected, return now.
-     */
-
-    if (xf86NumScreens == 0) {
-      xf86Msg(X_ERROR, "No devices detected.\n");
-      return;
-    }
-
-    xf86VGAarbiterInit();
-
-    /*
-     * Match up the screens found by the probes against those specified
-     * in the config file.  Remove the ones that won't be used.  Sort
-     * them in the order specified.
-     */
-
-    /*
-     * What is the best way to do this?
-     *
-     * For now, go through the screens allocated by the probes, and
-     * look for screen config entry which refers to the same device
-     * section as picked out by the probe.
-     *
-     */
-
-    for (i = 0; i < xf86NumScreens; i++) {
-      for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
-	   layout++) {
-	  Bool found = FALSE;
-	  for (j = 0; j < xf86Screens[i]->numEntities; j++) {
-
-	      GDevPtr dev =
-		xf86GetDevFromEntity(xf86Screens[i]->entityList[j],
-				     xf86Screens[i]->entityInstanceList[j]);
-
-	      if (dev == layout->screen->device) {
-		  /* A match has been found */
-		  xf86Screens[i]->confScreen = layout->screen;
-		  found = TRUE;
-		  break;
-	      }
-	  }
-	  if (found) break;
-      }
-      if (layout->screen == NULL) {
-	/* No match found */
-	xf86Msg(X_ERROR,
-	    "Screen %d deleted because of no matching config section.\n", i);
-        xf86DeleteScreen(i--, 0);
-      }
-    }
-
-    /*
-     * If no screens left, return now.
-     */
-
-    if (xf86NumScreens == 0) {
-      xf86Msg(X_ERROR,
-	      "Device(s) detected, but none match those in the config file.\n");
-      return;
-    }
+    if (xf86BusConfig() == FALSE)
+        return;
 
     xf86PostProbe();
 
@@ -1632,20 +1340,12 @@ ddxProcessArgument(int argc, char **argv, int i)
   }
   if (!strcmp(argv[i], "-isolateDevice"))
   {
-    int bus, device, func;
     CHECK_FOR_REQUIRED_ARGUMENT();
     if (strncmp(argv[++i], "PCI:", 4)) {
        FatalError("Bus types other than PCI not yet isolable\n");
     }
-    if (sscanf(argv[i], "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
-       xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
-       xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
-       xf86IsolateDevice.dev = device;
-       xf86IsolateDevice.func = func;
-       return 2;
-    } else {
-       FatalError("Invalid isolated device specification\n");
-    }
+    xf86PciIsolateDevice(argv[i]);
+    return 2;
   }
   /* Notice cmdline xkbdir, but pass to dix as well */
   if (!strcmp(argv[i], "-xkbdir"))
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index a8169e9..d2073ae 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -111,6 +111,7 @@ extern _X_EXPORT  RootWinPropPtr *xf86RegisteredPropertiesTable;
 
 /* xf86Bus.c */
 
+extern _X_EXPORT Bool xf86BusConfig(void);
 extern _X_EXPORT void xf86BusProbe(void);
 extern _X_EXPORT void xf86AccessEnter(void);
 extern _X_EXPORT void xf86AccessLeave(void);
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 3b30d72..4656f1a 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -420,4 +420,164 @@ xf86CheckPciSlot(const struct pci_device *d)
     return TRUE;
 }
 
+#define END_OF_MATCHES(m) \
+    (((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0))
 
+Bool
+xf86PciAddMatchingDev(DriverPtr drvp)
+{
+    const struct pci_id_match * const devices = drvp->supported_devices;
+    int j;
+    struct pci_device *pPci;
+    struct pci_device_iterator *iter;
+    int numFound = 0;
+
+
+    iter = pci_id_match_iterator_create(NULL);
+    while ((pPci = pci_device_next(iter)) != NULL) {
+    /* Determine if this device is supported by the driver.  If it is,
+     * add it to the list of devices to configure.
+     */
+    for (j = 0 ; ! END_OF_MATCHES(devices[j]) ; j++) {
+        if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
+         && PCI_ID_COMPARE( devices[j].device_id, pPci->device_id )
+         && ((devices[j].device_class_mask & pPci->device_class)
+             == devices[j].device_class) ) {
+        if (xf86CheckPciSlot(pPci)) {
+            GDevPtr pGDev = xf86AddBusDeviceToConfigure(
+                    drvp->driverName, BUS_PCI, pPci, -1);
+            if (pGDev != NULL) {
+            /* After configure pass 1, chipID and chipRev are
+             * treated as over-rides, so clobber them here.
+             */
+            pGDev->chipID = -1;
+            pGDev->chipRev = -1;
+            }
+
+            numFound++;
+        }
+
+        break;
+        }
+    }
+    }
+
+    pci_iterator_destroy(iter);
+
+    return (numFound != 0);
+}
+
+Bool
+xf86PciProbeDev(DriverPtr drvp)
+{
+    int i, j;
+    struct pci_device * pPci;
+    Bool foundScreen = FALSE;
+    const struct pci_id_match * const devices = drvp->supported_devices;
+    GDevPtr *devList;
+    const unsigned numDevs = xf86MatchDevice(drvp->driverName, & devList);
+
+    for ( i = 0 ; i < numDevs ; i++ ) {
+       struct pci_device_iterator *iter;
+       unsigned device_id;
+
+
+       /* Find the pciVideoRec associated with this device section.
+        */
+       iter = pci_id_match_iterator_create(NULL);
+       while ((pPci = pci_device_next(iter)) != NULL) {
+           if (devList[i]->busID && *devList[i]->busID) {
+               if (xf86ComparePciBusString(devList[i]->busID,
+                                           ((pPci->domain << 8)
+                                            | pPci->bus),
+                                           pPci->dev,
+                                           pPci->func)) {
+                   break;
+               }
+           }
+           else if (xf86IsPrimaryPci(pPci)) {
+               break;
+           }
+       }
+
+       pci_iterator_destroy(iter);
+
+       if (pPci == NULL) {
+           continue;
+       }
+       device_id = (devList[i]->chipID > 0)
+         ? devList[i]->chipID : pPci->device_id;
+
+
+       /* Once the pciVideoRec is found, determine if the device is supported
+        * by the driver.  If it is, probe it!
+        */
+       for ( j = 0 ; ! END_OF_MATCHES( devices[j] ) ; j++ ) {
+           if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
+                && PCI_ID_COMPARE( devices[j].device_id, device_id )
+                && ((devices[j].device_class_mask & pPci->device_class)
+                     == devices[j].device_class) ) {
+               int  entry;
+
+               /* Allow the same entity to be used more than once for
+                * devices with multiple screens per entity.  This assumes
+                * implicitly that there will be a screen == 0 instance.
+                *
+                * FIXME Need to make sure that two different drivers don't
+                * FIXME claim the same screen > 0 instance.
+                */
+               if ((devList[i]->screen == 0) && !xf86CheckPciSlot(pPci))
+                   continue;
+
+               DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
+                      drvp->driverName, pPci->bus, pPci->dev, pPci->func);
+
+               /* Allocate an entry in the lists to be returned */
+               entry = xf86ClaimPciSlot(pPci, drvp, device_id,
+                                         devList[i], devList[i]->active);
+
+               if ((entry == -1) && (devList[i]->screen > 0)) {
+                   unsigned k;
+
+                   for (k = 0; k < xf86NumEntities; k++ ) {
+                       EntityPtr pEnt = xf86Entities[k];
+                       if (pEnt->bus.type != BUS_PCI)
+                           continue;
+                       if (pEnt->bus.id.pci == pPci) {
+                           entry = k;
+                           xf86AddDevToEntity(k, devList[i]);
+                           break;
+                       }
+                   }
+               }
+
+               if (entry != -1) {
+                   if ((*drvp->PciProbe)(drvp, entry, pPci,
+                                         devices[j].match_data)) {
+                       foundScreen = TRUE;
+                   } else
+                       xf86UnclaimPciSlot(pPci);
+               }
+
+               break;
+           }
+       }
+    }
+    free(devList);
+
+    return foundScreen;
+}
+
+void
+xf86PciIsolateDevice(char *argument)
+{
+    int bus, device, func;
+
+    if (sscanf(argument, "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
+        xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
+        xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
+        xf86IsolateDevice.dev = device;
+        xf86IsolateDevice.func = func;
+    } else
+        FatalError("Invalid isolated device specification\n");
+}
diff --git a/hw/xfree86/common/xf86pciBus.h b/hw/xfree86/common/xf86pciBus.h
index 3125e0d..69c005a 100644
--- a/hw/xfree86/common/xf86pciBus.h
+++ b/hw/xfree86/common/xf86pciBus.h
@@ -34,5 +34,8 @@
 #define _XF86_PCI_BUS_H
 
 void xf86PciProbe(void);
+Bool xf86PciAddMatchingDev(DriverPtr drvp);
+Bool xf86PciProbeDev(DriverPtr drvp);
+void xf86PciIsolateDevice(char *argument);
 
 #endif /* _XF86_PCI_BUS_H */
commit 0dd299864a133d478e4635bd1cd305b67fc3964d
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 21:33:26 2010 +0300

    xfree86: remove xf86EnableAccess
    
    It's RAC remnant. This was substituted by xf86VGAarbiter{Lock, Unlock}
    mechanism.
    
    It's an API break, but the few drivers using it were covered already with
    macros to avoid problems.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index d889057..68c3744 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -104,7 +104,6 @@ extern _X_EXPORT void xf86FormatPciBusNumber(int busnum, char *buffer);
 extern _X_EXPORT int  xf86GetFbInfoForScreen(int scrnIndex);
 extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
 extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
-extern _X_EXPORT void xf86EnableAccess(ScrnInfoPtr pScrn);
 extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device * pPci);
 /* new RAC */
 extern _X_EXPORT Bool xf86DriverHasEntities(DriverPtr drvp);
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 2a0c5c8..153fc74 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -371,29 +371,6 @@ xf86AccessLeave(void)
 }
 
 /*
- * xf86EnableAccess() -- enable access to controlled resources.
- * To reduce latency when switching access the ScrnInfoRec has
- * a linked list of the EntityAccPtr of all screen entities.
- */
-/*
- * switching access needs to be done in te following oder:
- * disable
- * 1. disable old entity
- * 2. reroute bus
- * 3. enable new entity
- * Otherwise resources needed for access control might be shadowed
- * by other resources!
- */
-
-void
-xf86EnableAccess(ScrnInfoPtr pScrn)
-{
-    DebugF("Enable access %i\n",pScrn->scrnIndex);
-
-    return;
-}
-
-/*
  * xf86EnterServerState() -- set state the server is in.
  */
 
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 87d40e0..f84feec 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -833,7 +833,6 @@ DoConfigure(void)
 
 	ConfiguredMonitor = NULL;
 
-	xf86EnableAccess(xf86Screens[dev2screen[j]]);
 	if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], 
 						   PROBE_DETECT) &&
 	    ConfiguredMonitor) {
commit f28515b5f774b83e0481acbcdda2f682738079b9
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 21:24:46 2010 +0300

    xfree86: bus: remove SetSIGIOForState and simplify the code
    
    Also removed some dumb debug messages.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 9bf4514..2a0c5c8 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -399,12 +399,17 @@ xf86EnableAccess(ScrnInfoPtr pScrn)
 
 typedef enum { TRI_UNSET, TRI_TRUE, TRI_FALSE } TriState;
 
-static void
-SetSIGIOForState(xf86State state)
+void
+xf86EnterServerState(xf86State state)
 {
     static int sigio_state;
     static TriState sigio_blocked = TRI_UNSET;
 
+    /*
+     * This is a good place to block SIGIO during SETUP state. SIGIO should be
+     * blocked in SETUP state otherwise (u)sleep() might get interrupted
+     * early. We take care not to call xf86BlockSIGIO() twice.
+     */
     if ((state == SETUP) && (sigio_blocked != TRI_TRUE)) {
         sigio_state = xf86BlockSIGIO();
 	sigio_blocked = TRI_TRUE;
@@ -414,24 +419,6 @@ SetSIGIOForState(xf86State state)
     }
 }
 
-void
-xf86EnterServerState(xf86State state)
-{
-    /* 
-     * This is a good place to block SIGIO during SETUP state.
-     * SIGIO should be blocked in SETUP state otherwise (u)sleep()
-     * might get interrupted early. 
-     * We take care not to call xf86BlockSIGIO() twice. 
-     */
-    SetSIGIOForState(state);
-    if (state == SETUP)
-	DebugF("Entering SETUP state\n");
-    else
-	DebugF("Entering OPERATING state\n");
-
-    return;
-}
-
 /*
  * xf86PostProbe() -- Allocate all non conflicting resources
  * This function gets called by xf86Init().
@@ -458,13 +445,6 @@ void
 xf86PostScreenInit(void)
 {
     xf86VGAarbiterWrapFunctions();
-
-    if (fbSlotClaimed) {
-	SetSIGIOForState(OPERATING);
-	return;
-    }
-
-    DebugF("PostScreenInit  generation: %i\n",serverGeneration);
     xf86EnterServerState(OPERATING);
 }
 
commit 211ca67e4d8d00b20a74a78304a61d4dbea62706
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 21:16:23 2010 +0300

    xfree86: bus: fb drivers might want to use vga arbitration either
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 910c884..9bf4514 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -457,13 +457,13 @@ xf86PostProbe(void)
 void
 xf86PostScreenInit(void)
 {
+    xf86VGAarbiterWrapFunctions();
+
     if (fbSlotClaimed) {
 	SetSIGIOForState(OPERATING);
 	return;
     }
 
-    xf86VGAarbiterWrapFunctions();
-
     DebugF("PostScreenInit  generation: %i\n",serverGeneration);
     xf86EnterServerState(OPERATING);
 }
commit 2464eb7d56407422e033ab3b94634ba802a119d5
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 21:14:53 2010 +0300

    xfree86: bus: simplify entity related hooks
    
    Remove some out dated commentaries either.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 2296ee8..910c884 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -108,21 +108,6 @@ StringToBusType(const char* busID, const char **retID)
     return ret;
 }
 
-/*
- * Entity related code.
- */
-
-void
-xf86EntityInit(void)
-{
-    int i;
-    
-    for (i = 0; i < xf86NumEntities; i++)
-	if (xf86Entities[i]->entityInit) {
-	    xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
-	}
-}
-
 int
 xf86AllocateEntity(void)
 {
@@ -135,28 +120,6 @@ xf86AllocateEntity(void)
     return (xf86NumEntities - 1);
 }
 
-static void
-EntityEnter(void)
-{
-    int i;
-    
-    for (i = 0; i < xf86NumEntities; i++)
-	if (xf86Entities[i]->entityEnter) {
-	    xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
-	}
-}
-
-static void
-EntityLeave(void)
-{
-    int i;
-
-    for (i = 0; i < xf86NumEntities; i++)
-	if (xf86Entities[i]->entityLeave) {
-	    xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
-	}
-}
-
 Bool
 xf86IsEntityPrimary(int entityIndex)
 {
@@ -388,27 +351,23 @@ xf86GetDevFromEntity(int entityIndex, int instance)
 void
 xf86AccessEnter(void)
 {
-    /*
-     * on enter we simply disable routing of special resources
-     * to any bus and let the RAC code to "open" the right bridges.
-     */
-    EntityEnter();
+    int i;
+
+    for (i = 0; i < xf86NumEntities; i++)
+        if (xf86Entities[i]->entityEnter)
+		xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
+
     xf86EnterServerState(SETUP);
 }
 
-/*
- * xf86AccessLeave() -- prepares access for and calls the
- * entityLeave() functions.
- * xf86AccessLeaveState() --- gets called to restore the
- * access to the VGA IO resources when switching VT or on
- * server exit.
- * This was split to call xf86AccessLeaveState() from
- * ddxGiveUp().
- */
 void
 xf86AccessLeave(void)
 {
-    EntityLeave();
+    int i;
+
+    for (i = 0; i < xf86NumEntities; i++)
+        if (xf86Entities[i]->entityLeave)
+		xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
 }
 
 /*
@@ -480,6 +439,8 @@ xf86EnterServerState(xf86State state)
 void
 xf86PostProbe(void)
 {
+    int i;
+
     if (fbSlotClaimed && (pciSlotClaimed
 #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
 	    || sbusSlotClaimed
@@ -487,6 +448,10 @@ xf86PostProbe(void)
 	    ))
 	    FatalError("Cannot run in framebuffer mode. Please specify busIDs "
 		       "       for all framebuffer devices\n");
+
+    for (i = 0; i < xf86NumEntities; i++)
+        if (xf86Entities[i]->entityInit)
+	    xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
 }
 
 void
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index ef61e46..87d40e0 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -818,7 +818,6 @@ DoConfigure(void)
     }
 
     xf86PostProbe();
-    xf86EntityInit();
 
     for (j = 0; j < xf86NumScreens; j++) {
 	xf86Screens[j]->scrnIndex = j;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 80877e7..15b6bdc 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -786,7 +786,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     }
 
     xf86PostProbe();
-    xf86EntityInit();
 
     /*
      * Sort the drivers to match the requested ording.  Using a slow
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 6faf4d5..a8169e9 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -114,7 +114,6 @@ extern _X_EXPORT  RootWinPropPtr *xf86RegisteredPropertiesTable;
 extern _X_EXPORT void xf86BusProbe(void);
 extern _X_EXPORT void xf86AccessEnter(void);
 extern _X_EXPORT void xf86AccessLeave(void);
-extern _X_EXPORT void xf86EntityInit(void);
 
 extern _X_EXPORT void xf86FindPrimaryDevice(void);
 /* new RAC */
commit 971768e6884f20981652da09a1617c51a760fb86
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri May 7 15:25:48 2010 +0300

    xfree86: bus: enable declaration of sparc function as its code usage
    
    The code in xf86sbusBus.c seems too OS-specific to be usable on OpenBSD.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 4544a4f..d889057 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -64,7 +64,7 @@ extern _X_EXPORT ScrnInfoPtr *xf86Screens;	/* List of pointers to ScrnInfoRecs *
 extern _X_EXPORT const unsigned char byte_reversed[256];
 extern _X_EXPORT Bool pciSlotClaimed;
 extern _X_EXPORT Bool fbSlotClaimed;
-#if defined(__sparc__) || defined(__sparc)
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
 extern _X_EXPORT Bool sbusSlotClaimed;
 #endif
 extern _X_EXPORT confDRIRec xf86ConfigDRI;
commit a70ec0d136bbb9efb6f4e683d7ebcea00375083b
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 20:48:01 2010 +0300

    xfree86: bus: rework xf86PostProbe logic and remove useless log info
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index a4df1f2..2296ee8 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -480,21 +480,13 @@ xf86EnterServerState(xf86State state)
 void
 xf86PostProbe(void)
 {
-    if (fbSlotClaimed) {
-        if (pciSlotClaimed
+    if (fbSlotClaimed && (pciSlotClaimed
 #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
 	    || sbusSlotClaimed
 #endif
-	    ) { 
+	    ))
 	    FatalError("Cannot run in framebuffer mode. Please specify busIDs "
 		       "       for all framebuffer devices\n");
-	    return;
-	} else  {
-	    xf86Msg(X_INFO,"Running in FRAMEBUFFER Mode\n");
-
-	    return;
-	}
-    }
 }
 
 void
commit 2f7d630a1ee446711288af69711d57ea3054b594
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 20:29:11 2010 +0300

    xfree86: bus: reuse already assigned variable when fb driver claimed
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 4013a67..a4df1f2 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -58,8 +58,6 @@ static int xf86EntityPrivateCount = 0;
 
 BusRec primaryBus = { BUS_NONE, { 0 } };
 
-static Bool doFramebufferMode = FALSE;
-
 /*
  * Call the bus probes relevant to the architecture.
  *
@@ -493,7 +491,6 @@ xf86PostProbe(void)
 	    return;
 	} else  {
 	    xf86Msg(X_INFO,"Running in FRAMEBUFFER Mode\n");
-	    doFramebufferMode = TRUE;
 
 	    return;
 	}
@@ -503,7 +500,7 @@ xf86PostProbe(void)
 void
 xf86PostScreenInit(void)
 {
-    if (doFramebufferMode) {
+    if (fbSlotClaimed) {
 	SetSIGIOForState(OPERATING);
 	return;
     }
commit 964f29bb80c1bb05508a27969c3ac34cbf072ee9
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 20:14:40 2010 +0300

    xfree86: bus: fix Enter/Leave accesses behaviour
    
    Okay, seems we're not using extensively such hooks in fact. But fix the
    expected behaviour at least.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 7d4853a..4013a67 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -390,8 +390,6 @@ xf86GetDevFromEntity(int entityIndex, int instance)
 void
 xf86AccessEnter(void)
 {
-    return;
-
     /*
      * on enter we simply disable routing of special resources
      * to any bus and let the RAC code to "open" the right bridges.
@@ -412,7 +410,6 @@ xf86AccessEnter(void)
 void
 xf86AccessLeave(void)
 {
-    return;
     EntityLeave();
 }
 
commit b37462b4da7c389ec7bbcfd800e5f88bded79330
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 2 19:53:37 2010 +0300

    xfree86: remove unused xf86AccessInit()
    
    The function was only initializing the boolean xf86ResAccessEnter, which
    couldn't get any other value in the life of the server.
    
    The only possible, though suspicious, code was in xf86AccessLeave(), which
    could be triggered if AbortDDX is called before xf86AccessInit(). Even so,
    such change is safety because no driver would have configured any entity leave
    procedure at this point.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 39e531a..7d4853a 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -58,8 +58,6 @@ static int xf86EntityPrivateCount = 0;
 
 BusRec primaryBus = { BUS_NONE, { 0 } };
 
-static Bool xf86ResAccessEnter = FALSE;
-
 static Bool doFramebufferMode = FALSE;
 
 /*
@@ -386,24 +384,13 @@ xf86GetDevFromEntity(int entityIndex, int instance)
 }
 
 /*
- * xf86AccessInit() - set up everything needed for access control
- * called only once on first server generation.
- */
-void
-xf86AccessInit(void)
-{
-    xf86ResAccessEnter = TRUE;
-}
-
-/*
  * xf86AccessEnter() -- gets called to save the text mode VGA IO 
  * resources when reentering the server after a VT switch.
  */
 void
 xf86AccessEnter(void)
 {
-    if (xf86ResAccessEnter) 
-	return;
+    return;
 
     /*
      * on enter we simply disable routing of special resources
@@ -411,7 +398,6 @@ xf86AccessEnter(void)
      */
     EntityEnter();
     xf86EnterServerState(SETUP);
-    xf86ResAccessEnter = TRUE;
 }
 
 /*
@@ -426,8 +412,7 @@ xf86AccessEnter(void)
 void
 xf86AccessLeave(void)
 {
-    if (!xf86ResAccessEnter)
-	return;
+    return;
     EntityLeave();
 }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 39d229b..80877e7 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -700,10 +700,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /*
      * Locate bus slot that had register IO enabled at server startup
      */
-    if (xorgHWAccess) {
-        xf86AccessInit();
+    if (xorgHWAccess)
         xf86FindPrimaryDevice();
-    }
     /*
      * Now call each of the Probe functions.  Each successful probe will
      * result in an extra entry added to the xf86Screens[] list for each
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 0612c9c..6faf4d5 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -112,7 +112,6 @@ extern _X_EXPORT  RootWinPropPtr *xf86RegisteredPropertiesTable;
 /* xf86Bus.c */
 
 extern _X_EXPORT void xf86BusProbe(void);
-extern _X_EXPORT void xf86AccessInit(void);
 extern _X_EXPORT void xf86AccessEnter(void);
 extern _X_EXPORT void xf86AccessLeave(void);
 extern _X_EXPORT void xf86EntityInit(void);
commit c3ba199aa643e59abd30170c53fbb4e03077c377
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Apr 27 16:27:55 2010 +0300

    render: remove unused animcursor fields from private rec
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/render/animcur.c b/render/animcur.c
index f1e86f2..83211cc 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -58,10 +58,6 @@ typedef struct _AnimCur {
 } AnimCurRec, *AnimCurPtr;
 
 typedef struct _AnimScrPriv {
-    CursorPtr			pCursor;
-    int				elt;
-    CARD32			time;
-
     CloseScreenProcPtr		CloseScreen;
 
     ScreenBlockHandlerProcPtr	BlockHandler;
commit 9db63e4766bde07ebc375c4390bcc5c854b46ac3
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Apr 27 16:18:50 2010 +0300

    render: removed unused macro from animcursor
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/render/animcur.c b/render/animcur.c
index d207bcc..f1e86f2 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -98,7 +98,6 @@ static DevPrivateKey AnimCurScreenPrivateKey = &AnimCurScreenPrivateKeyIndex;
 #define IsAnimCur(c)	    ((c) && ((c)->bits == &animCursorBits))
 #define GetAnimCur(c)	    ((AnimCurPtr) ((c) + 1))
 #define GetAnimCurScreen(s) ((AnimCurScreenPtr)dixLookupPrivate(&(s)->devPrivates, AnimCurScreenPrivateKey))
-#define GetAnimCurScreenIfSet(s) GetAnimCurScreen(s)
 #define SetAnimCurScreen(s,p) dixSetPrivate(&(s)->devPrivates, AnimCurScreenPrivateKey, p)
 
 #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
@@ -375,7 +374,7 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp
     AnimCurPtr	ac;
 
     for (i = 0; i < screenInfo.numScreens; i++)
-	if (!GetAnimCurScreenIfSet (screenInfo.screens[i]))
+	if (!GetAnimCurScreen (screenInfo.screens[i]))
 	    return BadImplementation;
 
     for (i = 0; i < ncursor; i++)


More information about the xorg-commit mailing list