video: simplefb: add r5g5b5a1 and x8b8g8r8 formats to SIMPLEFB_FORMATS
Subsystems (4)
PATCH 1/5 video: simplefb: add r5g5b5a1 and x8b8g8r8 formats to SIMPLEFB_FORMATS
The DT binding (display/simple-framebuffer.yaml) lists 11 pixel formats but SIMPLEFB_FORMATS only covers 9 of them.
Sync with Linux to add the remaining two.
--- include/linux/platform_data/simplefb.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/platform_data/simplefb.h +4 -2
@@ -1,8 +1,8 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* SPDX-FileCopyrightText: 2013 David Herrmann <[email protected]> */ +/* SPDX-Comment: Origin-URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/platform_data/simplefb.h?id=8681e3663411ee6b64dd0714b23f5c86f64f7533 */ /* * simplefb.h - Simple Framebuffer Device -* -* Copyright (C) 2013 David Herrmann <[email protected]> */ #ifndef __PLATFORM_DATA_SIMPLEFB_H__
@@ -16,11 +16,13 @@#define SIMPLEFB_FORMATS \ { \ { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 }, \ + { "r5g5b5a1", 16, {11, 5}, {6, 5}, {1, 5}, {0, 1}, DRM_FORMAT_RGBA5551 }, \ { "x1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {0, 0}, DRM_FORMAT_XRGB1555 }, \ { "a1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {15, 1}, DRM_FORMAT_ARGB1555 }, \ { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \ { "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \ { "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \ + { "x8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {0, 0}, DRM_FORMAT_XBGR8888 }, \ { "a8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8}, DRM_FORMAT_ABGR8888 }, \ { "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \ { "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \
Signature · 1 line
2.47.3
PATCH 2/5 video: simplefb-fixup: use shared SIMPLEFB_FORMATS table
The driver maintained a private 2-entry format table covering only r5g6b5 and a8r8g8b8. The shared SIMPLEFB_FORMATS macro in <linux/platform_data/simplefb.h> covers all formats defined by the DT binding.
Replace the private struct simplefb_mode and simplefb_modes[] with the shared struct simplefb_format and SIMPLEFB_FORMATS and while at it, drop <common.h> in favour of the specific headers actually needed.
--- drivers/video/simplefb-fixup.c | 50 +++++++++------------------------- 1 file changed, 13 insertions(+), 37 deletions(-)
drivers/video/simplefb-fixup.c +13 -37
@@ -8,7 +8,6 @@#define pr_fmt (fmt) "simplefb: " fmt -#include <common.h> #include <errno.h> #include <fb.h> #include <fcntl.h>
@@ -16,38 +15,15 @@#include <of.h> #include <init.h> #include <xfuncs.h> - -struct simplefb_mode { -const char *format; -u32 bpp; -struct fb_bitfield red; -struct fb_bitfield green; -struct fb_bitfield blue; -struct fb_bitfield transp; -}; +#include <linux/io.h> +#include <linux/array_size.h> +#include <linux/platform_data/simplefb.h> /* * These values have to match the kernel's simplefb driver. -* See Documentation/devicetree/bindings/video/simple-framebuffer.txt +* See dts/Bindings/display/simple-framebuffer.yaml */ -static const struct simplefb_mode simplefb_modes[] = { - { - .format ="r5g6b5" , - .bpp =16 , - .red = { .length =5 , .offset =11 }, - .green = { .length =6 , .offset =5 }, - .blue = { .length =5 , .offset =0 }, - .transp = { .length =0 , .offset =0 }, - }, { - .format ="a8r8g8b8" , - .bpp =32 , - .red = { .length =8 , .offset =16 }, - .green = { .length =8 , .offset =8 }, - .blue = { .length =8 , .offset =0 }, - .transp = { .length =8 , .offset =24 }, - }, - -}; +static const struct simplefb_format simplefb_formats[] =SIMPLEFB_FORMATS ;static bool simplefb_bitfield_cmp (const struct fb_bitfield *a,const struct fb_bitfield *b)
@@ -62,15 +38,15 @@ static bool simplefb_bitfield_cmp(const struct fb_bitfield *a,return true; } -static const struct simplefb_mode *simplefb_find_mode (const struct fb_info *fbi) +static const struct simplefb_format *simplefb_find_mode (const struct fb_info *fbi) { -const struct simplefb_mode *mode; +const struct simplefb_format *mode;u32 i; -for (i =0 ; i <ARRAY_SIZE (simplefb_modes); ++i) { - mode = &simplefb_modes[i]; +for (i =0 ; i <ARRAY_SIZE (simplefb_formats); ++i) { + mode = &simplefb_formats[i]; -if (fbi->bits_per_pixel != mode->bpp) +if (fbi->bits_per_pixel != mode->bits_per_pixel)continue ;if (!simplefb_bitfield_cmp (&fbi->red, &mode->red))continue ;
@@ -154,7 +130,7 @@ static int simplefb_create_node(struct device_node *root,static int simplefb_of_fixup (struct device_node *root,void *ctx) {struct fb_info *info = ctx; -const struct simplefb_mode *mode; +const struct simplefb_format *mode;int ret;/* only create node if we are requested to */
@@ -171,11 +147,11 @@ static int simplefb_of_fixup(struct device_node *root, void *ctx)return -EINVAL ; } - ret =simplefb_create_node (root, info, mode->format); + ret =simplefb_create_node (root, info, mode->name);if (ret)dev_err (&info->dev,"failed to create node: %d\n" , ret);else -dev_info (&info->dev,"created %s node\n" , mode->format); +dev_info (&info->dev,"created %s node\n" , mode->name);return ret; }
Signature · 1 line
2.47.3
PATCH 3/5 parameter: allow enum params to be set by numeric index
In reply to Ahmad FatoumWhen no name matches the input string, fall back to parsing it as a decimal index into the names array for backwards compatibility.
This lets scripts and users write e.g. "0" or "1" in addition to the symbolic name, which can be useful if a boolean is turned into an enum to allow for more options.
As the index isn't stable, we emit a warning to point out that this is just to simplify migration.
--- lib/parameter.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
lib/parameter.c +11 -2
@@ -589,8 +589,17 @@ static int param_enum_set(struct bobject *bobj, struct param_d *p,if (pe->names[i] && !strcmp (val, pe->names[i]))break ; -if (i == pe->num_names) -return -EINVAL ; +if (i == pe->num_names) { +char *endp; +unsigned long idx =simple_strtoul (val, &endp,0 ); + +if (*endp || idx >= pe->num_names || !pe->names[idx]) +return -EINVAL ; + +pr_warn ("setting %s.%s by index is not stable, use \"%s\" instead\n" , + bobj->name, p->name, pe->names[idx]); + i = idx; + } *pe->value = i;
Signature · 1 line
2.47.3
PATCH 4/5 video: simplefb-fixup: add stdout-path mode to register_simplefb param
In reply to Ahmad FatoumReplace the boolean register_simplefb parameter with a three-value enum:
disabled - no simplefb DT node (previous value 0)
enabled - create simplefb DT node (previous value 1)
stdout-path - create simplefb DT node and set /chosen/stdout-path
The stdout-path mode tells the OS to use the framebuffer as its boot console.
On OpenBSD arm64, fdt_find_cons("simple-framebuffer") reads /chosen/stdout-path, resolves it to the node, and if compatible matches, passes it to simplefb_init_cons() which calls wsdisplay_cnattach(). Without stdout-path being set, OpenBSD's bootloader efi_console() never writes it because efi_cons (CN_MIDPRI) wins the cninit() probe over efi_fb (CN_LOWPRI), leaving the kernel without a console path.
--- .../migration-guides/migration-master.rst | 11 +++++ drivers/video/simplefb-fixup.c | 46 ++++++++++++++++--- include/fb.h | 4 +- 3 files changed, 52 insertions(+), 9 deletions(-)
Documentation/migration-guides/migration-master.rst +11 -0
@@ -1,5 +1,16 @@ :orphan: +register_simplefb parameter +--------------------------- + +The ``register_simplefb`` parameter on framebuffer devices has changed from +boolean to an enum with values ``disabled``, ``enabled``, and ``stdout-path``. + +Scripts that **read** the parameter will now receive ``"disabled"`` or +``"enabled"`` instead of ``"0"`` or ``"1"``. + +Scripts that **write** ``"0"`` or ``"1"`` continue to work. + CONFIG_CRYPTO_PUBLIC_KEYS -------------------------
drivers/video/simplefb-fixup.c +40 -6
82 lines not on this page · raw message
include/fb.h +1 -3
@@ -186,9 +186,7 @@ struct fb_info {int enabled;int p_enable; -int register_simplefb;/* If true a simplefb device node will -* be created. -*/ +int register_simplefb;/* enum simplefb_mode */ int shadowfb;struct fb_info *base_plane;
Signature · 1 line
2.47.3
PATCH 5/5 Documentation: add OpenBSD booting guide
In reply to Ahmad FatoumCovers the EFI boot flow, the simplefb stdout-path requirement for framebuffer console, and the specific steps needed on systems with no serial port where the framebuffer is the only console available.
--- Documentation/user/booting-openbsd.rst | 72 ++++++++++++++++++++++++++ Documentation/user/user-manual.rst | 1 + 2 files changed, 73 insertions(+) create mode 100644 Documentation/user/booting-openbsd.rst
Documentation/user/booting-openbsd.rst new file +72 -0
@@ -0,0 +1,72 @@ +.. _booting_openbsd: + +Booting OpenBSD +=============== + +barebox can boot OpenBSD on EFI-capable ARM64 systems. It acts as an EFI +loader, exposing EFI protocols (block devices, GOP framebuffer, RNG, …) to +subsequently loaded EFI binaries before handing off to the OS. + +Basic boot +---------- + +When ``CONFIG_EFI_LOADER_BOOTMGR`` is enabled, barebox's default boot order +includes the ``efibootmgr`` target, which scans all storage devices for an +ESP partition and boots ``EFI/BOOT/BOOTAA64.EFI`` from it. If the OpenBSD +installer placed its EFI bootloader on the ESP in the standard location, a +plain ``boot`` invocation should find and start it without any additional +configuration. + +To boot from a specific disk explicitly: + +.. code-block:: sh + + boot virtioblk0 + +or to persist: + +.. code-block:: sh + + #!/bin/sh + nv boot.default=virtioblk0 + +Framebuffer console +------------------- + +OpenBSD's kernel discovers its framebuffer console by reading +``/chosen/stdout-path`` from the device tree. If that property points at a +``simple-framebuffer`` node, the framebuffer is attached as the system console +before the kernel's driver subsystem starts. + +barebox sets this up when the ``register_simplefb`` parameter on the +framebuffer device is set to ``stdout-path``: + +.. code-block:: sh + + fb0.register_simplefb=stdout-path + +The three valid values are: + +``disabled`` + No simplefb DT node is created (default). + +``enabled`` + A simplefb DT node is created but ``stdout-path`` is not set. + +``stdout-path`` + A simplefb DT node is created and ``/chosen/stdout-path`` is pointed at + it, directing the OpenBSD kernel to use the framebuffer as its boot console. + +Systems without a serial console +--------------------------------- + +On laptops and desktops without an accessible serial port, ``stdout-path`` +mode is required, not optional. Without it the kernel has no console after +``ExitBootServices()`` and the screen stays black. + +Enable the framebuffer before booting and persist both settings: + +.. code-block:: sh + + nv dev.fb0.enable=1 + nv dev.fb0.register_simplefb=stdout-path
Documentation/user/user-manual.rst +1 -0
@@ -26,6 +26,7 @@ Contents: usb ubi booting-linux + booting-openbsd devboot bootchooser remote-control
Signature · 1 line
2.47.3
Sascha Hauer
AppliedQuoted 6 lines · Ahmad Fatoum
The DT binding (
display/simple-framebuffer.yaml) lists 11 pixel formats butSIMPLEFB_FORMATSonly covers 9 of them.Sync with Linux to add the remaining two.
Applied, thanks!
[1/5] video: simplefb: add r5g5b5a1 and x8b8g8r8 formats to SIMPLEFB_FORMATS
https://git.pengutronix.de/cgit/barebox/commit/?id=1191c54f4e6a (link may not be stable)
[2/5] video: simplefb-fixup: use shared SIMPLEFB_FORMATS table
https://git.pengutronix.de/cgit/barebox/commit/?id=1500be5d42a1 (link may not be stable)
[3/5] parameter: allow enum params to be set by numeric index
https://git.pengutronix.de/cgit/barebox/commit/?id=cc8374d6f2a6 (link may not be stable)
[4/5] video: simplefb-fixup: add stdout-path mode to register_simplefb param
https://git.pengutronix.de/cgit/barebox/commit/?id=1d5552fcbd7b (link may not be stable)
[5/5] Documentation: add OpenBSD booting guide
https://git.pengutronix.de/cgit/barebox/commit/?id=2ecbcc6e9233 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>
Sascha Hauer
AppliedQuoted 6 lines · Ahmad Fatoum
The DT binding (
display/simple-framebuffer.yaml) lists 11 pixel formats butSIMPLEFB_FORMATSonly covers 9 of them.Sync with Linux to add the remaining two.
Applied, thanks!
[1/5] video: simplefb: add r5g5b5a1 and x8b8g8r8 formats to SIMPLEFB_FORMATS
https://git.pengutronix.de/cgit/barebox/commit/?id=3e01b5a837bf (link may not be stable)
[2/5] video: simplefb-fixup: use shared SIMPLEFB_FORMATS table
https://git.pengutronix.de/cgit/barebox/commit/?id=1330f491c3b5 (link may not be stable)
[3/5] parameter: allow enum params to be set by numeric index
https://git.pengutronix.de/cgit/barebox/commit/?id=317917a16385 (link may not be stable)
[4/5] video: simplefb-fixup: add stdout-path mode to register_simplefb param
https://git.pengutronix.de/cgit/barebox/commit/?id=451becb0e16f (link may not be stable)
[5/5] Documentation: add OpenBSD booting guide
https://git.pengutronix.de/cgit/barebox/commit/?id=60b86d3f45af (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>