[RFC PATCH 4/6] dt-bindings: display: allow the boot logo in a reserved memory region
Max Pedraza <[email protected]> Fri, 31 Jul 2026 23:50:41 +0200
| Newsgroups | org.kernel.vger.linux-fbdev,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Carrying the image in the device tree ties it to the device tree, but the image and where it goes on screen are independent axes of variation. One board sold to several customers wants several device trees that differ in the logo; one customer with several products built on that board wants the same logo placed differently on each panel. The second case would otherwise mean duplicating the same image into every device tree. Let the node point at a reserved memory region filled in by the bootloader instead, so one image can be shared by device trees that differ only in placement. The region starts with a small header carrying a magic number and the geometry, so the kernel can tell a logo from an empty or stale region and bounds check everything against the reservation. A phandle to a declared region is used rather than a bare address: the reservation is what makes the memory safe to read and what gives the kernel a size to validate against. The two ways of supplying the image are mutually exclusive. Signed-off-by: Max Pedraza <[email protected]> --- .../display/linux,boot-logo-clut224.yaml | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/display/linux,boot-logo-clut224.yaml b/Documentation/devicetree/bindings/display/linux,boot-logo-clut224.yaml index 10845378d..c40683f3a 100644 --- a/Documentation/devicetree/bindings/display/linux,boot-logo-clut224.yaml +++ b/Documentation/devicetree/bindings/display/linux,boot-logo-clut224.yaml @@ -54,6 +54,23 @@ properties: index into the colour lookup table. The property length must be equal to width multiplied by height. + memory-region: + maxItems: 1 + description: | + Reserved memory region holding the logo, as an alternative to carrying + it in the width, height, clut and data properties. The bootloader is + expected to have placed the image there before starting the kernel. + + This lets one image be shared by several device trees that differ only + in where the logo goes, which is what a family of products built on the + same board but with different panels needs. + + The region starts with a header of four little endian 32 bit words: + the magic number 0x4f474f4c ("LOGO"), the width, the height and the + number of palette entries. The palette follows, as consecutive red, + green and blue bytes per entry, and then one byte per pixel, each an + index into that palette. + logo-position: $ref: /schemas/types.yaml#/definitions/uint32-array description: @@ -85,10 +102,17 @@ properties: required: - compatible - - width - - height - - clut - - data + +# The image either lives in the device tree or in a reserved memory region, +# never both. +oneOf: + - required: + - width + - height + - clut + - data + - required: + - memory-region additionalProperties: false @@ -106,3 +130,23 @@ examples: 0x02 0x00 0x00 0x02>; logo-centered; }; + - | + // The same logo taken from a region the bootloader filled in, centred on + // a panel whose usable area is not the centre of the mode. + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + logo_mem: logo@9c000000 { + reg = <0x9c000000 0x100000>; + no-map; + }; + }; + + logo { + compatible = "linux,boot-logo-clut224"; + memory-region = <&logo_mem>; + logo-centered; + logo-offset = <0 120>; + }; -- 2.39.5