Commit graph

19 commits

Author SHA1 Message Date
minicx
972fb8596b
LinuxKMS: Support framebuffers with padded lines (#9000)
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>
2025-07-28 15:41:51 +02:00
autofix-ci[bot]
c50f7ba73b [autofix.ci] apply automated fixes 2025-07-28 10:19:28 +02:00
minicx
43acb069b7 LinuxKMS: Remove hardcoded format restrictions in framebuffer callback
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>
2025-07-28 10:19:28 +02:00
minicx
ce263cc17a LinuxKMS: expand pixel_format_params to support many more DRM pixel formats
- 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>
2025-07-28 10:19:28 +02:00
minicx
4997103a5d LinuxKMS: Dynamically detect DRM framebuffer formats
- 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>
2025-07-28 10:19:28 +02:00
minicx
d974a8a063 LinuxKMS: Fix framebuffer format detection for 32-bit pixel formats
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>
2025-07-28 10:19:28 +02:00
minicx
6bb74c3abe LinuxKMS: Simplify format negotiation with stateless function
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>
2025-07-28 10:19:28 +02:00
minicx
6f3cd8763b LinuxKMS: Implement initial format negotiation for software display and renderer.
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>
2025-07-28 10:19:28 +02:00
Simon Hausmann
58279666b6 LinuxKMS: Fix build on aarch32
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
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.
2025-07-24 15:17:55 +02:00
minicx
f7bbed5af6
LinuxKMS: Set graphics mode on tty to hide cursor and improve 16bpp framebuffer support (#8965)
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
Signed-off-by: minicx <minicx@disroot.org>
2025-07-23 21:10:08 +02:00
Simon Hausmann
0d8ecc6bc6 LinuxKMS: Improve diagnostics when opening the linux framebuffer fails
Collect all the error messages and don't just print the last time. The
first one is most likely the interesting one.
2025-07-11 08:30:44 +02:00
Simon Hausmann
6595aee73c
Replace use of Rc<winit:🪟:Window> with Arc (#8257)
In preparation for wgpu usage, where the wgpu API requires the window
handle to be send, i.e. Arc<dyn HasWindowHandle>.
2025-04-24 13:28:51 +02:00
Simon Hausmann
0774681196 doc: use rust doc comments for DumbBufferDisplay fields 2025-01-09 16:26:24 +01:00
Simon Hausmann
31912fedaf LinusKMS: Clean up and simplify presenter interface
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.
2025-01-08 21:46:25 +01:00
Simon Hausmann
953d8a49fe Implement triple-buffering for the DRM dumb buffer display 2025-01-08 21:46:25 +01:00
Simon Hausmann
877bf786b8 Add support for RGB565 linux framebuffer rendering 2024-07-08 11:55:57 +02:00
Simon Hausmann
6d14f5ca15 Fix unused type warnings in i-slint-backend-linukxms build with default features
When no features are enabled, the TimerBasedAnimationDriver would be unused.
2024-07-01 11:33:46 +02:00
Simon Hausmann
d86ae620b4 Add a very basic and crude implementation for software rendering to the legacy Linux framebuffer interface
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
2024-06-22 09:37:34 +02:00
Simon Hausmann
011a3e8a47 linuxkms: Hide the drm dumb buffer software display implementation behind a trait
... to make room for a linuxfb fallback implementation
2024-06-22 09:37:34 +02:00