Merge branch 'bgrt' into 'master'
Add support for using the firmware splash as background for the two-step splash plugin using the ACPI BGRT extension See merge request plymouth/plymouth!14
|
|
@ -322,6 +322,7 @@ AC_CONFIG_FILES([Makefile
|
|||
themes/glow/Makefile
|
||||
themes/spinner/Makefile
|
||||
themes/script/Makefile
|
||||
themes/bgrt/Makefile
|
||||
images/Makefile
|
||||
scripts/plymouth-generate-initrd
|
||||
scripts/plymouth-populate-initrd
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ ply_pixel_buffer_fill_area_with_pixel_value (ply_pixel_buffer_t *buffer,
|
|||
/* If we're filling the entire buffer with a fully opaque color,
|
||||
* then make note of it
|
||||
*/
|
||||
if (fill_area == &buffer->area &&
|
||||
if (memcmp(fill_area, &buffer->area, sizeof(ply_rectangle_t)) == 0 &&
|
||||
(pixel_value >> 24) == 0xff) {
|
||||
buffer->is_opaque = true;
|
||||
}
|
||||
|
|
@ -868,8 +868,8 @@ ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (ply_pixel_buffer_t *canv
|
|||
if (cropped_area.width == 0 || cropped_area.height == 0)
|
||||
return;
|
||||
|
||||
x = cropped_area.x - x_offset;
|
||||
y = cropped_area.y - y_offset;
|
||||
x = cropped_area.x - x_offset * canvas->device_scale;
|
||||
y = cropped_area.y - y_offset * canvas->device_scale;
|
||||
|
||||
ply_pixel_buffer_copy_area (canvas, source, x, y, &cropped_area);
|
||||
|
||||
|
|
@ -1079,4 +1079,59 @@ ply_pixel_buffer_set_device_scale (ply_pixel_buffer_t *buffer,
|
|||
buffer->logical_area.height = buffer->area.height / scale;
|
||||
}
|
||||
|
||||
ply_pixel_buffer_rotation_t
|
||||
ply_pixel_buffer_get_device_rotation (ply_pixel_buffer_t *buffer)
|
||||
{
|
||||
return buffer->device_rotation;
|
||||
}
|
||||
|
||||
void
|
||||
ply_pixel_buffer_set_device_rotation (ply_pixel_buffer_t *buffer,
|
||||
ply_pixel_buffer_rotation_t device_rotation)
|
||||
{
|
||||
if (buffer->device_rotation == device_rotation)
|
||||
return;
|
||||
|
||||
buffer->device_rotation = device_rotation;
|
||||
|
||||
if (device_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE ||
|
||||
device_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) {
|
||||
unsigned long tmp = buffer->area.width;
|
||||
buffer->area.width = buffer->area.height;
|
||||
buffer->area.height = tmp;
|
||||
|
||||
ply_pixel_buffer_set_device_scale (buffer, buffer->device_scale);
|
||||
}
|
||||
|
||||
while (ply_list_get_length (buffer->clip_areas) > 0) {
|
||||
ply_pixel_buffer_pop_clip_area (buffer);
|
||||
}
|
||||
ply_pixel_buffer_push_clip_area (buffer, &buffer->area);
|
||||
}
|
||||
|
||||
ply_pixel_buffer_t *
|
||||
ply_pixel_buffer_rotate_upright (ply_pixel_buffer_t *old_buffer)
|
||||
{
|
||||
ply_pixel_buffer_t *buffer;
|
||||
int x,y, width, height;
|
||||
uint32_t pixel;
|
||||
|
||||
width = old_buffer->area.width;
|
||||
height = old_buffer->area.height;
|
||||
|
||||
buffer = ply_pixel_buffer_new (width, height);
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
pixel = ply_pixel_buffer_get_pixel (old_buffer, x, y);
|
||||
ply_pixel_buffer_set_pixel (buffer, x, y, pixel);
|
||||
}
|
||||
}
|
||||
|
||||
ply_pixel_buffer_set_device_scale (buffer, old_buffer->device_scale);
|
||||
ply_pixel_buffer_set_opaque (buffer, old_buffer->is_opaque);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */
|
||||
|
|
|
|||
|
|
@ -59,6 +59,12 @@ int ply_pixel_buffer_get_device_scale (ply_pixel_buffer_t *buffer);
|
|||
void ply_pixel_buffer_set_device_scale (ply_pixel_buffer_t *buffer,
|
||||
int scale);
|
||||
|
||||
ply_pixel_buffer_rotation_t
|
||||
ply_pixel_buffer_get_device_rotation (ply_pixel_buffer_t *buffer);
|
||||
/* Note calling this removes all pushed clip-areas */
|
||||
void ply_pixel_buffer_set_device_rotation (ply_pixel_buffer_t *buffer,
|
||||
ply_pixel_buffer_rotation_t rotation);
|
||||
|
||||
unsigned long ply_pixel_buffer_get_width (ply_pixel_buffer_t *buffer);
|
||||
unsigned long ply_pixel_buffer_get_height (ply_pixel_buffer_t *buffer);
|
||||
|
||||
|
|
@ -153,6 +159,12 @@ ply_pixel_buffer_t *ply_pixel_buffer_tile (ply_pixel_buffer_t *old_buffer,
|
|||
long width,
|
||||
long height);
|
||||
|
||||
/* Return the upright version of a buffer which is non upright.
|
||||
* This is the *only* ply_pixel_buffer function which works correctly with a
|
||||
* non upright buffer as source.
|
||||
*/
|
||||
ply_pixel_buffer_t *ply_pixel_buffer_rotate_upright (ply_pixel_buffer_t *old_buffer);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* PLY_PIXEL_BUFFER_H */
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ struct _ply_pixel_display
|
|||
|
||||
unsigned long width;
|
||||
unsigned long height;
|
||||
int device_scale;
|
||||
|
||||
ply_pixel_display_draw_handler_t draw_handler;
|
||||
void *draw_handler_user_data;
|
||||
|
|
@ -77,6 +78,7 @@ ply_pixel_display_new (ply_renderer_t *renderer,
|
|||
|
||||
display->width = size.width;
|
||||
display->height = size.height;
|
||||
display->device_scale = ply_pixel_buffer_get_device_scale (pixel_buffer);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
|
@ -105,6 +107,12 @@ ply_pixel_display_get_height (ply_pixel_display_t *display)
|
|||
return display->height;
|
||||
}
|
||||
|
||||
int
|
||||
ply_pixel_display_get_device_scale (ply_pixel_display_t *display)
|
||||
{
|
||||
return display->device_scale;
|
||||
}
|
||||
|
||||
static void
|
||||
ply_pixel_display_flush (ply_pixel_display_t *display)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ ply_renderer_head_t *ply_pixel_display_get_renderer_head (ply_pixel_display_t *d
|
|||
|
||||
unsigned long ply_pixel_display_get_width (ply_pixel_display_t *display);
|
||||
unsigned long ply_pixel_display_get_height (ply_pixel_display_t *display);
|
||||
int ply_pixel_display_get_device_scale (ply_pixel_display_t *display);
|
||||
|
||||
void ply_pixel_display_set_draw_handler (ply_pixel_display_t *display,
|
||||
ply_pixel_display_draw_handler_t draw_handler,
|
||||
|
|
|
|||
|
|
@ -68,6 +68,11 @@ typedef struct
|
|||
ply_renderer_input_source_t *input_source);
|
||||
|
||||
const char * (*get_device_name)(ply_renderer_backend_t *backend);
|
||||
bool (*get_panel_properties)(ply_renderer_backend_t *backend,
|
||||
int *width,
|
||||
int *height,
|
||||
ply_pixel_buffer_rotation_t *rotation,
|
||||
int *scale);
|
||||
} ply_renderer_plugin_interface_t;
|
||||
|
||||
#endif /* PLY_RENDERER_PLUGIN_H */
|
||||
|
|
|
|||
|
|
@ -410,4 +410,19 @@ ply_renderer_close_input_source (ply_renderer_t *renderer,
|
|||
renderer->input_source_is_open = false;
|
||||
}
|
||||
|
||||
bool
|
||||
ply_renderer_get_panel_properties (ply_renderer_t *renderer,
|
||||
int *width,
|
||||
int *height,
|
||||
ply_pixel_buffer_rotation_t *rotation,
|
||||
int *scale)
|
||||
{
|
||||
if (!renderer->plugin_interface->get_panel_properties)
|
||||
return false;
|
||||
|
||||
return renderer->plugin_interface->get_panel_properties (renderer->backend,
|
||||
width, height,
|
||||
rotation, scale);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
|
||||
|
|
|
|||
|
|
@ -76,6 +76,12 @@ void ply_renderer_set_handler_for_input_source (ply_renderer_t
|
|||
|
||||
void ply_renderer_close_input_source (ply_renderer_t *renderer,
|
||||
ply_renderer_input_source_t *input_source);
|
||||
|
||||
bool ply_renderer_get_panel_properties (ply_renderer_t *renderer,
|
||||
int *width,
|
||||
int *height,
|
||||
ply_pixel_buffer_rotation_t *rotation,
|
||||
int *scale);
|
||||
#endif
|
||||
|
||||
#endif /* PLY_RENDERER_H */
|
||||
|
|
|
|||
|
|
@ -55,6 +55,29 @@ struct _ply_image
|
|||
ply_pixel_buffer_t *buffer;
|
||||
};
|
||||
|
||||
struct bmp_file_header {
|
||||
uint16_t id;
|
||||
uint32_t file_size;
|
||||
uint32_t reserved;
|
||||
uint32_t bitmap_offset;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct bmp_dib_header {
|
||||
uint32_t dib_header_size;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
uint16_t planes;
|
||||
uint16_t bpp;
|
||||
uint32_t compression;
|
||||
uint32_t bitmap_size;
|
||||
uint32_t horz_resolution;
|
||||
uint32_t vert_resolution;
|
||||
uint32_t colors_used;
|
||||
uint32_t colors_important;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
const uint8_t png_header[8] = { 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a };
|
||||
|
||||
ply_image_t *
|
||||
ply_image_new (const char *filename)
|
||||
{
|
||||
|
|
@ -112,8 +135,8 @@ transform_to_argb32 (png_struct *png,
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ply_image_load (ply_image_t *image)
|
||||
static bool
|
||||
ply_image_load_png (ply_image_t *image, FILE *fp)
|
||||
{
|
||||
png_struct *png;
|
||||
png_info *info;
|
||||
|
|
@ -121,13 +144,9 @@ ply_image_load (ply_image_t *image)
|
|||
int bits_per_pixel, color_type, interlace_method;
|
||||
png_byte **rows;
|
||||
uint32_t *bytes;
|
||||
FILE *fp;
|
||||
|
||||
assert (image != NULL);
|
||||
|
||||
fp = fopen (image->filename, "re");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
assert (fp != NULL);
|
||||
|
||||
png = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
assert (png != NULL);
|
||||
|
|
@ -137,10 +156,8 @@ ply_image_load (ply_image_t *image)
|
|||
|
||||
png_init_io (png, fp);
|
||||
|
||||
if (setjmp (png_jmpbuf (png)) != 0) {
|
||||
fclose (fp);
|
||||
if (setjmp (png_jmpbuf (png)) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
png_read_info (png, info);
|
||||
png_get_IHDR (png, info,
|
||||
|
|
@ -188,12 +205,106 @@ ply_image_load (ply_image_t *image)
|
|||
|
||||
free (rows);
|
||||
png_read_end (png, info);
|
||||
fclose (fp);
|
||||
png_destroy_read_struct (&png, &info, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
ply_image_load_bmp (ply_image_t *image, FILE *fp)
|
||||
{
|
||||
uint32_t x, y, src_y, width, height, bmp_pitch, *dst;
|
||||
struct bmp_file_header file_header;
|
||||
struct bmp_dib_header dib_header;
|
||||
uint8_t r, g, b, *buf, *src;
|
||||
bool ret = false;
|
||||
|
||||
assert (image != NULL);
|
||||
assert (fp != NULL);
|
||||
|
||||
if (fread (&file_header, 1, sizeof(struct bmp_file_header), fp) != sizeof(struct bmp_file_header))
|
||||
return false;
|
||||
|
||||
if (fread (&dib_header, 1, sizeof(struct bmp_dib_header), fp) != sizeof(struct bmp_dib_header))
|
||||
return false;
|
||||
|
||||
if (dib_header.dib_header_size != 40 || dib_header.width < 0 ||
|
||||
dib_header.planes != 1 || dib_header.bpp != 24 ||
|
||||
dib_header.compression != 0)
|
||||
return false;
|
||||
|
||||
width = dib_header.width;
|
||||
height = abs (dib_header.height);
|
||||
bmp_pitch = (3 * width + 3) & ~3;
|
||||
|
||||
buf = malloc (bmp_pitch * height);
|
||||
assert (buf);
|
||||
|
||||
if (fseek (fp, file_header.bitmap_offset, SEEK_SET) != 0)
|
||||
goto out;
|
||||
|
||||
if (fread (buf, 1, bmp_pitch * height, fp) != bmp_pitch * height)
|
||||
goto out;
|
||||
|
||||
image->buffer = ply_pixel_buffer_new (width, height);
|
||||
dst = ply_pixel_buffer_get_argb32_data (image->buffer);
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
/* Positive header height means upside down row order */
|
||||
if (dib_header.height > 0)
|
||||
src_y = (height - 1) - y;
|
||||
else
|
||||
src_y = y;
|
||||
|
||||
src = buf + src_y * bmp_pitch;
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
b = *src++;
|
||||
g = *src++;
|
||||
r = *src++;
|
||||
*dst++ = (0xff << 24) | (r << 16) | (g << 8) | (b << 0);
|
||||
}
|
||||
}
|
||||
|
||||
ply_pixel_buffer_set_opaque (image->buffer, true);
|
||||
ret = true;
|
||||
out:
|
||||
free (buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
ply_image_load (ply_image_t *image)
|
||||
{
|
||||
uint8_t header[16];
|
||||
bool ret = false;
|
||||
FILE *fp;
|
||||
|
||||
assert (image != NULL);
|
||||
|
||||
fp = fopen (image->filename, "re");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
if (fread (header, 1, 16, fp) != 16)
|
||||
goto out;
|
||||
|
||||
/* Rewind */
|
||||
if (fseek (fp, 0, SEEK_SET) != 0)
|
||||
goto out;
|
||||
|
||||
if (memcmp (header, png_header, sizeof(png_header)) == 0)
|
||||
ret = ply_image_load_png (image, fp);
|
||||
|
||||
else if (((struct bmp_file_header *)header)->id == 0x4d42 &&
|
||||
((struct bmp_file_header *)header)->reserved == 0)
|
||||
ret = ply_image_load_bmp (image, fp);
|
||||
|
||||
out:
|
||||
fclose (fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t *
|
||||
ply_image_get_data (ply_image_t *image)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -138,6 +138,11 @@ struct _ply_renderer_backend
|
|||
uint32_t is_active : 1;
|
||||
uint32_t requires_explicit_flushing : 1;
|
||||
uint32_t use_preferred_mode : 1;
|
||||
|
||||
int panel_width;
|
||||
int panel_height;
|
||||
ply_pixel_buffer_rotation_t panel_rotation;
|
||||
int panel_scale;
|
||||
};
|
||||
|
||||
ply_renderer_plugin_interface_t *ply_renderer_backend_get_interface (void);
|
||||
|
|
@ -542,6 +547,15 @@ ply_renderer_head_new (ply_renderer_backend_t *backend,
|
|||
ply_pixel_buffer_fill_with_color (head->pixel_buffer, NULL,
|
||||
0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS ||
|
||||
connector->connector_type == DRM_MODE_CONNECTOR_eDP ||
|
||||
connector->connector_type == DRM_MODE_CONNECTOR_DSI) {
|
||||
backend->panel_width = mode->hdisplay;
|
||||
backend->panel_height = mode->vdisplay;
|
||||
backend->panel_rotation = rotation;
|
||||
backend->panel_scale = ply_pixel_buffer_get_device_scale (head->pixel_buffer);
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
|
|
@ -1488,6 +1502,23 @@ close_input_source (ply_renderer_backend_t *backend,
|
|||
input_source->backend = NULL;
|
||||
}
|
||||
|
||||
static bool
|
||||
get_panel_properties (ply_renderer_backend_t *backend,
|
||||
int *width,
|
||||
int *height,
|
||||
ply_pixel_buffer_rotation_t *rotation,
|
||||
int *scale)
|
||||
{
|
||||
if (!backend->panel_width)
|
||||
return false;
|
||||
|
||||
*width = backend->panel_width;
|
||||
*height = backend->panel_height;
|
||||
*rotation = backend->panel_rotation;
|
||||
*scale = backend->panel_scale;
|
||||
return true;
|
||||
}
|
||||
|
||||
ply_renderer_plugin_interface_t *
|
||||
ply_renderer_backend_get_interface (void)
|
||||
{
|
||||
|
|
@ -1509,7 +1540,8 @@ ply_renderer_backend_get_interface (void)
|
|||
.open_input_source = open_input_source,
|
||||
.set_handler_for_input_source = set_handler_for_input_source,
|
||||
.close_input_source = close_input_source,
|
||||
.get_device_name = get_device_name
|
||||
.get_device_name = get_device_name,
|
||||
.get_panel_properties = get_panel_properties,
|
||||
};
|
||||
|
||||
return &plugin_interface;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@ typedef struct
|
|||
ply_label_t *message_label;
|
||||
ply_rectangle_t box_area, lock_area, watermark_area;
|
||||
ply_trigger_t *end_trigger;
|
||||
ply_image_t *background_image;
|
||||
ply_pixel_buffer_t *background_buffer;
|
||||
bool background_is_bgrt;
|
||||
} view_t;
|
||||
|
||||
struct _ply_boot_splash_plugin
|
||||
|
|
@ -105,6 +106,7 @@ struct _ply_boot_splash_plugin
|
|||
ply_image_t *corner_image;
|
||||
ply_image_t *header_image;
|
||||
ply_image_t *background_tile_image;
|
||||
ply_image_t *background_bgrt_image;
|
||||
ply_image_t *watermark_image;
|
||||
ply_list_t *views;
|
||||
|
||||
|
|
@ -122,6 +124,7 @@ struct _ply_boot_splash_plugin
|
|||
|
||||
uint32_t background_start_color;
|
||||
uint32_t background_end_color;
|
||||
int background_bgrt_raw_width;
|
||||
|
||||
progress_function_t progress_function;
|
||||
|
||||
|
|
@ -181,8 +184,8 @@ view_free (view_t *view)
|
|||
ply_label_free (view->label);
|
||||
ply_label_free (view->message_label);
|
||||
|
||||
if (view->background_image != NULL)
|
||||
ply_image_free (view->background_image);
|
||||
if (view->background_buffer != NULL)
|
||||
ply_pixel_buffer_free (view->background_buffer);
|
||||
|
||||
free (view);
|
||||
}
|
||||
|
|
@ -242,20 +245,173 @@ view_load_end_animation (view_t *view)
|
|||
view->end_animation = NULL;
|
||||
}
|
||||
|
||||
static bool
|
||||
get_bgrt_sysfs_offsets(int *x_offset, int *y_offset)
|
||||
{
|
||||
bool ret = false;
|
||||
char buf[64];
|
||||
FILE *f;
|
||||
|
||||
f = fopen("/sys/firmware/acpi/bgrt/xoffset", "r");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
if (!fgets(buf, sizeof(buf), f))
|
||||
goto out;
|
||||
|
||||
if (sscanf(buf, "%d", x_offset) != 1)
|
||||
goto out;
|
||||
|
||||
fclose(f);
|
||||
|
||||
f = fopen("/sys/firmware/acpi/bgrt/yoffset", "r");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
if (!fgets(buf, sizeof(buf), f))
|
||||
goto out;
|
||||
|
||||
if (sscanf(buf, "%d", y_offset) != 1)
|
||||
goto out;
|
||||
|
||||
ret = true;
|
||||
out:
|
||||
fclose(f);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* The Microsoft boot logo spec says that the logo must use a black background
|
||||
* and have its center at 38.2% from the screen's top (golden ratio).
|
||||
* We reproduce this exactly here so that we get a background which is an exact
|
||||
* match of the firmware's boot splash.
|
||||
* At the time of writing this comment this is documented in a document called
|
||||
* "Boot screen components" which is available here:
|
||||
* https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components
|
||||
* Note that we normally do not use the firmware reported x and y-offset as
|
||||
* that is based on the EFI fb resolution which may not be the native
|
||||
* resolution of the screen (esp. when using multiple heads).
|
||||
*/
|
||||
static void
|
||||
view_set_bgrt_background (view_t *view)
|
||||
{
|
||||
ply_pixel_buffer_rotation_t panel_rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT;
|
||||
int x_offset, y_offset, sysfs_x_offset, sysfs_y_offset, width, height;
|
||||
int panel_width = 0, panel_height = 0, panel_scale = 1;
|
||||
int screen_width, screen_height, screen_scale;
|
||||
ply_pixel_buffer_t *bgrt_buffer;
|
||||
|
||||
if (!view->plugin->background_bgrt_image)
|
||||
return;
|
||||
|
||||
screen_width = ply_pixel_display_get_width (view->display);
|
||||
screen_height = ply_pixel_display_get_height (view->display);
|
||||
screen_scale = ply_pixel_display_get_device_scale (view->display);
|
||||
|
||||
bgrt_buffer = ply_image_get_buffer (view->plugin->background_bgrt_image);
|
||||
|
||||
if (ply_renderer_get_panel_properties (ply_pixel_display_get_renderer (view->display),
|
||||
&panel_width, &panel_height,
|
||||
&panel_rotation, &panel_scale)) {
|
||||
ply_pixel_buffer_set_device_rotation (bgrt_buffer, panel_rotation);
|
||||
ply_pixel_buffer_set_device_scale (bgrt_buffer, panel_scale);
|
||||
}
|
||||
|
||||
width = ply_pixel_buffer_get_width (bgrt_buffer);
|
||||
height = ply_pixel_buffer_get_height (bgrt_buffer);
|
||||
|
||||
x_offset = (screen_width - width) / 2;
|
||||
y_offset = screen_height * 382 / 1000 - height / 2;
|
||||
|
||||
/*
|
||||
* On laptops / tablets the LCD panel is typically brought up in
|
||||
* its native resolution, so we can trust the x- and y-offset values
|
||||
* provided by the firmware to be correct for a screen with the panels
|
||||
* resolution.
|
||||
*
|
||||
* Moreover some laptop / tablet firmwares to do all kind of hacks wrt
|
||||
* the y offset. This happens especially on devices where the panel is
|
||||
* mounted 90 degrees rotated, but also on other devices.
|
||||
*
|
||||
* So on devices with an internal LCD panel, we prefer to use the
|
||||
* firmware provided offsets, to make sure we match its quirky behavior.
|
||||
*
|
||||
* We check that the x-offset matches what we expect for the panel's
|
||||
* native resolution to make sure that the values are indeed for the
|
||||
* panel's native resolution and then we correct for any difference
|
||||
* between the (external) screen's and the panel's resolution.
|
||||
*/
|
||||
if (panel_width != 0 && panel_height != 0 &&
|
||||
get_bgrt_sysfs_offsets(&sysfs_x_offset, &sysfs_y_offset) &&
|
||||
(panel_width - view->plugin->background_bgrt_raw_width) / 2 == sysfs_x_offset) {
|
||||
if (panel_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE ||
|
||||
panel_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) {
|
||||
/* 90 degrees rotated, swap x and y */
|
||||
x_offset = sysfs_y_offset / panel_scale;
|
||||
y_offset = sysfs_x_offset / panel_scale;
|
||||
|
||||
x_offset += (screen_width - panel_height / panel_scale) / 2;
|
||||
y_offset += (screen_height - panel_width / panel_scale) * 382 / 1000;
|
||||
} else {
|
||||
/* Normal orientation */
|
||||
x_offset = sysfs_x_offset / panel_scale;
|
||||
y_offset = sysfs_y_offset / panel_scale;
|
||||
|
||||
x_offset += (screen_width - panel_width / panel_scale) / 2;
|
||||
y_offset += (screen_height - panel_height / panel_scale) * 382 / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
ply_trace ("using %dx%d bgrt image centered at %dx%d for %dx%d screen",
|
||||
width, height, x_offset, y_offset, screen_width, screen_height);
|
||||
|
||||
view->background_buffer = ply_pixel_buffer_new (screen_width * screen_scale, screen_height * screen_scale);
|
||||
ply_pixel_buffer_set_device_scale (view->background_buffer, screen_scale);
|
||||
ply_pixel_buffer_fill_with_hex_color (view->background_buffer, NULL, 0x000000);
|
||||
if (x_offset >= 0 && y_offset >= 0) {
|
||||
bgrt_buffer = ply_pixel_buffer_rotate_upright (bgrt_buffer);
|
||||
ply_pixel_buffer_fill_with_buffer (view->background_buffer, bgrt_buffer, x_offset, y_offset);
|
||||
ply_pixel_buffer_free (bgrt_buffer);
|
||||
}
|
||||
view->background_is_bgrt = true;
|
||||
}
|
||||
|
||||
static bool
|
||||
view_load (view_t *view)
|
||||
{
|
||||
unsigned long screen_width, screen_height;
|
||||
unsigned long screen_width, screen_height, screen_scale;
|
||||
ply_boot_splash_plugin_t *plugin;
|
||||
ply_pixel_buffer_t *buffer;
|
||||
|
||||
plugin = view->plugin;
|
||||
|
||||
screen_width = ply_pixel_display_get_width (view->display);
|
||||
screen_height = ply_pixel_display_get_height (view->display);
|
||||
|
||||
if (plugin->background_tile_image != NULL) {
|
||||
buffer = ply_renderer_get_buffer_for_head(
|
||||
ply_pixel_display_get_renderer (view->display),
|
||||
ply_pixel_display_get_renderer_head (view->display));
|
||||
screen_scale = ply_pixel_buffer_get_device_scale (buffer);
|
||||
|
||||
view_set_bgrt_background (view);
|
||||
|
||||
if (!view->background_buffer && plugin->background_tile_image != NULL) {
|
||||
ply_trace ("tiling background to %lux%lu", screen_width, screen_height);
|
||||
view->background_image = ply_image_tile (plugin->background_tile_image, screen_width, screen_height);
|
||||
|
||||
/* Create a buffer at screen scale so that we only do the slow interpolating scale once */
|
||||
view->background_buffer = ply_pixel_buffer_new (screen_width * screen_scale, screen_height * screen_scale);
|
||||
ply_pixel_buffer_set_device_scale (view->background_buffer, screen_scale);
|
||||
|
||||
if (plugin->background_start_color != plugin->background_end_color)
|
||||
ply_pixel_buffer_fill_with_gradient (view->background_buffer, NULL,
|
||||
plugin->background_start_color,
|
||||
plugin->background_end_color);
|
||||
else
|
||||
ply_pixel_buffer_fill_with_hex_color (view->background_buffer, NULL,
|
||||
plugin->background_start_color);
|
||||
|
||||
buffer = ply_pixel_buffer_tile (ply_image_get_buffer (plugin->background_tile_image), screen_width, screen_height);
|
||||
ply_pixel_buffer_fill_with_buffer (view->background_buffer, buffer, 0, 0);
|
||||
ply_pixel_buffer_free (buffer);
|
||||
}
|
||||
|
||||
if (plugin->watermark_image != NULL) {
|
||||
|
|
@ -649,6 +805,10 @@ create_plugin (ply_key_file_t *key_file)
|
|||
|
||||
free (color);
|
||||
|
||||
/* Boolean option, true if the key is present */
|
||||
if (ply_key_file_get_value (key_file, "two-step", "UseBGRT"))
|
||||
plugin->background_bgrt_image = ply_image_new ("/sys/firmware/acpi/bgrt/image");
|
||||
|
||||
progress_function = ply_key_file_get_value (key_file, "two-step", "ProgressFunction");
|
||||
|
||||
if (progress_function != NULL) {
|
||||
|
|
@ -726,6 +886,9 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
|
|||
if (plugin->background_tile_image != NULL)
|
||||
ply_image_free (plugin->background_tile_image);
|
||||
|
||||
if (plugin->background_bgrt_image != NULL)
|
||||
ply_image_free (plugin->background_bgrt_image);
|
||||
|
||||
if (plugin->watermark_image != NULL)
|
||||
ply_image_free (plugin->watermark_image);
|
||||
|
||||
|
|
@ -874,7 +1037,16 @@ draw_background (view_t *view,
|
|||
area.width = width;
|
||||
area.height = height;
|
||||
|
||||
if (plugin->background_start_color != plugin->background_end_color)
|
||||
/* When using the firmware logo as background, use solid black as
|
||||
* background for dialogs.
|
||||
*/
|
||||
if ((plugin->state == PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY ||
|
||||
plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) &&
|
||||
view->background_is_bgrt)
|
||||
ply_pixel_buffer_fill_with_hex_color (pixel_buffer, &area, 0);
|
||||
else if (view->background_buffer != NULL)
|
||||
ply_pixel_buffer_fill_with_buffer (pixel_buffer, view->background_buffer, 0, 0);
|
||||
else if (plugin->background_start_color != plugin->background_end_color)
|
||||
ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area,
|
||||
plugin->background_start_color,
|
||||
plugin->background_end_color);
|
||||
|
|
@ -882,17 +1054,6 @@ draw_background (view_t *view,
|
|||
ply_pixel_buffer_fill_with_hex_color (pixel_buffer, &area,
|
||||
plugin->background_start_color);
|
||||
|
||||
if (view->background_image != NULL) {
|
||||
uint32_t *data;
|
||||
data = ply_image_get_data (view->background_image);
|
||||
|
||||
/* We must pass NULL as fill area, because the fill area
|
||||
must be sized as the image we're sourcing from, otherwise
|
||||
sampling does not work
|
||||
*/
|
||||
ply_pixel_buffer_fill_with_argb32_data_with_clip (pixel_buffer, NULL, NULL, data);
|
||||
}
|
||||
|
||||
if (plugin->watermark_image != NULL) {
|
||||
uint32_t *data;
|
||||
|
||||
|
|
@ -1085,6 +1246,16 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
|
|||
}
|
||||
}
|
||||
|
||||
if (plugin->background_bgrt_image != NULL) {
|
||||
ply_trace ("loading background bgrt image");
|
||||
if (ply_image_load (plugin->background_bgrt_image)) {
|
||||
plugin->background_bgrt_raw_width = ply_image_get_width (plugin->background_bgrt_image);
|
||||
} else {
|
||||
ply_image_free (plugin->background_bgrt_image);
|
||||
plugin->background_bgrt_image = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin->watermark_image != NULL) {
|
||||
ply_trace ("loading watermark image");
|
||||
if (!ply_image_load (plugin->watermark_image)) {
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar
|
||||
SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar bgrt
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
|
|
|||
84
themes/bgrt/Makefile.am
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
themedir = $(datadir)/plymouth/themes/bgrt
|
||||
nodist_theme_DATA = bgrt.plymouth
|
||||
|
||||
dist_theme_DATA = \
|
||||
background-tile.png \
|
||||
box.png \
|
||||
bullet.png \
|
||||
entry.png \
|
||||
lock.png \
|
||||
animation-0001.png \
|
||||
animation-0002.png \
|
||||
animation-0003.png \
|
||||
animation-0004.png \
|
||||
animation-0005.png \
|
||||
animation-0006.png \
|
||||
animation-0007.png \
|
||||
animation-0008.png \
|
||||
animation-0009.png \
|
||||
animation-0010.png \
|
||||
animation-0011.png \
|
||||
animation-0012.png \
|
||||
animation-0013.png \
|
||||
animation-0014.png \
|
||||
animation-0015.png \
|
||||
animation-0016.png \
|
||||
animation-0017.png \
|
||||
animation-0018.png \
|
||||
animation-0019.png \
|
||||
animation-0020.png \
|
||||
animation-0021.png \
|
||||
animation-0022.png \
|
||||
animation-0023.png \
|
||||
animation-0024.png \
|
||||
animation-0025.png \
|
||||
animation-0026.png \
|
||||
animation-0027.png \
|
||||
animation-0028.png \
|
||||
animation-0029.png \
|
||||
animation-0030.png \
|
||||
animation-0031.png \
|
||||
animation-0032.png \
|
||||
animation-0033.png \
|
||||
animation-0034.png \
|
||||
animation-0035.png \
|
||||
animation-0036.png \
|
||||
throbber-0001.png \
|
||||
throbber-0002.png \
|
||||
throbber-0003.png \
|
||||
throbber-0004.png \
|
||||
throbber-0005.png \
|
||||
throbber-0006.png \
|
||||
throbber-0007.png \
|
||||
throbber-0008.png \
|
||||
throbber-0009.png \
|
||||
throbber-0010.png \
|
||||
throbber-0011.png \
|
||||
throbber-0012.png \
|
||||
throbber-0013.png \
|
||||
throbber-0014.png \
|
||||
throbber-0015.png \
|
||||
throbber-0016.png \
|
||||
throbber-0017.png \
|
||||
throbber-0018.png \
|
||||
throbber-0019.png \
|
||||
throbber-0020.png \
|
||||
throbber-0021.png \
|
||||
throbber-0022.png \
|
||||
throbber-0023.png \
|
||||
throbber-0024.png \
|
||||
throbber-0025.png \
|
||||
throbber-0026.png \
|
||||
throbber-0027.png \
|
||||
throbber-0028.png \
|
||||
throbber-0029.png \
|
||||
throbber-0030.png
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in bgrt.plymouth
|
||||
CLEANFILES = bgrt.plymouth
|
||||
|
||||
bgrt.plymouth: $(srcdir)/bgrt.plymouth.in
|
||||
sed -e 's,[@]PLYMOUTH_THEME_PATH[@],$(PLYMOUTH_THEME_PATH),g' \
|
||||
$(srcdir)/bgrt.plymouth.in > bgrt.plymouth
|
||||
|
||||
EXTRA_DIST = bgrt.plymouth.in
|
||||
BIN
themes/bgrt/animation-0001.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0002.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0003.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0004.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0005.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0006.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0007.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0008.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0009.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0010.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0011.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0012.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0013.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0014.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0015.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0016.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/animation-0017.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0018.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0019.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0020.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0021.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0022.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0023.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
themes/bgrt/animation-0024.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/animation-0025.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
themes/bgrt/animation-0026.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
themes/bgrt/animation-0027.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
themes/bgrt/animation-0028.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
themes/bgrt/animation-0029.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
themes/bgrt/animation-0030.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
themes/bgrt/animation-0031.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
themes/bgrt/animation-0032.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
themes/bgrt/animation-0033.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
themes/bgrt/animation-0034.png
Normal file
|
After Width: | Height: | Size: 1 KiB |
BIN
themes/bgrt/animation-0035.png
Normal file
|
After Width: | Height: | Size: 981 B |
BIN
themes/bgrt/animation-0036.png
Normal file
|
After Width: | Height: | Size: 989 B |
BIN
themes/bgrt/background-tile.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
16
themes/bgrt/bgrt.plymouth.in
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[Plymouth Theme]
|
||||
Name=BGRT
|
||||
Description=Jimmac's spinner theme using the ACPI BGRT graphics as background
|
||||
ModuleName=two-step
|
||||
|
||||
[two-step]
|
||||
ImageDir=@PLYMOUTH_THEME_PATH@/bgrt
|
||||
HorizontalAlignment=.5
|
||||
VerticalAlignment=.75
|
||||
WatermarkHorizontalAlignment=.5
|
||||
WatermarkVerticalAlignment=.96
|
||||
Transition=none
|
||||
TransitionDuration=0.0
|
||||
BackgroundStartColor=0x202020
|
||||
BackgroundEndColor=0x202020
|
||||
UseBGRT=true
|
||||
BIN
themes/bgrt/box.png
Normal file
|
After Width: | Height: | Size: 870 B |
BIN
themes/bgrt/bullet.png
Normal file
|
After Width: | Height: | Size: 131 B |
BIN
themes/bgrt/entry.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
themes/bgrt/lock.png
Normal file
|
After Width: | Height: | Size: 329 B |
BIN
themes/bgrt/throbber-0001.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0002.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0003.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0004.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0005.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0006.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0007.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0008.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0009.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0010.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0011.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0012.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0013.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0014.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0015.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0016.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0017.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0018.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0019.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0020.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
themes/bgrt/throbber-0021.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0022.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0023.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0024.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0025.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0026.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0027.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0028.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0029.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/bgrt/throbber-0030.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |