Commit graph

144 commits

Author SHA1 Message Date
Olivier Goffart
11208758f0 core: Refactor the partial renderer in its own module 2025-10-08 21:08:37 +02:00
autofix-ci[bot]
37964e0aad [autofix.ci] apply automated fixes 2025-09-07 08:14:08 +02:00
minicx
2b682cc125 LinuxKMS: Collect formats from all CRTC-compatible planes
Instead of returning formats from only the first associated plane,
collect all unique formats from planes.

Signed-off-by: minicx <minicx@disroot.org>
2025-09-07 08:14:08 +02:00
minicx
fad0c84900 LinuxKMS: Enable universal planes capability before enumerating formats
Set DRM_CLIENT_CAP_UNIVERSAL_PLANES before calling plane_handles() to
ensure all planes (primary, overlay, cursor) are visible for format
detection. This fixes cases where plane enumeration returns empty
results due to missing client capabilities.

Signed-off-by: minicx <minicx@disroot.org>
2025-09-07 08:14:08 +02:00
minicx
c2819b451b LinuxKMS: Add XRGB8888 fallback when no DRM plane formats found
Instead of failing when no plane formats are detected, fall back to
XRGB8888 which is widely supported. This prevents crashes on systems
where plane enumeration fails while still allowing the display to
function with a common pixel format.

Signed-off-by: minicx <minicx@disroot.org>
2025-09-07 08:14:08 +02:00
Simon Hausmann
42c683ce28 LinuxKMS: Fix build with just renderer-femtovg
Fixes #9321
2025-09-04 08:56:28 +00:00
Simon Hausmann
547d58784d LinuxKMS: Fix feature and method name for libinput event hook
cc #8958
2025-08-25 14:59:39 +02:00
Simon Hausmann
4b2bb92c2a LinuxKMS: Restore support for rendering to AR24 framebuffers
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 (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 / python_test (windows-2022) (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 (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 / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
We used to just map 32-bpp to XRGB before commit 6f3cd8763b and that was also fine. We don't really support transparency right now, but we should keep rendering.

Fixes #9126
2025-08-13 07:13:49 +02:00
Simon Hausmann
0cfe06b810 LinuxKMS: Add support for libinput event hooks
Hidden behind the unstable-input-09 feature, the BackendSelector now exposes with_input_090_event_hook, which takes a callback that's invoked for every event received from libinput.
2025-08-06 08:54:01 +02:00
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
12b1bb502b LinuxKMS: Remove incorrect mapping of DRM Abgr8888 format to Skia RGBA8888
Removed the mapping of drm::buffer::DrmFourcc::Abgr8888 to skia_safe::ColorType::RGBA8888 to prevent incorrect color channel swapping (red/blue) in output. Now unsupported formats correctly produce an error.

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
autofix-ci[bot]
165563ff07 [autofix.ci] apply automated fixes 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
168c38899a LinuxKMS: Add support for overriding the default framebuffer interface selection
Fixes #7749
2025-07-11 08:30:44 +02:00
Simon Hausmann
cacaa2bfea LinuxKMS: Bump nix dependency
Some checks are pending
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 / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.82) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.82) (push) Blocked by required conditions
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 / 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.82) (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
2025-06-07 14:13:16 +02:00
Olivier Goffart
c0cac46009 Add --generate-link-to-definition in the docs of all our published crate
This is a nice nightly rustdoc feature and we should make use of it
2025-06-06 21:47:36 +02:00
Simon Hausmann
d7ae61ec3a CI: Fix build
Bump vulkano dependency also in the linuxkms backend
2025-06-04 07:24:16 +00:00
Simon Hausmann
bd0a486da8 Clean up cfgs for Apple operating systems
Replace ios specific cfgs with "apple but not macOS", dubbed
ios_and_friends, so that we also cover iPadOS, etc.. What those have in
common is that they don't have user-resizable windows. (We might want to
add visionOs in the future)

Also, simplify a few macos or ios cfgs with just target_vendor =
"apple", for what applies to all the operating systems.
2025-05-09 20:54:47 +02:00
Simon Hausmann
302926edfa
Skia: Improve multi-window rendering resource consumption (#8304)
Share Vulkan instance as well as Metal device and command queue across windows.
2025-04-29 18:58:09 +02:00
Simon Hausmann
98dc4a8657 FemtoVG: Abstract the rest of the FemtoVGRenderer type to be independent from OpenGL
The main visible external change is that FemtoVGRenderer is now a generic type, but in the public Slint API the type alias that uses the OpenGL backend is re-exported under the old name. This looks a little different in rustdoc
but appears to be source compatible.
2025-04-25 10:08:38 +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
Olivier Goffart
78a3757b7f
Remormat all the toml file again to fix npm upload
Commit cd6f2e2 reformated the .toml, but the 80 char width column is
judged too small to be practical

Add a .taplo.toml file

Also do not split feature array
2025-04-09 15:06:00 +02:00
Tobias Hunger
cd6f2e2cf2 ci: Format toml files
... using taplo with default settings

I tried this with 4 spaces indentation, but the patch is almost as
big as this one, so I went with default settings instead as that
is just easier:-)
2025-04-02 11:03:41 +02:00
Simon Hausmann
9195f3e265 Fix build with renderer-skia-vulkan
We always offer the Skia software renderer fallback in
`new_try_vulkan_then_opengl_then_software`, so make sure that the drm
and mmemap dependencies are activated, needed to compile swdisplay.rs.
2025-02-11 09:15:38 +00:00
Simon Hausmann
c0948f83e5 Fix panic when using the scroll wheel with linuxkms
Don't use todo!().
2025-01-30 12:56:05 +01:00
Simon Hausmann
7816078593 linuxkms: Fix build
Ooops
2025-01-17 10:54:00 +00:00
Simon Hausmann
d17025dd3c linuxms: When we fail to open a DRM device, include the path in the error message 2025-01-17 10:51:39 +00:00
Simon Hausmann
67cd3d7aad linuxkms: Bump gbm dependency 2025-01-14 13:55:53 +01:00
Tasuku Suzuki
346d1c2df3 Fix typos
Ran `typos .` and fixed all typos that do make sense.
https://crates.io/crates/typos
2025-01-13 08:35:20 +01:00
Olivier Goffart
cfbcf0b1d7
Introduce Window::try_dispatch_event (#7313)
That is the same as Window::dispatch_event, but it reports an error
instead of panicking
2025-01-09 19:39:38 +01: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
82c72d4d26 LinuxKMS: Enable triple-buffering when rendering with gbm
cc #6951
2025-01-08 21:46:25 +01:00
Simon Hausmann
3f8084cdc0 When using Skia with softbuffer and partial rendering, report damages to softbuffer
Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-19 21:31:04 +01:00
Simon Hausmann
9b7de3f806 Pass the buffer age to the Skia software renderer 2024-11-19 21:31:04 +01:00
Ian Hattendorf
ac9b85049a Add PlatformBuilder API to allow selecting OpenGL API
Right now this just allows selecting between OpenGL and OpenGL ES.
2024-10-23 11:13:49 +02:00
Simon Hausmann
bd99648021 LinuxKMS: Fix rendering with Mali drivers that use linear drm modifiers
Passing empty for FbCmd2Flags triggers a failing assertion that requires MODIFIERS to be set if the buffer in question has a modifier.
2024-10-07 17:17:30 +02:00
Simon Hausmann
95ee117897 Remove outdated comment
Amends commit 44f1602fd6
2024-10-07 16:14:11 +02:00
crai0
3f3ac7e347
common: add support for back and forward pointing-device buttons (#6149)
Closes #6043

ChangeLog: add support for back and forward pointing-device buttons
2024-09-18 07:48:30 +02:00
Simon Hausmann
5bfdfaf6c3 linuxkms: bump more dependencies 2024-09-13 17:30:19 +02:00