Implement support for Linux framebuffers that have line padding by properly
handling the line_length field from fb_fix_screeninfo. This allows the backend
to work with displays that use non-linear memory organization where each row
has padding bytes at the end.
Signed-off-by: minicx <minicx@disroot.org>
Previously the code only explicitly supported XRGB8888 and RGB565 formats,
but the format is already negotiated through negotiate_format() which ensures
compatibility between renderer and fbdev capabilities. The callback should
work with any successfully negotiated format.
Signed-off-by: minicx <minicx@disroot.org>
- Added support for a wide range of 32-bit, 30-bit, 24-bit, 16-bit, and 8-bit RGB formats.
- Included detection for packed and planar YUV and NV formats.
Signed-off-by: minicx <minicx@disroot.org>
- Implemented dynamic detection of supported framebuffer formats using a new `DrmOutput::get_supported_formats()` method, which queries DRM planes for their format capabilities instead of relying on a hardcoded list.
- Updated the DumbBuffer allocation logic to require explicit format, depth, and bpp, and moved the depth/bpp lookup to a reusable `pixel_format_params` helper function.
- Removed obsolete format-guessing allocation routine and streamlined buffer creation logic.
Signed-off-by: minicx <minicx@disroot.org>
Correct the logic for detecting 32-bit framebuffer pixel formats by properly
matching RGB bit field offsets to DRM fourcc codes. The previous implementation
incorrectly mapped BGRX layouts to BGRA/RGBA formats and didn't properly check
alpha channel positioning.
Signed-off-by: minicx <minicx@disroot.org>
Replace the stateful FormatNegotiation struct with a simple negotiate_format()
function that takes renderer and display format slices as parameters. This
eliminates mutable state, unnecessary vector copying, and makes the negotiation
logic more testable and efficient.
Signed-off-by: minicx <minicx@disroot.org>
Introduces initial support for surface format negotiation between the Linux KMS display backends (dumbbuffer, linuxfb) and the software renderers (Skia and Software). The negotiation logic prioritizes selecting a pixel format that is supported by both the renderer and the framebuffer, based on lists of supported DrmFourcc formats.
Signed-off-by: minicx <minicx@disroot.org>
The aarch32 build produced errors like these:
135 | if unsafe { nix::libc::ioctl(ctl_fd, VT_GETSTATE, &mut state) } < 0 {
| ---------------- ^^^^^^^^^^^ expected `u32`, found `u64`
| |
| arguments to this function are incorrect
Use the nix macros to declare wrapper functions for the ioctls used, to mask that away.
With the drm output now waiting for the page flip on render *and* gbm and dumb buffer displays supporting triple buffering,
we don't need the entire async page flip handling logic anymore.
In the future we could turn wait_for_page_flip() into an async fn.
This assumes the same xrgb888 interface that the drm dumb buffer uses, too. Missing, beyond different pixel depths is:
- mode setting (requires fbset on the command line right now)
- vsync (not sure if possible)
- line padding