From bdfcf889f8cda47190d98fa8a3e401a1db38074c Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 7 Nov 2017 13:49:30 -0500
Subject: [PATCH] device-manager: fall back to text mode if graphical devices
fail
Right now we assume if we find a /dev/dri/card0 that it will work.
That may not be true. The proprietary nvidia driver, for instance,
provides /dev/dri/card0 but disables modesetting by default.
This commit makes sure we fall back to text mode if /dev/dri/card0
is insufficient for our needs.
https://bugs.freedesktop.org/show_bug.cgi?id=103612
---
src/libply-splash-core/ply-device-manager.c | 26 ++++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index b4c33d4..cf56f4e 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -47,7 +47,7 @@
static void create_devices_from_udev (ply_device_manager_t *manager);
#endif
-static void create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
+static bool create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
const char *device_path,
ply_terminal_t *terminal,
ply_renderer_type_t renderer_type);
@@ -212,11 +212,12 @@ fb_device_has_drm_device (ply_device_manager_t *manager,
return has_drm_device;
}
-static void
+static bool
create_devices_for_udev_device (ply_device_manager_t *manager,
struct udev_device *device)
{
const char *device_path;
+ bool created = false;
device_path = udev_device_get_devnode (device);
@@ -245,12 +246,14 @@ create_devices_for_udev_device (ply_device_manager_t *manager,
terminal = manager->local_console_terminal;
}
- create_devices_for_terminal_and_renderer_type (manager,
- device_path,
- terminal,
- renderer_type);
+ created = create_devices_for_terminal_and_renderer_type (manager,
+ device_path,
+ terminal,
+ renderer_type);
}
}
+
+ return created;
}
static void
@@ -310,8 +313,7 @@ create_devices_for_subsystem (ply_device_manager_t *manager,
node = udev_device_get_devnode (device);
if (node != NULL) {
ply_trace ("found node %s", node);
- found_device = true;
- create_devices_for_udev_device (manager, device);
+ found_device = create_devices_for_udev_device (manager, device);
}
} else {
ply_trace ("device doesn't have a devices tag");
@@ -656,7 +658,7 @@ create_text_displays_for_terminal (ply_device_manager_t *manager,
manager->text_display_added_handler (manager->event_handler_data, display);
}
-static void
+static bool
create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
const char *device_path,
ply_terminal_t *terminal,
@@ -670,7 +672,7 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
if (renderer != NULL) {
ply_trace ("ignoring device %s since it's already managed", device_path);
- return;
+ return true;
}
ply_trace ("creating devices for %s (renderer type: %u) (terminal: %s)",
@@ -686,7 +688,7 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
renderer = NULL;
if (renderer_type != PLY_RENDERER_TYPE_AUTO)
- return;
+ return false;
}
if (renderer != NULL) {
@@ -743,6 +745,8 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
ply_trace ("activating keyboards");
ply_keyboard_watch_for_input (keyboard);
}
+
+ return true;
}
static void
--
2.17.1