Commit graph

11675 commits

Author SHA1 Message Date
Nathan Collins
b23e846e84 Zephyr: update the README.md with known issues
Include the current know issues in the documentation, so that they
aren't hidden in a pull request.
2024-07-08 16:46:33 +02:00
Nathan Collins
b168981e93 Zephyr: bump the SDK version used by the mcu_zephyr task
Use the latest available SDK.
2024-07-08 16:46:33 +02:00
Nathan Collins
538387b3d6 Zephyr: apply license headers
The Zephyr VERSION file is excluded as this simply specifies the version
of the Zephyr applicaiton, and the documentation doesn't say how
comments should be specified or if they are supported.
2024-07-08 16:46:33 +02:00
Nathan Collins
2ce3e70094 Zephyr: allow the event loop to wait forever
If there are no active animations or timer updates, allow the event
loop to run forever, rather than hardcoding five seconds.
2024-07-08 16:46:33 +02:00
Nathan Collins
9fc7477014 Zephyr: individually render the dirty sub-regions
The software renderer now provides a list of regions which have
changed.  Convert the regions to big-endian and render them
individually to prevent the non-dirty regions from being converted
away from big-endian.  Unfortunately, this still means we convert any
intersection between region more than once but this will be tackled as
a follow-up commit, as in principle this affects more than just the
Zephyr demo.
2024-07-08 16:46:33 +02:00
Nathan Collins
93bca206aa Zephyr: prefer a release build for hardware
The performance is much better, so for someone testing the demo based
on the readme, this gives a better first experience.
2024-07-08 16:46:33 +02:00
Nathan Collins
4841e9acfc Zephyr: fix use of deprecated board specification
The hardware model in Zephyr has changed. Use the way to specify a
board.
2024-07-08 16:46:33 +02:00
Nathan Collins
57e327f3e6 Use working Zephyr revision
The native simulator uses the SDL display driver. In Zephyr v3.6.0 this
driver incorrectly mixes pitch and width in asserts, causing the
application to assert when run. This revision fixes the assert. Ideally
we would use a tagged release, but there is not one available yet.
2024-07-08 16:46:33 +02:00
Nathan Collins
195ac55948 Add an mcu_zephyr GitHub action job
For the native sim and the NXP MIMXRT1170-EVKB:
- checkout the code;
- install the linux dependencies, including Zephyr dependencies;
- setup rust with the correct target for the board;
- setup the Zephyr project, using the printerdemo_mcu manifest;
- export the Zephyr CMake package;
- build for the board specified in the matrix.
2024-07-08 16:46:33 +02:00
Nathan Collins
d448170219 Add a West manifest
Track the Zephyr v3.6.0 release. Update the documentation to make use
of the West manifest.
2024-07-08 16:46:33 +02:00
Nathan Collins
68a02013e4 Zephyr: document why PIXEL_FORMAT_BGR_565 works
Zephyr expects pixel data to be big endian [1].

The display driver expects RGB 565 pixel data [2], and appears to expect
it to be little endian.

By passing Slint's little endian, RGB 565 pixel data without converting
to big endian as Zephyr expects, we get colors that work.

[1] https://docs.zephyrproject.org/latest/hardware/peripherals/display/index.html#c.display_pixel_format
[2] c211cb347e/drivers/display/display_mcux_elcdif.c (L256)
2024-07-08 16:46:33 +02:00
Nathan Collins
caf75ce84c Zephyr: prefer a release build on device
Render times are greatly improved in release builds.
2024-07-08 16:46:33 +02:00
Nathan Collins
4732a0b759 Zephyr: log render times
Slint is taking quite some time to update the render buffer:

```
// Initial render
[00:00:01.727,000] <dbg> zephyrSlint: maybe_redraw: Rendered x: 0 y: 0 w: 720 h: 1280
[00:00:01.727,000] <dbg> zephyrSlint: maybe_redraw:  - total: 1363 ms, slint: 1347 ms, write: 16 ms
[00:00:01.727,000] <dbg> zephyrSlint: run_event_loop: Sleeping for 0ms
[00:00:01.727,000] <dbg> zephyrSlint: run_event_loop: Loop

// Partial update
[00:00:02.255,000] <dbg> zephyrSlint: maybe_redraw: Rendered x: 146 y: 18 w: 156 h: 204
[00:00:02.255,000] <dbg> zephyrSlint: maybe_redraw:  - total: 525 ms, slint: 504 ms, write: 21 ms
[00:00:02.255,000] <dbg> zephyrSlint: run_event_loop: Sleeping for 474ms
```
2024-07-08 16:46:33 +02:00
Nathan Collins
038d7f8381 Zephyr: Rendering on device works if we don't change to big endian
Zephyr reports that the RK055HDMIPI4MA0 MIPI display is using
PIXEL_FORMAT_BGR_565.

The buffer we provide to Slint uses `slint::platform::Rgb565Pixel`.

Somewhere, the pixel data ends up in the correct format to display on
the test hardware.
2024-07-08 16:46:33 +02:00
Nathan Collins
3c4a019d75 Zephyr: fix format specifier warning
Use the correct format for the duration representation.
2024-07-08 16:46:33 +02:00
Nathan Collins
cb5b78b45a Build and run on NXP MIMXRT1170-EVKB
Setup the printerdemo_mcu example to build and run on the NXP
MIMXRT1170-EVKB.

There is an issue with the supported pixel formats, which will be
resolved in a future commit
2024-07-08 16:46:33 +02:00
Nathan Collins
71987d8fb3 Zephyr: don't use std::mutex
Zephyr does not support std::mutex [1].

[1] https://docs.zephyrproject.org/latest/develop/languages/cpp/index.html#language-features
2024-07-08 16:46:33 +02:00
Nathan Collins
fe711aad10 Zephyr: don't block main thread with animations
Make sure we sleep, even if there are animations. Previously we would
spin the event loop forever once an animation started.

Ideally we need some slint API to get the duration until the next
animation tick.
2024-07-08 16:46:33 +02:00
Nathan Collins
43ea064207 Zephyr: handle touch events
Define a simple callback to handle touch events from Zephyr. We expect
an input_sdl_touch device to exist in the device tree. This is a fairly
simple implementation as a proof of concept.

The default behaviour of Zephyr (as configured) is to handle inputs in a
separate thread. Each `input_event` describes a specific change, with the
`sync` member specifying when the event has reached a stable state. We
use slint::invoke_from_event_loop to dispatch the slint event in the
main thread.
2024-07-08 16:46:33 +02:00
Nathan Collins
c32b941f62 Zephyr: Turn off display blanking once
This stops the display from flickering in the native_sim.
2024-07-08 16:46:33 +02:00
Nathan Collins
3a12cfbdfc Enable asserts in Zephyr
Turn on Zephyr asserts to help root out issues with the Zephyr
platform code.
2024-07-08 16:46:33 +02:00
Nathan Collins
4a2c4ab89c Fix ZephyrWindowAdapter rendering
Use the correct offset into the buffer. In combination with
zephyrproject-rtos/zephyr#72007 partial rendering now works as
expected.
2024-07-08 16:46:33 +02:00
Nathan Collins
8a4a3c22c2 Update examples/printerdemo_mcu/zephyr/README.md
Don't forget to source the Zephyr virtual env.
2024-07-08 16:46:33 +02:00
Nathan Collins
cc39d0a016 Render printerdemo in Zephyr RTOS
Add a variant of the printerdemo_mcu that works with Zephyr. For now
we only target the native_sim, and only have rendering set up. Future
commits will add touch support, and investigate synchronization
issues.
2024-07-08 16:46:33 +02:00
Tobias Hunger
41896332b3 compiler: Fix bug in snapshotting
Do not `take` an ElementRc to move it into the `Component`'s `root_element`.

@ogoffart spotted this! Thanks!
2024-07-08 16:34:17 +02:00
Tobias Hunger
e74745c68a backout of commit 402f7ea649
rgb crate has eben fixed upstream, remove the temporary work-around again.
2024-07-08 15:38:23 +02:00
Simon Hausmann
0be2d4521e API Review: Remove suspend/resume related functions from FemtoVG renderer
This could've been `set_opengl_context` taking an `Option`, but it turns
out that makes for an awkward interface when wanting to pass None,
because that also then requires a dummy type for the OpenGL context even
though none is wanted.
2024-07-08 12:23:56 +02:00
Simon Hausmann
877bf786b8 Add support for RGB565 linux framebuffer rendering 2024-07-08 11:55:57 +02:00
teknalb
1b9a5e308a fix-some-doc-typos 2024-07-08 11:55:38 +02:00
Simon Hausmann
402f7ea649 Work around build breakage in rgb 0.8.42
See https://github.com/kornelski/rust-rgb/issues/116 for details

cc #5574
2024-07-08 11:52:57 +02:00
Simon Hausmann
a16e86bbd9 API review: Remove accidental public strum dependency
Deriving strum::EnumIter on a publicly exposed enum (like PointerEventButton) implies visibility into types that strum declares. This was added just for testing
in systest and can be solved differently.

Amends a1857e6154
2024-07-05 20:48:25 +02:00
Simon Hausmann
89b80eb00e API review: move {window,display}_handle_06_rc() into WindowAdapterInternal 2024-07-05 20:48:02 +02:00
Simon Hausmann
e35d05f6b9 API Review: Remove SharedImageBuffer from public API and rename Window::grab_window() to take_snapshot()
Use SharedPixelBuffer as return value for take_snapshot() and provide counter-parts to from_rgb* in Image as to_rgb*
2024-07-05 20:46:55 +02:00
Olivier Goffart
5dfa8d56dc API review of the slint interpreter Compiler api
Closes #5466
2024-07-05 17:20:08 +02:00
Olivier Goffart
35a6e7bde5 Split Text item into SimpleText and ComplexText
SimpleText has all the most common properties and is half the size
2024-07-05 12:51:25 +02:00
Olivier Goffart
8b5df70dd0 Make a trait for the Text rendering
So we can Split Text
2024-07-05 12:51:25 +02:00
Olivier Goffart
c6be6e3e85 Don't mark as read for the purpose of analysis property only read from native code
We don't want to keep a smaller bative class to be used only because of
that
2024-07-05 12:51:25 +02:00
Olivier Goffart
7c93c7438b Rename resize-border => resize-border-width 2024-07-05 12:50:16 +02:00
Olivier Goffart
6b1c02be94 C++: document the SLINT_FEATURE_* macros 2024-07-05 12:50:05 +02:00
Simon Hausmann
cc47d6863f Improve WordWrap docs 2024-07-05 09:47:57 +02:00
Simon Hausmann
caf5b968dc Fix capitalization 2024-07-05 09:34:35 +02:00
Simon Hausmann
544e4151ac Fix broken link to quick start in Rust API docs 2024-07-05 09:29:56 +02:00
Noah Sweilem
6095398374
Winit window event filter (#5531)
* Add winit window event filter (#3066)

* Winit window event filter changelog entry

* Format fixes

* More format fixes

* Make requested changes

- Callback gets a ref to the Slint window
- Callback returns an enum
- Callback is no longer `Send`

* Format fixes

* More format fixes

* Merge conflict fixes

* Rename members of `WinitWindowEventResult`

Closes #3066
2024-07-04 17:41:57 +02:00
Olivier Goffart
b5100a872d Fix appliying property from a builtin global
(eg: NativeStyleMetrics)

We would consider the property constant and inline them as their default
value

Fix regression from 6687995c36
2024-07-04 15:50:44 +02:00
Olivier Goffart
a8cf5c8885 ChangeLog updates 2024-07-04 14:45:09 +02:00
Olivier Goffart
2e9644fe86 ChangeLog updates 2024-07-04 14:44:09 +02:00
Olivier Goffart
5ef7127354 Allow inlining components that inherit from layout
There is no longer a reason to prevent it.
2024-07-04 14:18:42 +02:00
Simon Hausmann
6d79ca1a05 Document the SLINT_FEATURE_XXX pre-processor variables
and sync them with the existing features.
2024-07-04 13:39:13 +02:00
Simon Hausmann
7ab7dd63c5 Document SLINT_ENABLED/DISABLED_FEATURES target properties 2024-07-04 13:39:13 +02:00
Simon Hausmann
964de46c51 C++: Make the system testing feature automatically enable debug info
While we haven't settled on the debug info feature and are
merely controlling it via environment variable, setting that can be very hard - especially when using Yocto.

To make life easier, let's do in C++ what we can't easily do for Rust but would like to:

When enabling system testing, automatically emit the necessary debug info, by setting the environment variable when calling the compiler.

This is done by adding SLINT_ENABLED_FEATURES and SLINT_DISABLED_FEATURES properties
on the Slint::Slint target that - as lists - export the list of features and their status.

This way we can compile Slint in once place and safely in the CMake code running in application
scope check about the available features.
2024-07-04 13:39:13 +02:00