import plymouth-0.9.3-12.el8

This commit is contained in:
CentOS Sources 2019-05-07 06:39:24 -04:00 committed by Andrew Lukoshko
commit 6a075bf0d7
23 changed files with 3813 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/plymouth-0.9.3.tar.xz

1
.plymouth.metadata Normal file
View File

@ -0,0 +1 @@
1a07c8bc7d3625e93c5c15b1b0943c0e3a054808 SOURCES/plymouth-0.9.3.tar.xz

View File

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

39
SOURCES/boot-duration Normal file
View File

@ -0,0 +1,39 @@
0.222:RCkernelparam
0.223:RChostname
0.238:RCmountfs
0.275:RCswap
0.330:microcode_ctl
0.357:cpuspeed
0.365:ip6tables
0.380:iptables
0.385:isdn
0.504:auditd
0.508:restorecond
0.523:rsyslog
0.530:irqbalance
0.533:rpcbind
0.549:nfslock
0.561:mdmonitor
0.563:rpcidmapd
0.578:rpcgssd
0.579:messagebus
0.580:fuse
0.594:netfs
0.600:acpid
0.611:haldaemon
0.660:pcscd
0.691:udev-post
0.703:portreserve
0.712:setroubleshoot
0.749:bluetooth
0.738:sshd
0.763:ntpd
0.807:sendmail
0.876:crond
0.902:kerneloops
0.907:smolt
0.915:atd
0.927:avahi-daemon
0.941:cups
0.983:anacron
0.992:local

8
SOURCES/bootlog Normal file
View File

@ -0,0 +1,8 @@
/var/log/boot.log
{
missingok
daily
copytruncate
rotate 7
notifempty
}

13
SOURCES/charge.plymouth Normal file
View File

@ -0,0 +1,13 @@
[Plymouth Theme]
Name=Charge
Description=A theme that features a stylized 8 and spinner
ModuleName=two-step
[two-step]
ImageDir=/usr/share/plymouth/themes/charge
HorizontalAlignment=.5
VerticalAlignment=.75
Transition=none
TransitionDuration=0.0
BackgroundStartColor=0x202020
BackgroundEndColor=0x202020

2
SOURCES/plymouth-update-initrd Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
dracut -f

1277
SPECS/plymouth.spec Normal file

File diff suppressed because it is too large Load Diff