xorg-server: Changes to 'ubuntu'
debian/changelog | 4
debian/patches/drm_device_keep_trying.patch | 138 ++++++++++++++++++++--------
2 files changed, 106 insertions(+), 36 deletions(-)
New commits:
commit 57a259eac11f6baa46b837ca3d2d4d993b507bbc
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date: Mon Apr 8 08:45:06 2013 +0200
refresh drm_device_keep_trying.patch
diff --git a/debian/changelog b/debian/changelog
index e4b55b4..3dbb5d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,10 @@
xorg-server (2:1.13.3-0ubuntu5) UNRELEASED; urgency=low
* Add no-nv.patch: Don't autoprobe -nv on linux.
+ * Refresh drm_device_keep_trying.patch
+ - Make platform devices work correctly, try to obtain busid from
+ path if possible. Fallback if not possible (tegra). (LP: #1161981)
+ - Set empty busid for usb devices, and parse pci path more strictly.
-- Bryce Harrington <bryce@ubuntu.com> Wed, 03 Apr 2013 13:39:50 -0700
diff --git a/debian/patches/drm_device_keep_trying.patch b/debian/patches/drm_device_keep_trying.patch
index 3f45cf2..cac3fdd 100644
--- a/debian/patches/drm_device_keep_trying.patch
+++ b/debian/patches/drm_device_keep_trying.patch
@@ -16,11 +16,9 @@ Signed-off-by: Bryce Harrington <bryce@canonical.com>
hw/xfree86/os-support/linux/lnx_platform.c | 29 +++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
-diff --git a/config/udev.c b/config/udev.c
-index 454838f..af133d2 100644
--- a/config/udev.c
+++ b/config/udev.c
-@@ -98,7 +98,7 @@ device_added(struct udev_device *udev_device)
+@@ -98,7 +98,7 @@
if (strncmp(sysname, "card", 4) != 0)
return;
@@ -29,7 +27,7 @@ index 454838f..af133d2 100644
config_udev_odev_setup_attribs(path, syspath, NewGPUDeviceRequest);
return;
-@@ -267,7 +267,7 @@ device_removed(struct udev_device *device)
+@@ -267,7 +267,7 @@
if (strncmp(sysname,"card", 4) != 0)
return;
@@ -38,73 +36,141 @@ index 454838f..af133d2 100644
if (!path)
return;
-@@ -437,6 +437,16 @@ config_udev_odev_setup_attribs(const char *path, const char *syspath,
+@@ -420,11 +420,23 @@
+ #ifdef CONFIG_UDEV_KMS
+
+ static Bool
++get_pci_busid(const char *in, char *pci_str)
++{
++ int ret, domain, bus, dev, func;
++ ret = sscanf(in, "/%04x:%02x:%02x.%d/drm/card%*d", &domain, &bus, &dev, &func);
++ if (ret != 4)
++ return FALSE;
++ sprintf(pci_str, "pci:%04x:%02x:%02x.%d", domain, bus, dev, func);
++ return TRUE;
++}
++
++static Bool
+ config_udev_odev_setup_attribs(const char *path, const char *syspath,
+ config_odev_probe_proc_ptr probe_callback)
+ {
+ struct OdevAttributes *attribs = config_odev_allocate_attribute_list();
+ int ret;
++ const char *platform;
+
+ if (!attribs)
+ return FALSE;
+@@ -437,6 +449,32 @@
if (ret == FALSE)
goto fail;
+ if (strstr(syspath, "/devices/pci")) {
++ char pci_str[17];
+ const char *end = strstr(syspath, "/drm/card");
-+ if (end && end - 12 > syspath) {
-+ char pci_str[17] = "pci:";
-+
-+ strncpy(pci_str + 4, end - 12, 12);
++ if (strstr(syspath, "/usb"))
++ ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_BUSID, "");
++ else if (get_pci_busid(end - 13, pci_str))
+ ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_BUSID, pci_str);
++ } else if ((platform = strstr(syspath, "/devices/platform/"))) {
++ const char *end;
++ platform += 18;
++ end = strchr(platform, '.');
++ if (end) {
++ char *busid;
++ ret = asprintf(&busid, "platform:%.*s:%02li",
++ (int)(end - platform), platform, strtol(end + 1, NULL, 10));
++ if (ret >= 0) {
++ ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_BUSID, busid);
++ free(busid);
++ }
++ else
++ ret = TRUE;
+ }
+ }
++ if (ret == FALSE)
++ goto fail;
+
/* ownership of attribs is passed to probe layer */
probe_callback(attribs);
return TRUE;
-diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
-index 76f5583..11bb9fc 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
-@@ -17,36 +17,6 @@
+@@ -17,8 +17,8 @@
#include "hotplug.h"
-static Bool
-get_drm_info(struct OdevAttributes *attribs, char *path)
--{
-- drmSetVersion sv;
-- char *buf;
-- int fd;
--
-- fd = open(path, O_RDWR, O_CLOEXEC);
-- if (fd == -1)
++static void
++set_drm_info(const char *path)
+ {
+ drmSetVersion sv;
+ char *buf;
+@@ -26,25 +26,23 @@
+
+ fd = open(path, O_RDWR, O_CLOEXEC);
+ if (fd == -1)
- return FALSE;
--
-- sv.drm_di_major = 1;
-- sv.drm_di_minor = 4;
-- sv.drm_dd_major = -1; /* Don't care */
-- sv.drm_dd_minor = -1; /* Don't care */
-- if (drmSetInterfaceVersion(fd, &sv)) {
++ return;
+
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 4;
+ sv.drm_dd_major = -1; /* Don't care */
+ sv.drm_dd_minor = -1; /* Don't care */
+ if (drmSetInterfaceVersion(fd, &sv)) {
- ErrorF("setversion 1.4 failed\n");
- return FALSE;
-- }
--
++ ErrorF("setversion 1.4 failed on %s: %m\n", path);
++ close(fd);
++ return;
+ }
+
- xf86_add_platform_device(attribs);
-
-- buf = drmGetBusid(fd);
-- xf86_add_platform_device_attrib(xf86_num_platform_devices - 1,
-- ODEV_ATTRIB_BUSID, buf);
-- drmFreeBusid(buf);
+ buf = drmGetBusid(fd);
++ close(fd);
+ xf86_add_platform_device_attrib(xf86_num_platform_devices - 1,
+ ODEV_ATTRIB_BUSID, buf);
+ drmFreeBusid(buf);
- close(fd);
- return TRUE;
--}
--
+ }
+
Bool
- xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid)
+@@ -93,14 +91,15 @@
{
-@@ -119,10 +89,7 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
+ struct OdevAttribute *attrib;
+ int i;
+- char *path = NULL;
+- Bool ret;
++ const char *path = NULL, *busid = NULL, *syspath = NULL;
+
+ xorg_list_for_each_entry(attrib, &attribs->list, member) {
+- if (attrib->attrib_id == ODEV_ATTRIB_PATH) {
++ if (attrib->attrib_id == ODEV_ATTRIB_PATH)
+ path = attrib->attrib_name;
+- break;
+- }
++ else if (attrib->attrib_id == ODEV_ATTRIB_SYSPATH)
++ syspath = attrib->attrib_name;
++ else if (attrib->attrib_id == ODEV_ATTRIB_BUSID)
++ busid = attrib->attrib_name;
+ }
+ if (!path)
+ goto out_free;
+@@ -119,10 +118,11 @@
LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n",
path);
-+ xf86_add_platform_device(attribs);
- ret = get_drm_info(attribs, path);
- if (ret == FALSE)
- goto out_free;
-
++ xf86_add_platform_device(attribs);
++ if (!busid) {
++ LogMessage(X_WARNING, "Could not extract busid from syspath %s, attempting drm probe\n", syspath);
++ set_drm_info(path);
++ }
return;
out_free:
Reply to: