Add monochrome framebuffer support to simple-framebuffer
Subsystems (5)
cover Add monochrome framebuffer support to simple-framebuffer
This patch series adds support for monochrome framebuffers (1 bpp, packed-pixel) to simple-framebuffer.
Monochrome framebuffers require far less video memory and bandwidth than 16bpp or 32bpp framebuffers, making them useful for small devices or FPGA implementations.
Sebastian Raase (2):
fbdev: simplefb: Add mono framebuffer format
dt-bindings: display: simple-framebuffer: Document mono format
.../devicetree/bindings/display/simple-framebuffer.yaml | 2 ++ drivers/video/fbdev/simplefb.c | 2 ++ include/linux/platform_data/simplefb.h | 1 + 3 files changed, 5 insertions(+)
Signature · 1 line
2.47.3
PATCH 1/2 fbdev: simplefb: Add mono framebuffer format
Add a new simple-framebuffer format for monochrome 1 bit-per-pixel framebuffers. Monochrome framebuffers are not true color, so their visual is set to FB_VISUAL_MONO10 (set pixels are bright).
--- drivers/video/fbdev/simplefb.c | 2 ++ include/linux/platform_data/simplefb.h | 1 + 2 files changed, 3 insertions(+)
drivers/video/fbdev/simplefb.c +2 -0
@@ -583,6 +583,8 @@ static int simplefb_probe(struct platform_device *pdev) info->fix.smem_start = mem->start; info->fix.smem_len =resource_size (mem); info->fix.line_length = params.stride; +if (params.format->bits_per_pixel ==1 ) + info->fix.visual =FB_VISUAL_MONO10 ; info->var = simplefb_var; info->var.xres = params.width;
include/linux/platform_data/simplefb.h +1 -0
@@ -15,6 +15,7 @@/* format array, use it to initialize a "struct simplefb_format" array */ #define SIMPLEFB_FORMATS \ { \ + { "mono", 1, {0, 1}, {0, 1}, {0, 1}, {0, 0}, DRM_FORMAT_R1 }, \ { "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 }, \
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH 1/2] fbdev: simplefb: Add mono framebuffer format
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] fbdev: simplefb: adding DRM_FORMAT_R1 to SIMPLEFB_FORMATS breaks simpledrm - [Medium] fbdev…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] fbdev: simplefb: adding DRM_FORMAT_R1 to SIMPLEFB_FORMATS breaks simpledrm
- [Medium] fbdev: simplefb: mono bit order in cfb helpers mismatches DRM_FORMAT_R1 --
commit 89b64a8b00831d236b9621c5f7f6d3729ed70512
Author: Sebastian Raase <[email protected]>
fbdev: simplefb: Add mono framebuffer format
This commit adds a 1 bit-per-pixel monochrome ("mono") format entry mapped to DRM_FORMAT_R1 in SIMPLEFB_FORMATS and configures simplefb to use the FB_VISUAL_MONO10 visual when probing 1-bpp framebuffers.
drivers/video/fbdev/simplefb.c static int simplefb_probe(struct platform_device *pdev) · line 587
Quoted 10 lines
drivers/video/fbdev/simplefb.c +2
-0@@ -583,6 +583,8 @@ static int simplefb_probe(struct platform_device *pdev) info->fix.smem_start = mem->start; info->fix.smem_len =resource_size (mem); info->fix.line_length = params.stride; +if (params.format->bits_per_pixel ==1 ) + info->fix.visual =FB_VISUAL_MONO10 ;
[Severity: Medium]
Does the bit ordering used by the cfb drawing helpers match DRM_FORMAT_R1 on little-endian systems?
In include/uapi/drm/drm_fourcc.h, DRM_FORMAT_R1 is defined with MSB-first pixel ordering ([7:0] R0:R1:R2:R3:R4:R5:R6:R7, where the leftmost pixel R0 is in bit 7).
However, in drivers/video/fbdev/core/fb_draw.h, fb_reverse_init() and the cfb drawing helpers (cfb_imageblit(), cfb_fillrect(), cfb_copyarea()) place pixel 0 in the LSB on little-endian architectures and in the MSB on big-endian architectures unless CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is enabled and FB_NONSTD_REV_PIX_IN_B is set in info->var.nonstd:
drivers/video/fbdev/core/fb_draw.h:fb_reverse_init() {
struct fb_reverse reverse;
#ifdef __LITTLE_ENDIAN
reverse.byte = fb_be_math(info) != 0;
#else
reverse.byte = fb_be_math(info) == 0;
#endif
#ifdef FB_REV_PIXELS_IN_BYTE
reverse.pixel = info->var.bits_per_pixel < BITS_PER_BYTE
&& (info->var.nonstd & FB_NONSTD_REV_PIX_IN_B);
#else
reverse.pixel = false;
#endif
return reverse;
}Since simplefb leaves info->var.nonstd at 0 and does not select FB_CFB_REV_PIXELS_IN_BYTE, won't the 8 horizontal pixels within each byte be bit-reversed relative to DRM_FORMAT_R1 (and relative to big-endian simplefb) on little-endian machines?
include/linux/platform_data/simplefb.h line 18
Quoted 12 lines
drivers/video/fbdev/simplefb.c +0
-0info->var = simplefb_var; info->var.xres = params.width;include/linux/platform_data/simplefb.h +1
-0@@ -15,6 +15,7 @@/* format array, use it to initialize a "struct simplefb_format" array */ #define SIMPLEFB_FORMATS \ { \ + { "mono", 1, {0, 1}, {0, 1}, {0, 1}, {0, 0}, DRM_FORMAT_R1 }, \
[Severity: High]
Can adding "mono" with DRM_FORMAT_R1 to SIMPLEFB_FORMATS break display output when simpledrm is enabled?
SIMPLEFB_FORMATS is shared with drivers/gpu/drm/sysfb/simpledrm.c, where simplefb_get_validated_format() matches fmt->name and looks up fmt->fourcc:
drivers/gpu/drm/sysfb/simpledrm.c:simplefb_get_validated_format() {
...
if (!strcmp(format_name, fmt->name)) {
info = drm_format_info(fmt->fourcc);
if (!info)
return ERR_PTR(-EINVAL);
return info;
}
...
}With this entry added, simpledrm binds to "mono" simple-framebuffer devices, acquires the aperture (evicting or blocking simplefb), and registers a primary plane advertising DRM_FORMAT_R1 and emulated DRM_FORMAT_XRGB8888.
When in-kernel clients (such as fbdev emulation via drm_client_setup() -> drm_fbdev_client_setup()) or userspace compositors commit an XRGB8888 framebuffer, drm_sysfb_plane_helper_begin_fb_access() calls drm_sysfb_get_blit_func(DRM_FORMAT_R1, DRM_FORMAT_XRGB8888):
drivers/gpu/drm/sysfb/drm_sysfb_modeset.c:drm_sysfb_get_blit_func() {
if (src_format == dst_format) {
return drm_sysfb_memcpy;
} else if (src_format == DRM_FORMAT_XRGB8888) {
switch (dst_format) {
case DRM_FORMAT_RGB565:
return drm_fb_xrgb8888_to_rgb565;
...
}
}
return NULL;
}Because drm_sysfb_get_blit_func() has no conversion helper for DRM_FORMAT_R1, it returns NULL, triggering a warning and failing every XRGB8888 atomic commit with -EINVAL.
Additionally, if a userspace client commits a native DRM_FORMAT_R1 framebuffer with a non-zero horizontal damage clip offset (clip->x1 > 0), drm_sysfb_memcpy() calls drm_fb_memcpy():
drivers/gpu/drm/drm_format_helper.c:drm_fb_memcpy() {
...
unsigned int bpp_i = drm_format_info_bpp(format, i);
unsigned int cpp_i = DIV_ROUND_UP(bpp_i, 8);
size_t len_i = DIV_ROUND_UP(drm_rect_width(clip) * bpp_i, 8);
src_i += clip_offset(clip, src->pitches[i], cpp_i);
...
}For 1-bpp DRM_FORMAT_R1, cpp_i evaluates to 1 byte per pixel, so clip_offset() advances src_i by clip->x1 bytes instead of bits (8 times the horizontal byte offset) while drm_sysfb_plane_helper_atomic_update() offsets dst using dst_format->cpp[0] == 0. Won't that read past the end of the source buffer on partial horizontal updates?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Helge Deller
maintainerRe: [PATCH 1/2] fbdev: simplefb: Add mono framebuffer format
In reply to Sebastian RaaseQuoted 9 lines · Sebastian Raase
Add a new simple-framebuffer format for monochrome 1 bit-per-pixel framebuffers. Monochrome framebuffers are not true color, so their visual is set to
FB_VISUAL_MONO10(set pixels are bright).Signed-off-by Sebastian Raase <[email protected]>--- drivers/video/fbdev/simplefb.c | 2 ++ include/linux/platform_data/simplefb.h | 1 + 2 files changed, 3 insertions(+)
series applied to fbdev git tree.
Thanks!
Helge
Thomas Zimmermann
maintainerRe: [PATCH 1/2] fbdev: simplefb: Add mono framebuffer format
Hi Helge
Am 11.11.26 um 00:25 schrieb Helge Deller:
Quoted 11 lines · Sebastian Raase
Quoted 9 lines
Add a new simple-framebuffer format for monochrome 1 bit-per-pixel framebuffers. Monochrome framebuffers are not true color, so their visual is set to
FB_VISUAL_MONO10(set pixels are bright).Signed-off-by Sebastian Raase <[email protected]>---
drivers/video/fbdev/simplefb.c | 2 ++
include/linux/platform_data/simplefb.h| 1 +2 files changed, 3 insertions(+)series applied to fbdev git tree.
Isn't that a bit premature? There's no use-case give; except because-we-can. And doesn't it require a review from DT maintainers?
Best regards
Thomas
Quoted 3 lines
Thanks!
Helge
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
Helge Deller
maintainerRe: [PATCH 1/2] fbdev: simplefb: Add mono framebuffer format
Quoted 13 lines · Thomas Zimmermann
Hi Helge
Am 11.11.26 um 00:25 schrieb Helge Deller:
Quoted 10 lines · Sebastian Raase
Quoted 9 lines
Add a new simple-framebuffer format for monochrome 1 bit-per-pixel framebuffers. Monochrome framebuffers are not true color, so their visual is set to
FB_VISUAL_MONO10(set pixels are bright).Signed-off-by Sebastian Raase <[email protected]>---
drivers/video/fbdev/simplefb.c | 2 ++
include/linux/platform_data/simplefb.h| 1 +2 files changed, 3 insertions(+)
Quoted 4 lines
Quoted 1 line
series applied to fbdev git tree.
Isn't that a bit premature? There's no use-case give; except because- we-can. And doesn't it require a review from DT maintainers?
I'm happy to add any Reviews or Acks, or drop it again if there are any objections.
Helge
Thomas Zimmermann
maintainerRe: [PATCH 1/2] fbdev: simplefb: Add mono framebuffer format
Hi
Am 11.11.26 um 18:52 schrieb Helge Deller:
Quoted 14 lines · Thomas Zimmermann
Quoted 13 lines
Hi Helge
Am 11.11.26 um 00:25 schrieb Helge Deller:
Quoted 10 lines · Sebastian Raase
Quoted 9 lines
Add a new simple-framebuffer format for monochrome 1 bit-per-pixel framebuffers. Monochrome framebuffers are not true color, so their visual is set to
FB_VISUAL_MONO10(set pixels are bright).Signed-off-by Sebastian Raase <[email protected]>---
drivers/video/fbdev/simplefb.c | 2 ++
include/linux/platform_data/simplefb.h| 1 +2 files changed, 3 insertions(+)
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
series applied to fbdev git tree.
Isn't that a bit premature? There's no use-case give; except because- we-can. And doesn't it require a review from DT maintainers?
I'm happy to add any Reviews or Acks, or drop it again if there are any objections.
Ok, sure. No general objections from my side.
Best regards
Thomas
Quoted 2 lines
Helge
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
PATCH 2/2 dt-bindings: display: simple-framebuffer: Document mono format
In reply to Sebastian RaaseThis is a 1 bit-per-pixel monochrome format, with 8 pixels/byte.
--- .../devicetree/bindings/display/simple-framebuffer.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/display/simple-framebuffer.yaml +2 -0
@@ -94,6 +94,7 @@ properties: format: description: > Format of the framebuffer: + * `mono` - 1-bit packed pixels, 8 pixels/byte * `a1r5g5b5` - 16-bit pixels, d[15]=a, d[14:10]=r, d[9:5]=g, d[4:0]=b * `a2r10g10b10` - 32-bit pixels, d[31:30]=a, d[29:20]=r, d[19:10]=g, d[9:0]=b * `a8b8g8r8` - 32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r
@@ -106,6 +107,7 @@ properties: * `x8r8g8b8` - 32-bit pixels, d[23:16]=r, d[15:8]=g, d[7:0]=b * `x8b8g8r8` - 32-bit pixels, d[23:16]=b, d[15:8]=g, d[7:0]=r enum: + - mono - a1r5g5b5 - a2r10g10b10 - a8b8g8r8
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH 2/2] dt-bindings: display: simple-framebuffer: Document mono format
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] drm/sysfb: missing DRM_FORMAT_R1 blit and clip support for mono format - [Medium] dt-bindings…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm/sysfb: missing DRM_FORMAT_R1 blit and clip support for mono format
- [Medium] dt-bindings: display: simple-framebuffer: underspecified mono bit order --
commit 20af76c182c22fb42d62d508852f5a56db4c14ee
Author: Sebastian Raase <[email protected]>
dt-bindings: display: simple-framebuffer: Document mono format
This commit documents the mono format in the simple-framebuffer Device Tree binding as a 1-bit packed pixel monochrome format with 8 pixels per byte.
Documentation/devicetree/bindings/display/simple-framebuffer.yaml properties: · line 97
Quoted 9 lines
Documentation/devicetree/bindings/display/simple-framebuffer.yaml +1
-0@@ -94,6 +94,7 @@ properties: format: description: > Format of the framebuffer: + * `mono` - 1-bit packed pixels, 8 pixels/byte
[Severity: Medium]
Should the binding description specify both the pixel polarity and the intra-byte bit ordering for mono, similar to how the other formats define their bit-to-channel mappings?
In include/linux/platform_data/simplefb.h, SIMPLEFB_FORMATS maps mono to DRM_FORMAT_R1:
include/linux/platform_data/simplefb.h:
#define SIMPLEFB_FORMATS \
{ \
{ "mono", 1, {0, 1}, {0, 1}, {0, 1}, {0, 0}, DRM_FORMAT_R1 }, \In include/uapi/drm/drm_fourcc.h, DRM_FORMAT_R1 is defined with the leftmost pixel in bit 7 (MSB) and the rightmost pixel in bit 0 (LSB).
However, in drivers/video/fbdev/simplefb.c, simplefb_probe() sets info->fix.visual = FB_VISUAL_MONO10 and uses FB_DEFAULT_IOMEM_OPS without setting FBINFO_BE_MATH or FB_NONSTD_REV_PIX_IN_B:
drivers/video/fbdev/simplefb.c:simplefb_probe() {
...
if (params.format->bits_per_pixel == 1)
info->fix.visual = FB_VISUAL_MONO10;
else
info->fix.visual = FB_VISUAL_TRUECOLOR;
...
}Because fb_reverse_init() in drivers/video/fbdev/core/fb_draw.h places the leftmost pixel at bit 0 (LSB) on little-endian CPUs and at bit 7 (MSB) on big-endian CPUs unless reversed, does simplefb end up using a CPU-endian dependent pixel bit order that is reversed relative to DRM_FORMAT_R1 on little-endian systems?
Documentation/devicetree/bindings/display/simple-framebuffer.yaml properties: · line 110
Quoted 8 lines
Documentation/devicetree/bindings/display/simple-framebuffer.yaml +1
-0* `a1r5g5b5` - 16-bit pixels, d[15]=a, d[14:10]=r, d[9:5]=g, d[4:0]=b * `a2r10g10b10` - 32-bit pixels, d[31:30]=a, d[29:20]=r, d[19:10]=g, d[9:0]=b * `a8b8g8r8` - 32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r@@ -106,6 +107,7 @@ properties: * `x8r8g8b8` - 32-bit pixels, d[23:16]=r, d[15:8]=g, d[7:0]=b * `x8b8g8r8` - 32-bit pixels, d[23:16]=b, d[15:8]=g, d[7:0]=r enum: + - mono
[Severity: High]
How does simpledrm handle a simple-framebuffer Device Tree node with format = "mono" when CONFIG_DRM_SIMPLEDRM is enabled?
Both simplefb and simpledrm bind to simple-framebuffer nodes and validate the format property against SIMPLEFB_FORMATS:
drivers/gpu/drm/sysfb/simpledrm.c:
simpledrm_probe() ->
simpledrm_device_create() ->
simplefb_get_validated_format()When simplefb_get_validated_format() accepts mono as DRM_FORMAT_R1, simpledrm claims the framebuffer aperture and registers a DRM device whose primary plane advertises DRM_FORMAT_R1 and emulated DRM_FORMAT_XRGB8888 via drm_sysfb_build_fourcc_list().
During drm_client_setup(), drm_fbdev_client_setup() requests color_mode = 1, which maps via drm_mode_legacy_fb_format(1, 1) to DRM_FORMAT_C1 rather than DRM_FORMAT_R1, so __drm_fb_helper_find_sizes() falls back to DRM_FORMAT_XRGB8888.
When the fbdev client or an XRGB8888 userspace compositor commits a framebuffer, drm_sysfb_plane_helper_begin_fb_access() calls drm_sysfb_get_blit_func(DRM_FORMAT_R1, DRM_FORMAT_XRGB8888):
drivers/gpu/drm/sysfb/drm_sysfb_modeset.c:drm_sysfb_get_blit_func() {
if (src_format == dst_format) {
return drm_sysfb_memcpy;
} else if (src_format == DRM_FORMAT_XRGB8888) {
switch (dst_format) {
case DRM_FORMAT_RGB565:
...
}
}
return NULL;
}Since drm_sysfb_get_blit_func() has no case for DRM_FORMAT_R1, won't drm_sysfb_plane_helper_begin_fb_access() warn and fail every XRGB8888 atomic commit with -EINVAL?
Additionally, if a client commits a native DRM_FORMAT_R1 framebuffer with a partial damage clip where x1 > 0, drm_sysfb_plane_helper_atomic_update() calculates the destination offset using drm_fb_clip_offset():
drivers/gpu/drm/sysfb/drm_sysfb_modeset.c:drm_sysfb_plane_helper_atomic_update() {
...
iosys_map_incr(&dst, drm_fb_clip_offset(dst_pitch, dst_format, &dst_clip));
blit_to_crtc(&dst, &dst_pitch, shadow_plane_state->data, fb, &damage,
&shadow_plane_state->fmtcnv_state);
...
}Because dst_format->cpp[0] is 0 for DRM_FORMAT_R1 while drm_fb_memcpy() uses DIV_ROUND_UP(bpp, 8) = 1 byte per pixel for the source clip offset, wouldn't partial damage updates also miscalculate horizontal offsets?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Thomas Zimmermann
maintainerRe: [PATCH 2/2] dt-bindings: display: simple-framebuffer: Document mono format
In reply to Sebastian RaaseHi
Am 04.11.26 um 03:34 schrieb Sebastian Raase:
Quoted 12 lines
This is a 1 bit-per-pixel monochrome format, with 8 pixels/byte.
Signed-off-by Sebastian Raase <[email protected]>--- .../devicetree/bindings/display/simple-framebuffer.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/display/simple-framebuffer.yaml +0
-0
Documentation/devicetree/bindings/display/simple-framebuffer.yaml properties: · line 97
Quoted 4 lines
Documentation/devicetree/bindings/display/simple-framebuffer.yaml +1
-0@@ -94,6 +94,7 @@ properties: format: description: > Format of the framebuffer: + * `mono` - 1-bit packed pixels, 8 pixels/byte
I don't object the change, but I really object the naming.
Mono is not a good name because it doesn't describe the format's pixel layout. For example, RGB with only 2 colors is also mono in some sense.
The common names used in the Linux kernel for this type of color format are C1 and R1. More generally speaking,
- Cn describes an n-bit format with a palette. The pixel bits index into the palette. Pixels are packed.
- Rn describes an n-bit format with a single color channel. The channel has linear color gradient. Pixels are packed.
In your case, you'd define 'r1'. While at it, we can also define r2, r4, and r8. The terminal supports up to 16 colors, so implementing r4 might be of interest to some simple hardware.
Best regards
Thomas
Quoted 11 lines
Documentation/devicetree/bindings/display/simple-framebuffer.yaml +1
-0* `a1r5g5b5` - 16-bit pixels, d[15]=a, d[14:10]=r, d[9:5]=g, d[4:0]=b * `a2r10g10b10` - 32-bit pixels, d[31:30]=a, d[29:20]=r, d[19:10]=g, d[9:0]=b * `a8b8g8r8` - 32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r@@ -106,6 +107,7 @@ properties: * `x8r8g8b8` - 32-bit pixels, d[23:16]=r, d[15:8]=g, d[7:0]=b * `x8b8g8r8` - 32-bit pixels, d[23:16]=b, d[15:8]=g, d[7:0]=r enum: + - mono - a1r5g5b5 - a2r10g10b10 - a8b8g8r8
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
Re: [PATCH 2/2] dt-bindings: display: simple-framebuffer: Document mono format
Hi,
Quoted 10 lines · On Thu, 12 Nov 2026 08:35:59 +0100 Thomas Zimmermann <[email protected]>…
Hi
Am 04.11.26 um 03:34 schrieb Sebastian Raase:
Quoted 7 lines
This is a 1 bit-per-pixel monochrome format, with 8 pixels/byte.
Signed-off-by Sebastian Raase <[email protected]>---
.../devicetree/bindings/display/simple-framebuffer.yaml|
2 ++ 1 file changed, 2 insertions(+)
Quoted 12 lines
Quoted 10 lines
diff --git
a/Documentation/devicetree/bindings/display/simple-framebuffer.yamlb/Documentation/devicetree/bindings/display/simple-framebuffer.yamlindex45ffdebc9d86..c627ec088434100644 ---a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
+++b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml(quoted diff) +0
-0@@ -94,6 +94,7 @@ properties: format: description: > Format of theframebuffer:
+ *mono- 1-bit packed pixels, 8 pixels/byteI don't object the change, but I really object the naming.
I fully agree, but could not think of a better name at the time.
As Sashiko pointed out, "mono" neither describes the endianness nor the polarity.
Quoted 3 lines
Mono is not a good name because it doesn't describe the format's pixel layout. For example, RGB with only 2 colors is also mono in some sense.
A two-color RGB format sounds like a contradiction, although bi-color LEDs are very common.
Quoted 11 lines
The common names used in the Linux kernel for this type of color format are C1 and R1. More generally speaking,
- Cn describes an n-bit format with a palette. The pixel bits index
into the palette. Pixels are packed.
- Rn describes an n-bit format with a single color channel. The
channel has linear color gradient. Pixels are packed.In your case, you'd define 'r1'. While at it, we can also define r2, r4, and r8. The terminal supports up to 16 colors, so implementing r4 might be of interest to some simple hardware.
Sounds like a good idea; I can test those for simplefb (not simpledrm). Do you have a suggestion on endianness and polarity in the name?
Today, we have grayscale/color in mind, so the obvious polarity is 0=dark and 1=bright. But the other approach uses 0=paper (white) and 1=ink (black), which leads to reverse video hardware. It's uncommon, so we can probably ignore this.
Endianness is basically the same difference as RGBA vs. ABGR in 32-bit color formats.
So far, I have only tried stride values which were multiples of 8, to align them with byte boundaries. Any restriction would apply to r1, r2 and r4 formats.
If I send a v2 patch, should that be a follow-up of this email thread, or a completely new thread?
Quoted 18 lines
Best regards
ThomasQuoted 14 lines
*
a1r5g5b5- 16-bit pixels, d[15]=a, d[14:10]=r,
d[9:5]=g, d[4:0]=b
*a2r10g10b10- 32-bit pixels, d[31:30]=a, d[29:20]=r,
d[19:10]=g, d[9:0]=b
*a8b8g8r8- 32-bit pixels, d[31:24]=a, d[23:16]=b,
d[15:8]=g, d[7:0]=r @@ -106,6 +107,7 @@ properties:
*x8r8g8b8- 32-bit pixels, d[23:16]=r, d[15:8]=g,
d[7:0]=b
*x8b8g8r8- 32-bit pixels, d[23:16]=b, d[15:8]=g,
d[7:0]=r enum:
+ - mono
- a1r5g5b5
- a2r10g10b10
- a8b8g8r8
Best Regards,
Sebastian
Thomas Zimmermann
maintainerRe: [PATCH 2/2] dt-bindings: display: simple-framebuffer: Document mono format
Hi
Am 15.11.26 um 20:00 schrieb Sebastian Raase:
Quoted 45 lines
Hi,
Quoted 10 lines · On Thu, 12 Nov 2026 08:35:59 +0100 Thomas Zimmermann <[email protected]>…
Hi
Am 04.11.26 um 03:34 schrieb Sebastian Raase:
Quoted 7 lines
This is a 1 bit-per-pixel monochrome format, with 8 pixels/byte.
Signed-off-by Sebastian Raase <[email protected]>---
.../devicetree/bindings/display/simple-framebuffer.yaml|
2 ++ 1 file changed, 2 insertions(+)Quoted 11 lines
Quoted 10 lines
diff --git
a/Documentation/devicetree/bindings/display/simple-framebuffer.yamlb/Documentation/devicetree/bindings/display/simple-framebuffer.yamlindex45ffdebc9d86..c627ec088434100644 ---a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
+++b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml(quoted diff) +0
-0@@ -94,6 +94,7 @@ properties: format: description: > Format of theframebuffer:
+ *mono- 1-bit packed pixels, 8 pixels/byteI don't object the change, but I really object the naming.
I fully agree, but could not think of a better name at the time.
As Sashiko pointed out, "mono" neither describes the endianness nor the polarity.
Quoted 3 lines
Mono is not a good name because it doesn't describe the format's pixel layout. For example, RGB with only 2 colors is also mono in some sense.
A two-color RGB format sounds like a contradiction, although bi-color LEDs are very common.
Quoted 8 lines
The common names used in the Linux kernel for this type of color format are C1 and R1. More generally speaking,
- Cn describes an n-bit format with a palette. The pixel bits index
into the palette. Pixels are packed.
- Rn describes an n-bit format with a single color channel. The
channel has linear color gradient. Pixels are packed.
Quoted 5 lines
Quoted 3 lines
In your case, you'd define 'r1'. While at it, we can also define r2, r4, and r8. The terminal supports up to 16 colors, so implementing r4 might be of interest to some simple hardware.
Sounds like a good idea; I can test those for simplefb (not simpledrm). Do you have a suggestion on endianness and polarity in the name?
See [1] for what we use in DRM.
- Cn: Index into color LUT
- Rn: Linear gradient, 0 means dark
- Dn: Linear gradient, 0 means full brightness
For what you want to do, 'r1' seams like the right choice, as I outlined before.
[1] https://elixir.bootlin.com/linux/v7.3.1/source/include/uapi/drm/drm_fourcc.h#L95
Quoted 3 lines
Today, we have grayscale/color in mind, so the obvious polarity is 0=dark and 1=bright. But the other approach uses 0=paper (white) and
That's Rn
Quoted 2 lines
1=ink (black), which leads to reverse video hardware. It's uncommon, so we can probably ignore this.
That's Dn. I'm not aware of any hardware that would implement this and use simple-framebuffer. No need to add this for now.
Quoted 3 lines
Endianness is basically the same difference as RGBA vs. ABGR in 32-bit color formats.
Our conversion logic from 8-bit grayscale to 1-bit mono is at [2]. It encodes from LSB to MSB. AFIAK, that's the usual convention.
[2] https://elixir.bootlin.com/linux/v7.3.1/source/drivers/gpu/drm/drm_format_helper.c#L1187
Quoted 4 lines
So far, I have only tried stride values which were multiples of 8, to align them with byte boundaries. Any restriction would apply to r1, r2 and r4 formats.
Stride and display resolution needs to be aligned to byte boundaries. It's usually not a problem in practice.
Quoted 3 lines
If I send a v2 patch, should that be a follow-up of this email thread, or a completely new thread?
A new thread please.
Best regards
Thomas
Quoted 21 lines
Quoted 19 lines
Best regards
ThomasQuoted 14 lines
*
a1r5g5b5- 16-bit pixels, d[15]=a, d[14:10]=r,
d[9:5]=g, d[4:0]=b
*a2r10g10b10- 32-bit pixels, d[31:30]=a, d[29:20]=r,
d[19:10]=g, d[9:0]=b
*a8b8g8r8- 32-bit pixels, d[31:24]=a, d[23:16]=b,
d[15:8]=g, d[7:0]=r @@ -106,6 +107,7 @@ properties:
*x8r8g8b8- 32-bit pixels, d[23:16]=r, d[15:8]=g,
d[7:0]=b
*x8b8g8r8- 32-bit pixels, d[23:16]=b, d[15:8]=g,
d[7:0]=r enum:
+ - mono
- a1r5g5b5
- a2r10g10b10
- a8b8g8r8Best Regards,
Sebastian
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
Hans de Goede
maintainerHi Sebastian,
Quoted 6 lines · Sebastian Raase
This patch series adds support for monochrome framebuffers (1 bpp, packed-pixel) to simple-framebuffer.
Monochrome framebuffers require far less video memory and bandwidth than 16bpp or 32bpp framebuffers, making them useful for small devices or FPGA implementations.
Thank you for your patch-series and I see that Helge has just applied this to the fbdev tree.
Have you considered also extending the simpledrm driver to also support these monochrome formats there ?
Most Linux distributions now a days have switched from using simplefb to using simpledrm.
But I must admit I've no idea how well the drm subsys / kernel-mode- setting API handles monochrome formats.
Regards,
Hans
Thomas Zimmermann
maintainerHi
Am 11.11.26 um 12:15 schrieb Hans de Goede:
Quoted 12 lines
Hi Sebastian,
Quoted 6 lines · Sebastian Raase
This patch series adds support for monochrome framebuffers (1 bpp, packed-pixel) to simple-framebuffer.
Monochrome framebuffers require far less video memory and bandwidth than 16bpp or 32bpp framebuffers, making them useful for small devices or FPGA implementations.
Thank you for your patch-series and I see that Helge has just applied this to the fbdev tree.
Quoted 8 lines
Have you considered also extending the simpledrm driver to also support these monochrome formats there ?
Most Linux distributions now a days have switched from using simplefb to using simpledrm.
But I must admit I've no idea how well the drm subsys / kernel-mode- setting API handles monochrome formats.
Only kind of. We either support it natively if the compositor can handle it, or we convert from XRGB8888 to the internal pixel format. But our helpers for converting pixel formats expect 8-bit per pixel at a minimum. All the drivers with lower pixel size do some kind of workaround. I'd love to see better support, but had no time to work on it.
Best regards
Thomas
Quoted 7 lines
Regards,
Hans
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
Hi Hans,
Quoted 6 lines · On Wed, 11 Nov 2026 12:15:36 +0100 Hans de Goede <[email protected]> wrote:
Hi Sebastian,
Quoted 3 lines · Sebastian Raase
This patch series adds support for monochrome framebuffers (1 bpp, packed-pixel) to simple-framebuffer.
Quoted 6 lines
Quoted 3 lines
Monochrome framebuffers require far less video memory and bandwidth than 16bpp or 32bpp framebuffers, making them useful for small devices or FPGA implementations.
Thank you for your patch-series and I see that Helge has just applied this to the fbdev tree.
This may need a revision because of the DT bindings discussion. I agree with Thomas that 'mono' was not a particularly good choice of name.
Quoted 2 lines
Have you considered also extending the simpledrm driver to also support these monochrome formats there ?
I have, but my target environment does not support simpledrm (DRM doesn't work with CONFIG_NOMMU), so I could not test it.
It's a very basic Busybox-based system, not a full distribution.
Quoted 9 lines
Most Linux distributions now a days have switched from using simplefb to using simpledrm.
But I must admit I've no idea how well the drm subsys / kernel-mode- setting API handles monochrome formats.
Regards,
Hans
Best Regards,
Sebastian