61f6bb5
From 014c2158898067176738ec36c9c90cc266a7e35b Mon Sep 17 00:00:00 2001
61f6bb5
From: Adam Williamson <awilliam@redhat.com>
61f6bb5
Date: Wed, 6 Jun 2018 17:06:14 -0700
61f6bb5
Subject: [PATCH] device-manager: skip graphical renderer setup when details
61f6bb5
 forced
61f6bb5
61f6bb5
If neither "rhgb" nor "splash" is on the kernel cmdline, then
61f6bb5
plymouth forces the "details" splash. This splash is merely
61f6bb5
a passthrough plugin, where it makes boot looks like plymouth
61f6bb5
isn't even running.
61f6bb5
61f6bb5
In this case, the code sets PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV.
61f6bb5
The idea is to not bother waiting for udev events notifying
61f6bb5
plymouth when graphics devices show up, since it doesn't need
61f6bb5
to use the grpahics devices directly anyway.
61f6bb5
61f6bb5
Unfortunately, it does still erroneously try to setup graphical
61f6bb5
renderers in this case, including the /dev/fb renderer.
61f6bb5
61f6bb5
Before commit e4f86e3c, these graphical renderers failed because
61f6bb5
they were given the wrong device name, but since that fix, they're
61f6bb5
suceeding.  We definitely don't want the /dev/fb renderer to
61f6bb5
load if we're ignoring udev on efi systems, since during very
61f6bb5
early boot /dev/fb is backed by efifb, something we never want to
61f6bb5
use.  efifb is supposed to get replaced during the boot process
61f6bb5
by other fb implementations like say radeondrmfb, virtiodrmfb or
61f6bb5
bochsdrmfb, and some of those implementations can't handle the
61f6bb5
transition if /dev/fb is open at switchover time.
61f6bb5
61f6bb5
This commit adds a new flag to tell the device manager to
61f6bb5
not bother trying to setup graphical renderers when details are
61f6bb5
forced.
61f6bb5
61f6bb5
http://bugzilla.redhat.com/1518464
61f6bb5
---
61f6bb5
 src/libply-splash-core/ply-device-manager.c | 20 ++++++++++++++++----
61f6bb5
 src/libply-splash-core/ply-device-manager.h |  3 ++-
61f6bb5
 src/main.c                                  |  4 +++-
61f6bb5
 3 files changed, 21 insertions(+), 6 deletions(-)
61f6bb5
61f6bb5
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
61f6bb5
index fbf4723..b637fb8 100644
61f6bb5
--- a/src/libply-splash-core/ply-device-manager.c
61f6bb5
+++ b/src/libply-splash-core/ply-device-manager.c
61f6bb5
@@ -786,6 +786,15 @@ create_devices_from_terminals (ply_device_manager_t *manager)
61f6bb5
         return false;
61f6bb5
 }
61f6bb5
 
61f6bb5
+static void
61f6bb5
+create_non_graphical_devices (ply_device_manager_t *manager)
61f6bb5
+{
61f6bb5
+        create_devices_for_terminal_and_renderer_type (manager,
61f6bb5
+                                                       NULL,
61f6bb5
+                                                       manager->local_console_terminal,
61f6bb5
+                                                       PLY_RENDERER_TYPE_NONE);
61f6bb5
+}
61f6bb5
+
61f6bb5
 #ifdef HAVE_UDEV
61f6bb5
 static void
61f6bb5
 create_devices_from_udev (ply_device_manager_t *manager)
61f6bb5
@@ -801,10 +810,7 @@ create_devices_from_udev (ply_device_manager_t *manager)
61f6bb5
                 return;
61f6bb5
 
61f6bb5
         ply_trace ("Creating non-graphical devices, since there's no suitable graphics hardware");
61f6bb5
-        create_devices_for_terminal_and_renderer_type (manager,
61f6bb5
-                                                       NULL,
61f6bb5
-                                                       manager->local_console_terminal,
61f6bb5
-                                                       PLY_RENDERER_TYPE_NONE);
61f6bb5
+        create_non_graphical_devices (manager);
61f6bb5
 }
61f6bb5
 #endif
61f6bb5
 
61f6bb5
@@ -845,6 +851,12 @@ ply_device_manager_watch_devices (ply_device_manager_t                *manager,
61f6bb5
         if (done_with_initial_devices_setup)
61f6bb5
                 return;
61f6bb5
 
61f6bb5
+        if ((manager->flags & PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS)) {
61f6bb5
+                ply_trace ("Creating non-graphical devices, since renderers are being explicitly skipped");
61f6bb5
+                create_non_graphical_devices (manager);
61f6bb5
+                return;
61f6bb5
+        }
61f6bb5
+
61f6bb5
         if ((manager->flags & PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV)) {
61f6bb5
                 ply_trace ("udev support disabled, creating fallback devices");
61f6bb5
                 create_fallback_devices (manager);
61f6bb5
diff --git a/src/libply-splash-core/ply-device-manager.h b/src/libply-splash-core/ply-device-manager.h
61f6bb5
index 058f6e8..ad05897 100644
61f6bb5
--- a/src/libply-splash-core/ply-device-manager.h
61f6bb5
+++ b/src/libply-splash-core/ply-device-manager.h
61f6bb5
@@ -31,7 +31,8 @@ typedef enum
61f6bb5
 {
61f6bb5
         PLY_DEVICE_MANAGER_FLAGS_NONE = 0,
61f6bb5
         PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES = 1 << 0,
61f6bb5
-                PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV = 1 << 1
61f6bb5
+        PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV = 1 << 1,
61f6bb5
+        PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS = 1 << 2
61f6bb5
 } ply_device_manager_flags_t;
61f6bb5
 
61f6bb5
 typedef struct _ply_device_manager ply_device_manager_t;
61f6bb5
diff --git a/src/main.c b/src/main.c
61f6bb5
index f1e0fa7..841fe6b 100644
61f6bb5
--- a/src/main.c
61f6bb5
+++ b/src/main.c
61f6bb5
@@ -2358,7 +2358,9 @@ main (int    argc,
61f6bb5
                 device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV;
61f6bb5
 
61f6bb5
         if (!plymouth_should_show_default_splash (&state)) {
61f6bb5
-                /* don't bother listening for udev events if we're forcing details */
61f6bb5
+                /* don't bother listening for udev events or setting up a graphical renderer
61f6bb5
+                 * if we're forcing details */
61f6bb5
+                device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS;
61f6bb5
                 device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV;
61f6bb5
 
61f6bb5
                 /* don't ever delay showing the detailed splash */
61f6bb5
-- 
61f6bb5
2.17.1
61f6bb5