aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/os-support
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/os-support')
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Sbus.c8
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_platform.c62
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/posix_tty.c3
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_init.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSproc.h3
5 files changed, 63 insertions, 15 deletions
diff --git a/xorg-server/hw/xfree86/os-support/bus/Sbus.c b/xorg-server/hw/xfree86/os-support/bus/Sbus.c
index 826000712..14e6d4bfd 100644
--- a/xorg-server/hw/xfree86/os-support/bus/Sbus.c
+++ b/xorg-server/hw/xfree86/os-support/bus/Sbus.c
@@ -617,8 +617,10 @@ sparcPromPathname2Node(const char *pathName)
return 0;
strcpy(name, pathName);
name[i + 1] = 0;
- if (name[0] != '/')
+ if (name[0] != '/') {
+ free(name);
return 0;
+ }
p = strchr(name + 1, '/');
if (p)
*p = 0;
@@ -629,8 +631,10 @@ sparcPromPathname2Node(const char *pathName)
*regstr++ = 0;
else
regstr = p;
- if (name + 1 == regstr)
+ if (name + 1 == regstr) {
+ free(name);
return 0;
+ }
promGetSibling(0);
i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0);
free(name);
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c b/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c
index 76f5583dd..1865b31b9 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c
@@ -7,6 +7,8 @@
#include <xf86drm.h>
#include <fcntl.h>
#include <unistd.h>
+#include <errno.h>
+#include <string.h>
/* Linux platform device support */
#include "xf86_OSproc.h"
@@ -18,11 +20,12 @@
#include "hotplug.h"
static Bool
-get_drm_info(struct OdevAttributes *attribs, char *path)
+get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
{
drmSetVersion sv;
char *buf;
int fd;
+ int err = 0;
fd = open(path, O_RDWR, O_CLOEXEC);
if (fd == -1)
@@ -32,19 +35,26 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
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;
+
+ err = drmSetInterfaceVersion(fd, &sv);
+ if (err) {
+ ErrorF("setversion 1.4 failed: %s\n", strerror(-err));
+ goto out;
}
- xf86_add_platform_device(attribs);
+ /* for a delayed probe we've already added the device */
+ if (delayed_index == -1) {
+ xf86_add_platform_device(attribs);
+ delayed_index = xf86_num_platform_devices - 1;
+ }
buf = drmGetBusid(fd);
- xf86_add_platform_device_attrib(xf86_num_platform_devices - 1,
+ xf86_add_platform_device_attrib(delayed_index,
ODEV_ATTRIB_BUSID, buf);
drmFreeBusid(buf);
+out:
close(fd);
- return TRUE;
+ return (err == 0);
}
Bool
@@ -89,6 +99,23 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu
}
void
+xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs)
+{
+ Bool ret;
+ char *dpath;
+ dpath = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH);
+
+ ret = get_drm_info(attribs, dpath, index);
+ if (ret == FALSE) {
+ xf86_remove_platform_device(index);
+ return;
+ }
+ ret = xf86platformAddDevice(index);
+ if (ret == -1)
+ xf86_remove_platform_device(index);
+}
+
+void
xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
{
struct OdevAttribute *attrib;
@@ -116,10 +143,17 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
if (i != xf86_num_platform_devices)
goto out_free;
- LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n",
- path);
+ LogMessage(X_INFO, "xfree86: Adding drm device (%s)\n", path);
- ret = get_drm_info(attribs, path);
+ if (!xf86VTOwner()) {
+ /* if we don't currently own the VT then don't probe the device,
+ just mark it as unowned for later use */
+ attribs->unowned = TRUE;
+ xf86_add_platform_device(attribs);
+ return;
+ }
+
+ ret = get_drm_info(attribs, path, -1);
if (ret == FALSE)
goto out_free;
@@ -138,6 +172,9 @@ void NewGPUDeviceRequest(struct OdevAttributes *attribs)
if (old_num == xf86_num_platform_devices)
return;
+ if (xf86_get_platform_device_unowned(xf86_num_platform_devices - 1) == TRUE)
+ return;
+
ret = xf86platformAddDevice(xf86_num_platform_devices-1);
if (ret == -1)
xf86_remove_platform_device(xf86_num_platform_devices-1);
@@ -171,7 +208,10 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs)
ErrorF("xf86: remove device %d %s\n", index, syspath);
- xf86platformRemoveDevice(index);
+ if (xf86_get_platform_device_unowned(index) == TRUE)
+ xf86_remove_platform_device(index);
+ else
+ xf86platformRemoveDevice(index);
out:
config_odev_free_attribute_list(attribs);
}
diff --git a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
index ab3757a2a..4d08c1e85 100644
--- a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
+++ b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
@@ -421,7 +421,8 @@ xf86FlushInput(int fd)
{
fd_set fds;
struct timeval timeout;
- char c[4];
+ /* this needs to be big enough to flush an evdev event. */
+ char c[256];
DebugF("FlushingSerial\n");
if (tcflush(fd, TCIFLUSH) == 0)
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
index 4b75a98ac..68527a577 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
@@ -274,7 +274,7 @@ xf86OpenConsole(void)
* this is to make sure we don't continue until the activate
* signal is received.
*/
- if (!xf86Screens[0]->vtSema)
+ if (!xf86VTOwner())
sleep(5);
}
#endif /* HAS_USL_VTS */
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
index ea2b16e46..6be594651 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
@@ -223,6 +223,9 @@ extern _X_EXPORT void xf86InitVidMem(void);
#include "hotplug.h"
void
xf86PlatformDeviceProbe(struct OdevAttributes *attribs);
+
+void
+xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs);
#endif
_XFUNCPROTOEND