import plymouth-0.9.4-1.20200615git1e36e30.el8

This commit is contained in:
CentOS Sources 2020-07-28 10:23:38 -04:00 committed by Stepan Oksanichenko
parent 06bfaae3ce
commit 7e9a4b83ee
23 changed files with 1335 additions and 3063 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/plymouth-0.9.3.tar.xz
SOURCES/plymouth-1e36e303e08ba425fecbcff4dde22c8ee936638c.tar.bz2

View File

@ -1 +1 @@
1a07c8bc7d3625e93c5c15b1b0943c0e3a054808 SOURCES/plymouth-0.9.3.tar.xz
7847967f397a536ccf5fb2d43aa561ac5e5dff6c SOURCES/plymouth-1e36e303e08ba425fecbcff4dde22c8ee936638c.tar.bz2

File diff suppressed because it is too large Load Diff

View File

@ -1,489 +0,0 @@
From b5bacf2b5e5d9e58cbe96fda0a56baf5dfa11358 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 10 Oct 2018 20:07:37 +0100
Subject: [PATCH] device-manager: don't watch for udev events when deactivated
If a device gets added when we're already deactivated, plymouth shouldn't
process the device, since processing it effectively activates plymouth.
This commit pulls the udev monitor fd out of the event loop while
plymouth is deactivated so new events are deferred until reactivation.
Modified by Iain Lane <iain.lane@canonical.com>: Also deactivate the
timer that finds all devices known to udev after an interval, when
paused.
---
src/libply-splash-core/ply-device-manager.c | 74 +++++++++++++++++----
src/libply-splash-core/ply-device-manager.h | 2 +
src/main.c | 3 +
3 files changed, 67 insertions(+), 12 deletions(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index b637fb8..82f0137 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -36,74 +36,78 @@
#include "ply-logger.h"
#include "ply-event-loop.h"
#include "ply-hashtable.h"
#include "ply-list.h"
#include "ply-utils.h"
#define SUBSYSTEM_DRM "drm"
#define SUBSYSTEM_FRAME_BUFFER "graphics"
#ifdef HAVE_UDEV
static void create_devices_from_udev (ply_device_manager_t *manager);
#endif
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);
struct _ply_device_manager
{
ply_device_manager_flags_t flags;
ply_event_loop_t *loop;
ply_hashtable_t *terminals;
ply_hashtable_t *renderers;
ply_terminal_t *local_console_terminal;
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;
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;
ply_text_display_added_handler_t text_display_added_handler;
ply_text_display_removed_handler_t text_display_removed_handler;
void *event_handler_data;
uint32_t local_console_managed : 1;
uint32_t local_console_is_text : 1;
uint32_t serial_consoles_detected : 1;
uint32_t renderers_activated : 1;
uint32_t keyboards_activated : 1;
+
+ uint32_t paused : 1;
+ uint32_t device_timeout_elapsed : 1;
};
static void
detach_from_event_loop (ply_device_manager_t *manager)
{
assert (manager != NULL);
manager->loop = NULL;
}
static void
attach_to_event_loop (ply_device_manager_t *manager,
ply_event_loop_t *loop)
{
assert (manager != NULL);
assert (loop != NULL);
assert (manager->loop == NULL);
manager->loop = loop;
ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
detach_from_event_loop,
manager);
}
static void
free_displays_for_renderer (ply_device_manager_t *manager,
ply_renderer_t *renderer)
{
ply_list_node_t *node;
@@ -348,77 +352,92 @@ on_udev_event (ply_device_manager_t *manager)
return;
if (strcmp (action, "add") == 0) {
const char *subsystem;
subsystem = udev_device_get_subsystem (device);
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
if (manager->local_console_managed && manager->local_console_is_text)
ply_trace ("ignoring since we're already using text splash for local console");
else
create_devices_for_udev_device (manager, device);
} else {
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem);
}
} else if (strcmp (action, "remove") == 0) {
free_devices_for_udev_device (manager, device);
}
udev_device_unref (device);
}
static void
watch_for_udev_events (ply_device_manager_t *manager)
{
int fd;
assert (manager != NULL);
assert (manager->udev_monitor == NULL);
+ if (manager->fd_watch != NULL)
+ return;
+
ply_trace ("watching for udev graphics device add and remove events");
- manager->udev_monitor = udev_monitor_new_from_netlink (manager->udev_context, "udev");
+ if (manager->udev_monitor == NULL) {
+ manager->udev_monitor = udev_monitor_new_from_netlink (manager->udev_context, "udev");
- udev_monitor_filter_add_match_subsystem_devtype (manager->udev_monitor, SUBSYSTEM_DRM, NULL);
- udev_monitor_filter_add_match_subsystem_devtype (manager->udev_monitor, SUBSYSTEM_FRAME_BUFFER, NULL);
- udev_monitor_filter_add_match_tag (manager->udev_monitor, "seat");
- udev_monitor_enable_receiving (manager->udev_monitor);
+ udev_monitor_filter_add_match_subsystem_devtype (manager->udev_monitor, SUBSYSTEM_DRM, NULL);
+ udev_monitor_filter_add_match_subsystem_devtype (manager->udev_monitor, SUBSYSTEM_FRAME_BUFFER, NULL);
+ udev_monitor_filter_add_match_tag (manager->udev_monitor, "seat");
+ udev_monitor_enable_receiving (manager->udev_monitor);
+ }
fd = udev_monitor_get_fd (manager->udev_monitor);
- ply_event_loop_watch_fd (manager->loop,
- fd,
- PLY_EVENT_LOOP_FD_STATUS_HAS_DATA,
- (ply_event_handler_t)
- on_udev_event,
- NULL,
- manager);
+ manager->fd_watch = ply_event_loop_watch_fd (manager->loop,
+ fd,
+ PLY_EVENT_LOOP_FD_STATUS_HAS_DATA,
+ (ply_event_handler_t)
+ on_udev_event,
+ NULL,
+ manager);
+}
+
+static void
+stop_watching_for_udev_events (ply_device_manager_t *manager)
+{
+ if (manager->fd_watch == NULL)
+ return;
+
+ ply_event_loop_stop_watching_fd (manager->loop, manager->fd_watch);
+ manager->fd_watch = NULL;
}
#endif
static void
free_terminal (char *device,
ply_terminal_t *terminal,
ply_device_manager_t *manager)
{
ply_hashtable_remove (manager->terminals, device);
ply_terminal_free (terminal);
}
static void
free_terminals (ply_device_manager_t *manager)
{
ply_hashtable_foreach (manager->terminals,
(ply_hashtable_foreach_func_t *)
free_terminal,
manager);
}
static ply_terminal_t *
get_terminal (ply_device_manager_t *manager,
const char *device_name)
{
char *full_name = NULL;
ply_terminal_t *terminal;
if (strncmp (device_name, "/dev/", strlen ("/dev/")) == 0)
@@ -774,60 +793,67 @@ create_devices_from_terminals (ply_device_manager_t *manager)
if (has_serial_consoles) {
ply_trace ("serial consoles detected, managing them with details forced");
manager->serial_consoles_detected = true;
ply_hashtable_foreach (manager->terminals,
(ply_hashtable_foreach_func_t *)
create_devices_for_terminal,
manager);
return true;
}
return false;
}
static void
create_non_graphical_devices (ply_device_manager_t *manager)
{
create_devices_for_terminal_and_renderer_type (manager,
NULL,
manager->local_console_terminal,
PLY_RENDERER_TYPE_NONE);
}
#ifdef HAVE_UDEV
static void
create_devices_from_udev (ply_device_manager_t *manager)
{
bool found_drm_device, found_fb_device;
+ manager->device_timeout_elapsed = true;
+
+ if (manager->paused) {
+ ply_trace ("create_devices_from_udev timeout elapsed while paused, deferring execution");
+ return;
+ }
+
ply_trace ("Timeout elapsed, looking for devices from udev");
found_drm_device = create_devices_for_subsystem (manager, SUBSYSTEM_DRM);
found_fb_device = create_devices_for_subsystem (manager, SUBSYSTEM_FRAME_BUFFER);
if (found_drm_device || found_fb_device)
return;
ply_trace ("Creating non-graphical devices, since there's no suitable graphics hardware");
create_non_graphical_devices (manager);
}
#endif
static void
create_fallback_devices (ply_device_manager_t *manager)
{
create_devices_for_terminal_and_renderer_type (manager,
NULL,
manager->local_console_terminal,
PLY_RENDERER_TYPE_AUTO);
}
void
ply_device_manager_watch_devices (ply_device_manager_t *manager,
double device_timeout,
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,
ply_text_display_added_handler_t text_display_added_handler,
@@ -965,30 +991,54 @@ ply_device_manager_activate_keyboards (ply_device_manager_t *manager)
ply_keyboard_watch_for_input (keyboard);
node = next_node;
}
manager->keyboards_activated = true;
}
void
ply_device_manager_deactivate_keyboards (ply_device_manager_t *manager)
{
ply_list_node_t *node;
ply_trace ("deactivating keyboards");
node = ply_list_get_first_node (manager->keyboards);
while (node != NULL) {
ply_keyboard_t *keyboard;
ply_list_node_t *next_node;
keyboard = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (manager->keyboards, node);
ply_keyboard_stop_watching_for_input (keyboard);
node = next_node;
}
manager->keyboards_activated = false;
}
+
+void
+ply_device_manager_pause (ply_device_manager_t *manager)
+{
+ ply_trace ("ply_device_manager_pause() called, stopping watching for udev events");
+ manager->paused = true;
+#ifdef HAVE_UDEV
+ stop_watching_for_udev_events (manager);
+#endif
+}
+
+void
+ply_device_manager_unpause (ply_device_manager_t *manager)
+{
+ ply_trace ("ply_device_manager_unpause() called, resuming watching for udev events");
+ manager->paused = false;
+#ifdef HAVE_UDEV
+ if (manager->device_timeout_elapsed) {
+ ply_trace ("ply_device_manager_unpause(): timeout elapsed while paused, looking for udev devices");
+ create_devices_from_udev (manager);
+ }
+ watch_for_udev_events (manager);
+#endif
+}
diff --git a/src/libply-splash-core/ply-device-manager.h b/src/libply-splash-core/ply-device-manager.h
index ad05897..389b636 100644
--- a/src/libply-splash-core/ply-device-manager.h
+++ b/src/libply-splash-core/ply-device-manager.h
@@ -28,46 +28,48 @@
#include "ply-text-display.h"
typedef enum
{
PLY_DEVICE_MANAGER_FLAGS_NONE = 0,
PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES = 1 << 0,
PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV = 1 << 1,
PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS = 1 << 2
} ply_device_manager_flags_t;
typedef struct _ply_device_manager ply_device_manager_t;
typedef void (* ply_keyboard_added_handler_t) (void *, ply_keyboard_t *);
typedef void (* ply_keyboard_removed_handler_t) (void *, ply_keyboard_t *);
typedef void (* ply_pixel_display_added_handler_t) (void *, ply_pixel_display_t *);
typedef void (* ply_pixel_display_removed_handler_t) (void *, ply_pixel_display_t *);
typedef void (* ply_text_display_added_handler_t) (void *, ply_text_display_t *);
typedef void (* ply_text_display_removed_handler_t) (void *, ply_text_display_t *);
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
ply_device_manager_t *ply_device_manager_new (const char *default_tty,
ply_device_manager_flags_t flags);
void ply_device_manager_watch_devices (ply_device_manager_t *manager,
double device_timeout,
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,
ply_text_display_added_handler_t text_display_added_handler,
ply_text_display_removed_handler_t text_display_removed_handler,
void *data);
+void ply_device_manager_pause (ply_device_manager_t *manager);
+void ply_device_manager_unpause (ply_device_manager_t *manager);
bool ply_device_manager_has_serial_consoles (ply_device_manager_t *manager);
bool ply_device_manager_has_displays (ply_device_manager_t *manager);
ply_list_t *ply_device_manager_get_keyboards (ply_device_manager_t *manager);
ply_list_t *ply_device_manager_get_pixel_displays (ply_device_manager_t *manager);
ply_list_t *ply_device_manager_get_text_displays (ply_device_manager_t *manager);
void ply_device_manager_free (ply_device_manager_t *manager);
void ply_device_manager_activate_keyboards (ply_device_manager_t *manager);
void ply_device_manager_deactivate_keyboards (ply_device_manager_t *manager);
void ply_device_manager_activate_renderers (ply_device_manager_t *manager);
void ply_device_manager_deactivate_renderers (ply_device_manager_t *manager);
ply_terminal_t *ply_device_manager_get_default_terminal (ply_device_manager_t *manager);
#endif
#endif
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
diff --git a/src/main.c b/src/main.c
index e44de7b..3253aa9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1305,94 +1305,97 @@ on_boot_splash_idle (state_t *state)
ply_trace ("quitting program");
quit_program (state);
} else if (state->deactivate_trigger != NULL) {
ply_trace ("deactivating splash");
deactivate_splash (state);
}
}
static void
on_deactivate (state_t *state,
ply_trigger_t *deactivate_trigger)
{
if (state->is_inactive) {
ply_trigger_pull (deactivate_trigger, NULL);
return;
}
if (state->deactivate_trigger != NULL) {
ply_trigger_add_handler (state->deactivate_trigger,
(ply_trigger_handler_t)
ply_trigger_pull,
deactivate_trigger);
return;
}
state->deactivate_trigger = deactivate_trigger;
ply_trace ("deactivating");
cancel_pending_delayed_show (state);
+ ply_device_manager_pause (state->device_manager);
ply_device_manager_deactivate_keyboards (state->device_manager);
if (state->boot_splash != NULL) {
ply_boot_splash_become_idle (state->boot_splash,
(ply_boot_splash_on_idle_handler_t)
on_boot_splash_idle,
state);
} else {
ply_trace ("deactivating splash");
deactivate_splash (state);
}
}
static void
on_reactivate (state_t *state)
{
if (!state->is_inactive)
return;
if (state->local_console_terminal != NULL) {
ply_terminal_open (state->local_console_terminal);
ply_terminal_watch_for_vt_changes (state->local_console_terminal);
ply_terminal_set_unbuffered_input (state->local_console_terminal);
ply_terminal_ignore_mode_changes (state->local_console_terminal, false);
}
if ((state->session != NULL) && state->should_be_attached) {
ply_trace ("reactivating terminal session");
attach_to_running_session (state);
}
ply_device_manager_activate_keyboards (state->device_manager);
ply_device_manager_activate_renderers (state->device_manager);
+ ply_device_manager_unpause (state->device_manager);
+
state->is_inactive = false;
update_display (state);
}
static void
on_quit (state_t *state,
bool retain_splash,
ply_trigger_t *quit_trigger)
{
ply_trace ("quitting (retain splash: %s)", retain_splash ? "true" : "false");
if (state->quit_trigger != NULL) {
ply_trace ("quit trigger already pending, so chaining to it");
ply_trigger_add_handler (state->quit_trigger,
(ply_trigger_handler_t)
ply_trigger_pull,
quit_trigger);
return;
}
if (state->system_initialized) {
ply_trace ("system initialized so saving boot-duration file");
ply_create_directory (PLYMOUTH_TIME_DIRECTORY);
ply_progress_save_cache (state->progress,
get_cache_file_for_mode (state->mode));
} else {
ply_trace ("system not initialized so skipping saving boot-duration file");
}
state->quit_trigger = quit_trigger;
--
2.21.0

View File

@ -1,32 +0,0 @@
From 6e9e95dc0fe89a3c52f50e44ff0096a6e65e46a6 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 20 Dec 2017 10:49:19 -0500
Subject: [PATCH 1/6] device-manager: drop superfluous
create_pixel_displays_for_renderer call
commit 29e27637694eefc962d53333c729e6cac1c66518 tried to move
create_pixel_displays_for_renderer down a couple of lines, but it
inadvertently copied it instead of moved it.
This commit fixes that.
https://bugs.freedesktop.org/show_bug.cgi?id=104353
---
src/libply-splash-core/ply-device-manager.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index cf56f4e..fbf4723 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -713,7 +713,6 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
if (manager->keyboard_added_handler != NULL)
manager->keyboard_added_handler (manager->event_handler_data, keyboard);
- create_pixel_displays_for_renderer (manager, renderer);
ply_hashtable_insert (manager->renderers, strdup (ply_renderer_get_device_name (renderer)), renderer);
create_pixel_displays_for_renderer (manager, renderer);
--
2.17.0

View File

@ -1,113 +0,0 @@
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

View File

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

View File

@ -1,181 +0,0 @@
From 5fc9f555176bbbc354d651e6e31f618aea0b2b7d Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 17 Jul 2018 09:46:12 +0200
Subject: [PATCH] logger: Add a separator between different boot logs
Since we concatenate boot logs one after the other in /var/log/boot.log
it is hard to tell where the logs from one boot end the next boot starts.
This commit makes plymouth write out a separator including a time + date
of the date, when the log file gets opened to add new boot messages to it.
Note ply_logger_open_file() is only called from ply_terminal_session_open_log()
which in turn is only used for /var/log/boot.log, so this only effects
/var/log/boot.log.
Closes #29
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply/ply-logger.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/libply/ply-logger.c b/src/libply/ply-logger.c
index 1b56ea8..3dbc3ca 100644
--- a/src/libply/ply-logger.c
+++ b/src/libply/ply-logger.c
@@ -7,60 +7,61 @@
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by: Ray Strode <rstrode@redhat.com>
*/
#include "config.h"
#include "ply-logger.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <time.h>
#include <unistd.h>
#include "ply-utils.h"
#include "ply-list.h"
#ifndef PLY_LOGGER_OPEN_FLAGS
#define PLY_LOGGER_OPEN_FLAGS (O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW | O_CLOEXEC)
#endif
#ifndef PLY_LOGGER_MAX_INJECTION_SIZE
#define PLY_LOGGER_MAX_INJECTION_SIZE 4096
#endif
#ifndef PLY_LOGGER_MAX_BUFFER_CAPACITY
#define PLY_LOGGER_MAX_BUFFER_CAPACITY (8 * 4096)
#endif
typedef struct
{
ply_logger_filter_handler_t handler;
void *user_data;
} ply_logger_filter_t;
struct _ply_logger
{
int output_fd;
char *filename;
char *buffer;
size_t buffer_size;
@@ -285,77 +286,89 @@ ply_logger_free_filters (ply_logger_t *logger)
free (filter);
node = next_node;
}
ply_list_free (logger->filters);
}
void
ply_logger_free (ply_logger_t *logger)
{
if (logger == NULL)
return;
if (logger->output_fd >= 0) {
if (ply_logger_is_logging (logger))
ply_logger_flush (logger);
close (logger->output_fd);
}
ply_logger_free_filters (logger);
free (logger->filename);
free (logger->buffer);
free (logger);
}
bool
ply_logger_open_file (ply_logger_t *logger,
const char *filename)
{
+ char header[80];
+ struct tm* tm;
+ time_t t;
int fd;
mode_t mode;
assert (logger != NULL);
assert (filename != NULL);
fd = open (filename, PLY_LOGGER_OPEN_FLAGS, 0600);
if (fd < 0)
return false;
ply_logger_set_output_fd (logger, fd);
free (logger->filename);
logger->filename = strdup (filename);
+ time (&t);
+ tm = localtime (&t);
+ if (tm) {
+ /* This uses uname -v date format */
+ strftime (header, sizeof(header),
+ "------------ %a %b %d %T %Z %Y ------------\n", tm);
+ ply_logger_write (logger, header, strlen(header), true);
+ }
+
return true;
}
void
ply_logger_close_file (ply_logger_t *logger)
{
assert (logger != NULL);
if (logger->output_fd < 0)
return;
close (logger->output_fd);
ply_logger_set_output_fd (logger, -1);
}
void
ply_logger_set_output_fd (ply_logger_t *logger,
int fd)
{
assert (logger != NULL);
logger->output_fd = fd;
}
int
ply_logger_get_output_fd (ply_logger_t *logger)
{
assert (logger != NULL);
return logger->output_fd;
--
2.18.1

View File

@ -1,83 +0,0 @@
From f31312257094b3336c38cc8bdce1ded9188d37c3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Oct 2018 21:02:50 -0400
Subject: [PATCH 1/6] populate-initrd: drop unused local variable
the inst_library function declares a variable `_lib`
that's completely unused.
This commit removes the declaration.
---
scripts/plymouth-populate-initrd.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index e3326e9..5f3bb85 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -141,61 +141,61 @@ inst_simple() {
# find symlinks linked to given library file
# $1 = library file
# Function searches for symlinks by stripping version numbers appended to
# library filename, checks if it points to the same target and finally
# prints the list of symlinks to stdout.
#
# Example:
# rev_lib_symlinks libfoo.so.8.1
# output: libfoo.so.8 libfoo.so
# (Only if libfoo.so.8 and libfoo.so exists on host system.)
rev_lib_symlinks() {
[[ ! $1 ]] && return 0
local fn="$1" orig="$(readlink -f "$1")" links=''
[[ ${fn} =~ .*\.so\..* ]] || return 1
until [[ ${fn##*.} == so ]]; do
fn="${fn%.*}"
[[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}"
done
echo "${links}"
}
# Same as above, but specialized to handle dynamic libraries.
# It handles making symlinks according to how the original library
# is referenced.
inst_library() {
- local _src="$1" _dest=${2:-$1} _lib _reallib _symlink
+ local _src="$1" _dest=${2:-$1} _reallib _symlink
strstr "$1" "/" || return 1
[[ -e $initdir/$_dest ]] && return 0
if [[ -L $_src ]]; then
# install checksum files also
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
fi
_reallib=$(readlink -f "$_src")
inst_simple "$_reallib" "$_reallib"
inst_dir "${_dest%/*}"
[[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
ln -sfn $(convert_abs_rel "${_dest}" "${_reallib}") "${initdir}/${_dest}"
else
inst_simple "$_src" "$_dest"
fi
# Create additional symlinks. See rev_symlinks description.
for _symlink in $(rev_lib_symlinks $_src) $(rev_lib_symlinks $_reallib); do
[[ ! -e $initdir/$_symlink ]] && {
ddebug "Creating extra symlink: $_symlink"
inst_symlink $_symlink
}
done
}
# find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
if [[ -z ${1##/*} ]]; then
if [[ -x $1 ]] || { strstr "$1" ".so" && ldd $1 &>/dev/null; }; then
--
2.17.1

View File

@ -1,86 +0,0 @@
From c9a698d7840fca23cbaa205262a094e4f8648bb3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Oct 2018 21:04:47 -0400
Subject: [PATCH 2/6] boot-splash: fix memory leak in error path
If the splash key file fails to load, we don't free
the associated key file object.
This commit fixes that.
---
src/libply-splash-core/ply-boot-splash.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libply-splash-core/ply-boot-splash.c b/src/libply-splash-core/ply-boot-splash.c
index 87a7a0c..54f8585 100644
--- a/src/libply-splash-core/ply-boot-splash.c
+++ b/src/libply-splash-core/ply-boot-splash.c
@@ -181,62 +181,64 @@ void
ply_boot_splash_remove_text_display (ply_boot_splash_t *splash,
ply_text_display_t *display)
{
int number_of_columns, number_of_rows;
if (splash->plugin_interface->remove_text_display == NULL)
return;
number_of_columns = ply_text_display_get_number_of_columns (display);
number_of_rows = ply_text_display_get_number_of_rows (display);
ply_trace ("removing %dx%d text display", number_of_columns, number_of_rows);
splash->plugin_interface->remove_text_display (splash->plugin, display);
ply_list_remove_data (splash->text_displays, display);
}
bool
ply_boot_splash_load (ply_boot_splash_t *splash)
{
ply_key_file_t *key_file;
char *module_name;
char *module_path;
assert (splash != NULL);
get_plugin_interface_function_t get_boot_splash_plugin_interface;
key_file = ply_key_file_new (splash->theme_path);
- if (!ply_key_file_load (key_file))
+ if (!ply_key_file_load (key_file)) {
+ ply_key_file_free (key_file);
return false;
+ }
module_name = ply_key_file_get_value (key_file, "Plymouth Theme", "ModuleName");
asprintf (&module_path, "%s%s.so",
splash->plugin_dir, module_name);
free (module_name);
splash->module_handle = ply_open_module (module_path);
free (module_path);
if (splash->module_handle == NULL) {
ply_key_file_free (key_file);
return false;
}
get_boot_splash_plugin_interface = (get_plugin_interface_function_t)
ply_module_look_up_function (splash->module_handle,
"ply_boot_splash_plugin_get_interface");
if (get_boot_splash_plugin_interface == NULL) {
ply_save_errno ();
ply_close_module (splash->module_handle);
splash->module_handle = NULL;
ply_key_file_free (key_file);
ply_restore_errno ();
return false;
}
splash->plugin_interface = get_boot_splash_plugin_interface ();
--
2.17.1

View File

@ -1,45 +0,0 @@
From da27e42316962be6f6b8ba2afb49760d9704d070 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 21 Jan 2018 14:07:39 +0100
Subject: [PATCH 2/6] main: Do not update the display on backspace when there
is no input to remove
On machines with a slow CPU (Atom) and a highres screen drawing the
diskcrypt dialog may take longer then the keyrepeat speed, this leads to
a long delay before showing keypresses when doing the following:
1) Type long password
2) Realize it is wrong, press + hold backspace
the key-repeat will now generate backspace key presses faster then we
process them as main.c does an update_display for each press
3) Users releases backspace when we've processed input-length backspace
key-presses, but since we were drawing slower then key-presses were
coming in many more backspace keypresses are in the keyboard buffer
4) User types first character of the right password, this shows up up to
a couple of seconds later because first we are still processing all
the queued up backspace presses and doing a redraw for each.
This commit fixes this by skipping the redraws in on_backspace when there
is no more input left in the input buffer.
https://bugs.freedesktop.org/show_bug.cgi?id=104714
---
src/main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/main.c b/src/main.c
index 08c7fe1..f1e0fa7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1570,6 +1570,8 @@ on_backspace (state_t *state)
bytes = ply_buffer_get_bytes (state->entry_buffer);
size = ply_buffer_get_size (state->entry_buffer);
+ if (size == 0)
+ return;
bytes_to_remove = MIN (size, PLY_UTF8_CHARACTER_SIZE_MAX);
while ((previous_character_size = ply_utf8_character_get_size (bytes + size - bytes_to_remove, bytes_to_remove)) < bytes_to_remove) {
--
2.17.0

View File

@ -0,0 +1,142 @@
From b9faf90fe5939fedfd710e1e8385f4d5c12e1df7 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Jun 2020 10:35:45 -0400
Subject: [PATCH 2/2] throbgress: update for api change
---
src/plugins/splash/throbgress/plugin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c
index 86be064..68cca70 100644
--- a/src/plugins/splash/throbgress/plugin.c
+++ b/src/plugins/splash/throbgress/plugin.c
@@ -715,61 +715,61 @@ update_status (ply_boot_splash_plugin_t *plugin,
}
static void
on_boot_progress (ply_boot_splash_plugin_t *plugin,
double duration,
double percent_done)
{
ply_list_node_t *node;
double total_duration;
if (plugin->mode == PLY_BOOT_SPLASH_MODE_UPDATES ||
plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE ||
plugin->mode == PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE)
return;
total_duration = duration / percent_done;
/* Fun made-up smoothing function to make the growth asymptotic:
* fraction(time,estimate)=1-2^(-(time^1.45)/estimate) */
percent_done = 1.0 - pow (2.0, -pow (duration, 1.45) / total_duration) * (1.0 - percent_done);
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
ply_list_node_t *next_node;
view_t *view;
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
- ply_progress_bar_set_percent_done (view->progress_bar, percent_done);
+ ply_progress_bar_set_fraction_done (view->progress_bar, percent_done);
node = next_node;
}
}
static void
hide_splash_screen (ply_boot_splash_plugin_t *plugin,
ply_event_loop_t *loop)
{
assert (plugin != NULL);
ply_trace ("hiding splash");
if (plugin->loop != NULL) {
stop_animation (plugin, NULL);
ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)
detach_from_event_loop,
plugin);
detach_from_event_loop (plugin);
}
plugin->is_visible = false;
}
static void
show_password_prompt (ply_boot_splash_plugin_t *plugin,
const char *text,
int number_of_bullets)
{
ply_list_node_t *node;
@@ -920,61 +920,61 @@ display_question (ply_boot_splash_plugin_t *plugin,
show_prompt (plugin, prompt, entry_text);
redraw_views (plugin);
unpause_views (plugin);
}
static void
display_message (ply_boot_splash_plugin_t *plugin,
const char *message)
{
show_message (plugin, message);
}
static void
system_update (ply_boot_splash_plugin_t *plugin,
int progress)
{
ply_list_node_t *node;
if (plugin->mode != PLY_BOOT_SPLASH_MODE_UPDATES &&
plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE &&
plugin->mode != PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE)
return;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
ply_list_node_t *next_node;
view_t *view;
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
- ply_progress_bar_set_percent_done (view->progress_bar, (double) progress / 100.f);
+ ply_progress_bar_set_fraction_done (view->progress_bar, (double) progress / 100.f);
node = next_node;
}
}
ply_boot_splash_plugin_interface_t *
ply_boot_splash_plugin_get_interface (void)
{
static ply_boot_splash_plugin_interface_t plugin_interface =
{
.create_plugin = create_plugin,
.destroy_plugin = destroy_plugin,
.add_pixel_display = add_pixel_display,
.remove_pixel_display = remove_pixel_display,
.show_splash_screen = show_splash_screen,
.update_status = update_status,
.on_boot_progress = on_boot_progress,
.hide_splash_screen = hide_splash_screen,
.on_root_mounted = on_root_mounted,
.become_idle = become_idle,
.display_normal = display_normal,
.display_password = display_password,
.display_question = display_question,
.display_message = display_message,
.system_update = system_update,
};
return &plugin_interface;
}
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
--
2.21.0

View File

@ -1,86 +0,0 @@
From 9f335750af9e46d6597de0cea5b8a2f7db951dc1 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Oct 2018 21:07:01 -0400
Subject: [PATCH 3/6] event-loop: fix leak in error path
ply_event_loop_new fails to clean itself up if it's unable to
create a pipe for dispatching signals.
This commit fixes that.
---
src/libply/ply-event-loop.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libply/ply-event-loop.c b/src/libply/ply-event-loop.c
index 9736dae..0e8ad7c 100644
--- a/src/libply/ply-event-loop.c
+++ b/src/libply/ply-event-loop.c
@@ -469,62 +469,64 @@ ply_event_loop_remove_destination_by_fd_watch (ply_event_loop_t *loop,
source = destination->source;
assert (source != NULL);
ply_list_remove_data (source->destinations, destination);
ply_event_source_drop_reference (source);
assert (ply_list_find_node (source->destinations, destination) == NULL);
ply_event_loop_update_source_event_mask (loop, source);
}
ply_event_loop_t *
ply_event_loop_new (void)
{
ply_event_loop_t *loop;
loop = calloc (1, sizeof(ply_event_loop_t));
loop->epoll_fd = epoll_create1 (EPOLL_CLOEXEC);
loop->wakeup_time = PLY_EVENT_LOOP_NO_TIMED_WAKEUP;
assert (loop->epoll_fd >= 0);
loop->should_exit = false;
loop->exit_code = 0;
loop->sources = ply_list_new ();
loop->exit_closures = ply_list_new ();
loop->timeout_watches = ply_list_new ();
loop->signal_dispatcher = ply_signal_dispatcher_new ();
- if (loop->signal_dispatcher == NULL)
+ if (loop->signal_dispatcher == NULL) {
+ ply_event_loop_free (loop);
return NULL;
+ }
ply_event_loop_watch_fd (loop,
ply_signal_dispatcher_receiver_fd,
PLY_EVENT_LOOP_FD_STATUS_HAS_DATA,
(ply_event_handler_t)
ply_signal_dispatcher_dispatch_signal,
(ply_event_handler_t)
ply_signal_dispatcher_reset_signal_sources,
loop->signal_dispatcher);
return loop;
}
ply_event_loop_t *
ply_event_loop_get_default (void)
{
static ply_event_loop_t *loop = NULL;
if (loop == NULL)
loop = ply_event_loop_new ();
return loop;
}
static void
ply_event_loop_free_exit_closures (ply_event_loop_t *loop)
{
ply_list_node_t *node;
node = ply_list_get_first_node (loop->exit_closures);
--
2.17.1

View File

@ -1,249 +0,0 @@
From 0e4e268844ea38075535eb5b233dda325da4481d Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 6 Dec 2017 17:37:12 +0100
Subject: [PATCH 3/6] pixel-buffer: Add the concept of device rotation
On some devices the LCD panel is mounted in the casing in such a way
that the up/top side of the panel does not match with the top side of
the device (e.g. it is mounted upside-down).
This commit adds support to the ply-pixel-buffer code to create
buffers which take device rotation into account and which will rotate
the picture to compensate.
https://bugs.freedesktop.org/show_bug.cgi?id=104714
---
src/libply-splash-core/ply-pixel-buffer.c | 109 ++++++++++++++++++++--
src/libply-splash-core/ply-pixel-buffer.h | 9 ++
2 files changed, 110 insertions(+), 8 deletions(-)
diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c
index 52a3f86..a337407 100644
--- a/src/libply-splash-core/ply-pixel-buffer.c
+++ b/src/libply-splash-core/ply-pixel-buffer.c
@@ -50,6 +50,7 @@ struct _ply_pixel_buffer
ply_region_t *updated_areas; /* in device pixels */
uint32_t is_opaque : 1;
int device_scale;
+ int device_rotation;
};
static inline void ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer,
@@ -153,6 +154,52 @@ make_pixel_value_translucent (uint32_t pixel_value,
return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
+static inline void ply_pixel_buffer_set_pixel (ply_pixel_buffer_t *buffer,
+ int x,
+ int y,
+ uint32_t pixel_value)
+{
+ switch (buffer->device_rotation) {
+ case PLY_PIXEL_BUFFER_ROTATE_UPRIGHT:
+ buffer->bytes[y * buffer->area.width + x] = pixel_value;
+ break;
+ case PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN:
+ x = (buffer->area.width - 1) - x;
+ y = (buffer->area.height - 1) - y;
+ buffer->bytes[y * buffer->area.width + x] = pixel_value;
+ break;
+ case PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE:
+ y = (buffer->area.height - 1) - y;
+ buffer->bytes[x * buffer->area.height + y] = pixel_value;
+ break;
+ case PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE:
+ x = (buffer->area.width - 1) - x;
+ buffer->bytes[x * buffer->area.height + y] = pixel_value;
+ break;
+ }
+}
+
+static inline uint32_t ply_pixel_buffer_get_pixel (ply_pixel_buffer_t *buffer,
+ int x,
+ int y)
+{
+ switch (buffer->device_rotation) {
+ case PLY_PIXEL_BUFFER_ROTATE_UPRIGHT:
+ return buffer->bytes[y * buffer->area.width + x];
+ case PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN:
+ x = (buffer->area.width - 1) - x;
+ y = (buffer->area.height - 1) - y;
+ return buffer->bytes[y * buffer->area.width + x];
+ case PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE:
+ y = (buffer->area.height - 1) - y;
+ return buffer->bytes[x * buffer->area.height + y];
+ case PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE:
+ x = (buffer->area.width - 1) - x;
+ return buffer->bytes[x * buffer->area.height + y];
+ }
+ return 0;
+}
+
static inline void
ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer,
int x,
@@ -162,12 +209,12 @@ ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer,
uint32_t old_pixel_value;
if ((pixel_value >> 24) != 0xff) {
- old_pixel_value = buffer->bytes[y * buffer->area.width + x];
+ old_pixel_value = ply_pixel_buffer_get_pixel (buffer, x, y);
pixel_value = blend_two_pixel_values (pixel_value, old_pixel_value);
}
- buffer->bytes[y * buffer->area.width + x] = pixel_value;
+ ply_pixel_buffer_set_pixel (buffer, x, y, pixel_value);
}
static void
@@ -222,6 +269,35 @@ ply_pixel_buffer_crop_area_to_clip_area (ply_pixel_buffer_t *buffer,
}
}
+static void ply_pixel_buffer_add_updated_area (ply_pixel_buffer_t *buffer,
+ ply_rectangle_t *area)
+{
+ ply_rectangle_t updated_area = *area;
+
+ switch (buffer->device_rotation) {
+ case PLY_PIXEL_BUFFER_ROTATE_UPRIGHT:
+ break;
+ case PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN:
+ updated_area.x = buffer->area.width - area->width - area->x;
+ updated_area.y = buffer->area.height - area->height - area->y;
+ break;
+ case PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE:
+ updated_area.x = buffer->area.height - area->height - area->y;
+ updated_area.y = area->x;
+ updated_area.height = area->width;
+ updated_area.width = area->height;
+ break;
+ case PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE:
+ updated_area.x = area->y;
+ updated_area.y = buffer->area.width - area->width - area->x;
+ updated_area.height = area->width;
+ updated_area.width = area->height;
+ break;
+ }
+
+ ply_region_add_rectangle (buffer->updated_areas, &updated_area);
+}
+
static void
ply_pixel_buffer_fill_area_with_pixel_value (ply_pixel_buffer_t *buffer,
ply_rectangle_t *fill_area,
@@ -251,7 +327,7 @@ ply_pixel_buffer_fill_area_with_pixel_value (ply_pixel_buffer_t *buffer,
}
}
- ply_region_add_rectangle (buffer->updated_areas, &cropped_area);
+ ply_pixel_buffer_add_updated_area (buffer, &cropped_area);
}
void
@@ -281,9 +357,24 @@ ply_pixel_buffer_pop_clip_area (ply_pixel_buffer_t *buffer)
ply_pixel_buffer_t *
ply_pixel_buffer_new (unsigned long width,
unsigned long height)
+{
+ return ply_pixel_buffer_new_with_device_rotation (
+ width, height, PLY_PIXEL_BUFFER_ROTATE_UPRIGHT);
+}
+
+ply_pixel_buffer_t *
+ply_pixel_buffer_new_with_device_rotation (unsigned long width,
+ unsigned long height,
+ int device_rotation)
{
ply_pixel_buffer_t *buffer;
+ if (device_rotation >= PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE) {
+ unsigned long tmp = width;
+ width = height;
+ height = tmp;
+ }
+
buffer = calloc (1, sizeof(ply_pixel_buffer_t));
buffer->updated_areas = ply_region_new ();
@@ -292,6 +383,7 @@ ply_pixel_buffer_new (unsigned long width,
buffer->area.height = height;
buffer->logical_area = buffer->area;
buffer->device_scale = 1;
+ buffer->device_rotation = device_rotation;
buffer->clip_areas = ply_list_new ();
ply_pixel_buffer_push_clip_area (buffer, &buffer->area);
@@ -447,7 +539,7 @@ ply_pixel_buffer_fill_with_gradient (ply_pixel_buffer_t *buffer,
for (y = buffer->area.y; y < buffer->area.y + buffer->area.height; y++) {
if (cropped_area.y <= y && y < cropped_area.y + cropped_area.height) {
- if (cropped_area.width < UNROLLED_PIXEL_COUNT) {
+ if (cropped_area.width < UNROLLED_PIXEL_COUNT || buffer->device_rotation) {
for (x = cropped_area.x; x < cropped_area.x + cropped_area.width; x++) {
pixel = 0xff000000;
RANDOMIZE (noise);
@@ -457,7 +549,7 @@ ply_pixel_buffer_fill_with_gradient (ply_pixel_buffer_t *buffer,
RANDOMIZE (noise);
pixel |= (((blue + noise) & COLOR_MASK) >> BLUE_SHIFT);
- buffer->bytes[y * buffer->area.width + x] = pixel;
+ ply_pixel_buffer_set_pixel (buffer, x, y, pixel);
}
} else {
uint32_t shaded_set[UNROLLED_PIXEL_COUNT];
@@ -485,7 +577,7 @@ ply_pixel_buffer_fill_with_gradient (ply_pixel_buffer_t *buffer,
blue += blue_step;
}
- ply_region_add_rectangle (buffer->updated_areas, &cropped_area);
+ ply_pixel_buffer_add_updated_area (buffer, &cropped_area);
}
void
@@ -671,7 +763,7 @@ ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip_and_scale (ply_pixel
}
}
- ply_region_add_rectangle (buffer->updated_areas, &cropped_area);
+ ply_pixel_buffer_add_updated_area (buffer, &cropped_area);
}
void
@@ -756,7 +848,8 @@ ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (ply_pixel_buffer_t *canv
/* Fast path to memcpy if we need no blending or scaling */
if (opacity == 1.0 && ply_pixel_buffer_is_opaque (source) &&
- canvas->device_scale == source->device_scale) {
+ canvas->device_scale == source->device_scale &&
+ canvas->device_rotation == PLY_PIXEL_BUFFER_ROTATE_UPRIGHT) {
ply_rectangle_t cropped_area;
cropped_area.x = x_offset;
diff --git a/src/libply-splash-core/ply-pixel-buffer.h b/src/libply-splash-core/ply-pixel-buffer.h
index 595e9bd..7736dd3 100644
--- a/src/libply-splash-core/ply-pixel-buffer.h
+++ b/src/libply-splash-core/ply-pixel-buffer.h
@@ -37,9 +37,18 @@ typedef struct _ply_pixel_buffer ply_pixel_buffer_t;
| ((uint8_t) (CLAMP (g * 255.0, 0.0, 255.0)) << 8) \
| ((uint8_t) (CLAMP (b * 255.0, 0.0, 255.0))))
+#define PLY_PIXEL_BUFFER_ROTATE_UPRIGHT 0
+#define PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN 1
+#define PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE 2
+#define PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE 3
+
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width,
unsigned long height);
+ply_pixel_buffer_t *
+ply_pixel_buffer_new_with_device_rotation (unsigned long width,
+ unsigned long height,
+ int device_rotation);
void ply_pixel_buffer_free (ply_pixel_buffer_t *buffer);
void ply_pixel_buffer_get_size (ply_pixel_buffer_t *buffer,
ply_rectangle_t *size);
--
2.17.0

View File

@ -1,102 +0,0 @@
From a6f25b727698a2382e332ab566ed39ee30f8efdc Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 12 Dec 2017 19:47:26 +0100
Subject: [PATCH 4/6] drm: Check for "panel orientation" connector property
On some devices the LCD panel is mounted in the casing in such a way
that the up/top side of the panel does not match with the top side of
the device (e.g. it is mounted upside-down).
Kernel 4.16 introduces a new "panel-orientation" property on the drm
connector which allows modesetting applications / code to check for
such LCD panels.
This commit adds support for this new property and passes this to the
pixel_buffer code using the new ply_pixel_buffer_new_with_device_rotation
method, so that the pixel_buffer code will automatically rotate the
image to correct for the panel orientation.
https://bugs.freedesktop.org/show_bug.cgi?id=104714
---
src/plugins/renderers/drm/plugin.c | 51 +++++++++++++++++++++++++++++-
1 file changed, 50 insertions(+), 1 deletion(-)
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index b93e8e4..f495854 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -367,6 +367,53 @@ destroy_output_buffer (ply_renderer_backend_t *backend,
ply_renderer_buffer_free (backend, buffer);
}
+static int
+connector_orientation_prop_to_rotation (drmModePropertyPtr prop,
+ int orientation)
+{
+ const char *name = prop->enums[orientation].name;
+
+ if (strcmp (name, "Upside Down") == 0)
+ return PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN;
+
+ if (strcmp (name, "Left Side Up") == 0) {
+ /* Left side up, rotate counter clockwise to correct */
+ return PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE;
+ }
+
+ if (strcmp (name, "Right Side Up") == 0) {
+ /* Left side up, rotate clockwise to correct */
+ return PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE;
+ }
+
+ return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT;
+}
+
+static int
+ply_renderer_connector_get_rotation (ply_renderer_backend_t *backend,
+ drmModeConnector *connector)
+{
+ drmModePropertyPtr prop;
+ int i, rotation;
+
+ for (i = 0; i < connector->count_props; i++) {
+ prop = drmModeGetProperty (backend->device_fd, connector->props[i]);
+ if (!prop)
+ continue;
+
+ if ((prop->flags & DRM_MODE_PROP_ENUM) &&
+ strcmp (prop->name, "panel orientation") == 0) {
+ rotation = connector_orientation_prop_to_rotation (prop, connector->prop_values[i]);
+ drmModeFreeProperty (prop);
+ return rotation;
+ }
+
+ drmModeFreeProperty (prop);
+ }
+
+ return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT;
+}
+
static bool
ply_renderer_head_add_connector (ply_renderer_head_t *head,
drmModeConnector *connector,
@@ -402,6 +449,7 @@ ply_renderer_head_new (ply_renderer_backend_t *backend,
{
ply_renderer_head_t *head;
drmModeModeInfo *mode;
+ int rotation;
head = calloc (1, sizeof(ply_renderer_head_t));
@@ -425,7 +473,8 @@ ply_renderer_head_new (ply_renderer_backend_t *backend,
ply_renderer_head_add_connector (head, connector, connector_mode_index);
assert (ply_array_get_size (head->connector_ids) > 0);
- head->pixel_buffer = ply_pixel_buffer_new (head->area.width, head->area.height);
+ rotation = ply_renderer_connector_get_rotation (backend, connector);
+ head->pixel_buffer = ply_pixel_buffer_new_with_device_rotation (head->area.width, head->area.height, rotation);
ply_pixel_buffer_set_device_scale (head->pixel_buffer,
ply_get_device_scale (head->area.width,
head->area.height,
--
2.17.0

View File

@ -1,216 +0,0 @@
From b8d406161ee95ad4fa1a478d262993090404608f Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Oct 2018 21:13:58 -0400
Subject: [PATCH 4/6] key-file: ply_key_file_get_value returns duplicated
memory, don't leak
For some reason I made the same api misdesign with ply_key_file_t
that I made when writing GKeyFile...it returns duplicated memory for
no good reason.
This commit sprinkles frees around.
---
src/main.c | 13 +++++++++----
src/plugins/splash/two-step/plugin.c | 2 ++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/main.c b/src/main.c
index 841fe6b..e44de7b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -268,116 +268,121 @@ on_system_update (state_t *state,
}
static void
show_messages (state_t *state)
{
if (state->boot_splash == NULL) {
ply_trace ("not displaying messages, since no boot splash");
return;
}
ply_list_node_t *node = ply_list_get_first_node (state->messages);
while (node != NULL) {
ply_list_node_t *next_node;
char *message = ply_list_node_get_data (node);
ply_trace ("displaying messages");
ply_boot_splash_display_message (state->boot_splash, message);
next_node = ply_list_get_next_node (state->messages, node);
node = next_node;
}
}
static bool
load_settings (state_t *state,
const char *path,
char **theme_path)
{
ply_key_file_t *key_file = NULL;
bool settings_loaded = false;
- const char *scale_string;
- const char *splash_string;
+ char *scale_string = NULL;
+ char *splash_string = NULL;
ply_trace ("Trying to load %s", path);
key_file = ply_key_file_new (path);
if (!ply_key_file_load (key_file))
goto out;
splash_string = ply_key_file_get_value (key_file, "Daemon", "Theme");
if (splash_string == NULL)
goto out;
asprintf (theme_path,
PLYMOUTH_RUNTIME_THEME_PATH "%s/%s.plymouth",
splash_string, splash_string);
ply_trace ("Checking if %s exists", *theme_path);
if (!ply_file_exists (*theme_path)) {
ply_trace ("%s not found, fallbacking to " PLYMOUTH_THEME_PATH,
*theme_path);
asprintf (theme_path,
PLYMOUTH_THEME_PATH "%s/%s.plymouth",
splash_string, splash_string);
}
if (isnan (state->splash_delay)) {
- const char *delay_string;
+ char *delay_string;
delay_string = ply_key_file_get_value (key_file, "Daemon", "ShowDelay");
if (delay_string != NULL) {
state->splash_delay = atof (delay_string);
ply_trace ("Splash delay is set to %lf", state->splash_delay);
+ free (delay_string);
}
}
if (isnan (state->device_timeout)) {
- const char *timeout_string;
+ char *timeout_string;
timeout_string = ply_key_file_get_value (key_file, "Daemon", "DeviceTimeout");
if (timeout_string != NULL) {
state->device_timeout = atof (timeout_string);
ply_trace ("Device timeout is set to %lf", state->device_timeout);
+
+ free (timeout_string);
}
}
scale_string = ply_key_file_get_value (key_file, "Daemon", "DeviceScale");
if (scale_string != NULL) {
ply_set_device_scale (strtoul (scale_string, NULL, 0));
+ free (scale_string);
}
settings_loaded = true;
out:
+ free (splash_string);
ply_key_file_free (key_file);
return settings_loaded;
}
static void
show_detailed_splash (state_t *state)
{
ply_boot_splash_t *splash;
if (state->boot_splash != NULL)
return;
ply_trace ("Showing detailed splash screen");
splash = show_theme (state, NULL);
if (splash == NULL) {
ply_trace ("Could not start detailed splash screen, this could be a problem.");
return;
}
state->boot_splash = splash;
show_messages (state);
update_display (state);
}
static const char *
command_line_get_string_after_prefix (const char *command_line,
const char *prefix)
diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c
index 070741d..52986d2 100644
--- a/src/plugins/splash/two-step/plugin.c
+++ b/src/plugins/splash/two-step/plugin.c
@@ -631,60 +631,62 @@ create_plugin (ply_key_file_t *key_file)
if (color != NULL)
plugin->background_start_color = strtol (color, NULL, 0);
else
plugin->background_start_color = PLYMOUTH_BACKGROUND_START_COLOR;
free (color);
color = ply_key_file_get_value (key_file, "two-step", "BackgroundEndColor");
if (color != NULL)
plugin->background_end_color = strtol (color, NULL, 0);
else
plugin->background_end_color = PLYMOUTH_BACKGROUND_END_COLOR;
free (color);
progress_function = ply_key_file_get_value (key_file, "two-step", "ProgressFunction");
if (progress_function != NULL) {
if (strcmp (progress_function, "wwoods") == 0) {
ply_trace ("Using wwoods progress function");
plugin->progress_function = PROGRESS_FUNCTION_TYPE_WWOODS;
} else if (strcmp (progress_function, "linear") == 0) {
ply_trace ("Using linear progress function");
plugin->progress_function = PROGRESS_FUNCTION_TYPE_LINEAR;
} else {
ply_trace ("unknown progress function %s, defaulting to linear", progress_function);
plugin->progress_function = PROGRESS_FUNCTION_TYPE_LINEAR;
}
+
+ free (progress_function);
}
plugin->views = ply_list_new ();
return plugin;
}
static void
free_views (ply_boot_splash_plugin_t *plugin)
{
ply_list_node_t *node;
ply_trace ("freeing views");
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
ply_list_node_t *next_node;
view_t *view;
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
view_free (view);
ply_list_remove_node (plugin->views, node);
node = next_node;
}
ply_list_free (plugin->views);
--
2.17.1

View File

@ -1,148 +0,0 @@
From d769f1194c934ed4ff7ce6bfc502ba485d461c12 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 20 Jan 2018 12:20:29 +0100
Subject: [PATCH 5/6] drm: Reset primary plane rotation to DRM_MODE_ROTATE_0
On devices where the (LCD) panel is mounted upside-down in the case
the kernel's drm_fb_helper code may have set up rotation on the primary
plane to make the text-console (and other fbdev using apps) show the right
way up.
We inherit this rotation from the text-mode and since we do our own rotation
where necessary we end up rotating twice and showing the boot-splash
upside-down again.
Dealing with hardware rotation may require using a specific framebuffer
tiling which we do not support, so we should just disable the hardware
rotation and keep using our own software rotation.
This commit adds code to find the primary plane and its rotation property
and if it is not DRM_MODE_ROTATE_0 then sets it to DRM_MODE_ROTATE_0. fixing
the double rotation issue.
https://bugs.freedesktop.org/show_bug.cgi?id=104714
---
src/plugins/renderers/drm/plugin.c | 86 ++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index f495854..fb79aa6 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -43,6 +43,7 @@
#include <unistd.h>
#include <drm.h>
+#include <drm_mode.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
@@ -62,6 +63,11 @@
#define BYTES_PER_PIXEL (4)
+/* For builds with libdrm < 2.4.89 */
+#ifndef DRM_MODE_ROTATE_0
+#define DRM_MODE_ROTATE_0 (1<<0)
+#endif
+
struct _ply_renderer_head
{
ply_renderer_backend_t *backend;
@@ -499,6 +505,85 @@ ply_renderer_head_free (ply_renderer_head_t *head)
free (head);
}
+static void
+ply_renderer_head_clear_plane_rotation (ply_renderer_backend_t *backend,
+ ply_renderer_head_t *head)
+{
+ drmModeObjectPropertiesPtr plane_props;
+ drmModePlaneResPtr plane_resources;
+ drmModePropertyPtr prop;
+ drmModePlanePtr plane;
+ uint64_t rotation;
+ uint32_t i, j;
+ int rotation_prop_id = -1;
+ int primary_id = -1;
+ int err;
+
+ err = drmSetClientCap (backend->device_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
+ if (err)
+ return;
+
+ plane_resources = drmModeGetPlaneResources (backend->device_fd);
+ if (!plane_resources)
+ return;
+
+ for (i = 0; i < plane_resources->count_planes; i++) {
+ plane = drmModeGetPlane (backend->device_fd,
+ plane_resources->planes[i]);
+ if (!plane)
+ continue;
+
+ if (plane->crtc_id != head->controller_id) {
+ drmModeFreePlane (plane);
+ continue;
+ }
+
+ plane_props = drmModeObjectGetProperties (backend->device_fd,
+ plane->plane_id,
+ DRM_MODE_OBJECT_PLANE);
+
+ for (j = 0; plane_props && (j < plane_props->count_props); j++) {
+ prop = drmModeGetProperty (backend->device_fd,
+ plane_props->props[j]);
+ if (!prop)
+ continue;
+
+ if (strcmp (prop->name, "type") == 0 &&
+ plane_props->prop_values[j] == DRM_PLANE_TYPE_PRIMARY) {
+ primary_id = plane->plane_id;
+ }
+
+ if (strcmp (prop->name, "rotation") == 0) {
+ rotation_prop_id = plane_props->props[j];
+ rotation = plane_props->prop_values[j];
+ }
+
+ drmModeFreeProperty (prop);
+ }
+
+ drmModeFreeObjectProperties (plane_props);
+ drmModeFreePlane (plane);
+
+ if (primary_id != -1)
+ break;
+
+ /* Not primary -> clear any found rotation property */
+ rotation_prop_id = -1;
+ }
+
+ if (primary_id != -1 && rotation_prop_id != -1 && rotation != DRM_MODE_ROTATE_0) {
+ err = drmModeObjectSetProperty (backend->device_fd,
+ primary_id,
+ DRM_MODE_OBJECT_PLANE,
+ rotation_prop_id,
+ DRM_MODE_ROTATE_0);
+ ply_trace ("Cleared rotation on primary plane %d result %d",
+ primary_id, err);
+ }
+
+ drmModeFreePlaneResources (plane_resources);
+}
+
static bool
ply_renderer_head_set_scan_out_buffer (ply_renderer_backend_t *backend,
ply_renderer_head_t *head,
@@ -525,6 +610,7 @@ ply_renderer_head_set_scan_out_buffer (ply_renderer_backend_t *backend,
return false;
}
+ ply_renderer_head_clear_plane_rotation (backend, head);
return true;
}
--
2.17.0

View File

@ -1,556 +0,0 @@
From 6980c2cdf003f5963695809b3a278ff53ad51832 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Oct 2018 21:44:10 -0400
Subject: [PATCH 5/6] script: fix various memory leaks
coverity found a few leaks.
this commit mops them up.
---
src/plugins/splash/script/script-lib-image.c | 5 +-
src/plugins/splash/script/script-lib-sprite.c | 4 +-
src/plugins/splash/script/script-parse.c | 61 +++++++++++++++++--
3 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/src/plugins/splash/script/script-lib-image.c b/src/plugins/splash/script/script-lib-image.c
index a202702..748e6d1 100644
--- a/src/plugins/splash/script/script-lib-image.c
+++ b/src/plugins/splash/script/script-lib-image.c
@@ -173,61 +173,64 @@ static script_return_t image_text (script_state_t *state,
script_obj_unref (alpha_obj);
font_obj = script_obj_hash_peek_element (state->local, "font");
if (script_obj_is_string (font_obj))
font = script_obj_as_string (font_obj);
else
font = NULL;
script_obj_unref (font_obj);
align_obj = script_obj_hash_peek_element (state->local, "align");
if (script_obj_is_string (align_obj)) {
char *align_str = script_obj_as_string (align_obj);
if (!strcmp ("left", align_str))
align = PLY_LABEL_ALIGN_LEFT;
else if (!strcmp ("center", align_str))
align = PLY_LABEL_ALIGN_CENTER;
else if (!strcmp ("right", align_str))
align = PLY_LABEL_ALIGN_RIGHT;
else
ply_error ("Unrecognized Image.Text alignment string '%s'. "
"Expecting 'left', 'center', or 'right'\n",
align_str);
free (align_str);
}
script_obj_unref (align_obj);
- if (!text) return script_return_obj_null ();
+ if (!text) {
+ free (font);
+ return script_return_obj_null ();
+ }
label = ply_label_new ();
ply_label_set_text (label, text);
if (font)
ply_label_set_font (label, font);
ply_label_set_alignment (label, align);
ply_label_set_color (label, red, green, blue, alpha);
ply_label_show (label, NULL, 0, 0);
width = ply_label_get_width (label);
height = ply_label_get_height (label);
image = ply_pixel_buffer_new (width, height);
ply_label_draw_area (label, image, 0, 0, width, height);
free (text);
free (font);
ply_label_free (label);
return script_return_obj (script_obj_new_native (image, data->class));
}
script_lib_image_data_t *script_lib_image_setup (script_state_t *state,
char *image_dir)
{
script_lib_image_data_t *data = malloc (sizeof(script_lib_image_data_t));
data->class = script_obj_native_class_new (image_free, "image", data);
data->image_dir = strdup (image_dir);
diff --git a/src/plugins/splash/script/script-lib-sprite.c b/src/plugins/splash/script/script-lib-sprite.c
index c49297d..b119f05 100644
--- a/src/plugins/splash/script/script-lib-sprite.c
+++ b/src/plugins/splash/script/script-lib-sprite.c
@@ -714,66 +714,68 @@ region_add_area (ply_region_t *region,
ply_region_add_rectangle (region, &rectangle);
}
void script_lib_sprite_pixel_display_removed (script_lib_sprite_data_t *data, ply_pixel_display_t *pixel_display)
{
ply_list_node_t *node;
ply_list_node_t *next_node;
script_lib_display_t* display;
if (!data)
return;
node = ply_list_get_first_node (data->displays);
while (node)
{
next_node = ply_list_get_next_node (data->displays, node);
display = ply_list_node_get_data (node);
if (display->pixel_display == pixel_display)
{
ply_list_remove_node (data->displays, node);
}
node = next_node;
}
}
void
script_lib_sprite_refresh (script_lib_sprite_data_t *data)
{
ply_list_node_t *node;
- ply_region_t *region = ply_region_new ();
+ ply_region_t *region;
ply_list_t *rectable_list;
if (!data)
return;
+ region = ply_region_new ();
+
ply_list_sort_stable (data->sprite_list, &sprite_compare_z);
node = ply_list_get_first_node (data->sprite_list);
if (data->full_refresh) {
for (node = ply_list_get_first_node (data->displays);
node;
node = ply_list_get_next_node (data->displays, node)) {
script_lib_display_t *display = ply_list_node_get_data (node);
region_add_area (region,
display->x,
display->y,
ply_pixel_display_get_width (display->pixel_display),
ply_pixel_display_get_height (display->pixel_display));
}
data->full_refresh = false;
}
while (node) {
sprite_t *sprite = ply_list_node_get_data (node);
ply_list_node_t *next_node = ply_list_get_next_node (data->sprite_list,
node);
if (sprite->remove_me) {
if (sprite->image) {
region_add_area (region,
sprite->old_x,
sprite->old_y,
sprite->old_width,
diff --git a/src/plugins/splash/script/script-parse.c b/src/plugins/splash/script/script-parse.c
index a4c7656..ea5fdd2 100644
--- a/src/plugins/splash/script/script-parse.c
+++ b/src/plugins/splash/script/script-parse.c
@@ -27,60 +27,61 @@
#include "ply-hashtable.h"
#include "ply-list.h"
#include "ply-bitarray.h"
#include "ply-logger.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
#include <stdbool.h>
#include "script-debug.h"
#include "script-scan.h"
#include "script-parse.h"
#define WITH_SEMIES
typedef struct
{
const char *symbol;
script_exp_type_t exp_type;
int presedence;
}script_parse_operator_table_entry_t;
static script_op_t *script_parse_op (script_scan_t *scan);
static script_exp_t *script_parse_exp (script_scan_t *scan);
static ply_list_t *script_parse_op_list (script_scan_t *scan);
static void script_parse_op_list_free (ply_list_t *op_list);
+static void script_parse_exp_free (script_exp_t *exp);
static script_exp_t *script_parse_new_exp (script_exp_type_t type,
script_debug_location_t *location)
{
script_exp_t *exp = malloc (sizeof(script_exp_t));
exp->type = type;
script_debug_add_element (exp, location);
return exp;
}
static script_exp_t *script_parse_new_exp_single (script_exp_type_t type,
script_exp_t *sub,
script_debug_location_t *location)
{
script_exp_t *exp = script_parse_new_exp (type, location);
exp->data.sub = sub;
return exp;
}
static script_exp_t *script_parse_new_exp_dual (script_exp_type_t type,
script_exp_t *sub_a,
script_exp_t *sub_b,
script_debug_location_t *location)
{
script_exp_t *exp = script_parse_new_exp (type, location);
exp->data.dual.sub_a = sub_a;
exp->data.dual.sub_b = sub_b;
@@ -198,101 +199,127 @@ static void script_parse_error (script_debug_location_t *location,
static const script_parse_operator_table_entry_t * /* Only allows 1 or 2 character symbols */
script_parse_operator_table_entry_lookup (script_scan_t *scan,
const script_parse_operator_table_entry_t *table)
{
int entry_index;
script_scan_token_t *curtoken = script_scan_get_current_token (scan);
script_scan_token_t *peektoken = script_scan_peek_next_token (scan);
for (entry_index = 0; table[entry_index].symbol; entry_index++) {
if (!script_scan_token_is_symbol (curtoken)) continue;
if (curtoken->data.symbol != table[entry_index].symbol[0]) continue;
if (table[entry_index].symbol[1]) {
if (!script_scan_token_is_symbol (peektoken)) continue;
if (peektoken->data.symbol != table[entry_index].symbol[1]) continue;
if (peektoken->whitespace) continue;
}
break;
}
return &table[entry_index];
}
static void script_parse_advance_scan_by_string (script_scan_t *scan,
const char *string)
{
while (*string) {
script_scan_get_next_token (scan);
string++;
}
}
+static void
+free_parameter_list (script_scan_t *scan,
+ ply_list_t *parameter_list)
+{
+ if (parameter_list != NULL) {
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (parameter_list);
+ while (node != NULL) {
+ ply_list_node_t *next_node;
+ char *parameter;
+
+ parameter = ply_list_node_get_data (node);
+ next_node = ply_list_get_next_node (parameter_list, node);
+ free (parameter);
+ ply_list_remove_node (parameter_list, node);
+
+ node = next_node;
+ }
+ }
+}
+
static script_function_t *script_parse_function_def (script_scan_t *scan)
{
script_scan_token_t *curtoken = script_scan_get_current_token (scan);
- ply_list_t *parameter_list;
+ script_function_t *function = NULL;
+ ply_list_t *parameter_list = NULL;
if (!script_scan_token_is_symbol_of_value (curtoken, '(')) {
script_parse_error (&curtoken->location,
"Function declaration requires parameters to be declared within '(' brackets");
return NULL;
}
curtoken = script_scan_get_next_token (scan);
parameter_list = ply_list_new ();
while (true) {
if (script_scan_token_is_symbol_of_value (curtoken, ')')) break;
if (!script_scan_token_is_identifier (curtoken)) {
script_parse_error (&curtoken->location,
"Function declaration parameters must be valid identifiers");
- return NULL;
+ goto out;
}
char *parameter = strdup (curtoken->data.string);
ply_list_append_data (parameter_list, parameter);
curtoken = script_scan_get_next_token (scan);
if (script_scan_token_is_symbol_of_value (curtoken, ')')) break;
if (!script_scan_token_is_symbol_of_value (curtoken, ',')) {
script_parse_error (&curtoken->location,
"Function declaration parameters must separated with ',' and terminated with a ')'");
- return NULL;
+ goto out;
}
curtoken = script_scan_get_next_token (scan);
}
curtoken = script_scan_get_next_token (scan);
script_op_t *func_op = script_parse_op (scan);
- script_function_t *function = script_function_script_new (func_op,
- NULL,
- parameter_list);
+ function = script_function_script_new (func_op,
+ NULL,
+ parameter_list);
+ parameter_list = NULL;
+out:
+ free_parameter_list (scan, parameter_list);
return function;
}
static script_exp_t *script_parse_exp_tm (script_scan_t *scan)
{
script_scan_token_t *curtoken = script_scan_get_current_token (scan);
script_exp_t *exp = NULL;
if (script_scan_token_is_integer (curtoken)) {
exp = script_parse_new_exp_number (curtoken->data.integer, &curtoken->location);
script_scan_get_next_token (scan);
return exp;
}
if (script_scan_token_is_float (curtoken)) {
exp = script_parse_new_exp_number (curtoken->data.floatpoint, &curtoken->location);
script_scan_get_next_token (scan);
return exp;
}
if (script_scan_token_is_identifier (curtoken)) {
if (script_scan_token_is_identifier_of_value (curtoken, "NULL")) {
exp = script_parse_new_exp (SCRIPT_EXP_TYPE_TERM_NULL, &curtoken->location);
} else if (script_scan_token_is_identifier_of_value (curtoken, "INFINITY")) {
exp = script_parse_new_exp_number (INFINITY, &curtoken->location);
} else if (script_scan_token_is_identifier_of_value (curtoken, "NAN")) {
exp = script_parse_new_exp_number (NAN, &curtoken->location);
} else if (script_scan_token_is_identifier_of_value (curtoken, "global")) {
exp = script_parse_new_exp (SCRIPT_EXP_TYPE_TERM_GLOBAL, &curtoken->location);
} else if (script_scan_token_is_identifier_of_value (curtoken, "local")) {
exp = script_parse_new_exp (SCRIPT_EXP_TYPE_TERM_LOCAL, &curtoken->location);
} else if (script_scan_token_is_identifier_of_value (curtoken, "this")) {
@@ -300,112 +327,132 @@ static script_exp_t *script_parse_exp_tm (script_scan_t *scan)
} else if (script_scan_token_is_identifier_of_value (curtoken, "fun")) {
script_debug_location_t location = curtoken->location;
script_scan_get_next_token (scan);
exp = script_parse_new_exp_function_def (script_parse_function_def (scan), &location);
return exp;
} else {
exp = script_parse_new_exp_var (curtoken->data.string, &curtoken->location);
}
curtoken = script_scan_get_next_token (scan);
return exp;
}
if (script_scan_token_is_string (curtoken)) {
exp = script_parse_new_exp_string (curtoken->data.string, &curtoken->location);
script_scan_get_next_token (scan);
return exp;
}
if (script_scan_token_is_symbol_of_value (curtoken, '[')) {
ply_list_t *parameters = ply_list_new ();
script_debug_location_t location = curtoken->location;
script_scan_get_next_token (scan);
while (true) {
if (script_scan_token_is_symbol_of_value (curtoken, ']')) break;
script_exp_t *parameter = script_parse_exp (scan);
ply_list_append_data (parameters, parameter);
curtoken = script_scan_get_current_token (scan);
if (script_scan_token_is_symbol_of_value (curtoken, ']')) break;
if (!script_scan_token_is_symbol_of_value (curtoken, ',')) {
+ ply_list_node_t *node;
script_parse_error (&curtoken->location,
"Set parameters should be separated with a ',' and terminated with a ']'");
+
+
+ for (node = ply_list_get_first_node (parameters);
+ node;
+ node = ply_list_get_next_node (parameters, node)) {
+ script_exp_t *sub = ply_list_node_get_data (node);
+ script_parse_exp_free (sub);
+ }
+ ply_list_free (parameters);
return NULL;
}
curtoken = script_scan_get_next_token (scan);
}
script_scan_get_next_token (scan);
exp = script_parse_new_exp_set (parameters, &location);
return exp;
}
if (script_scan_token_is_symbol_of_value (curtoken, '(')) {
script_scan_get_next_token (scan);
exp = script_parse_exp (scan);
curtoken = script_scan_get_current_token (scan);
if (!exp) {
script_parse_error (&curtoken->location,
"Expected valid contents of bracketed expression");
return NULL;
}
if (!script_scan_token_is_symbol_of_value (curtoken, ')')) {
script_parse_error (&curtoken->location,
"Expected bracketed block to be terminated with a ')'");
return NULL;
}
script_scan_get_next_token (scan);
return exp;
}
return NULL;
}
static script_exp_t *script_parse_exp_pi (script_scan_t *scan)
{
script_exp_t *exp = script_parse_exp_tm (scan);
script_scan_token_t *curtoken = script_scan_get_current_token (scan);
while (true) {
script_debug_location_t location = curtoken->location;
if (!script_scan_token_is_symbol (curtoken)) break;
if (script_scan_token_is_symbol_of_value (curtoken, '(')) {
ply_list_t *parameters = ply_list_new ();
script_scan_get_next_token (scan);
while (true) {
if (script_scan_token_is_symbol_of_value (curtoken, ')')) break;
script_exp_t *parameter = script_parse_exp (scan);
ply_list_append_data (parameters, parameter);
curtoken = script_scan_get_current_token (scan);
if (script_scan_token_is_symbol_of_value (curtoken, ')')) break;
if (!script_scan_token_is_symbol_of_value (curtoken, ',')) {
+ ply_list_node_t *node;
+
script_parse_error (&curtoken->location,
"Function parameters should be separated with a ',' and terminated with a ')'");
+
+ for (node = ply_list_get_first_node (parameters);
+ node;
+ node = ply_list_get_next_node (parameters, node)) {
+ script_exp_t *sub = ply_list_node_get_data (node);
+ script_parse_exp_free (sub);
+ }
+ ply_list_free (parameters);
return NULL;
}
curtoken = script_scan_get_next_token (scan);
}
script_scan_get_next_token (scan);
exp = script_parse_new_exp_function_exe (exp, parameters, &location);
continue;
}
script_exp_t *key;
if (script_scan_token_is_symbol_of_value (curtoken, '.')) {
script_scan_get_next_token (scan);
if (script_scan_token_is_identifier (curtoken)) {
key = script_parse_new_exp_string (curtoken->data.string, &curtoken->location);
} else {
script_parse_error (&curtoken->location,
"A dot based hash index must be an identifier");
return NULL;
}
curtoken = script_scan_get_next_token (scan);
} else if (script_scan_token_is_symbol_of_value (curtoken, '[')) {
script_scan_get_next_token (scan);
key = script_parse_exp (scan);
if (!key) {
script_parse_error (&curtoken->location,
"Expected a valid index expression");
return NULL;
}
curtoken = script_scan_get_current_token (scan);
if (!script_scan_token_is_symbol_of_value (curtoken, ']')) {
@@ -965,59 +1012,61 @@ void script_parse_op_free (script_op_t *op)
static void script_parse_op_list_free (ply_list_t *op_list)
{
ply_list_node_t *node;
for (node = ply_list_get_first_node (op_list);
node;
node = ply_list_get_next_node (op_list, node)) {
script_op_t *op = ply_list_node_get_data (node);
script_parse_op_free (op);
}
ply_list_free (op_list);
return;
}
script_op_t *script_parse_file (const char *filename)
{
script_scan_t *scan = script_scan_file (filename);
if (!scan) {
ply_error ("Parser error : Error opening file %s\n", filename);
return NULL;
}
script_scan_token_t *curtoken = script_scan_get_current_token (scan);
script_debug_location_t location = curtoken->location;
ply_list_t *list = script_parse_op_list (scan);
curtoken = script_scan_get_current_token (scan);
if (curtoken->type != SCRIPT_SCAN_TOKEN_TYPE_EOF) {
script_parse_error (&curtoken->location, "Unparsed characters at end of file");
+ script_parse_op_list_free (list);
return NULL;
}
script_op_t *op = script_parse_new_op_block (list, &location);
script_scan_free (scan);
return op;
}
script_op_t *script_parse_string (const char *string,
const char *name)
{
script_scan_t *scan = script_scan_string (string, name);
if (!scan) {
ply_error ("Parser error : Error creating a parser with a string");
return NULL;
}
script_scan_token_t *curtoken = script_scan_get_current_token (scan);
script_debug_location_t location = curtoken->location;
ply_list_t *list = script_parse_op_list (scan);
curtoken = script_scan_get_current_token (scan);
if (curtoken->type != SCRIPT_SCAN_TOKEN_TYPE_EOF) {
script_parse_error (&curtoken->location, "Unparsed characters at end of file");
+ script_parse_op_list_free (list);
return NULL;
}
script_op_t *op = script_parse_new_op_block (list, &location);
script_scan_free (scan);
return op;
}
--
2.17.1

View File

@ -1,351 +0,0 @@
From ebb1c642cd62592afc1ece9e0cf5d2ec9dfb84c0 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Oct 2018 21:56:03 -0400
Subject: [PATCH 6/6] boot-server: free the argument and triggers
coverity found some pervasive leaking of the argument
and triggers.
This commit mops them up.
---
src/ply-boot-server.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/ply-boot-server.c b/src/ply-boot-server.c
index 3c1a268..ff0e6fd 100644
--- a/src/ply-boot-server.c
+++ b/src/ply-boot-server.c
@@ -359,60 +359,61 @@ print_connection_process_identity (ply_boot_connection_t *connection)
static void
ply_boot_connection_on_request (ply_boot_connection_t *connection)
{
ply_boot_server_t *server;
char *command, *argument;
assert (connection != NULL);
assert (connection->fd >= 0);
server = connection->server;
assert (server != NULL);
if (!ply_boot_connection_read_request (connection,
&command, &argument)) {
ply_trace ("could not read connection request");
return;
}
if (ply_is_tracing ())
print_connection_process_identity (connection);
if (!ply_boot_connection_is_from_root (connection)) {
ply_error ("request came from non-root user");
if (!ply_write (connection->fd,
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK,
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK)))
ply_trace ("could not finish writing is-not-root nak: %m");
+ free (argument);
free (command);
return;
}
if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_UPDATE) == 0) {
if (!ply_write (connection->fd,
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK,
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK)) &&
errno != EPIPE)
ply_trace ("could not finish writing update reply: %m");
ply_trace ("got update request");
if (server->update_handler != NULL)
server->update_handler (server->user_data, argument, server);
free (argument);
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_CHANGE_MODE) == 0) {
if (!ply_write (connection->fd,
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK,
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK)))
ply_trace ("could not finish writing update reply: %m");
ply_trace ("got change mode notification");
if (server->change_mode_handler != NULL)
server->change_mode_handler (server->user_data, argument, server);
free (argument);
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SYSTEM_UPDATE) == 0) {
@@ -439,105 +440,112 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SYSTEM_INITIALIZED) == 0) {
ply_trace ("got system initialized notification");
if (server->system_initialized_handler != NULL)
server->system_initialized_handler (server->user_data, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_ERROR) == 0) {
ply_trace ("got error notification");
if (server->error_handler != NULL)
server->error_handler (server->user_data, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH) == 0) {
ply_trace ("got show splash request");
if (server->show_splash_handler != NULL)
server->show_splash_handler (server->user_data, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_SPLASH) == 0) {
ply_trace ("got hide splash request");
if (server->hide_splash_handler != NULL)
server->hide_splash_handler (server->user_data, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_DEACTIVATE) == 0) {
ply_trigger_t *deactivate_trigger;
ply_trace ("got deactivate request");
deactivate_trigger = ply_trigger_new (NULL);
ply_trigger_add_handler (deactivate_trigger,
(ply_trigger_handler_t)
ply_boot_connection_on_deactivated,
connection);
if (server->deactivate_handler != NULL)
server->deactivate_handler (server->user_data, deactivate_trigger, server);
+ else
+ ply_trigger_free (deactivate_trigger);
free (argument);
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_REACTIVATE) == 0) {
ply_trace ("got reactivate request");
if (server->reactivate_handler != NULL)
server->reactivate_handler (server->user_data, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT) == 0) {
bool retain_splash;
ply_trigger_t *quit_trigger;
retain_splash = (bool) argument[0];
ply_trace ("got quit %srequest", retain_splash ? "--retain-splash " : "");
quit_trigger = ply_trigger_new (NULL);
ply_trigger_add_handler (quit_trigger,
(ply_trigger_handler_t)
ply_boot_connection_on_quit_complete,
connection);
if (server->quit_handler != NULL)
server->quit_handler (server->user_data, retain_splash, quit_trigger, server);
+ else
+ ply_trigger_free (quit_trigger);
free (argument);
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD) == 0) {
ply_trigger_t *answer;
ply_trace ("got password request");
answer = ply_trigger_new (NULL);
ply_trigger_add_handler (answer,
(ply_trigger_handler_t)
ply_boot_connection_on_password_answer,
connection);
if (server->ask_for_password_handler != NULL) {
server->ask_for_password_handler (server->user_data,
argument,
answer,
server);
+ } else {
+ ply_trigger_free (answer);
+ free (argument);
}
/* will reply later
*/
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD) == 0) {
ply_list_node_t *node;
ply_buffer_t *buffer;
size_t buffer_size;
uint32_t size;
ply_trace ("got cached password request");
buffer = ply_buffer_new ();
node = ply_list_get_first_node (server->cached_passwords);
ply_trace ("There are %d cached passwords",
ply_list_get_length (server->cached_passwords));
/* Add each answer separated by their NUL terminators into
* a buffer that we write out to the client
*/
while (node != NULL) {
ply_list_node_t *next_node;
const char *password;
next_node = ply_list_get_next_node (server->cached_passwords, node);
password = (const char *) ply_list_node_get_data (node);
@@ -565,146 +573,155 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
ply_list_get_length (server->cached_passwords));
if (!ply_write (connection->fd,
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_MULTIPLE_ANSWERS,
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_MULTIPLE_ANSWERS)) ||
!ply_write_uint32 (connection->fd,
size) ||
!ply_write (connection->fd,
ply_buffer_get_bytes (buffer), size))
ply_trace ("could not finish writing cached answer reply: %m");
}
ply_buffer_free (buffer);
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUESTION) == 0) {
ply_trigger_t *answer;
ply_trace ("got question request");
answer = ply_trigger_new (NULL);
ply_trigger_add_handler (answer,
(ply_trigger_handler_t)
ply_boot_connection_on_question_answer,
connection);
if (server->ask_question_handler != NULL) {
server->ask_question_handler (server->user_data,
argument,
answer,
server);
+ } else {
+ ply_trigger_free (answer);
+ free (argument);
}
/* will reply later
*/
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_MESSAGE) == 0) {
ply_trace ("got show message request");
if (server->display_message_handler != NULL)
server->display_message_handler (server->user_data, argument, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_MESSAGE) == 0) {
ply_trace ("got hide message request");
if (server->hide_message_handler != NULL)
server->hide_message_handler (server->user_data, argument, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE) == 0) {
ply_trigger_t *answer;
ply_trace ("got keystroke request");
answer = ply_trigger_new (NULL);
ply_trigger_add_handler (answer,
(ply_trigger_handler_t)
ply_boot_connection_on_keystroke_answer,
connection);
if (server->watch_for_keystroke_handler != NULL) {
server->watch_for_keystroke_handler (server->user_data,
argument,
answer,
server);
+ } else {
+ ply_trigger_free (answer);
+ free (argument);
}
/* will reply later
*/
free (command);
return;
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE_REMOVE) == 0) {
ply_trace ("got keystroke remove request");
if (server->ignore_keystroke_handler != NULL)
server->ignore_keystroke_handler (server->user_data,
argument,
server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PROGRESS_PAUSE) == 0) {
ply_trace ("got progress pause request");
if (server->progress_pause_handler != NULL)
server->progress_pause_handler (server->user_data,
server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PROGRESS_UNPAUSE) == 0) {
ply_trace ("got progress unpause request");
if (server->progress_unpause_handler != NULL)
server->progress_unpause_handler (server->user_data,
server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_NEWROOT) == 0) {
ply_trace ("got newroot request");
if (server->newroot_handler != NULL)
server->newroot_handler (server->user_data, argument, server);
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HAS_ACTIVE_VT) == 0) {
bool answer = false;
ply_trace ("got has_active vt? request");
if (server->has_active_vt_handler != NULL)
answer = server->has_active_vt_handler (server->user_data, server);
if (!answer) {
if (!ply_write (connection->fd,
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK,
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK)))
ply_trace ("could not finish writing nak: %m");
+ free (argument);
free (command);
return;
}
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PING) != 0) {
ply_error ("received unknown command '%s' from client", command);
if (!ply_write (connection->fd,
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK,
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK)))
ply_trace ("could not finish writing ping reply: %m");
+ free (argument);
free (command);
return;
}
if (!ply_write (connection->fd,
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK,
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK)))
ply_trace ("could not finish writing ack: %m");
+ free (argument);
free (command);
}
static void
ply_boot_connection_on_hangup (ply_boot_connection_t *connection)
{
ply_list_node_t *node;
ply_boot_server_t *server;
assert (connection != NULL);
assert (connection->server != NULL);
server = connection->server;
node = ply_list_find_node (server->connections, connection);
assert (node != NULL);
ply_boot_connection_free (connection);
ply_list_remove_node (server->connections, node);
}
static void
ply_boot_server_on_new_connection (ply_boot_server_t *server)
{
ply_boot_connection_t *connection;
int fd;
assert (server != NULL);
--
2.17.1

View File

@ -1,80 +0,0 @@
From 555257c74f75bbb1086155fca52c29d71399b305 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 10 Apr 2018 16:40:06 -0400
Subject: [PATCH 6/6] pixel-buffer: switch device rotation to an enum
Right now device rotation is stored in a bare integer.
For clarity, switch that to an enum.
---
src/libply-splash-core/ply-pixel-buffer.c | 12 +++++++-----
src/libply-splash-core/ply-pixel-buffer.h | 13 ++++++++-----
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c
index a337407..de3b107 100644
--- a/src/libply-splash-core/ply-pixel-buffer.c
+++ b/src/libply-splash-core/ply-pixel-buffer.c
@@ -50,7 +50,8 @@ struct _ply_pixel_buffer
ply_region_t *updated_areas; /* in device pixels */
uint32_t is_opaque : 1;
int device_scale;
- int device_rotation;
+
+ ply_pixel_buffer_rotation_t device_rotation;
};
static inline void ply_pixel_buffer_blend_value_at_pixel (ply_pixel_buffer_t *buffer,
@@ -363,13 +364,14 @@ ply_pixel_buffer_new (unsigned long width,
}
ply_pixel_buffer_t *
-ply_pixel_buffer_new_with_device_rotation (unsigned long width,
- unsigned long height,
- int device_rotation)
+ply_pixel_buffer_new_with_device_rotation (unsigned long width,
+ unsigned long height,
+ ply_pixel_buffer_rotation_t device_rotation)
{
ply_pixel_buffer_t *buffer;
- if (device_rotation >= PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE) {
+ if (device_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE ||
+ device_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) {
unsigned long tmp = width;
width = height;
height = tmp;
diff --git a/src/libply-splash-core/ply-pixel-buffer.h b/src/libply-splash-core/ply-pixel-buffer.h
index 7736dd3..ea7f833 100644
--- a/src/libply-splash-core/ply-pixel-buffer.h
+++ b/src/libply-splash-core/ply-pixel-buffer.h
@@ -37,10 +37,13 @@ typedef struct _ply_pixel_buffer ply_pixel_buffer_t;
| ((uint8_t) (CLAMP (g * 255.0, 0.0, 255.0)) << 8) \
| ((uint8_t) (CLAMP (b * 255.0, 0.0, 255.0))))
-#define PLY_PIXEL_BUFFER_ROTATE_UPRIGHT 0
-#define PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN 1
-#define PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE 2
-#define PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE 3
+typedef enum
+{
+ PLY_PIXEL_BUFFER_ROTATE_UPRIGHT = 0,
+ PLY_PIXEL_BUFFER_ROTATE_UPSIDE_DOWN,
+ PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE,
+ PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE
+} ply_pixel_buffer_rotation_t;
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width,
@@ -48,7 +51,7 @@ ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width,
ply_pixel_buffer_t *
ply_pixel_buffer_new_with_device_rotation (unsigned long width,
unsigned long height,
- int device_rotation);
+ ply_pixel_buffer_rotation_t device_rotation);
void ply_pixel_buffer_free (ply_pixel_buffer_t *buffer);
void ply_pixel_buffer_get_size (ply_pixel_buffer_t *buffer,
ply_rectangle_t *size);
--
2.17.0

View File

@ -1,27 +0,0 @@
From e12b5ee34c619e88509f59424068417790b69e04 Mon Sep 17 00:00:00 2001
From: Sakaki <sakaki@deciban.com>
Date: Fri, 18 Aug 2017 10:08:23 -0400
Subject: [PATCH] terminal: add include for sysmacros.h
That file is, in some cases, not included implicitly by sys/types.h.
This commit explicitly includes it.
---
src/libply-splash-core/ply-terminal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c
index a0954f2..f3b32fe 100644
--- a/src/libply-splash-core/ply-terminal.c
+++ b/src/libply-splash-core/ply-terminal.c
@@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
--
2.17.0

View File

@ -1,23 +1,32 @@
From aa56c9bab334f6c97204e83e578c000db274a3c0 Mon Sep 17 00:00:00 2001
From f72cdd6969c483d7811e5684fa3143deff55a0c7 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 17 Jun 2019 13:54:42 -0400
Subject: [PATCH] ship-label-plugin-in-initrd.patch
Subject: [PATCH] populate-initrd: ship label plugin
This gives us font rendering at early boot.
---
scripts/plymouth-populate-initrd.in | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
scripts/plymouth-populate-initrd.in | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index 5f3bb85..36600a7 100755
index 616ecc4..60fd063 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -1,47 +1,48 @@
@@ -1,55 +1,56 @@
#!/bin/bash
#
# inst bits ruthlessly and viciously stolen from dracut
[ -z "$DESTDIR" ] || exit 0
# For running on a (cross-compiled) sysroot, the following
# settings are needed:
# PLYMOUTH_SYSROOT - the sysroot directory
# PLYMOUTH_LDD - an optional ldd command that works on foreign binaries
# PLYMOUTH_LDD_PATH - optional PATH ldd is run with
[ -z "$PLYMOUTH_LDD" ] && PLYMOUTH_LDD="ldd"
[ -z "$PLYMOUTH_LDD_PATH" ] && PLYMOUTH_LDD_PATH="$PATH"
[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_DATADIR@"
[ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
@ -60,37 +69,39 @@ index 5f3bb85..36600a7 100755
convert_abs_rel() {
local __current __absolute __abssize __cursize __newpath
local -i __i __level
@@ -390,59 +391,77 @@ if [ -z "$PLYMOUTH_THEME_NAME" ]; then
fi
if [ $THEME_OVERRIDE ]; then
@@ -434,59 +435,77 @@ if [ $THEME_OVERRIDE ]; then
conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf
echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" > /dev/stderr
echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" >&2
# make sure the section and key exist so we can modify them
grep -q "^ *\[Daemon\]" $conf || echo "[Daemon]" >> $conf
grep -q "^ *Theme *=" $conf || echo "Theme=fade-in" >> $conf
sed -i "s/^ *Theme *=.*/# theme modified by plymouth-populate-initrd\nTheme=$PLYMOUTH_THEME_NAME/" $conf
fi
PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
PLYMOUTH_THEME_DIR="${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}"
PLYMOUTH_IMAGE_DIR=$(grep "ImageDir *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ImageDir *= *//')
if [ ! -f ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" > /dev/stderr
if [ ! -f ${PLYMOUTH_SYSROOT}${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" >&2
exit 1
fi
inst ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so $INITRDDIR
[ -f "${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so" ] && inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
[ -f "${PLYMOUTH_SYSROOT}${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so" ] && inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so $INITRDDIR
if [ -d ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME} ]; then
for x in ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/* ; do
[ ! -f "$x" ] && continue
inst $x $INITRDDIR
done
if [ -d "${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}" ]; then
inst_recur "${PLYMOUTH_THEME_DIR}"
fi
if [ "${PLYMOUTH_IMAGE_DIR}" != "${PLYMOUTH_THEME_DIR}" -a -d "${PLYMOUTH_SYSROOT}${PLYMOUTH_IMAGE_DIR}" ]; then
inst_recur "${PLYMOUTH_IMAGE_DIR}"
fi
-if [ -L ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then
- cp -a ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes
+fonts=""
+needs_graphics="$(find ${INITRDDIR} -name 'libply-splash-graphics.so*' -print -quit | grep -q libply-splash-graphics.so && echo -n 1)"
+
@ -109,11 +120,11 @@ index 5f3bb85..36600a7 100755
+ fi
+fi
+
if [ -L ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then
cp -a ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes
+if [ -L ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then
+ cp -a ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes
fi
if [ -n "$SYSTEMD_UNIT_DIR" -a -d "$SYSTEMD_UNIT_DIR" ]; then
if [ -n "$SYSTEMD_UNIT_DIR" -a -d "${PLYMOUTH_SYSROOT}$SYSTEMD_UNIT_DIR" ]; then
inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.path $INITRDDIR
inst $SYSTEMD_UNIT_DIR/systemd-ask-password-plymouth.service $INITRDDIR

View File

@ -3,61 +3,29 @@
%global plymouth_libdir %{_libdir}
%global plymouth_initrd_file /boot/initrd-plymouth.img
# Set to 1 if building from snapshots.
%global snapshot_build 0
%if %{snapshot_build}
%global snapshot_date 20160620
%global snapshot_hash 0e65b86c
%global snapshot_rel %{?snapshot_date}git%{?snapshot_hash}
%endif
%global commit 1e36e303e08ba425fecbcff4dde22c8ee936638c
%global commitdate 20200615
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Summary: Graphical Boot Animation and Logger
Name: plymouth
Version: 0.9.3
Release: 16%{?snapshot_rel}%{?dist}
Version: 0.9.4
Release: 1.%{commitdate}git%{shortcommit}%{?dist}
License: GPLv2+
URL: http://www.freedesktop.org/wiki/Software/Plymouth
Group: System Environment/Base
Source0: http://freedesktop.org/software/plymouth/releases/%{name}-%{version}.tar.xz
Source0: https://gitlab.freedesktop.org/plymouth/plymouth/-/archive/%{commit}/%{name}-%{commit}.tar.bz2
Source1: boot-duration
Source2: charge.plymouth
Source3: plymouth-update-initrd
Source4: bootlog
# Patches from upstream git for rotated-display support
# https://bugs.freedesktop.org/show_bug.cgi?id=104714
# These can all be dropped on the next rebase
Patch1: 0001-device-manager-drop-superfluous-create_pixel_display.patch
Patch2: 0002-main-Do-not-update-the-display-on-backspace-when-the.patch
Patch3: 0003-pixel-buffer-Add-the-concept-of-device-rotation.patch
Patch4: 0004-drm-Check-for-panel-orientation-connector-property.patch
Patch5: 0005-drm-Reset-primary-plane-rotation-to-DRM_MODE_ROTATE_.patch
Patch6: 0006-pixel-buffer-switch-device-rotation-to-an-enum.patch
Patch7: 0007-terminal-add-include-for-sysmacros.h.patch
# Patches to handle text mode situations better
Patch10: 0001-device-manager-skip-graphical-renderer-setup-when-de.patch
Patch11: 0001-device-manager-fall-back-to-text-mode-if-graphical-d.patch
# Coverity fixes
Patch21: 0001-populate-initrd-drop-unused-local-variable.patch
Patch22: 0002-boot-splash-fix-memory-leak-in-error-path.patch
Patch23: 0003-event-loop-fix-leak-in-error-path.patch
Patch24: 0004-key-file-ply_key_file_get_value-returns-duplicated-m.patch
Patch25: 0005-script-fix-various-memory-leaks.patch
Patch26: 0006-boot-server-free-the-argument-and-triggers.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1658026
Patch31: 0001-logger-Add-a-separator-between-different-boot-logs.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1661880
Patch41: 0001-device-manager-don-t-watch-for-udev-events-when-deac.patch
Patch10001: 0001-Revert-throbgress-Remove-the-throbgress-plugin.patch
Patch10002: 0002-throbgress-update-for-api-change.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1702764
Patch51: ship-label-plugin-in-initrd.patch
Patch20001: ship-label-plugin-in-initrd.patch
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(libudev)
@ -67,8 +35,12 @@ BuildRequires: libxslt, docbook-style-xsl
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pango-devel >= 1.21.0
BuildRequires: cairo-devel
BuildRequires: gcc libtool git
BuildRequires: gettext-devel
BuildRequires: intltool
Requires(post): plymouth-scripts
Suggests: logrotate
%description
Plymouth provides an attractive graphical boot animation in
@ -221,7 +193,7 @@ Provides: plymouth(system-theme) = %{version}-%{release}
%description theme-charge
This package contains the "charge" boot splash theme for
Plymouth. It is the default theme for Red Hat Enterprise Linux.
Plymouth. It was the default theme for Red Hat Enterprise Linux.
%package plugin-script
Summary: Plymouth "script" plugin
@ -257,10 +229,11 @@ This package contains the "spinner" boot splash theme for
Plymouth. It features a small spinner on a dark background.
%prep
%autosetup -p1
%autosetup -S git -p1 -n %{name}-%{commit}
autoreconf --force --install --symlink -Wno-portability
# Change the default theme
sed -i -e 's/spinner/charge/g' src/plymouthd.defaults
sed -i -e 's/spinner/bgrt/g' src/plymouthd.defaults
%build
%configure --enable-tracing --disable-tests \
@ -271,27 +244,21 @@ sed -i -e 's/spinner/charge/g' src/plymouthd.defaults
--disable-gdm-transition \
--enable-systemd-integration \
--without-system-root-install \
--without-log-viewer \
--without-rhgb-compat-link \
--disable-libkms
make
--without-rhgb-compat-link
%make_build
%install
make install DESTDIR=$RPM_BUILD_ROOT
# Glow isn't quite ready for primetime
rm -rf $RPM_BUILD_ROOT%{_datadir}/plymouth/glow/
rm -f $RPM_BUILD_ROOT%{_libdir}/plymouth/glow.so
find $RPM_BUILD_ROOT -name '*.a' -delete
%make_install
%find_lang %{name}
find $RPM_BUILD_ROOT -name '*.la' -delete
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/plymouth
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/plymouth
cp $RPM_SOURCE_DIR/boot-duration $RPM_BUILD_ROOT%{_datadir}/plymouth/default-boot-duration
cp -f $RPM_SOURCE_DIR/plymouth-update-initrd $RPM_BUILD_ROOT%{_libexecdir}/plymouth
# Add charge, our new default
# Add charge, our old default
mkdir -p $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/charge
cp %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/charge
cp $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/glow/{box,bullet,entry,lock}.png $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/charge
@ -299,6 +266,9 @@ cp $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/glow/{box,bullet,entry,lock}.png $
# Drop glow, it's not very Fedora-y
rm -rf $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/glow
# add in the watermark to spinner and bgrt
(cd $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/spinner; ln -sf ../charge/watermark.png)
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -p -m 644 $RPM_SOURCE_DIR/bootlog $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/bootlog
@ -330,6 +300,15 @@ if [ $1 -eq 0 ]; then
fi
fi
%post theme-spinner
export PLYMOUTH_PLUGIN_PATH=%{_libdir}/plymouth/
# On upgrades replace charge with the new bgrt default
if [ $1 -eq 2 ]; then
if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "charge" ]; then
%{_sbindir}/plymouth-set-default-theme bgrt
fi
fi
%postun theme-spinner
export LIB=%{_lib}
if [ $1 -eq 0 ]; then
@ -346,16 +325,6 @@ if [ $1 -eq 0 ]; then
fi
fi
%post theme-charge
export LIB=%{_lib}
if [ $1 -eq 1 ]; then
%{_sbindir}/plymouth-set-default-theme charge
else
if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "solar" ]; then
%{_sbindir}/plymouth-set-default-theme charge
fi
fi
%postun theme-charge
export LIB=%{_lib}
if [ $1 -eq 0 ]; then
@ -364,7 +333,7 @@ if [ $1 -eq 0 ]; then
fi
fi
%files
%files -f %{name}.lang
%license COPYING
%doc AUTHORS README
%dir %{_datadir}/plymouth
@ -438,21 +407,16 @@ fi
%{_datadir}/plymouth/themes/fade-in/fade-in.plymouth
%files theme-spinner
%dir %{_datadir}/plymouth/themes/spinner
%{_datadir}/plymouth/themes/spinner/*.png
%{_datadir}/plymouth/themes/spinner/spinner.plymouth
# bgrt is a variant of spinner with different settings in its .plymouth file
%{_datadir}/plymouth/themes/bgrt
%{_datadir}/plymouth/themes/spinner
%files plugin-throbgress
%{_libdir}/plymouth/throbgress.so
%files theme-spinfinity
%dir %{_datadir}/plymouth/themes/spinfinity
%{_datadir}/plymouth/themes/spinfinity/box.png
%{_datadir}/plymouth/themes/spinfinity/bullet.png
%{_datadir}/plymouth/themes/spinfinity/entry.png
%{_datadir}/plymouth/themes/spinfinity/lock.png
%{_datadir}/plymouth/themes/spinfinity/throbber-[0-3][0-9].png
%{_datadir}/plymouth/themes/spinfinity/spinfinity.plymouth
%{_datadir}/plymouth/themes/spinfinity/*
%files plugin-space-flares
%{_libdir}/plymouth/space-flares.so
@ -482,6 +446,10 @@ fi
%files system-theme
%changelog
* Mon Jun 15 2020 Ray Strode <rstrode@redhat.com> - 0.9.4-1.git1688935
- Rebase to git snapshot
Resolves: #1688935
* Tue Dec 10 2019 Ray Strode <rstrode@redhat.com> - 0.9.3-16
- ship fonts in initrd
Resolves: #1702764