Commit graph

48 commits

Author SHA1 Message Date
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
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
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
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
Simon Hausmann
44f1602fd6 Update drm/gbm dependencies
Fixes #3669
2024-09-13 16:10:10 +02:00
Simon Hausmann
9bef3e47f4 Fix GBM rendering on mali EGL drivers
Combining an EGL config with EGL_ALPHA_SIZE == 8 with an Xrgb8888 surface yields a bad match on eglCreateWindowSurface.
That's fair, and we should accomodate for that by avoiding such EGL configs.
2024-07-30 13:04:48 +02: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
Simon Hausmann
760e04a411 Fix build
- Upgrade linuxkms backend to rwh06
- Adapt vulkan_surface to internal Skia surface trait changes made in earlier commit
2024-06-18 17:48:17 +02:00
Simon Hausmann
028903c2d3 LinuxKMS: Add support for partial rendering with the Slint software renderer 2024-06-10 06:01:19 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Simon Hausmann
2b2afaf7d8 Work around gbm display not working on Vivante gbm drivers
gbm.rs' lock_front_buffer calls has_free_buffers before calling the underling C lock_front_buffer function on the gbm surface. This has_free_buffers() check succeeds the first time but always fails after that.

However apart from this check, everything else appears to be working perfectly fine. Projects like weston, ksmcube, Qt, or mutter don't do this check beforehand either, so this patch works around gbm.rs by skipping this.

Unfortunately this requires going to gbm-sys directly and implementing the drm traits that require calling the various gbm_bo_get_* functions to retrieve the buffer details for posting to DRM.
2024-02-29 15:18:14 +01:00
Simon Hausmann
9c247553e1 LinuxKMS: Tweak the output shown after SLINT_{DRM,VULKAN}_{MODE,OUTPUT,DISPLAY}=list to mention the environment variable in question
As suggested by Olivier, this makes it much clearer what the next steps
are.
2024-01-12 17:32:56 +01:00
Simon Hausmann
4d23bcdd97 LinuxKMS: Replace the use of panic with eprintln/std::process::exit
As suggested by Olivier, That's a little cleaner than panicing. There's
no reason to panic, this is normal :-)
2024-01-12 17:32:56 +01:00
Simon Hausmann
a7d1ab89d7 Minor cleanup
Merge two functions that had only one call site.
2024-01-08 09:56:14 +01:00
Simon Hausmann
982b4c806f LinuxKMS: Add initial support for software rendering with Skia
This is the initial implementation based on DRM dumb buffers,
which cleans up various things at the same time:

 - DRM output is separate from GBM and DRM dumb buffer displays.
   The latter two re-use the former.
 - The timer refresh for the Vulkan KHR Display rendering lives
   now with the KHR display code, in hope to be replaced with a
   better mechanism in the future.

What's missing still is support for partial updates as well as
rendering with our own software renderer.
2024-01-07 11:54:29 +01:00
Simon Hausmann
8193d4d064 LinuxKMS: Clean up internal page flip callback API
Remove the hack of calling present() from our swap_buffers() forwarder (and let it really only forward),
and instead call it explicitly through the shared egl_display member.
The way we can pass along the callback instead of storing it separately.
2024-01-04 10:35:40 +01:00
Simon Hausmann
0b21d8bfce linuxkms: Don't use a 16ms timer for the animation frame callback after the first buffer was posted
We don't need to wait 16ms, we could render right away. In theory this could also use invoke_from_event_loop, but then
the callback needs to be sync, which is an unnecessary
complication.
2023-12-19 16:59:35 +01:00
Simon Hausmann
2d0f2a52e6 linuxkms: Simplify drm event handling code a little bit
Less code nesting :)
2023-12-19 16:59:35 +01:00
Simon Hausmann
0ccc334de7 linuxkms: remove home-grown fd event source with calloop's generic even source
That's less boiler plate for us and better error handling (note how the receive_events()
call on the DRM device now propagates the error). And this also unregisters automatically
on drop.
2023-12-19 16:59:35 +01:00
Simon Hausmann
208a1e24ac linuxkms: replace 16m timer for animations with page flip driven rendering (if possible) 2023-12-19 16:59:35 +01:00
Simon Hausmann
4f0ad4c15b linuxkms: remove page flip specific bits from the calloop event loop
This belongs encapsulated inside the egldisplay code.
2023-12-19 16:59:35 +01:00
Simon Hausmann
b998f94ad6 linuxkms: Avoid keeping the EGL display around for too long
Don't keep a strong reference to the EGL display, we don't need that. If the display is removed but there are pending events, just ignore them.
2023-12-19 16:59:35 +01:00
Simon Hausmann
b40b629e11 linuxkms: don't blockingly read on the drm fd after issuing a page flip request
... instead pass the fd into the calloop event loop and change state when we receive activity on it.

This improves performance slightly, and is a necessary to be able to implement refresh rate throttled rendering (in the next commits).
2023-12-19 16:59:35 +01:00
Simon Hausmann
11df315c54 linuxkms: Clean up file descriptor handling (part 2)
File can be converted into OwnedFd, so we can replace the
use of a dyn with the concrete Rc<OwnedFd>.
2023-12-19 16:59:35 +01:00
Simon Hausmann
e98a029293 linuxkms: Clean up file descriptor handling (part 1)
We don't need Arc for the file descriptors that remain in the same thread.
2023-12-19 16:59:35 +01:00
Simon Hausmann
58f9cf5d36 Port to new vulkano
This might fix the issue with resizing causing swapchain re-creation
errors, because "Swapchain creation no longer returns an error when the
swapchain extent doesn't match the current surface extent."

cc #3850
2023-11-13 12:39:59 +01:00
Simon Hausmann
0d35e01724 Revert "linuxkms: Update drm and gbm dependencies"
This reverts commit 17afe1aa8a.

This causes

 thread '<unnamed>' panicked at 'assertion failed: (has_modifier && modifier.is_some()) || (!has_modifier && modifier.is_none())', drm-0.10.0/src/control/mod.rs:324:9

when running on qemu-virgl.
2023-10-13 15:21:15 +02:00
Simon Hausmann
17afe1aa8a linuxkms: Update drm and gbm dependencies 2023-10-13 08:54:59 +02:00
Simon Hausmann
186c3ef3cb Simplify filter/map expression
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-10-07 11:26:17 +02:00
Simon Hausmann
b6b3dfc9c0 linuxkms: Prospective fix for failing crtc setup
If the chosen connector doesn't have a current encoder (who's crtc we could use), fall back to the algorithm described in

    https://manpages.debian.org/testing/libdrm-dev/drm-kms.7.en.html#CRTC/Encoder_Selection

for selecting the crtc (minus the usage check, since we drive only one connector).
This is also the same logic as in kmscube.
2023-10-07 11:26:17 +02:00
Olivier Goffart
95b6eda10b Make sure PLatformError is Send+Sync as it is needed for anyhow 2023-08-31 20:52:10 +02:00
Simon Hausmann
d96d37ea4b Fix linuxkms on i915
Adding a framebuffer with the given modifiers fails for some reason. Forcing
the gbm surface to linear is one workaround, but instead
let's use the old API without modifiers but still planar support.

This also removes the dependency to drm-ffi again, which was missing from renderer-femtovg.
2023-07-31 13:47:23 +02:00
Simon Hausmann
4b2eacd024 Fix build
Amends 717a3d9729
2023-07-31 12:46:58 +02:00
Simon Hausmann
717a3d9729 linuxkms: Add support for planar framebuffers and DRM modifiers 2023-07-31 12:07:33 +02:00
Simon Hausmann
fee44f3f7d Add basic support for libseat
This is not dynamic unfortunately, but at least it forwards device access for OpenGL and remove the need to run it as root.
2023-07-28 13:40:37 +02:00
Simon Hausmann
4991278a2b Improve error propagation when opening DRM devices fails
Print the last error
2023-07-28 13:40:37 +02:00
Luke D. Jones
b907b8f904 linuxkms: iterate over DRI files to find correct device 2023-07-28 13:40:37 +02:00
Simon Hausmann
e40f6c253e linuxkms: Add support for FemtoVG as renderer 2023-07-28 13:40:37 +02:00