Revert "linux: Make platform device probe less fragile"
This reverts commit 74b7427c41
.
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1068
This commit is contained in:
parent
39cb95e959
commit
af4c84ce88
|
@ -56,7 +56,7 @@ static struct udev_monitor *udev_monitor;
|
||||||
|
|
||||||
#ifdef CONFIG_UDEV_KMS
|
#ifdef CONFIG_UDEV_KMS
|
||||||
static void
|
static void
|
||||||
config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path, const char *syspath,
|
config_udev_odev_setup_attribs(const char *path, const char *syspath,
|
||||||
int major, int minor,
|
int major, int minor,
|
||||||
config_odev_probe_proc_ptr probe_callback);
|
config_odev_probe_proc_ptr probe_callback);
|
||||||
#endif
|
#endif
|
||||||
|
@ -128,7 +128,7 @@ device_added(struct udev_device *udev_device)
|
||||||
|
|
||||||
LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path);
|
LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path);
|
||||||
|
|
||||||
config_udev_odev_setup_attribs(udev_device, path, syspath, major(devnum),
|
config_udev_odev_setup_attribs(path, syspath, major(devnum),
|
||||||
minor(devnum), NewGPUDeviceRequest);
|
minor(devnum), NewGPUDeviceRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ device_removed(struct udev_device *device)
|
||||||
|
|
||||||
LogMessage(X_INFO, "config/udev: removing GPU device %s %s\n",
|
LogMessage(X_INFO, "config/udev: removing GPU device %s %s\n",
|
||||||
syspath, path);
|
syspath, path);
|
||||||
config_udev_odev_setup_attribs(device, path, syspath, major(devnum),
|
config_udev_odev_setup_attribs(path, syspath, major(devnum),
|
||||||
minor(devnum), DeleteGPUDeviceRequest);
|
minor(devnum), DeleteGPUDeviceRequest);
|
||||||
/* Retry vtenter after a drm node removal */
|
/* Retry vtenter after a drm node removal */
|
||||||
systemd_logind_vtenter();
|
systemd_logind_vtenter();
|
||||||
|
@ -465,24 +465,17 @@ config_udev_fini(void)
|
||||||
#ifdef CONFIG_UDEV_KMS
|
#ifdef CONFIG_UDEV_KMS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path, const char *syspath,
|
config_udev_odev_setup_attribs(const char *path, const char *syspath,
|
||||||
int major, int minor,
|
int major, int minor,
|
||||||
config_odev_probe_proc_ptr probe_callback)
|
config_odev_probe_proc_ptr probe_callback)
|
||||||
{
|
{
|
||||||
struct OdevAttributes *attribs = config_odev_allocate_attributes();
|
struct OdevAttributes *attribs = config_odev_allocate_attributes();
|
||||||
const char *value;
|
|
||||||
|
|
||||||
attribs->path = XNFstrdup(path);
|
attribs->path = XNFstrdup(path);
|
||||||
attribs->syspath = XNFstrdup(syspath);
|
attribs->syspath = XNFstrdup(syspath);
|
||||||
attribs->major = major;
|
attribs->major = major;
|
||||||
attribs->minor = minor;
|
attribs->minor = minor;
|
||||||
|
|
||||||
value = udev_device_get_property_value(udev_device, "ID_PATH");
|
|
||||||
if (value && !strncmp(value, "pci-", 4)) {
|
|
||||||
attribs->busid = XNFstrdup(value);
|
|
||||||
attribs->busid[3] = ':';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ownership of attribs is passed to probe layer */
|
/* ownership of attribs is passed to probe layer */
|
||||||
probe_callback(attribs);
|
probe_callback(attribs);
|
||||||
}
|
}
|
||||||
|
@ -523,7 +516,7 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
|
||||||
else if (!check_seat(udev_device))
|
else if (!check_seat(udev_device))
|
||||||
goto no_probe;
|
goto no_probe;
|
||||||
|
|
||||||
config_udev_odev_setup_attribs(udev_device, path, syspath, major(devnum),
|
config_udev_odev_setup_attribs(path, syspath, major(devnum),
|
||||||
minor(devnum), probe_callback);
|
minor(devnum), probe_callback);
|
||||||
no_probe:
|
no_probe:
|
||||||
udev_device_unref(udev_device);
|
udev_device_unref(udev_device);
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
static Bool
|
static Bool
|
||||||
get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
|
get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
|
||||||
{
|
{
|
||||||
|
drmSetVersion sv;
|
||||||
drmVersionPtr v;
|
drmVersionPtr v;
|
||||||
|
char *buf;
|
||||||
int fd;
|
int fd;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
Bool paused, server_fd = FALSE;
|
Bool paused, server_fd = FALSE;
|
||||||
|
|
||||||
LogMessage(X_INFO, "Platform probe for %s\n", attribs->syspath);
|
|
||||||
|
|
||||||
fd = systemd_logind_take_fd(attribs->major, attribs->minor, path, &paused);
|
fd = systemd_logind_take_fd(attribs->major, attribs->minor, path, &paused);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
if (paused) {
|
if (paused) {
|
||||||
|
@ -48,6 +48,18 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return FALSE;
|
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 */
|
||||||
|
|
||||||
|
err = drmSetInterfaceVersion(fd, &sv);
|
||||||
|
if (err) {
|
||||||
|
xf86Msg(X_ERROR, "%s: failed to set DRM interface version 1.4: %s\n",
|
||||||
|
path, strerror(-err));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* for a delayed probe we've already added the device */
|
/* for a delayed probe we've already added the device */
|
||||||
if (delayed_index == -1) {
|
if (delayed_index == -1) {
|
||||||
xf86_add_platform_device(attribs, FALSE);
|
xf86_add_platform_device(attribs, FALSE);
|
||||||
|
@ -57,6 +69,10 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
|
||||||
if (server_fd)
|
if (server_fd)
|
||||||
xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD;
|
xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD;
|
||||||
|
|
||||||
|
buf = drmGetBusid(fd);
|
||||||
|
xf86_platform_odev_attributes(delayed_index)->busid = XNFstrdup(buf);
|
||||||
|
drmFreeBusid(buf);
|
||||||
|
|
||||||
v = drmGetVersion(fd);
|
v = drmGetVersion(fd);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path);
|
xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path);
|
||||||
|
|
Loading…
Reference in New Issue