mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
backend/session: use device boot_display
shouldn't need to check for `boot_vga` if newer, more general sysfs `boot_display` is set. closes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/4016
This commit is contained in:
parent
6d63871f05
commit
d786e07899
1 changed files with 14 additions and 10 deletions
|
|
@ -519,8 +519,6 @@ ssize_t wlr_session_find_gpus(struct wlr_session *session,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_boot_vga = false;
|
|
||||||
|
|
||||||
const char *path = udev_list_entry_get_name(entry);
|
const char *path = udev_list_entry_get_name(entry);
|
||||||
struct udev_device *dev = udev_device_new_from_syspath(session->udev, path);
|
struct udev_device *dev = udev_device_new_from_syspath(session->udev, path);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
|
|
@ -536,14 +534,20 @@ ssize_t wlr_session_find_gpus(struct wlr_session *session,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is owned by 'dev', so we don't need to free it
|
bool is_primary = false;
|
||||||
struct udev_device *pci =
|
const char *boot_display = udev_device_get_sysattr_value(dev, "boot_display");
|
||||||
udev_device_get_parent_with_subsystem_devtype(dev, "pci", NULL);
|
if (boot_display && strcmp(boot_display, "1") == 0) {
|
||||||
|
is_primary = true;
|
||||||
|
} else {
|
||||||
|
// This is owned by 'dev', so we don't need to free it
|
||||||
|
struct udev_device *pci =
|
||||||
|
udev_device_get_parent_with_subsystem_devtype(dev, "pci", NULL);
|
||||||
|
|
||||||
if (pci) {
|
if (pci) {
|
||||||
const char *id = udev_device_get_sysattr_value(pci, "boot_vga");
|
const char *id = udev_device_get_sysattr_value(pci, "boot_vga");
|
||||||
if (id && strcmp(id, "1") == 0) {
|
if (id && strcmp(id, "1") == 0) {
|
||||||
is_boot_vga = true;
|
is_primary = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -557,7 +561,7 @@ ssize_t wlr_session_find_gpus(struct wlr_session *session,
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
|
|
||||||
ret[i] = wlr_dev;
|
ret[i] = wlr_dev;
|
||||||
if (is_boot_vga) {
|
if (is_primary) {
|
||||||
struct wlr_device *tmp = ret[0];
|
struct wlr_device *tmp = ret[0];
|
||||||
ret[0] = ret[i];
|
ret[0] = ret[i];
|
||||||
ret[i] = tmp;
|
ret[i] = tmp;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue