Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/next/external/patch/misc/0010-bootsplash.patch
Views: 3959
diff --git a/Documentation/ABI/testing/sysfs-platform-bootsplash b/Documentation/ABI/testing/sysfs-platform-bootsplash1new file mode 1006442index 000000000000..742c7b035ded3--- /dev/null4+++ b/Documentation/ABI/testing/sysfs-platform-bootsplash5@@ -0,0 +1,11 @@6+What: /sys/devices/platform/bootsplash.0/enabled7+Date: Oct 20178+KernelVersion: 4.149+Contact: Max Staudt <[email protected]>10+Description:11+ Can be set and read.12+13+ 0: Splash is disabled.14+ 1: Splash is shown whenever fbcon would show a text console15+ (i.e. no graphical application is running), and a splash16+ file is loaded.17diff --git a/Documentation/bootsplash.rst b/Documentation/bootsplash.rst18new file mode 10064419index 000000000000..611f0c55892520--- /dev/null21+++ b/Documentation/bootsplash.rst22@@ -0,0 +1,285 @@23+====================24+The Linux bootsplash25+====================26+27+:Date: November, 201728+:Author: Max Staudt <[email protected]>29+30+31+The Linux bootsplash is a graphical replacement for the '``quiet``' boot32+option, typically showing a logo and a spinner animation as the system starts.33+34+Currently, it is a part of the Framebuffer Console support, and can be found35+as ``CONFIG_BOOTSPLASH`` in the kernel configuration. This means that as long36+as it is enabled, it hijacks fbcon's output and draws a splash screen instead.37+38+Purely compiling in the bootsplash will not render it functional - to actually39+render a splash, you will also need a splash theme file. See the example40+utility and script in ``tools/bootsplash`` for a live demo.41+42+43+44+Motivation45+==========46+47+- The '``quiet``' boot option only suppresses most messages during boot, but48+ errors are still shown.49+50+- A user space implementation can only show a logo once user space has been51+ initialized far enough to allow this. A kernel splash can display a splash52+ immediately as soon as fbcon can be displayed.53+54+- Implementing a splash screen in user space (e.g. Plymouth) is problematic55+ due to resource conflicts.56+57+ For example, if Plymouth is keeping ``/dev/fb0`` (provided via vesafb/efifb)58+ open, then most DRM drivers can't replace it because the address space is59+ still busy - thus leading to a VRAM reservation error.60+61+ See: https://bugzilla.opensuse.org/show_bug.cgi?id=98075062+63+64+65+Command line arguments66+======================67+68+``bootsplash.bootfile``69+ Which file in the initramfs to load.70+71+ The splash theme is loaded via request_firmware(), thus to load72+ ``/lib/firmware/bootsplash/mytheme`` pass the command line:73+74+ ``bootsplash.bootfile=bootsplash/mytheme``75+76+ Note: The splash file *has to be* in the initramfs, as it needs to be77+ available when the splash is initialized early on.78+79+ Default: none, i.e. a non-functional splash, falling back to showing text.80+81+82+83+sysfs run-time configuration84+============================85+86+``/sys/devices/platform/bootsplash.0/enabled``87+ Enable/disable the bootsplash.88+ The system boots with this set to 1, but will not show a splash unless89+ a splash theme file is also loaded.90+91+92+93+Kconfig94+=======95+96+``BOOTSPLASH``97+ Whether to compile in bootsplash support98+ (depends on fbcon compiled in, i.e. ``FRAMEBUFFER_CONSOLE=y``)99+100+101+102+Bootsplash file format103+======================104+105+A file specified in the kernel configuration as ``CONFIG_BOOTSPLASH_FILE``106+or specified on the command line as ``bootsplash.bootfile`` will be loaded107+and displayed as soon as fbcon is initialized.108+109+110+Main blocks111+-----------112+113+There are 3 main blocks in each file:114+115+ - one File header116+ - n Picture headers117+ - m (Blob header + payload) blocks118+119+120+Structures121+----------122+123+The on-disk structures are defined in124+``drivers/video/fbdev/core/bootsplash_file.h`` and represent these blocks:125+126+ - ``struct splash_file_header``127+128+ Represents the file header, with splash-wide information including:129+130+ - The magic string "``Linux bootsplash``" on big-endian platforms131+ (the reverse on little endian)132+ - The file format version (for incompatible updates, hopefully never)133+ - The background color134+ - Number of picture and blob blocks135+ - Animation speed (we only allow one delay for all animations)136+137+ The file header is followed by the first picture header.138+139+140+ - ``struct splash_picture_header``141+142+ Represents an object (picture) drawn on screen, including its immutable143+ properties:144+ - Width, height145+ - Positioning relative to screen corners or in the center146+ - Animation, if any147+ - Animation type148+ - Number of blobs149+150+ The picture header is followed by another picture header, up until n151+ picture headers (as defined in the file header) have been read. Then,152+ the (blob header, payload) pairs follow.153+154+155+ - ``struct splash_blob_header``156+ (followed by payload)157+158+ Represents one raw data stream. So far, only picture data is defined.159+160+ The blob header is followed by a payload, then padding to n*16 bytes,161+ then (if further blobs are defined in the file header) a further blob162+ header.163+164+165+Alignment166+---------167+168+The bootsplash file is designed to be loaded into memory as-is.169+170+All structures are a multiple of 16 bytes long, all elements therein are171+aligned to multiples of their length, and the payloads are always padded172+up to multiples of 16 bytes. This is to allow aligned accesses in all173+cases while still simply mapping the structures over an in-memory copy of174+the bootsplash file.175+176+177+Further information178+-------------------179+180+Please see ``drivers/video/fbdev/core/bootsplash_file.h`` for further181+details and possible values in the file.182+183+184+185+Hooks - how the bootsplash is integrated186+========================================187+188+``drivers/video/fbdev/core/fbcon.c``189+ ``fbcon_init()`` calls ``bootsplash_init()``, which loads the default190+ bootsplash file or the one specified on the kernel command line.191+192+ ``fbcon_switch()`` draws the bootsplash when it's active, and is also193+ one of the callers of ``set_blitting_type()``.194+195+ ``set_blitting_type()`` calls ``fbcon_set_dummyops()`` when the196+ bootsplash is active, overriding the text rendering functions.197+198+ ``fbcon_cursor()`` will call ``bootsplash_disable()`` when an oops is199+ being printed in order to make a kernel panic visible.200+201+``drivers/video/fbdev/core/dummyblit.c``202+ This contains the dummy text rendering functions used to suppress text203+ output while the bootsplash is shown.204+205+``drivers/tty/vt/keyboard.c``206+ ``kbd_keycode()`` can call ``bootsplash_disable()`` when the user207+ presses ESC or F1-F12 (changing VT). This is to provide a built-in way208+ of disabling the splash manually at any time.209+210+211+212+FAQ: Frequently Asked Questions213+===============================214+215+I want to see the log! How do I show the log?216+---------------------------------------------217+218+Press ESC while the splash is shown, or remove the ``bootsplash.bootfile``219+parameter from the kernel cmdline. Without that parameter, the bootsplash220+will boot disabled.221+222+223+Why use FB instead of modern DRM/KMS?224+-------------------------------------225+226+This is a semantic problem:227+ - What memory to draw the splash to?228+ - And what mode will the screen be set to?229+230+Using the fbdev emulation solves these issues.231+232+Let's start from a bare KMS system, without fbcon, and without fbdev233+emulation. In this case, as long as userspace doesn't open the KMS234+device, the state of the screen is undefined. No framebuffer is235+allocated in video RAM, and no particular mode is set.236+237+In this case, we'd have to allocate a framebuffer to show the splash,238+and set our mode ourselves. This either wastes a screenful of video RAM239+if the splash is to co-exist with the userspace program's own allocated240+framebuffer, or there is a flicker as we deactivate and delete the241+bootsplash's framebuffer and hand control over to userspace. Since we242+may set a different mode than userspace, we'd also have flicker due243+to mode switching.244+245+This logic is already contained in every KMS driver that performs fbdev246+emulation. So we might as well use that. And the correct API to do so is247+fbdev. Plus, we get compatibility with old, pure fbdev drivers for free.248+With the fbdev emulation, there is *always* a well-defined framebuffer249+to draw on. And the selection of mode has already been done by the250+graphics driver, so we don't need to reinvent that wheel, either.251+Finally, if userspace decides to use /dev/fbX, we don't have to worry252+about wasting video RAM, either.253+254+255+Why is the bootsplash integrated in fbcon?256+------------------------------------------257+258+Right now, the bootsplash is drawn from within fbcon, as this allows us259+to easily know *when* to draw - i.e. when we're safe from fbcon and260+userspace drawing all over our beautiful splash logo.261+262+Separating them is not easy - see the to-do list below.263+264+265+266+TO DO list for future development267+=================================268+269+Second enable/disable switch for the system270+-------------------------------------------271+272+It may be helpful to differentiate between the system and the user273+switching off the bootsplash. Thus, the system may make it disappear and274+reappear e.g. for a password prompt, yet once the user has pressed ESC,275+it could stay gone.276+277+278+Fix buggy DRM/KMS drivers279+-------------------------280+281+Currently, the splash code manually checks for fbdev emulation provided by282+the ast, cirrus, and mgag200 DRM/KMS drivers.283+These drivers use a manual mechanism similar to deferred I/O for their FB284+emulation, and thus need to be manually flushed onto the screen in the same285+way.286+287+This may be improved upon in several ways:288+289+1. Changing these drivers to expose the fbdev BO's memory directly, like290+ bochsdrmfb does.291+2. Creating a new fb_ops->fb_flush() API to allow the kernel to flush the292+ framebuffer once the bootsplash has been drawn into it.293+294+295+Separating from fbcon296+---------------------297+298+Separating these two components would yield independence from fbcon being299+compiled into the kernel, and thus lowering code size in embedded300+applications.301+302+To do this cleanly will involve a clean separation of users of an FB device303+within the kernel, i.e. fbcon, bootsplash, and userspace. Right now, the304+legacy fbcon code and VT code co-operate to switch between fbcon and305+userspace (by setting the VT into KD_GRAPHICS mode). Installing a muxer306+between these components ensues refactoring of old code and checking for307+correct locking.308diff --git a/MAINTAINERS b/MAINTAINERS309index 5c237445761e..7ffac272434e 100644310--- a/MAINTAINERS311+++ b/MAINTAINERS312@@ -2709,6 +2709,8 @@ BOOTSPLASH313M: Max Staudt <[email protected]>314L: [email protected]315S: Maintained316+F: Documentation/ABI/testing/sysfs-platform-bootsplash317+F: Documentation/bootsplash.rst318F: drivers/video/fbdev/core/bootsplash*.*319F: drivers/video/fbdev/core/dummycon.c320F: include/linux/bootsplash.h321322323