[xorg-x11-server] re-add support for non pci platform devices

Peter Robinson pbrobinson at fedoraproject.org
Tue Aug 26 19:27:26 UTC 2014


commit 5556cee4a9c3875f5aa947fbca789116a5fa122f
Author: Peter Robinson <pbrobinson at gmail.com>
Date:   Tue Aug 26 20:27:18 2014 +0100

    re-add support for non pci platform devices

 xorg-non-pci.patch   |  136 ++++++++++++++++++++++++++++++++++++++++++++++++++
 xorg-x11-server.spec |   11 ++++-
 2 files changed, 146 insertions(+), 1 deletions(-)
---
diff --git a/xorg-non-pci.patch b/xorg-non-pci.patch
new file mode 100644
index 0000000..8aa474a
--- /dev/null
+++ b/xorg-non-pci.patch
@@ -0,0 +1,136 @@
+From: Peter Robinson <pbrobinson at fedoraproject.org>
+
+--- xorg-server-1.16.0/hw/xfree86/common/xf86Init.c.orig	2014-08-26 19:29:26.802470808 +0100
++++ xorg-server-1.16.0/hw/xfree86/common/xf86Init.c	2014-08-26 19:31:21.495368739 +0100
+@@ -546,10 +546,18 @@
+             if (xf86DriverList[i]->Identify != NULL)
+                 xf86DriverList[i]->Identify(0);
+ 
+-            if (xf86DriverList[i]->driverFunc)
++            if (xf86DriverList[i]->driverFunc) {
+                 xf86DriverList[i]->driverFunc(NULL,
+                                               GET_REQUIRED_HW_INTERFACES,
+                                               &flags);
++                /* also let the driver know that it is safe to
++                 * allow platformProbe() to claim the device
++                 * if it is a non-pci platform device:
++                 */
++                xf86DriverList[i]->driverFunc(NULL,
++                                              SERVER_SUPPORTS_NON_PCI_PLATFORM_DEVS,
++                                              NULL);
++            }
+ 
+             if (NEED_IO_ENABLED(flags))
+                 want_hw_access = TRUE;
+--- xorg-server-1.16.0/hw/xfree86/common/xf86str.h.orig	2014-08-26 19:29:39.158675241 +0100
++++ xorg-server-1.16.0/hw/xfree86/common/xf86str.h	2014-08-26 19:31:21.495368739 +0100
+@@ -258,6 +258,7 @@
+     RR_GET_MODE_MM,
+     GET_REQUIRED_HW_INTERFACES = 10,
+     SUPPORTS_SERVER_FDS = 11,
++    SERVER_SUPPORTS_NON_PCI_PLATFORM_DEVS = 12,
+ } xorgDriverFuncOp;
+ 
+ typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *);
+--- xorg-server-1.16.0/hw/xfree86/common/xf86platformBus.c.orig	2014-07-16 19:57:12.000000000 +0100
++++ xorg-server-1.16.0/hw/xfree86/common/xf86platformBus.c	2014-08-26 19:31:26.483451297 +0100
+@@ -275,6 +275,41 @@
+     return i;
+ }
+ 
++static int
++find_non_pci_driver(const char *busid, char *returnList[], int returnListMax)
++{
++    /* Add more entries here if we ever return more than 4 drivers for
++       any device */
++    const char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
++    int i = 0;
++    char *p, *s;
++
++    s = xstrdup(busid);
++    p = strtok(s, ":");
++
++    if (strcmp(p, "platform"))
++        goto out;
++
++    /* extract device name: */
++    p = strtok(NULL, ":");
++
++    /* check for special cases where DDX driver name does not match busid: */
++    if (!strcmp(p, "mdp")) {
++        driverList[i++] = "freedreno";
++    }
++
++    /* add name derived from busid last: */
++    driverList[i++] = p;
++
++    for (i = 0; (i < returnListMax) && (driverList[i] != NULL); i++) {
++        returnList[i] = xnfstrdup(driverList[i]);
++    }
++
++out:
++    free(s);
++    return i;                   /* Number of entries added */
++}
++
+ /**
+  *  @return The numbers of found devices that match with the current system
+  *  drivers.
+@@ -305,6 +340,9 @@
+ 
+             if ((info != NULL) && (j < nmatches)) {
+                 j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j);
++            } else if (j < nmatches) {
++                char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
++                j += find_non_pci_driver(busid, &(matches[j]), nmatches - j);
+             }
+         }
+     }
+@@ -323,6 +361,9 @@
+         pci = FALSE;
+     }
+ 
++    /* First pass, look for PCI devices.  If we find a suitable
++     * PCI device that takes priority.
++     */
+     for (i = 0; i < xf86_num_platform_devices; i++) {
+         char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
+ 
+@@ -330,6 +371,24 @@
+             platform_find_pci_info(&xf86_platform_devices[i], busid);
+         }
+     }
++
++    /* if we found something, we are done: */
++    if (primaryBus.type != BUS_NONE)
++        return 0;
++
++    /* Second pass, look for real platform devices (ie. in the linux-
++     * kernel sense of platform device.. something that is not pci)
++     */
++    for (i = 0; i < xf86_num_platform_devices; i++) {
++        char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
++
++        if (strncmp(busid, "platform:", 9) == 0) {
++            primaryBus.type = BUS_PLATFORM;
++            primaryBus.id.plat = &xf86_platform_devices[i];
++            break;
++        }
++    }
++
+     return 0;
+ }
+ 
+@@ -476,10 +535,8 @@
+                 /* for non-seat0 servers assume first device is the master */
+                 if (ServerIsNotSeat0())
+                     break;
+-                if (xf86_platform_devices[j].pdev) {
+-                    if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
+-                        break;
+-                }
++                if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
++                    break;
+             }
+         }
+ 
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 8e2b74a..860ee81 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -42,7 +42,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.16.0
-Release:   4%{?gitdate:.%{gitdate}}%{dist}
+Release:   5%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -99,6 +99,12 @@ Patch10000: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
 # submitted http://lists.x.org/archives/xorg-devel/2014-July/042936.html
 Patch10200: 0001-xwayland-Snap-damage-reports-to-the-bounding-box.patch
 
+# submitted http://lists.x.org/archives/xorg-devel/2014-June/042826.html
+# needed to allow X to start on arm and other devices without video on pci buses
+# There's a slight variant upstream but it doesn't build against 1.16.0 atm
+# rebase of Rob Clark's patches
+Patch10300: xorg-non-pci.patch
+
 %global moduledir	%{_libdir}/xorg/modules
 %global drimoduledir	%{_libdir}/dri
 %global sdkdir		%{_includedir}/xorg
@@ -635,6 +641,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
 
 
 %changelog
+* Mon Aug 26 2014 Peter Robinson <pbrobinson at fedoraproject.org> 1.16.0-5
+- re-add support for non pci platform devices
+
 * Mon Aug 18 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.16.0-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 


More information about the scm-commits mailing list