diff options
author | Hans de Goede <jwrdegoede@fedoraproject.org> | 2018-11-29 08:40:27 +0000 |
---|---|---|
committer | Hans de Goede <jwrdegoede@fedoraproject.org> | 2018-11-29 08:40:27 +0000 |
commit | a7ec3e65ba3db78656883732feb9af7cf7362f77 (patch) | |
tree | 14c5d50f7b7ce5de5f35c58f819ee15a2a390408 | |
parent | 70f0c7a029b6f11596c7970918c4793c9b1dbf16 (diff) | |
parent | 4925a485c56fec0bd1333ec94d99b9c0e5b769b4 (diff) |
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
85 files changed, 551 insertions, 34 deletions
diff --git a/configure.ac b/configure.ac index 66d36493..78550d08 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c index de3b1079..3ce6f78f 100644 --- a/src/libply-splash-core/ply-pixel-buffer.c +++ b/src/libply-splash-core/ply-pixel-buffer.c @@ -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 */ diff --git a/src/libply-splash-core/ply-pixel-buffer.h b/src/libply-splash-core/ply-pixel-buffer.h index ea7f833d..7b5da364 100644 --- a/src/libply-splash-core/ply-pixel-buffer.h +++ b/src/libply-splash-core/ply-pixel-buffer.h @@ -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 */ diff --git a/src/libply-splash-core/ply-pixel-display.c b/src/libply-splash-core/ply-pixel-display.c index cb01a2c6..dc088bb6 100644 --- a/src/libply-splash-core/ply-pixel-display.c +++ b/src/libply-splash-core/ply-pixel-display.c @@ -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) { diff --git a/src/libply-splash-core/ply-pixel-display.h b/src/libply-splash-core/ply-pixel-display.h index 675c181d..a57b9a9a 100644 --- a/src/libply-splash-core/ply-pixel-display.h +++ b/src/libply-splash-core/ply-pixel-display.h @@ -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, diff --git a/src/libply-splash-core/ply-renderer-plugin.h b/src/libply-splash-core/ply-renderer-plugin.h index f1455d30..db18d195 100644 --- a/src/libply-splash-core/ply-renderer-plugin.h +++ b/src/libply-splash-core/ply-renderer-plugin.h @@ -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 */ diff --git a/src/libply-splash-core/ply-renderer.c b/src/libply-splash-core/ply-renderer.c index ecf70822..5e83627a 100644 --- a/src/libply-splash-core/ply-renderer.c +++ b/src/libply-splash-core/ply-renderer.c @@ -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: */ diff --git a/src/libply-splash-core/ply-renderer.h b/src/libply-splash-core/ply-renderer.h index 59391e17..c0e0ed59 100644 --- a/src/libply-splash-core/ply-renderer.h +++ b/src/libply-splash-core/ply-renderer.h @@ -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 */ diff --git a/src/libply-splash-graphics/ply-image.c b/src/libply-splash-graphics/ply-image.c index 8b469788..204fd2e1 100644 --- a/src/libply-splash-graphics/ply-image.c +++ b/src/libply-splash-graphics/ply-image.c @@ -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) { diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index 1ff2b295..34b52d7b 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -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; diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 0ceda904..641eb703 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -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); } @@ -243,19 +246,172 @@ view_load_end_animation (view_t *view) } 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)) { diff --git a/themes/Makefile.am b/themes/Makefile.am index 72e642bc..8e4566e9 100644 --- a/themes/Makefile.am +++ b/themes/Makefile.am @@ -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 diff --git a/themes/bgrt/Makefile.am b/themes/bgrt/Makefile.am new file mode 100644 index 00000000..4cb7aba9 --- /dev/null +++ b/themes/bgrt/Makefile.am @@ -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 diff --git a/themes/bgrt/animation-0001.png b/themes/bgrt/animation-0001.png Binary files differnew file mode 100644 index 00000000..6bd82397 --- /dev/null +++ b/themes/bgrt/animation-0001.png diff --git a/themes/bgrt/animation-0002.png b/themes/bgrt/animation-0002.png Binary files differnew file mode 100644 index 00000000..ef8ff54a --- /dev/null +++ b/themes/bgrt/animation-0002.png diff --git a/themes/bgrt/animation-0003.png b/themes/bgrt/animation-0003.png Binary files differnew file mode 100644 index 00000000..205380b1 --- /dev/null +++ b/themes/bgrt/animation-0003.png diff --git a/themes/bgrt/animation-0004.png b/themes/bgrt/animation-0004.png Binary files differnew file mode 100644 index 00000000..6038af8b --- /dev/null +++ b/themes/bgrt/animation-0004.png diff --git a/themes/bgrt/animation-0005.png b/themes/bgrt/animation-0005.png Binary files differnew file mode 100644 index 00000000..7a967678 --- /dev/null +++ b/themes/bgrt/animation-0005.png diff --git a/themes/bgrt/animation-0006.png b/themes/bgrt/animation-0006.png Binary files differnew file mode 100644 index 00000000..eb0256f8 --- /dev/null +++ b/themes/bgrt/animation-0006.png diff --git a/themes/bgrt/animation-0007.png b/themes/bgrt/animation-0007.png Binary files differnew file mode 100644 index 00000000..d2ccac92 --- /dev/null +++ b/themes/bgrt/animation-0007.png diff --git a/themes/bgrt/animation-0008.png b/themes/bgrt/animation-0008.png Binary files differnew file mode 100644 index 00000000..85849c8f --- /dev/null +++ b/themes/bgrt/animation-0008.png diff --git a/themes/bgrt/animation-0009.png b/themes/bgrt/animation-0009.png Binary files differnew file mode 100644 index 00000000..3e79b9bc --- /dev/null +++ b/themes/bgrt/animation-0009.png diff --git a/themes/bgrt/animation-0010.png b/themes/bgrt/animation-0010.png Binary files differnew file mode 100644 index 00000000..1f64875a --- /dev/null +++ b/themes/bgrt/animation-0010.png diff --git a/themes/bgrt/animation-0011.png b/themes/bgrt/animation-0011.png Binary files differnew file mode 100644 index 00000000..57bec05f --- /dev/null +++ b/themes/bgrt/animation-0011.png diff --git a/themes/bgrt/animation-0012.png b/themes/bgrt/animation-0012.png Binary files differnew file mode 100644 index 00000000..cdefdc78 --- /dev/null +++ b/themes/bgrt/animation-0012.png diff --git a/themes/bgrt/animation-0013.png b/themes/bgrt/animation-0013.png Binary files differnew file mode 100644 index 00000000..de5aa6ec --- /dev/null +++ b/themes/bgrt/animation-0013.png diff --git a/themes/bgrt/animation-0014.png b/themes/bgrt/animation-0014.png Binary files differnew file mode 100644 index 00000000..a0199041 --- /dev/null +++ b/themes/bgrt/animation-0014.png diff --git a/themes/bgrt/animation-0015.png b/themes/bgrt/animation-0015.png Binary files differnew file mode 100644 index 00000000..249e1739 --- /dev/null +++ b/themes/bgrt/animation-0015.png diff --git a/themes/bgrt/animation-0016.png b/themes/bgrt/animation-0016.png Binary files differnew file mode 100644 index 00000000..f72a577c --- /dev/null +++ b/themes/bgrt/animation-0016.png diff --git a/themes/bgrt/animation-0017.png b/themes/bgrt/animation-0017.png Binary files differnew file mode 100644 index 00000000..02926e71 --- /dev/null +++ b/themes/bgrt/animation-0017.png diff --git a/themes/bgrt/animation-0018.png b/themes/bgrt/animation-0018.png Binary files differnew file mode 100644 index 00000000..667cd7d4 --- /dev/null +++ b/themes/bgrt/animation-0018.png diff --git a/themes/bgrt/animation-0019.png b/themes/bgrt/animation-0019.png Binary files differnew file mode 100644 index 00000000..760868a0 --- /dev/null +++ b/themes/bgrt/animation-0019.png diff --git a/themes/bgrt/animation-0020.png b/themes/bgrt/animation-0020.png Binary files differnew file mode 100644 index 00000000..d228ed84 --- /dev/null +++ b/themes/bgrt/animation-0020.png diff --git a/themes/bgrt/animation-0021.png b/themes/bgrt/animation-0021.png Binary files differnew file mode 100644 index 00000000..e7bd0f5c --- /dev/null +++ b/themes/bgrt/animation-0021.png diff --git a/themes/bgrt/animation-0022.png b/themes/bgrt/animation-0022.png Binary files differnew file mode 100644 index 00000000..4c772822 --- /dev/null +++ b/themes/bgrt/animation-0022.png diff --git a/themes/bgrt/animation-0023.png b/themes/bgrt/animation-0023.png Binary files differnew file mode 100644 index 00000000..8e77aa14 --- /dev/null +++ b/themes/bgrt/animation-0023.png diff --git a/themes/bgrt/animation-0024.png b/themes/bgrt/animation-0024.png Binary files differnew file mode 100644 index 00000000..ed52d3d4 --- /dev/null +++ b/themes/bgrt/animation-0024.png diff --git a/themes/bgrt/animation-0025.png b/themes/bgrt/animation-0025.png Binary files differnew file mode 100644 index 00000000..371a299f --- /dev/null +++ b/themes/bgrt/animation-0025.png diff --git a/themes/bgrt/animation-0026.png b/themes/bgrt/animation-0026.png Binary files differnew file mode 100644 index 00000000..1bfd5dca --- /dev/null +++ b/themes/bgrt/animation-0026.png diff --git a/themes/bgrt/animation-0027.png b/themes/bgrt/animation-0027.png Binary files differnew file mode 100644 index 00000000..6f4d83b6 --- /dev/null +++ b/themes/bgrt/animation-0027.png diff --git a/themes/bgrt/animation-0028.png b/themes/bgrt/animation-0028.png Binary files differnew file mode 100644 index 00000000..eda5e3f2 --- /dev/null +++ b/themes/bgrt/animation-0028.png diff --git a/themes/bgrt/animation-0029.png b/themes/bgrt/animation-0029.png Binary files differnew file mode 100644 index 00000000..33f26830 --- /dev/null +++ b/themes/bgrt/animation-0029.png diff --git a/themes/bgrt/animation-0030.png b/themes/bgrt/animation-0030.png Binary files differnew file mode 100644 index 00000000..c5132bd9 --- /dev/null +++ b/themes/bgrt/animation-0030.png diff --git a/themes/bgrt/animation-0031.png b/themes/bgrt/animation-0031.png Binary files differnew file mode 100644 index 00000000..f6ed4b2b --- /dev/null +++ b/themes/bgrt/animation-0031.png diff --git a/themes/bgrt/animation-0032.png b/themes/bgrt/animation-0032.png Binary files differnew file mode 100644 index 00000000..09791642 --- /dev/null +++ b/themes/bgrt/animation-0032.png diff --git a/themes/bgrt/animation-0033.png b/themes/bgrt/animation-0033.png Binary files differnew file mode 100644 index 00000000..c9ec0e5e --- /dev/null +++ b/themes/bgrt/animation-0033.png diff --git a/themes/bgrt/animation-0034.png b/themes/bgrt/animation-0034.png Binary files differnew file mode 100644 index 00000000..2851ef3b --- /dev/null +++ b/themes/bgrt/animation-0034.png diff --git a/themes/bgrt/animation-0035.png b/themes/bgrt/animation-0035.png Binary files differnew file mode 100644 index 00000000..2bd3b0dc --- /dev/null +++ b/themes/bgrt/animation-0035.png diff --git a/themes/bgrt/animation-0036.png b/themes/bgrt/animation-0036.png Binary files differnew file mode 100644 index 00000000..fbe48ff5 --- /dev/null +++ b/themes/bgrt/animation-0036.png diff --git a/themes/bgrt/background-tile.png b/themes/bgrt/background-tile.png Binary files differnew file mode 100644 index 00000000..6b70a2d4 --- /dev/null +++ b/themes/bgrt/background-tile.png diff --git a/themes/bgrt/bgrt.plymouth.in b/themes/bgrt/bgrt.plymouth.in new file mode 100644 index 00000000..b5cc8432 --- /dev/null +++ b/themes/bgrt/bgrt.plymouth.in @@ -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 diff --git a/themes/bgrt/box.png b/themes/bgrt/box.png Binary files differnew file mode 100644 index 00000000..54876e68 --- /dev/null +++ b/themes/bgrt/box.png diff --git a/themes/bgrt/bullet.png b/themes/bgrt/bullet.png Binary files differnew file mode 100644 index 00000000..87ddfe81 --- /dev/null +++ b/themes/bgrt/bullet.png diff --git a/themes/bgrt/entry.png b/themes/bgrt/entry.png Binary files differnew file mode 100644 index 00000000..65810dea --- /dev/null +++ b/themes/bgrt/entry.png diff --git a/themes/bgrt/lock.png b/themes/bgrt/lock.png Binary files differnew file mode 100644 index 00000000..f2330495 --- /dev/null +++ b/themes/bgrt/lock.png diff --git a/themes/bgrt/throbber-0001.png b/themes/bgrt/throbber-0001.png Binary files differnew file mode 100644 index 00000000..6a64683c --- /dev/null +++ b/themes/bgrt/throbber-0001.png diff --git a/themes/bgrt/throbber-0002.png b/themes/bgrt/throbber-0002.png Binary files differnew file mode 100644 index 00000000..8e9a85d8 --- /dev/null +++ b/themes/bgrt/throbber-0002.png diff --git a/themes/bgrt/throbber-0003.png b/themes/bgrt/throbber-0003.png Binary files differnew file mode 100644 index 00000000..9fe95aa2 --- /dev/null +++ b/themes/bgrt/throbber-0003.png diff --git a/themes/bgrt/throbber-0004.png b/themes/bgrt/throbber-0004.png Binary files differnew file mode 100644 index 00000000..687aa8bb --- /dev/null +++ b/themes/bgrt/throbber-0004.png diff --git a/themes/bgrt/throbber-0005.png b/themes/bgrt/throbber-0005.png Binary files differnew file mode 100644 index 00000000..3a56beb7 --- /dev/null +++ b/themes/bgrt/throbber-0005.png diff --git a/themes/bgrt/throbber-0006.png b/themes/bgrt/throbber-0006.png Binary files differnew file mode 100644 index 00000000..949cb230 --- /dev/null +++ b/themes/bgrt/throbber-0006.png diff --git a/themes/bgrt/throbber-0007.png b/themes/bgrt/throbber-0007.png Binary files differnew file mode 100644 index 00000000..14d8b45c --- /dev/null +++ b/themes/bgrt/throbber-0007.png diff --git a/themes/bgrt/throbber-0008.png b/themes/bgrt/throbber-0008.png Binary files differnew file mode 100644 index 00000000..beef3913 --- /dev/null +++ b/themes/bgrt/throbber-0008.png diff --git a/themes/bgrt/throbber-0009.png b/themes/bgrt/throbber-0009.png Binary files differnew file mode 100644 index 00000000..b366daa8 --- /dev/null +++ b/themes/bgrt/throbber-0009.png diff --git a/themes/bgrt/throbber-0010.png b/themes/bgrt/throbber-0010.png Binary files differnew file mode 100644 index 00000000..0312f626 --- /dev/null +++ b/themes/bgrt/throbber-0010.png diff --git a/themes/bgrt/throbber-0011.png b/themes/bgrt/throbber-0011.png Binary files differnew file mode 100644 index 00000000..f3e2cb9e --- /dev/null +++ b/themes/bgrt/throbber-0011.png diff --git a/themes/bgrt/throbber-0012.png b/themes/bgrt/throbber-0012.png Binary files differnew file mode 100644 index 00000000..ca4f0172 --- /dev/null +++ b/themes/bgrt/throbber-0012.png diff --git a/themes/bgrt/throbber-0013.png b/themes/bgrt/throbber-0013.png Binary files differnew file mode 100644 index 00000000..ace87648 --- /dev/null +++ b/themes/bgrt/throbber-0013.png diff --git a/themes/bgrt/throbber-0014.png b/themes/bgrt/throbber-0014.png Binary files differnew file mode 100644 index 00000000..6c43a9d5 --- /dev/null +++ b/themes/bgrt/throbber-0014.png diff --git a/themes/bgrt/throbber-0015.png b/themes/bgrt/throbber-0015.png Binary files differnew file mode 100644 index 00000000..1e87c5d2 --- /dev/null +++ b/themes/bgrt/throbber-0015.png diff --git a/themes/bgrt/throbber-0016.png b/themes/bgrt/throbber-0016.png Binary files differnew file mode 100644 index 00000000..fac163b6 --- /dev/null +++ b/themes/bgrt/throbber-0016.png diff --git a/themes/bgrt/throbber-0017.png b/themes/bgrt/throbber-0017.png Binary files differnew file mode 100644 index 00000000..ce792def --- /dev/null +++ b/themes/bgrt/throbber-0017.png diff --git a/themes/bgrt/throbber-0018.png b/themes/bgrt/throbber-0018.png Binary files differnew file mode 100644 index 00000000..6423b951 --- /dev/null +++ b/themes/bgrt/throbber-0018.png diff --git a/themes/bgrt/throbber-0019.png b/themes/bgrt/throbber-0019.png Binary files differnew file mode 100644 index 00000000..45e93592 --- /dev/null +++ b/themes/bgrt/throbber-0019.png diff --git a/themes/bgrt/throbber-0020.png b/themes/bgrt/throbber-0020.png Binary files differnew file mode 100644 index 00000000..b84b04dd --- /dev/null +++ b/themes/bgrt/throbber-0020.png diff --git a/themes/bgrt/throbber-0021.png b/themes/bgrt/throbber-0021.png Binary files differnew file mode 100644 index 00000000..a64932df --- /dev/null +++ b/themes/bgrt/throbber-0021.png diff --git a/themes/bgrt/throbber-0022.png b/themes/bgrt/throbber-0022.png Binary files differnew file mode 100644 index 00000000..4b57e234 --- /dev/null +++ b/themes/bgrt/throbber-0022.png diff --git a/themes/bgrt/throbber-0023.png b/themes/bgrt/throbber-0023.png Binary files differnew file mode 100644 index 00000000..b3dbeef0 --- /dev/null +++ b/themes/bgrt/throbber-0023.png diff --git a/themes/bgrt/throbber-0024.png b/themes/bgrt/throbber-0024.png Binary files differnew file mode 100644 index 00000000..196e987d --- /dev/null +++ b/themes/bgrt/throbber-0024.png diff --git a/themes/bgrt/throbber-0025.png b/themes/bgrt/throbber-0025.png Binary files differnew file mode 100644 index 00000000..3905e00e --- /dev/null +++ b/themes/bgrt/throbber-0025.png diff --git a/themes/bgrt/throbber-0026.png b/themes/bgrt/throbber-0026.png Binary files differnew file mode 100644 index 00000000..4c02eb16 --- /dev/null +++ b/themes/bgrt/throbber-0026.png diff --git a/themes/bgrt/throbber-0027.png b/themes/bgrt/throbber-0027.png Binary files differnew file mode 100644 index 00000000..9ab5b001 --- /dev/null +++ b/themes/bgrt/throbber-0027.png diff --git a/themes/bgrt/throbber-0028.png b/themes/bgrt/throbber-0028.png Binary files differnew file mode 100644 index 00000000..fa8584b3 --- /dev/null +++ b/themes/bgrt/throbber-0028.png diff --git a/themes/bgrt/throbber-0029.png b/themes/bgrt/throbber-0029.png Binary files differnew file mode 100644 index 00000000..d9931e1e --- /dev/null +++ b/themes/bgrt/throbber-0029.png diff --git a/themes/bgrt/throbber-0030.png b/themes/bgrt/throbber-0030.png Binary files differnew file mode 100644 index 00000000..fc1683f8 --- /dev/null +++ b/themes/bgrt/throbber-0030.png |