Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 98898827a0da14a5bd73ec8875b6c078f76d7c21 Mon Sep 17 00:00:00 2001
- From: Steven Walter <stevenrwalter@gmail.com>
- Date: Thu, 9 Mar 2017 09:23:01 -0500
- Subject: [PATCH] get_primary_gpu_path: handle the lack of any boot_vga device
- ---
- src/backends/native/meta-launcher.c | 15 ++++++++++++++-
- 1 file changed, 14 insertions(+), 1 deletion(-)
- diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
- index ea28e5a..116b1c3 100644
- --- a/src/backends/native/meta-launcher.c
- +++ b/src/backends/native/meta-launcher.c
- @@ -321,6 +321,8 @@ get_primary_gpu_path (const gchar *seat_name)
- {
- /* if the device has been explicitly assigned other seat
- * than seat0, it is probably the right device to use */
- + if (path)
- + g_free(path);
- path = g_strdup (g_udev_device_get_device_file (dev));
- break;
- }
- @@ -332,6 +334,8 @@ get_primary_gpu_path (const gchar *seat_name)
- platform_device = g_udev_device_get_parent_with_subsystem (dev, "platform", NULL);
- if (platform_device != NULL)
- {
- + if (path)
- + g_free(path);
- path = g_strdup (g_udev_device_get_device_file (dev));
- break;
- }
- @@ -339,12 +343,21 @@ get_primary_gpu_path (const gchar *seat_name)
- pci_device = g_udev_device_get_parent_with_subsystem (dev, "pci", NULL);
- if (pci_device != NULL)
- {
- + /* If we've gotten this far, this device is a good candidate for
- + * being the primary GPU. However, we won't stop looking unless we
- + * find the boot_vga attribute. We might not find any device with
- + * the boot_vga attribute (for example, if that device has been
- + * grabbed by vfio-pci) in which case this device is better than no
- + * device. */
- + if (path)
- + g_free(path);
- + path = g_strdup (g_udev_device_get_device_file (dev));
- +
- /* get value of boot_vga attribute or 0 if the device has no boot_vga */
- boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga");
- if (boot_vga == 1)
- {
- /* found the boot_vga device */
- - path = g_strdup (g_udev_device_get_device_file (dev));
- break;
- }
- }
- --
- 2.9.3
Advertisement
Add Comment
Please, Sign In to add comment