rpms/xorg-x11-server/devel xorg-x11-server-1.1.0-fix-default-mouse-device.patch, NONE, 1.1 xorg-x11-server-1.1.0-pci-driver-detection.patch, NONE, 1.1 xorg-x11-server.spec, 1.81, 1.82

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Jun 15 23:22:55 UTC 2006


Author: ajackson

Update of /cvs/dist/rpms/xorg-x11-server/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv5141

Modified Files:
	xorg-x11-server.spec 
Added Files:
	xorg-x11-server-1.1.0-fix-default-mouse-device.patch 
	xorg-x11-server-1.1.0-pci-driver-detection.patch 
Log Message:
- Add loader infrastructure for publishing PCI ID lists in the drivers, and
  autodetecting drivers based on that.  Currently unused since no drivers
  publish such a list yet.
- Fix mouse autoconfig to use /dev/input/mice instead of /dev/mouse.


xorg-x11-server-1.1.0-fix-default-mouse-device.patch:
 lnx_mouse.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE xorg-x11-server-1.1.0-fix-default-mouse-device.patch ---
--- xorg-server-1.1.0/hw/xfree86/os-support/linux/lnx_mouse.c.mice	2006-06-15 18:23:09.000000000 -0400
+++ xorg-server-1.1.0/hw/xfree86/os-support/linux/lnx_mouse.c	2006-06-15 18:23:31.000000000 -0400
@@ -29,7 +29,7 @@
     return "Auto";
 }
 
-#define DEFAULT_MOUSE_DEV		"/dev/mouse"
+#define DEFAULT_MOUSE_DEV		"/dev/input/mice"
 #define DEFAULT_PS2_DEV			"/dev/psaux"
 #define DEFAULT_GPM_DATA_DEV		"/dev/gpmdata"
 #define DEFAULT_GPM_CTL_DEV		"/dev/gpmdata"

xorg-x11-server-1.1.0-pci-driver-detection.patch:
 xf86AutoConfig.c |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 xf86Init.c       |    2 +
 xf86str.h        |   10 +++++
 3 files changed, 105 insertions(+), 2 deletions(-)

--- NEW FILE xorg-x11-server-1.1.0-pci-driver-detection.patch ---
--- xorg-server-1.1.0/hw/xfree86/common/xf86Init.c.pci-loader	2006-06-15 16:52:55.000000000 -0400
+++ xorg-server-1.1.0/hw/xfree86/common/xf86Init.c	2006-06-15 17:04:29.000000000 -0400
@@ -460,6 +460,7 @@
 
     for (i = 0; i < xf86NumDrivers; i++) {
 	xorgHWFlags flags;
+	if (!xf86DriverList[i]) continue;
       /* The Identify function is mandatory, but if it isn't there continue */
 	if (xf86DriverList[i]->Identify != NULL)
 	    xf86DriverList[i]->Identify(0);
@@ -499,6 +500,7 @@
 
     for (i = 0; i < xf86NumDrivers; i++) {
 	xorgHWFlags flags;
+	if (!xf86DriverList[i]) continue;
 	if (!xorgHWAccess) {
 	    if (!xf86DriverList[i]->driverFunc
 		|| !xf86DriverList[i]->driverFunc(NULL,
--- xorg-server-1.1.0/hw/xfree86/common/xf86str.h.pci-loader	2006-06-14 19:10:23.000000000 -0400
+++ xorg-server-1.1.0/hw/xfree86/common/xf86str.h	2006-06-14 19:10:23.000000000 -0400
@@ -427,6 +427,16 @@
    pointer			extraOptions;
 } IDevRec, *IDevPtr;
 
+#define PCI_MATCH_ANY (~0)
+
+typedef struct {
+    int vendor_id;
+    int device_id;
+    int subvendor_id;
+    int subdevice_id;
+    /* XXX should pad this probably */
+} pciMatchRec, *pciMatchPtr;
+
 typedef struct {
     int			vendor;
     int			chipType;
--- xorg-server-1.1.0/hw/xfree86/common/xf86AutoConfig.c.pci-loader	2006-06-14 19:10:23.000000000 -0400
+++ xorg-server-1.1.0/hw/xfree86/common/xf86AutoConfig.c	2006-06-15 16:27:54.000000000 -0400
@@ -38,12 +38,14 @@
 #include <xorg-config.h>
 #endif
 
+#define IN_LOADER
 #include "xf86.h"
 #include "xf86Parser.h"
 #include "xf86tokens.h"
 #include "xf86Config.h"
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
+#include "loaderProcs.h"
 
 /*
  * Sections for the default built-in configuration.
@@ -170,16 +172,105 @@
     AppendToList(s, &builtinConfig, &builtinLines);
 }
 
+#define DO_PCI_MATCH(a, b) (((a) == PCI_MATCH_ANY) || ((a) == (b)))
+
+static int
+xorgMatchPCIDevice(pciVideoPtr info, pciMatchPtr device_list)
+{
+    pciMatchPtr device;
+    for (device = device_list; device->vendor_id; device++)
+	if (DO_PCI_MATCH(device->vendor_id, info->vendor) &&
+	    DO_PCI_MATCH(device->device_id, info->chipType) &&
+	    DO_PCI_MATCH(device->subvendor_id, info->subsysVendor) &&
+	    DO_PCI_MATCH(device->subdevice_id, info->subsysCard))
+	    return 1;
+    return 0;
+}
+
+static char *
+detectVideoDriver(pciVideoPtr info)
+{
+    int i, errmaj, errmin, found = 0;
+    ModuleDescPtr mod;
+    char *driver = NULL, *sym;
+    pciMatchPtr device_list;
+    char **drivers = xf86DriverlistFromCompile();
+
+    for (driver = *drivers; *drivers; driver = (*drivers++)) {
+	if (!(mod = LoadDriver(driver, NULL, 0, NULL, &errmaj, &errmin))) {
+	    LoaderErrorMsg(NULL, driver, errmaj, errmin);
+	    continue;
+	}
+	if (!(sym = xcalloc(1, strlen(driver) + strlen("PCIDeviceList"))))
+	    continue; /* suck... */
+	if ((device_list = LoaderSymbol(sym)))
+	    found = xorgMatchPCIDevice(info, device_list);
+	xfree(sym);
+	/* UnloadDriver(mod); */
+	if (found) break;
+    }
+    /*
+     * This is amazingly broken.  You'd like to just UnloadDriver(mod) and
+     * have it DTRT, but since LoadDriver calls the Setup hook, which calls
+     * xf86AddDriver, you end up unloading drivers but leaving pointers to
+     * their address space dangling from xf86DriverList.
+     */
+    for (i = 0; i < xf86NumDrivers; i++)
+	if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
+	    xf86DeleteDriver(i);
+    return (found ? driver : NULL);
+}
+
+/* this is partially factored, needs help to know which config to modify */
+char *
+xorgAutoConfigDriver(void)
+{
+    pciVideoPtr *pciptr, info;
+    char *driver = NULL;
+    char buf[1024];
+
+    /* Find the primary device, and get some information about it. */
+    if (xf86PciVideoInfo) {
+	for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) {
+	    if (xf86IsPrimaryPci(info)) {
+		break;
+	    }
+	}
+	if (!info) {
+	    ErrorF("Primary device is not PCI\n");
+	    return NULL;
+	}
+    } else {
+	ErrorF("xf86PciVideoInfo is not set\n");
+	return NULL;
+    }
+
+    if ((driver = detectVideoDriver(info))) {
+	snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE,
+		 driver, 0, driver);
+	AppendToConfig(buf);
+	ErrorF("New driver is \"%s\"\n", driver);
+	AppendToConfig(BUILTIN_DEVICE_SECTION_POST);
+	snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION,
+		 driver, 0, driver, 0);
+	AppendToConfig(buf);
+    }
+
+    return driver;
+}
+
 Bool
 xf86AutoConfig(void)
 {
     const char **p;
     char buf[1024];
     pciVideoPtr *pciptr, info = NULL;
-    char *driver = NULL;
+    char *driver = NULL, *driver2 = NULL;
     FILE *gp = NULL;
     ConfigStatus ret;
 
+    driver2 = xorgAutoConfigDriver();
+
     /* Find the primary device, and get some information about it. */
     if (xf86PciVideoInfo) {
 	for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) {
@@ -300,7 +391,7 @@
     AppendToConfig(BUILTIN_MODULE_SECTION);
     AppendToConfig(BUILTIN_MONITOR_SECTION);
 
-    if (driver) {
+    if (driver && !driver2) {
 	snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE,
 		 driver, 0, driver);
 	AppendToConfig(buf);


Index: xorg-x11-server.spec
===================================================================
RCS file: /cvs/dist/rpms/xorg-x11-server/devel/xorg-x11-server.spec,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- xorg-x11-server.spec	15 Jun 2006 02:29:07 -0000	1.81
+++ xorg-x11-server.spec	15 Jun 2006 23:22:53 -0000	1.82
@@ -4,7 +4,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.1.0
-Release:   14
+Release:   15
 URL:       http://www.x.org
 License:   MIT/X11
 Group:     User Interface/X
@@ -38,6 +38,8 @@
 Patch3002:  xorg-x11-server-1.1.0-cvt-generator-in-core.patch
 Patch3003:  xorg-x11-server-1.1.0-edid-mode-injection-2.patch
 Patch3004:  xorg-x11-server-1.1.0-no-autoconfig-targetrefresh.patch
+Patch3005:  xorg-x11-server-1.1.0-pci-driver-detection.patch
+Patch3006:  xorg-x11-server-1.1.0-fix-default-mouse-device.patch
 
 # INFO: We don't ship the X server on s390/s390x
 ExcludeArch: s390 s390x
@@ -281,6 +283,8 @@
 %patch3002 -p1 -b .cvt
 %patch3003 -p1 -b .edid2
 %patch3004 -p1 -b .targetrefresh
+%patch3005 -p1 -b .pci-loader
+%patch3006 -p1 -b .mice
 
 %build
 #FONTDIR="${datadir}/X11/fonts"
@@ -566,6 +570,12 @@
 # -------------------------------------------------------------------
 
 %changelog
+* Thu Jun 15 2006 Adam Jackson <ajackson at redhat.com> 1.1.0-15
+- Add loader infrastructure for publishing PCI ID lists in the drivers, and
+  autodetecting drivers based on that.  Currently unused since no drivers
+  publish such a list yet.
+- Fix mouse autoconfig to use /dev/input/mice instead of /dev/mouse.
+
 * Wed Jun 14 2006 Kristian Høgsberg <krh at redhat.com> - 1.1.0-14
 - Change selection atom to _COMPIZ_GL_INCLUDE_INFERIORS in
   xorg-x11-server-1.1.0-gl-include-inferiors.patch.




More information about the fedora-cvs-commits mailing list