plymouth/0001-ply-device-manager-Fall-back-to-text-plugin-if-no-re.patch

151 lines
6.2 KiB
Diff
Raw Normal View History

From 2b18218ef6b5fe33b64a418d9596924acd62b093 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 25 Dec 2023 20:20:31 -0500
Subject: [PATCH] ply-device-manager: Fall back to text plugin if no renderers
installed
If there's no renderers installed there's no point in continuing to
listen for DRM events and trying to load the drm plugin.
This commit just forces text mode right away in that case.
---
src/libply-splash-core/ply-device-manager.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index 99433345..d65d9dd6 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -25,60 +25,61 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/inotify.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_UDEV
#include <libudev.h>
#endif
#include <xkbcommon/xkbcommon.h>
#include "ply-logger.h"
#include "ply-event-loop.h"
#include "ply-hashtable.h"
#include "ply-list.h"
#include "ply-key-file.h"
#include "ply-utils.h"
#include "ply-input-device.h"
#define SUBSYSTEM_DRM "drm"
#define SUBSYSTEM_FRAME_BUFFER "graphics"
#define SUBSYSTEM_INPUT "input"
#ifdef HAVE_UDEV
static void create_devices_from_udev (ply_device_manager_t *manager);
#endif
+static void create_non_graphical_devices (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);
static void create_pixel_displays_for_renderer (ply_device_manager_t *manager,
ply_renderer_t *renderer);
struct _ply_device_manager
{
ply_device_manager_flags_t flags;
ply_event_loop_t *loop;
ply_hashtable_t *terminals;
ply_hashtable_t *renderers;
ply_hashtable_t *input_devices;
ply_terminal_t *local_console_terminal;
const char *keymap;
ply_list_t *keyboards;
ply_list_t *text_displays;
ply_list_t *pixel_displays;
struct udev *udev_context;
struct udev_monitor *udev_monitor;
ply_fd_watch_t *fd_watch;
struct xkb_context *xkb_context;
struct xkb_keymap *xkb_keymap;
ply_keyboard_added_handler_t keyboard_added_handler;
ply_keyboard_removed_handler_t keyboard_removed_handler;
ply_pixel_display_added_handler_t pixel_display_added_handler;
ply_pixel_display_removed_handler_t pixel_display_removed_handler;
@@ -1070,60 +1071,66 @@ create_text_displays_for_terminal (ply_device_manager_t *manager,
if (manager->text_display_added_handler != NULL)
manager->text_display_added_handler (manager->event_handler_data, display);
}
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)
{
ply_renderer_t *renderer = NULL;
ply_keyboard_t *keyboard = NULL;
if (device_path != NULL)
renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path);
if (renderer != NULL) {
ply_trace ("ignoring device %s since it's already managed", device_path);
return true;
}
ply_trace ("creating devices for %s (renderer type: %u) (terminal: %s)",
device_path ? : "", renderer_type, terminal ? ply_terminal_get_name (terminal) : "none");
if (renderer_type != PLY_RENDERER_TYPE_NONE) {
ply_renderer_t *old_renderer = NULL;
renderer = ply_renderer_new (renderer_type, device_path, terminal);
if (renderer != NULL && !ply_renderer_open (renderer)) {
+ if (errno == ENOENT) {
+ ply_trace ("No renderers available creating non-graphical devices");
+ create_non_graphical_devices (manager);
+ manager->device_timeout_elapsed = true;
+ return false;
+ }
ply_trace ("could not open renderer for %s", device_path);
ply_renderer_free (renderer);
renderer = NULL;
if (renderer_type != PLY_RENDERER_TYPE_AUTO)
return false;
}
if (renderer != NULL) {
old_renderer = ply_hashtable_lookup (manager->renderers,
(void *) ply_renderer_get_device_name (renderer));
if (old_renderer != NULL) {
ply_trace ("ignoring device %s since it's already managed",
ply_renderer_get_device_name (renderer));
ply_renderer_free (renderer);
renderer = NULL;
return true;
}
add_input_devices_to_renderer (manager, renderer);
}
}
if (renderer != NULL) {
keyboard = ply_keyboard_new_for_renderer (renderer);
ply_list_append_data (manager->keyboards, keyboard);
if (manager->keyboard_added_handler != NULL)
--
2.43.0