1
0
forked from rpms/plymouth

Update to 0.9.4

This commit is contained in:
Ray Strode 2018-11-05 15:34:25 -05:00
parent 5d0d9781e2
commit 225defa74c
24 changed files with 7 additions and 2353 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ plymouth-0.8.4.tar.bz2
/plymouth-0.8.9.tar.bz2 /plymouth-0.8.9.tar.bz2
/plymouth-0.9.3.tar.bz2 /plymouth-0.9.3.tar.bz2
/plymouth-0.9.3.tar.xz /plymouth-0.9.3.tar.xz
/plymouth-0.9.4.tar.xz

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,71 +0,0 @@
From 28ee4012c94b4045b97e5a2a66f66b7688b2dff3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sat, 25 Aug 2018 12:21:45 -0400
Subject: [PATCH 1/5] main: ensure tty is closed on deactivate
If plymouth doesn't get explicitly "activated" then when
GDM tries to deactivate it, the deactivation request is
a noop.
One aspect of being active, though is having ownership and
control of the terminal. This happens immediately, even
before a splash is shown.
The `deactivate` request needs to relinguish such control,
unconditionally, since some display server is about to use
the tty.
This commit fixes that.
---
src/main.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/main.c b/src/main.c
index 7e58fff..0564e15 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1267,13 +1267,8 @@ quit_program (state_t *state)
}
static void
-deactivate_splash (state_t *state)
+deactivate_console (state_t *state)
{
- assert (!state->is_inactive);
-
- if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash))
- ply_device_manager_deactivate_renderers (state->device_manager);
-
detach_from_running_session (state);
if (state->local_console_terminal != NULL) {
@@ -1287,6 +1282,18 @@ deactivate_splash (state_t *state)
if (command_line_has_argument (state->kernel_command_line, "plymouth.debug"))
ply_logger_close_file (ply_logger_get_error_default ());
+}
+
+static void
+deactivate_splash (state_t *state)
+{
+ assert (!state->is_inactive);
+
+ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash))
+ ply_device_manager_deactivate_renderers (state->device_manager);
+
+ deactivate_console (state);
+
state->is_inactive = true;
ply_trigger_pull (state->deactivate_trigger, NULL);
@@ -1322,6 +1329,7 @@ on_deactivate (state_t *state,
ply_trigger_t *deactivate_trigger)
{
if (state->is_inactive) {
+ deactivate_console (state);
ply_trigger_pull (deactivate_trigger, NULL);
return;
}
--
2.19.0

View File

@ -1,36 +0,0 @@
From eb147e52b123070ab8839c3f59aaecc43fcc8652 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 25 Jun 2018 22:02:07 +0200
Subject: [PATCH 1/9] renderer: support reactivating renderer without closing
it first
At the moment, ply_renderer_activate() doesn't work immediately following
ply_renderer_deactivate(). This is because the renderer isn't marked
inactive until it's closed.
This commit marks the renderer inactive when it's deactivated.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
https://bugs.freedesktop.org/show_bug.cgi?id=107047
---
src/libply-splash-core/ply-renderer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/libply-splash-core/ply-renderer.c b/src/libply-splash-core/ply-renderer.c
index b9059ef..ecf7082 100644
--- a/src/libply-splash-core/ply-renderer.c
+++ b/src/libply-splash-core/ply-renderer.c
@@ -314,7 +314,8 @@ ply_renderer_deactivate (ply_renderer_t *renderer)
{
assert (renderer->plugin_interface != NULL);
- return renderer->plugin_interface->deactivate (renderer->backend);
+ renderer->plugin_interface->deactivate (renderer->backend);
+ renderer->is_active = false;
}
bool
--
2.18.0

View File

@ -1,494 +0,0 @@
From 13d95b10dd15974a74f645e99f99d934544afe37 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 4 Oct 2018 12:47:52 +0200
Subject: [PATCH 2/5] libply: Move kernel commandline parsing functions to
libply/ply-utils
Move kernel commandline parsing functions to libply/ply-utils to avoid
code duplication between the daemon, the client and the plugins.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/client/plymouth.c | 34 +---------
src/libply/ply-utils.c | 94 ++++++++++++++++++++++++++++
src/libply/ply-utils.h | 4 ++
src/main.c | 137 ++++++-----------------------------------
4 files changed, 120 insertions(+), 149 deletions(-)
diff --git a/src/client/plymouth.c b/src/client/plymouth.c
index 46a64f5..4e14603 100644
--- a/src/client/plymouth.c
+++ b/src/client/plymouth.c
@@ -49,7 +49,6 @@ typedef struct
ply_event_loop_t *loop;
ply_boot_client_t *client;
ply_command_parser_t *command_parser;
- char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE];
} state_t;
typedef struct
@@ -704,31 +703,6 @@ on_quit_request (state_t *state,
on_failure, state);
}
-static bool
-get_kernel_command_line (state_t *state)
-{
- int fd;
-
- ply_trace ("opening /proc/cmdline");
- fd = open ("/proc/cmdline", O_RDONLY);
-
- if (fd < 0) {
- ply_trace ("couldn't open it: %m");
- return false;
- }
-
- ply_trace ("reading kernel command line");
- if (read (fd, state->kernel_command_line, sizeof(state->kernel_command_line) - 1) < 0) {
- ply_trace ("couldn't read it: %m");
- close (fd);
- return false;
- }
-
- ply_trace ("Kernel command line is: '%s'", state->kernel_command_line);
- close (fd);
- return true;
-}
-
static void
on_update_root_fs_request (state_t *state,
const char *command)
@@ -1099,12 +1073,8 @@ main (int argc,
return 0;
}
- if (get_kernel_command_line (&state)) {
- if ((strstr (state.kernel_command_line, "plymouth.debug") != NULL ||
- strstr (state.kernel_command_line, "plymouth:debug") != NULL)
- && !ply_is_tracing ())
- ply_toggle_tracing ();
- }
+ if (ply_kernel_cmd_line_has_argument ("plymouth.debug") && !ply_is_tracing ())
+ ply_toggle_tracing ();
if (should_be_verbose && !ply_is_tracing ())
ply_toggle_tracing ();
diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c
index 89e37e9..1f7f07c 100644
--- a/src/libply/ply-utils.c
+++ b/src/libply/ply-utils.c
@@ -24,6 +24,7 @@
#include "ply-utils.h"
#include <assert.h>
+#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -80,6 +81,9 @@ static int errno_stack_position = 0;
static int overridden_device_scale = 0;
+static char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE];
+static bool kernel_command_line_is_set;
+
bool
ply_open_unidirectional_pipe (int *sender_fd,
int *receiver_fd)
@@ -1015,4 +1019,94 @@ ply_get_device_scale (uint32_t width,
return device_scale;
}
+static const char *
+ply_get_kernel_command_line (void)
+{
+ const char *remaining_command_line;
+ char *key;
+ int fd;
+
+ if (kernel_command_line_is_set)
+ return kernel_command_line;
+
+ ply_trace ("opening /proc/cmdline");
+ fd = open ("/proc/cmdline", O_RDONLY);
+
+ if (fd < 0) {
+ ply_trace ("couldn't open it: %m");
+ return NULL;
+ }
+
+ ply_trace ("reading kernel command line");
+ if (read (fd, kernel_command_line, sizeof(kernel_command_line) - 1) < 0) {
+ ply_trace ("couldn't read it: %m");
+ close (fd);
+ return NULL;
+ }
+
+ /* we now use plymouth.argument for kernel commandline arguments.
+ * It used to be plymouth:argument. This bit just rewrites all : to be .
+ */
+ remaining_command_line = kernel_command_line;
+ while ((key = strstr (remaining_command_line, "plymouth:")) != NULL) {
+ char *colon;
+
+ colon = key + strlen ("plymouth");
+ *colon = '.';
+
+ remaining_command_line = colon + 1;
+ }
+ ply_trace ("Kernel command line is: '%s'", kernel_command_line);
+
+ close (fd);
+
+ kernel_command_line_is_set = true;
+ return kernel_command_line;
+}
+
+const char *
+ply_kernel_cmd_line_get_string_after_prefix (const char *prefix)
+{
+ const char *command_line = ply_get_kernel_command_line();
+ char *argument;
+
+ if (!command_line)
+ return NULL;
+
+ argument = strstr (command_line, prefix);
+
+ if (argument == NULL)
+ return NULL;
+
+ if (argument == command_line ||
+ argument[-1] == ' ')
+ return argument + strlen (prefix);
+
+ return NULL;
+}
+
+bool
+ply_kernel_cmd_line_has_argument (const char *argument)
+{
+ const char *string;
+
+ string = ply_kernel_cmd_line_get_string_after_prefix (argument);
+
+ if (string == NULL)
+ return false;
+
+ if (!isspace ((int) string[0]) && string[0] != '\0')
+ return false;
+
+ return true;
+}
+
+void
+ply_kernel_cmd_line_set (const char *cmd_line)
+{
+ strncpy (kernel_command_line, cmd_line, sizeof(kernel_command_line));
+ kernel_command_line[sizeof(kernel_command_line) - 1] = '\0';
+ kernel_command_line_is_set = true;
+}
+
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h
index c46603e..6016484 100644
--- a/src/libply/ply-utils.h
+++ b/src/libply/ply-utils.h
@@ -128,6 +128,10 @@ int ply_get_device_scale (uint32_t width,
uint32_t width_mm,
uint32_t height_mm);
+const char *ply_kernel_cmd_line_get_string_after_prefix (const char *prefix);
+bool ply_kernel_cmd_line_has_argument (const char *argument);
+void ply_kernel_cmd_line_set (const char *cmd_line);
+
#endif
#endif /* PLY_UTILS_H */
diff --git a/src/main.c b/src/main.c
index 0564e15..61d94c1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,7 +24,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <math.h>
-#include <ctype.h>
#include <limits.h>
#include <dirent.h>
#include <fcntl.h>
@@ -56,10 +55,6 @@
#include "ply-utils.h"
#include "ply-progress.h"
-#ifndef PLY_MAX_COMMAND_LINE_SIZE
-#define PLY_MAX_COMMAND_LINE_SIZE 4097
-#endif
-
#define BOOT_DURATION_FILE PLYMOUTH_TIME_DIRECTORY "/boot-duration"
#define SHUTDOWN_DURATION_FILE PLYMOUTH_TIME_DIRECTORY "/shutdown-duration"
@@ -109,8 +104,6 @@ typedef struct
double splash_delay;
double device_timeout;
- char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE];
- uint32_t kernel_command_line_is_set : 1;
uint32_t no_boot_log : 1;
uint32_t showing_details : 1;
uint32_t system_initialized : 1;
@@ -381,41 +374,6 @@ show_detailed_splash (state_t *state)
update_display (state);
}
-static const char *
-command_line_get_string_after_prefix (const char *command_line,
- const char *prefix)
-{
- char *argument;
-
- argument = strstr (command_line, prefix);
-
- if (argument == NULL)
- return NULL;
-
- if (argument == command_line ||
- argument[-1] == ' ')
- return argument + strlen (prefix);
-
- return NULL;
-}
-
-static bool
-command_line_has_argument (const char *command_line,
- const char *argument)
-{
- const char *string;
-
- string = command_line_get_string_after_prefix (command_line, argument);
-
- if (string == NULL)
- return false;
-
- if (!isspace ((int) string[0]) && string[0] != '\0')
- return false;
-
- return true;
-}
-
static void
find_override_splash (state_t *state)
{
@@ -424,8 +382,7 @@ find_override_splash (state_t *state)
if (state->override_splash_path != NULL)
return;
- splash_string = command_line_get_string_after_prefix (state->kernel_command_line,
- "plymouth.splash=");
+ splash_string = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.splash=");
if (splash_string != NULL) {
const char *end;
@@ -452,7 +409,7 @@ find_override_splash (state_t *state)
if (isnan (state->splash_delay)) {
const char *delay_string;
- delay_string = command_line_get_string_after_prefix (state->kernel_command_line, "plymouth.splash-delay=");
+ delay_string = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.splash-delay=");
if (delay_string != NULL)
state->splash_delay = atof (delay_string);
@@ -464,7 +421,7 @@ find_force_scale (state_t *state)
{
const char *scale_string;
- scale_string = command_line_get_string_after_prefix (state->kernel_command_line, "plymouth.force-scale=");
+ scale_string = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.force-scale=");
if (scale_string != NULL)
ply_set_device_scale (strtoul (scale_string, NULL, 0));
@@ -879,10 +836,10 @@ static bool
plymouth_should_ignore_show_splash_calls (state_t *state)
{
ply_trace ("checking if plymouth should be running");
- if (state->mode != PLY_MODE_BOOT || command_line_has_argument (state->kernel_command_line, "plymouth.force-splash"))
+ if (state->mode != PLY_MODE_BOOT || ply_kernel_cmd_line_has_argument ("plymouth.force-splash"))
return false;
- if (command_line_has_argument (state->kernel_command_line, "plymouth.ignore-show-splash"))
+ if (ply_kernel_cmd_line_has_argument ("plymouth.ignore-show-splash"))
return true;
return false;
@@ -894,7 +851,7 @@ sh_is_init (state_t *state)
const char *init_string;
size_t length;
- init_string = command_line_get_string_after_prefix (state->kernel_command_line, "init=");
+ init_string = ply_kernel_cmd_line_get_string_after_prefix ("init=");
if (init_string) {
length = strcspn (init_string, " \n");
@@ -919,28 +876,28 @@ plymouth_should_show_default_splash (state_t *state)
return false;
for (i = 0; strings[i] != NULL; i++) {
- if (command_line_has_argument (state->kernel_command_line, strings[i])) {
+ if (ply_kernel_cmd_line_has_argument (strings[i])) {
ply_trace ("no default splash because kernel command line has option \"%s\"", strings[i]);
return false;
}
}
- if (command_line_has_argument (state->kernel_command_line, "splash=verbose")) {
+ if (ply_kernel_cmd_line_has_argument ("splash=verbose")) {
ply_trace ("no default splash because kernel command line has option \"splash=verbose\"");
return false;
}
- if (command_line_has_argument (state->kernel_command_line, "rhgb")) {
+ if (ply_kernel_cmd_line_has_argument ("rhgb")) {
ply_trace ("using default splash because kernel command line has option \"rhgb\"");
return true;
}
- if (command_line_has_argument (state->kernel_command_line, "splash")) {
+ if (ply_kernel_cmd_line_has_argument ("splash")) {
ply_trace ("using default splash because kernel command line has option \"splash\"");
return true;
}
- if (command_line_has_argument (state->kernel_command_line, "splash=silent")) {
+ if (ply_kernel_cmd_line_has_argument ("splash=silent")) {
ply_trace ("using default splash because kernel command line has option \"splash=silent\"");
return true;
}
@@ -1279,7 +1236,7 @@ deactivate_console (state_t *state)
}
/* do not let any tty opened where we could write after deactivate */
- if (command_line_has_argument (state->kernel_command_line, "plymouth.debug"))
+ if (ply_kernel_cmd_line_has_argument ("plymouth.debug"))
ply_logger_close_file (ply_logger_get_error_default ());
}
@@ -1872,52 +1829,6 @@ detach_from_running_session (state_t *state)
state->is_attached = false;
}
-static bool
-get_kernel_command_line (state_t *state)
-{
- int fd;
- const char *remaining_command_line;
- char *key;
-
- if (state->kernel_command_line_is_set)
- return true;
-
- ply_trace ("opening /proc/cmdline");
- fd = open ("/proc/cmdline", O_RDONLY);
-
- if (fd < 0) {
- ply_trace ("couldn't open it: %m");
- return false;
- }
-
- ply_trace ("reading kernel command line");
- if (read (fd, state->kernel_command_line, sizeof(state->kernel_command_line) - 1) < 0) {
- ply_trace ("couldn't read it: %m");
- close (fd);
- return false;
- }
-
-
- /* we now use plymouth.argument for kernel commandline arguments.
- * It used to be plymouth:argument. This bit just rewrites all : to be .
- */
- remaining_command_line = state->kernel_command_line;
- while ((key = strstr (remaining_command_line, "plymouth:")) != NULL) {
- char *colon;
-
- colon = key + strlen ("plymouth");
- *colon = '.';
-
- remaining_command_line = colon + 1;
- }
- ply_trace ("Kernel command line is: '%s'", state->kernel_command_line);
-
- close (fd);
-
- state->kernel_command_line_is_set = true;
- return true;
-}
-
static void
check_verbosity (state_t *state)
{
@@ -1926,13 +1837,11 @@ check_verbosity (state_t *state)
ply_trace ("checking if tracing should be enabled");
- stream = command_line_get_string_after_prefix (state->kernel_command_line,
- "plymouth.debug=stream:");
+ stream = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.debug=stream:");
- path = command_line_get_string_after_prefix (state->kernel_command_line,
- "plymouth.debug=file:");
+ path = ply_kernel_cmd_line_get_string_after_prefix ("plymouth.debug=file:");
if (stream != NULL || path != NULL ||
- command_line_has_argument (state->kernel_command_line, "plymouth.debug")) {
+ ply_kernel_cmd_line_has_argument ("plymouth.debug")) {
int fd;
ply_trace ("tracing should be enabled!");
@@ -2010,7 +1919,7 @@ check_logging (state_t *state)
ply_trace ("checking if console messages should be redirected and logged");
- kernel_no_log = command_line_has_argument (state->kernel_command_line, "plymouth.nolog");
+ kernel_no_log = ply_kernel_cmd_line_has_argument ("plymouth.nolog");
if (kernel_no_log)
state->no_boot_log = true;
@@ -2064,9 +1973,6 @@ initialize_environment (state_t *state)
{
ply_trace ("initializing minimal work environment");
- if (!get_kernel_command_line (state))
- return false;
-
if (!state->default_tty)
if (getenv ("DISPLAY") != NULL && access (PLYMOUTH_PLUGIN_PATH "renderers/x11.so", F_OK) == 0)
state->default_tty = "/dev/tty";
@@ -2279,11 +2185,8 @@ main (int argc,
if (tty != NULL)
state.default_tty = tty;
- if (kernel_command_line != NULL) {
- strncpy (state.kernel_command_line, kernel_command_line, sizeof(state.kernel_command_line));
- state.kernel_command_line[sizeof(state.kernel_command_line) - 1] = '\0';
- state.kernel_command_line_is_set = true;
- }
+ if (kernel_command_line != NULL)
+ ply_kernel_cmd_line_set (kernel_command_line);
if (geteuid () != 0) {
ply_error ("plymouthd must be run as root user");
@@ -2375,10 +2278,10 @@ main (int argc,
find_system_default_splash (&state);
find_distribution_default_splash (&state);
- if (command_line_has_argument (state.kernel_command_line, "plymouth.ignore-serial-consoles"))
+ if (ply_kernel_cmd_line_has_argument ("plymouth.ignore-serial-consoles"))
device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES;
- if (command_line_has_argument (state.kernel_command_line, "plymouth.ignore-udev") ||
+ if (ply_kernel_cmd_line_has_argument ("plymouth.ignore-udev") ||
(getenv ("DISPLAY") != NULL))
device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV;
--
2.19.0

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

@ -1,61 +0,0 @@
From 778e0fb77a9dfb85270242f1238eba237488eb48 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 25 Jun 2018 16:55:39 +0200
Subject: [PATCH 2/9] main: move ply_device_manager_deactivate_renderers() into
hide_splash()
hide_splash() should be the counter-part of show_splash(). show_splash()
calls ply_device_manager_activate_renderers() (through show_theme()).
2 of the 3 callers of hide_splash() are already calling
ply_device_manager_deactivate_renderers() directly before calling
hide_splash(). This commit moves the deactivate call into hide_splash()
so that it also gets called from the 3th code-path, which is when
the user hits the escape to key to toggle from the splash to details.
It's important that plymouth deactivates its renderers before going
to details, because those renderers can block the kernel from
initializing fbcon, which the kernel will start doing lazily in the
future:
https://lkml.org/lkml/2018/6/26/489.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
https://bugs.freedesktop.org/show_bug.cgi?id=107047
---
src/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 841fe6b..ff02ea6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1174,6 +1174,8 @@ quit_splash (state_t *state)
static void
hide_splash (state_t *state)
{
+ ply_device_manager_deactivate_renderers (state->device_manager);
+
state->is_shown = false;
cancel_pending_delayed_show (state);
@@ -1193,7 +1195,6 @@ dump_details_and_quit_splash (state_t *state)
state->showing_details = false;
toggle_between_splash_and_details (state);
- ply_device_manager_deactivate_renderers (state->device_manager);
hide_splash (state);
quit_splash (state);
}
@@ -1291,7 +1292,6 @@ on_boot_splash_idle (state_t *state)
if (state->quit_trigger != NULL) {
if (!state->should_retain_splash) {
ply_trace ("hiding splash");
- ply_device_manager_deactivate_renderers (state->device_manager);
hide_splash (state);
}
--
2.18.0

View File

@ -1,123 +0,0 @@
From 2da4f7614e5aecb470b748752a3864d2ecae365a Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 2 Oct 2018 10:26:28 +0200
Subject: [PATCH 3/5] drm: Reset LUT/gamma table before the first
drmModeSetCrtc call
When we takeover the kms master from whatever process came before us the
LUT table may be a mess making the graphics funky. So lets reset it once
before our first drmModeSetCrtc call.
Closes #59
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/plugins/renderers/drm/plugin.c | 40 +++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index 1080590..6e6b520 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -84,6 +84,9 @@ struct _ply_renderer_head
uint32_t encoder_id;
uint32_t console_buffer_id;
uint32_t scan_out_buffer_id;
+
+ int gamma_size;
+ uint16_t *gamma;
};
struct _ply_renderer_input_source
@@ -451,11 +454,13 @@ ply_renderer_head_new (ply_renderer_backend_t *backend,
int connector_mode_index,
uint32_t encoder_id,
uint32_t controller_id,
- uint32_t console_buffer_id)
+ uint32_t console_buffer_id,
+ int gamma_size)
{
ply_renderer_head_t *head;
drmModeModeInfo *mode;
- int rotation;
+ unsigned int shift;
+ int i, rotation;
head = calloc (1, sizeof(ply_renderer_head_t));
@@ -476,6 +481,20 @@ ply_renderer_head_new (ply_renderer_backend_t *backend,
head->area.width = mode->hdisplay;
head->area.height = mode->vdisplay;
+ if (gamma_size) {
+ head->gamma_size = gamma_size;
+ head->gamma = malloc(gamma_size * 3 * sizeof(uint16_t));
+
+ /* gamma_size is always a power of 2 */
+ for (shift = 0; (gamma_size << shift) < (1 << 16); shift++);
+
+ for (i = 0; i < gamma_size; i++) {
+ head->gamma[0 * gamma_size + i] = i << shift; /* red */
+ head->gamma[1 * gamma_size + i] = i << shift; /* green */
+ head->gamma[2 * gamma_size + i] = i << shift; /* blue */
+ }
+ }
+
ply_renderer_head_add_connector (head, connector, connector_mode_index);
assert (ply_array_get_size (head->connector_ids) > 0);
@@ -502,6 +521,7 @@ ply_renderer_head_free (ply_renderer_head_t *head)
drmModeFreeConnector (head->connector0);
ply_array_free (head->connector_ids);
+ free (head->gamma);
free (head);
}
@@ -601,6 +621,18 @@ ply_renderer_head_set_scan_out_buffer (ply_renderer_backend_t *backend,
ply_trace ("Setting scan out buffer of %ldx%ld head to our buffer",
head->area.width, head->area.height);
+ /* Set gamma table, do this only once */
+ if (head->gamma) {
+ drmModeCrtcSetGamma (backend->device_fd,
+ head->controller_id,
+ head->gamma_size,
+ head->gamma + 0 * head->gamma_size,
+ head->gamma + 1 * head->gamma_size,
+ head->gamma + 2 * head->gamma_size);
+ free (head->gamma);
+ head->gamma = NULL;
+ }
+
/* Tell the controller to use the allocated scan out buffer on each connectors
*/
if (drmModeSetCrtc (backend->device_fd, head->controller_id, buffer_id,
@@ -1024,6 +1056,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
uint32_t controller_id;
uint32_t console_buffer_id;
int connector_mode_index;
+ int gamma_size;
connector = drmModeGetConnector (backend->device_fd,
backend->resources->connectors[i]);
@@ -1069,6 +1102,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
}
console_buffer_id = controller->buffer_id;
+ gamma_size = controller->gamma_size;
drmModeFreeCrtc (controller);
head = ply_hashtable_lookup (heads_by_controller_id,
@@ -1077,7 +1111,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
if (head == NULL) {
head = ply_renderer_head_new (backend, connector, connector_mode_index,
encoder_id, controller_id,
- console_buffer_id);
+ console_buffer_id, gamma_size);
ply_list_append_data (backend->heads, head);
--
2.19.0

View File

@ -1,98 +0,0 @@
From 447c783046a0e6bd0486e780f6a94396637a5bd4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 2 Jul 2018 09:39:12 +0200
Subject: [PATCH 3/9] main: Only activate renderers if the splash uses
pixel-displays
Since commit eb147e52b123 ("renderer: support reactivating renderer without
closing it first"), the show_theme() call done by
toggle_between_splash_and_details() will reactivate the renderers after
switching to details mode, causing the drm renderer to switch the screen
from text to graphics mode hiding the details being logged on the console.
This commit fixes this by only calling ply_device_manager_activate_renderers()
and ply_device_manager_deactivate_renderers if the splash uses pixel-displays.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
https://bugs.freedesktop.org/show_bug.cgi?id=107047
---
src/libply-splash-core/ply-boot-splash.c | 6 ++++++
src/libply-splash-core/ply-boot-splash.h | 1 +
src/main.c | 12 ++++++++----
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/libply-splash-core/ply-boot-splash.c b/src/libply-splash-core/ply-boot-splash.c
index 87a7a0c..2e295f4 100644
--- a/src/libply-splash-core/ply-boot-splash.c
+++ b/src/libply-splash-core/ply-boot-splash.c
@@ -695,4 +695,10 @@ ply_boot_splash_become_idle (ply_boot_splash_t *splash,
splash->plugin_interface->become_idle (splash->plugin, splash->idle_trigger);
}
+bool
+ply_boot_splash_uses_pixel_displays (ply_boot_splash_t *splash)
+{
+ return splash->plugin_interface->add_pixel_display != NULL;
+}
+
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
diff --git a/src/libply-splash-core/ply-boot-splash.h b/src/libply-splash-core/ply-boot-splash.h
index b66ca47..0bdbe96 100644
--- a/src/libply-splash-core/ply-boot-splash.h
+++ b/src/libply-splash-core/ply-boot-splash.h
@@ -89,6 +89,7 @@ void ply_boot_splash_attach_progress (ply_boot_splash_t *splash,
void ply_boot_splash_become_idle (ply_boot_splash_t *splash,
ply_boot_splash_on_idle_handler_t idle_handler,
void *user_data);
+bool ply_boot_splash_uses_pixel_displays (ply_boot_splash_t *splash);
#endif
diff --git a/src/main.c b/src/main.c
index ff02ea6..ed23968 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1174,7 +1174,8 @@ quit_splash (state_t *state)
static void
hide_splash (state_t *state)
{
- ply_device_manager_deactivate_renderers (state->device_manager);
+ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash))
+ ply_device_manager_deactivate_renderers (state->device_manager);
state->is_shown = false;
@@ -1260,7 +1261,8 @@ deactivate_splash (state_t *state)
{
assert (!state->is_inactive);
- ply_device_manager_deactivate_renderers (state->device_manager);
+ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash))
+ ply_device_manager_deactivate_renderers (state->device_manager);
detach_from_running_session (state);
@@ -1359,7 +1361,8 @@ on_reactivate (state_t *state)
}
ply_device_manager_activate_keyboards (state->device_manager);
- ply_device_manager_activate_renderers (state->device_manager);
+ if (state->boot_splash && ply_boot_splash_uses_pixel_displays (state->boot_splash))
+ ply_device_manager_activate_renderers (state->device_manager);
state->is_inactive = false;
@@ -1763,7 +1766,8 @@ show_theme (state_t *state,
return NULL;
attach_splash_to_devices (state, splash);
- ply_device_manager_activate_renderers (state->device_manager);
+ if (ply_boot_splash_uses_pixel_displays (splash))
+ ply_device_manager_activate_renderers (state->device_manager);
splash_mode = get_splash_mode_from_mode (state->mode);
--
2.18.0

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,144 +0,0 @@
From 8db07cf2629d3a211b78c24b676f803703b1ec1f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 2 Oct 2018 14:13:19 +0200
Subject: [PATCH 4/5] drm: Refactor ply_renderer_connector_get_rotation
ply_renderer_connector_get_rotation walks over all properties to add
support for selecting the preferred mode we also want to know if a connector
is part of a tiled output or not, which also requires walking over the props.
This commit refactors ply_renderer_connector_get_rotation into
ply_renderer_connector_get_rotation_and_tiled to prepare for this.
While at also properly use ply_pixel_buffer_rotation_t for the orientation
instead of an int.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/plugins/renderers/drm/plugin.c | 52 +++++++++++++++++-------------
1 file changed, 30 insertions(+), 22 deletions(-)
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index 6e6b520..2d90ecb 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -376,7 +376,7 @@ destroy_output_buffer (ply_renderer_backend_t *backend,
ply_renderer_buffer_free (backend, buffer);
}
-static int
+static ply_pixel_buffer_rotation_t
connector_orientation_prop_to_rotation (drmModePropertyPtr prop,
int orientation)
{
@@ -398,12 +398,17 @@ connector_orientation_prop_to_rotation (drmModePropertyPtr prop,
return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT;
}
-static int
-ply_renderer_connector_get_rotation (ply_renderer_backend_t *backend,
- drmModeConnector *connector)
+static void
+ply_renderer_connector_get_rotation_and_tiled (ply_renderer_backend_t *backend,
+ drmModeConnector *connector,
+ ply_pixel_buffer_rotation_t *rotation,
+ bool *tiled)
{
drmModePropertyPtr prop;
- int i, rotation;
+ int i;
+
+ *rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT;
+ *tiled = false;
for (i = 0; i < connector->count_props; i++) {
prop = drmModeGetProperty (backend->device_fd, connector->props[i]);
@@ -411,16 +416,15 @@ ply_renderer_connector_get_rotation (ply_renderer_backend_t *backend,
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;
- }
+ strcmp (prop->name, "panel orientation") == 0)
+ *rotation = connector_orientation_prop_to_rotation (prop, connector->prop_values[i]);
+
+ if ((prop->flags & DRM_MODE_PROP_BLOB) &&
+ strcmp (prop->name, "TILE") == 0)
+ *tiled = true;
drmModeFreeProperty (prop);
}
-
- return PLY_PIXEL_BUFFER_ROTATE_UPRIGHT;
}
static bool
@@ -449,18 +453,19 @@ ply_renderer_head_add_connector (ply_renderer_head_t *head,
}
static ply_renderer_head_t *
-ply_renderer_head_new (ply_renderer_backend_t *backend,
- drmModeConnector *connector,
- int connector_mode_index,
- uint32_t encoder_id,
- uint32_t controller_id,
- uint32_t console_buffer_id,
- int gamma_size)
+ply_renderer_head_new (ply_renderer_backend_t *backend,
+ drmModeConnector *connector,
+ int connector_mode_index,
+ uint32_t encoder_id,
+ uint32_t controller_id,
+ uint32_t console_buffer_id,
+ int gamma_size,
+ ply_pixel_buffer_rotation_t rotation)
{
ply_renderer_head_t *head;
drmModeModeInfo *mode;
unsigned int shift;
- int i, rotation;
+ int i;
head = calloc (1, sizeof(ply_renderer_head_t));
@@ -498,7 +503,6 @@ 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);
- 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,
@@ -1057,6 +1061,8 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
uint32_t console_buffer_id;
int connector_mode_index;
int gamma_size;
+ ply_pixel_buffer_rotation_t rotation;
+ bool tiled;
connector = drmModeGetConnector (backend->device_fd,
backend->resources->connectors[i]);
@@ -1092,6 +1098,8 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
controller_id = controller->crtc_id;
+ ply_renderer_connector_get_rotation_and_tiled (backend, connector, &rotation, &tiled);
+
connector_mode_index = get_index_of_active_mode (backend, controller, connector);
/* If we couldn't find the current active mode, fall back to the first available.
@@ -1111,7 +1119,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
if (head == NULL) {
head = ply_renderer_head_new (backend, connector, connector_mode_index,
encoder_id, controller_id,
- console_buffer_id, gamma_size);
+ console_buffer_id, gamma_size, rotation);
ply_list_append_data (backend->heads, head);
--
2.19.0

View File

@ -1,85 +0,0 @@
From b527834c8821362da6d01ee15ecab589a43abfcb Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 2 Jul 2018 23:46:59 +0200
Subject: [PATCH 4/9] drm: Remove unnecessary reset_scan_out_buffer_if_needed()
call from ply_renderer_head_map()
ply_renderer_head_map() gets only called from map_to_device() which
calls activate() directly afterwards which calls
ply_renderer_head_set_scan_out_buffer(), so there is no need for the
reset_scan_out_buffer_if_needed() call.
Not only is it not needed, but it is actually harmful, there are 2 problems
woth it:
1) Normally the drm plugin gets instantiated by ply-renderer.c with
rendered->is_active=true, backend->is_active=false. The
rendered->is_active=true causes the first ply_renderer_activate call
to be a no-op without calling backend->activate(). So when the first
map_to_device() calls happen activate() has not been called yet and we've
not yet claimed master rights, so ply_renderer_head_set_scan_out_buffer()
calls will always fail, resulting in this in a ply-trace:
Mapping buffer for 1920x1080 renderer head
Redrawing 1920x1080 renderer head
Setting scan out buffer of 1920x1080 head to our buffer
Couldn't set scan out buffer for head with controller id 41
This is harmless, but also shows that the reset_scan_out_buffer_if_needed()
is really not needed.
2. If deactivate_renderer() gets called before the first show-splash then
rendered->is_active will become false, so renderer_activate() done before
map_to_device() will now actually call backend->activate() claiming
drm master rights and setting backend->is_active=true.
The map_to_device() -> ply_renderer_head_map() call done after this, calls
ply_renderer_head_redraw() -> flush_head() which under 1. was a no-op
as it exits directly when backend->is_active=false. But now it actually
flushes the buffers by calling reset_scan_out_buffer_if_needed(). This
itself is fine.
But since reset_scan_out_buffer_if_needed() has already happened in
ply_renderer_head_redraw() the reset_scan_out_buffer_if_needed() call this
commit removes would always return false (no reset necessary) causing
ply_renderer_head_map() to destroy the buffer and return an error.
This results in the splash briefly showing, followed by the core soon after
trying another map_to_device(), which again briefly shows the splash, etc.
With the end result being a badly flickering display.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/plugins/renderers/drm/plugin.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index fb79aa6..1080590 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -618,8 +618,6 @@ static bool
ply_renderer_head_map (ply_renderer_backend_t *backend,
ply_renderer_head_t *head)
{
- bool scan_out_set;
-
assert (backend != NULL);
assert (backend->device_fd >= 0);
assert (backend != NULL);
@@ -646,13 +644,6 @@ ply_renderer_head_map (ply_renderer_backend_t *backend,
*/
ply_renderer_head_redraw (backend, head);
- scan_out_set = reset_scan_out_buffer_if_needed (backend, head);
- if (!scan_out_set && backend->is_active) {
- destroy_output_buffer (backend, head->scan_out_buffer_id);
- head->scan_out_buffer_id = 0;
- return false;
- }
-
return true;
}
--
2.18.0

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,126 +0,0 @@
From 65fce3926d6519b2991f67097517c1614c8fc535 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 2 Oct 2018 11:44:28 +0200
Subject: [PATCH 5/5] drm: Use preferred mode for outputs instead of current
mode
When enumerating outputs pick the preferred mode instead of the current
active mode, which may be e.g. a very low res mode.
Sofar we've been relying on fbcon setting up the modes for us, but as
mentioned in https://bugs.freedesktop.org/show_bug.cgi?id=101520#c22
we really should not rely on this.
With the recent flickerfree boot changes we can no longer rely on fbcon
to do the setup for us, hence this commit. For now this commit only
changes the mode-picking logic on UEFI setups as we only have
flickerfree boot there. Once the setup code is more mature we should
probably always use it.
Closes #68
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/plugins/renderers/drm/plugin.c | 51 ++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index 2d90ecb..e72f6c6 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -137,6 +137,7 @@ struct _ply_renderer_backend
uint32_t is_active : 1;
uint32_t requires_explicit_flushing : 1;
+ uint32_t use_preferred_mode : 1;
};
ply_renderer_plugin_interface_t *ply_renderer_backend_get_interface (void);
@@ -149,6 +150,31 @@ static bool reset_scan_out_buffer_if_needed (ply_renderer_backend_t *backend,
static void flush_head (ply_renderer_backend_t *backend,
ply_renderer_head_t *head);
+/* A small helper to determine if we should try to keep the current mode
+ * or pick the best mode ourselves, we keep the current mode if:
+ * 1. The user specified a specific mode using video= on the commandline
+ * 2. The code to pick the best mode was added because with flicker-free boot
+ * we can no longer rely on the kernel's fbcon code setting things up.
+ * We should be able to do a better job then fbcon regardless, but for
+ * now lets only use the new code on flicker-free systems until it is
+ * more mature, this means only using it on UEFI systems.
+ */
+static bool
+should_use_preferred_mode (void)
+{
+ bool use_preferred_mode = true;
+
+ if (ply_kernel_cmd_line_get_string_after_prefix ("video="))
+ use_preferred_mode = false;
+
+ if (access("/sys/firmware/efi/efivars/", F_OK) != 0)
+ use_preferred_mode = false;
+
+ ply_trace ("should_use_preferred_mode: %d", use_preferred_mode);
+
+ return use_preferred_mode;
+}
+
static bool
ply_renderer_buffer_map (ply_renderer_backend_t *backend,
ply_renderer_buffer_t *buffer)
@@ -779,6 +805,7 @@ create_backend (const char *device_name,
backend->requires_explicit_flushing = true;
backend->output_buffers = ply_hashtable_new (ply_hashtable_direct_hash,
ply_hashtable_direct_compare);
+ backend->use_preferred_mode = should_use_preferred_mode();
return backend;
}
@@ -1027,6 +1054,22 @@ find_index_of_mode (ply_renderer_backend_t *backend,
return -1;
}
+static int
+get_index_of_preferred_mode (drmModeConnector *connector)
+{
+ int i;
+
+ for (i = 0; i < connector->count_modes; i++)
+ if (connector->modes[i].type & DRM_MODE_TYPE_PREFERRED) {
+ ply_trace("Found preferred mode %dx%d at index %d\n",
+ connector->modes[i].hdisplay,
+ connector->modes[i].vdisplay, i);
+ return i;
+ }
+
+ return -1;
+}
+
static int
get_index_of_active_mode (ply_renderer_backend_t *backend,
drmModeCrtc *controller,
@@ -1059,7 +1102,7 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
drmModeCrtc *controller;
uint32_t controller_id;
uint32_t console_buffer_id;
- int connector_mode_index;
+ int connector_mode_index = -1;
int gamma_size;
ply_pixel_buffer_rotation_t rotation;
bool tiled;
@@ -1100,7 +1143,11 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend)
ply_renderer_connector_get_rotation_and_tiled (backend, connector, &rotation, &tiled);
- connector_mode_index = get_index_of_active_mode (backend, controller, connector);
+ if (!tiled && backend->use_preferred_mode)
+ connector_mode_index = get_index_of_preferred_mode (connector);
+
+ if (connector_mode_index < 0)
+ connector_mode_index = get_index_of_active_mode (backend, controller, connector);
/* If we couldn't find the current active mode, fall back to the first available.
*/
--
2.19.0

View File

@ -1,40 +0,0 @@
From 129b4a5004d771e83de37fc6f0d74615119ec102 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 3 Jul 2018 08:44:33 +0200
Subject: [PATCH 5/9] main: Show details when ESC is pressed during
splash_delay
Start listening for keypresses on the first show_splash() call, so that
pressing ESC while we're delaying show the non-details splash will show
the details splash.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main.c b/src/main.c
index ed23968..d7f192f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -361,6 +361,8 @@ show_detailed_splash (state_t *state)
{
ply_boot_splash_t *splash;
+ cancel_pending_delayed_show (state);
+
if (state->boot_splash != NULL)
return;
@@ -1001,6 +1003,8 @@ show_splash (state_t *state)
(ply_event_loop_timeout_handler_t)
show_splash,
state);
+ /* Listen for ESC to show details */
+ ply_device_manager_activate_keyboards (state->device_manager);
return;
}
}
--
2.18.0

View File

@ -1,96 +0,0 @@
From 6a1fdabf344bdc15956e69d6dee78752680369a5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 26 Jun 2018 09:15:25 +0200
Subject: [PATCH 6/9] main: Fix getting detailed logs from systemd
This are 3 issues with the detailed logs handling:
1) plymouth attaches to the session directly on a show-splash command
(in on_show_splash()), but it does not tell systemd to start printing
details until the splash is actually shown after the splash_delay.
2) If the splash is actually shown during the initrd (e.g. a diskcript
password is necessary) then we tell the initrd systemd instance to
print details, but we don't tell the regular initrd instance which takes
over as pid 1 after the switch-root to print details.
This leads to rather inconsistent logging/printing behavior, e.g.:
* If a diskcrypt password is asked for, we only log details from
the initrd phase.
* If the boot is shorter then splash_delay no details are logged
* If the user presses ESC during boot during the initrd, only initrd
messages are printed
* If the user presses ESC during boot after the initrd, only normal
messages are printed
This commit fixes both these issues by:
1) Telling systemd to print details as soon as we have attached to the session;
and to stop printing details when we detach from the session (*)
2) Telling systemd to print details after the rootfs has been remounted rw
*) This is necessary to have a smooth transition to e.g. gdm if the splash
has not shown because the boot is shorter then splash_delay
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/main.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/main.c b/src/main.c
index d7f192f..634a38e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -853,6 +853,11 @@ on_system_initialized (state_t *state)
ply_trace ("system now initialized, opening log");
state->system_initialized = true;
+#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
+ if (state->is_attached)
+ tell_systemd_to_print_details (state);
+#endif
+
prepare_logging (state);
}
@@ -1782,11 +1787,6 @@ show_theme (state_t *state,
return NULL;
}
-#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
- if (state->is_attached)
- tell_systemd_to_print_details (state);
-#endif
-
ply_device_manager_activate_keyboards (state->device_manager);
return splash;
@@ -1833,6 +1833,10 @@ attach_to_running_session (state_t *state)
return false;
}
+#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
+ tell_systemd_to_print_details (state);
+#endif
+
state->is_redirected = should_be_redirected;
state->is_attached = true;
state->session = session;
@@ -1849,6 +1853,10 @@ detach_from_running_session (state_t *state)
if (!state->is_attached)
return;
+#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
+ tell_systemd_to_stop_printing_details (state);
+#endif
+
ply_trace ("detaching from terminal session");
ply_terminal_session_detach (state->session);
state->is_redirected = false;
--
2.18.0

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,28 +0,0 @@
From 75ef8ee24bf5875875af44a91cd24975a4d92664 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 10 Jul 2018 15:58:04 -0400
Subject: [PATCH 7/7] main: fix build
I slightly modified Hans patch in commit 129b4a50 before pushing it
and broke the build.
This fixes the build by adding a forward declaration.
---
src/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main.c b/src/main.c
index 5555f0b..7e58fff 100644
--- a/src/main.c
+++ b/src/main.c
@@ -168,6 +168,7 @@ static void on_quit (state_t *state,
bool retain_splash,
ply_trigger_t *quit_trigger);
static bool sh_is_init (state_t *state);
+static void cancel_pending_delayed_show (state_t *state);
static ply_boot_splash_mode_t
get_splash_mode_from_mode (ply_mode_t mode)
--
2.18.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

@ -15,8 +15,8 @@
Summary: Graphical Boot Animation and Logger Summary: Graphical Boot Animation and Logger
Name: plymouth Name: plymouth
Version: 0.9.3 Version: 0.9.4
Release: 14%{?snapshot_rel}%{?dist} Release: 1%{?snapshot_rel}%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://www.freedesktop.org/wiki/Software/Plymouth URL: http://www.freedesktop.org/wiki/Software/Plymouth
@ -24,41 +24,6 @@ Source0: http://freedesktop.org/software/plymouth/releases/%{name}-%{version}.ta
Source2: charge.plymouth Source2: charge.plymouth
Source3: plymouth-update-initrd Source3: plymouth-update-initrd
# 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
# Patch from upstream for #1518464
Patch8: 0001-device-manager-skip-graphical-renderer-setup-when-de.patch
# Patch from upstream fixes boot with rhgb but no renderers available
Patch9: 0001-device-manager-fall-back-to-text-mode-if-graphical-d.patch
# Patches from upstream to fix details view on kernels build with
# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
Patch10: 0001-renderer-support-reactivating-renderer-without-closi.patch
Patch11: 0002-main-move-ply_device_manager_deactivate_renderers-in.patch
Patch12: 0003-main-Only-activate-renderers-if-the-splash-uses-pixe.patch
Patch13: 0004-drm-Remove-unnecessary-reset_scan_out_buffer_if_need.patch
Patch14: 0005-main-Show-details-when-ESC-is-pressed-during-splash_.patch
Patch15: 0006-main-Fix-getting-detailed-logs-from-systemd.patch
Patch16: 0007-main-fix-build.patch
# Patches from upstream git to set the mode to the preferred mode,
# addressing: https://gitlab.freedesktop.org/plymouth/plymouth/issues/68
Patch17: 0001-main-ensure-tty-is-closed-on-deactivate.patch
Patch18: 0002-libply-Move-kernel-commandline-parsing-functions-to-.patch
Patch19: 0003-drm-Reset-LUT-gamma-table-before-the-first-drmModeSe.patch
Patch20: 0004-drm-Refactor-ply_renderer_connector_get_rotation.patch
Patch21: 0005-drm-Use-preferred-mode-for-outputs-instead-of-curren.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(libudev)
@ -461,6 +426,9 @@ fi
%files system-theme %files system-theme
%changelog %changelog
* Mon Nov 05 2018 Ray Strode <rstrode@redhat.com> - 0.9.4-1
- Update to 0.9.4
* Thu Oct 04 2018 Hans de Goede <jwrdegoede@fedoraproject.org> - 0.9.3-14 * Thu Oct 04 2018 Hans de Goede <jwrdegoede@fedoraproject.org> - 0.9.3-14
- Add patches from upstream to fix the disk unlock screen sometimes having - Add patches from upstream to fix the disk unlock screen sometimes having
a very low resolution on UEFI machines: a very low resolution on UEFI machines:

View File

@ -1 +1 @@
SHA512 (plymouth-0.9.3.tar.xz) = d7b9ba97485cdac7ad6bcaf5a7f1a9c84ece54b8d46d5efce4170294c0aa6571656d7d9957b53aed9c1e51d4d525714f54b7dbb08d8ec0b196a1a4419fd186ed SHA512 (plymouth-0.9.4.tar.xz) = 83eb2de7e6d0980e9f7fa4e0b0f20c46a8238051d84bc38dbbb5dfa438e41c1a39846dcd652374256d9f1fe79967b154a3576cd9c433ef816b6c962be2d31e93