Skip to content

Commit e2f5185

Browse files
authored
Merge pull request #101 from ardera/develop
Merge develop
2 parents d22d17d + dc948af commit e2f5185

18 files changed

+2257
-1124
lines changed

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,21 @@ pkg_check_modules(GBM REQUIRED gbm)
9191
pkg_check_modules(EGL REQUIRED egl)
9292
pkg_check_modules(GLESV2 REQUIRED glesv2)
9393
pkg_check_modules(LIBSYSTEMD REQUIRED libsystemd)
94-
pkg_check_modules(LIBINPUT libinput)
94+
pkg_check_modules(LIBINPUT REQUIRED libinput)
95+
pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon)
9596
pkg_check_modules(LIBUDEV libudev)
9697
pkg_check_modules(GPIOD libgpiod)
9798

9899
set(FLUTTER_PI_SRC
99100
src/flutter-pi.c
100101
src/platformchannel.c
101102
src/pluginregistry.c
102-
src/console_keyboard.c
103103
src/texture_registry.c
104104
src/compositor.c
105105
src/modesetting.c
106106
src/collection.c
107-
src/cursor.c
107+
src/cursor.c
108+
src/keyboard.c
108109
src/plugins/services.c
109110
src/plugins/testplugin.c
110111
src/plugins/text_input.c
@@ -136,6 +137,7 @@ target_link_libraries(flutter-pi
136137
${LIBINPUT_LDFLAGS}
137138
${LIBUDEV_LDFLAGS}
138139
${GPIOD_LDFLAGS}
140+
${LIBXKBCOMMON_LDFLAGS}
139141
pthread dl rt m
140142
)
141143

@@ -151,6 +153,7 @@ target_include_directories(flutter-pi PRIVATE
151153
${LIBINPUT_INCLUDE_DIRS}
152154
${LIBUDEV_INCLUDE_DIRS}
153155
${GPIOD_INCLUDE_DIRS}
156+
${LIBXKBCOMMON_INCLUDE_DIRS}
154157
)
155158

156159
target_compile_options(flutter-pi PRIVATE
@@ -162,6 +165,7 @@ target_compile_options(flutter-pi PRIVATE
162165
${LIBINPUT_CFLAGS}
163166
${LIBUDEV_CFLAGS}
164167
${GPIOD_CFLAGS}
168+
${LIBXKBCOMMON_CFLAGS}
165169
-ggdb
166170
-DBUILD_TEXT_INPUT_PLUGIN
167171
-DBUILD_SPIDEV_PLUGIN

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
REAL_CFLAGS = -I./include $(shell pkg-config --cflags gbm libdrm glesv2 egl libsystemd libinput libudev) \
1+
REAL_CFLAGS = -I./include $(shell pkg-config --cflags gbm libdrm glesv2 egl libsystemd libinput libudev xkbcommon) \
22
-DBUILD_TEXT_INPUT_PLUGIN \
33
-DBUILD_TEST_PLUGIN \
44
-DBUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN \
55
-O0 -ggdb \
66
$(CFLAGS)
77

88
REAL_LDFLAGS = \
9-
$(shell pkg-config --libs gbm libdrm glesv2 egl libsystemd libinput libudev) \
9+
$(shell pkg-config --libs gbm libdrm glesv2 egl libsystemd libinput libudev xkbcommon) \
1010
-lrt \
1111
-lpthread \
1212
-ldl \
@@ -17,12 +17,12 @@ REAL_LDFLAGS = \
1717
SOURCES = src/flutter-pi.c \
1818
src/platformchannel.c \
1919
src/pluginregistry.c \
20-
src/console_keyboard.c \
2120
src/texture_registry.c \
2221
src/compositor.c \
2322
src/modesetting.c \
2423
src/collection.c \
2524
src/cursor.c \
25+
src/keyboard.c \
2626
src/plugins/services.c \
2727
src/plugins/testplugin.c \
2828
src/plugins/text_input.c \

README.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
## 📰 NEWS
2-
- the physical dimensions of the screen can now be specified via cmdline, using the `--dimensions` option.
3-
- the layout of the engine-binaries branch has changed again. The symbolic link from `libflutter_engine.so` to the fitting `libflutter_engine.so.release` or `libflutter_engine.so.debug` is no longer needed, flutter-pi will now dynamically load the engine fitting the the runtime mode that was specified via cmdline. (if `--release` is given, flutter-pi will load `libflutter_engine.so.release`, else `libflutter_engine.so.debug`)
4-
- flutter-pi now requires `libsystemd-dev`, `libinput-dev` and `libudev-dev` at compile-time. (`libudev-dev` is actually optional. To build without udev support, use cmake.)
5-
- flutter-pi and the engine binaries updated for flutter 1.20.
6-
- it's possible to run flutter-pi in AOT mode now. Instructions for that are WIP.
7-
- `--aot` was renamed to `--release`
2+
- flutter-pi now requires `libxkbcommon`. Install using `sudo apt install libxkbcommon-dev`
3+
- keyboard input works better now. You can now use any keyboard connected to the Raspberry Pi for text and raw keyboard input.
84

95
# flutter-pi
106
A light-weight Flutter Engine Embedder for Raspberry Pi. Inspired by https://github.com/chinmaygarde/flutter_from_scratch.
@@ -236,7 +232,7 @@ sudo fc-cache
236232
```
237233
### libgpiod (for the included GPIO plugin), libsystemd, libinput, libudev
238234
```bash
239-
sudo apt-get install gpiod libgpiod-dev libsystemd-dev libinput-dev libudev-dev
235+
sudo apt-get install gpiod libgpiod-dev libsystemd-dev libinput-dev libudev-dev libxkbcommon-dev
240236
```
241237

242238
## Compiling flutter-pi (on the Raspberry Pi)
@@ -250,13 +246,6 @@ The _flutter-pi_ executable will then be located at this path: `/path/to/the/clo
250246
## Performance
251247
Performance is actually better than I expected. With most of the apps inside the `flutter SDK -> examples -> catalog` directory I get smooth 50-60fps.
252248

253-
## Keyboard Input
254-
Keyboard input is supported. **There is one important limitation though**. Text input (i.e. writing any kind of text/symbols to flutter input fields) only works when typing on the keyboard, which is attached to the terminal flutter-pi is running on. So, if you ssh into your Raspberry Pi to run flutter-pi, you have to enter text into your ssh terminal.
255-
256-
Raw Keyboard input (i.e. using tab to iterate through focus nodes) works with any keyboard attached to your Raspberry Pi.
257-
258-
converting raw key-codes to text symbols is not that easy (because of all the different keyboard layouts), so for text input flutter-pi basically uses `stdin`.
259-
260249
## Touchscreen Latency
261250
Due to the way the touchscreen driver works in raspbian, there's some delta between an actual touch of the touchscreen and a touch event arriving at userspace. The touchscreen driver in the raspbian kernel actually just repeatedly polls some buffer shared with the firmware running on the VideoCore, and the videocore repeatedly polls the touchscreen. (both at 60Hz) So on average, there's a delay of 17ms (minimum 0ms, maximum 34ms). If I have enough time in the future, I'll try to build a better touchscreen driver to lower the delay.
262251

include/compositor.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ struct compositor {
115115
uint32_t gem_bo_handle;
116116
uint32_t *buffer;
117117
} cursor;
118+
119+
/**
120+
* If true, @ref on_present_layers will commit blockingly.
121+
*
122+
* It will also schedule a simulated page flip event on the main thread
123+
* afterwards so the frame queue works.
124+
*
125+
* If false, @ref on_present_layers will commit nonblocking using page flip events,
126+
* like usual.
127+
*/
128+
bool do_blocking_atomic_commits;
118129
};
119130

120131
/*
@@ -210,6 +221,17 @@ struct rendertarget {
210221
int height,
211222
int zpos
212223
);
224+
int (*present_legacy)(
225+
struct rendertarget *target,
226+
struct drmdev *drmdev,
227+
uint32_t drm_plane_id,
228+
int offset_x,
229+
int offset_y,
230+
int width,
231+
int height,
232+
int zpos,
233+
bool set_mode
234+
);
213235
};
214236

215237
struct flutterpi_backing_store {

include/console_keyboard.h

Lines changed: 0 additions & 191 deletions
This file was deleted.

include/flutter-pi.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <modesetting.h>
2828
#include <collection.h>
29+
#include <keyboard.h>
2930

3031
#define LOAD_EGL_PROC(flutterpi_struct, name) \
3132
do { \
@@ -394,13 +395,15 @@ struct flutterpi {
394395
struct {
395396
bool use_paths;
396397
bool disable_text_input;
398+
397399
glob_t input_devices_glob;
398400
# ifndef BUILD_WITHOUT_UDEV_SUPPORT
399401
struct libudev libudev;
400402
# endif
401403
struct libinput *libinput;
402404
sd_event_source *libinput_event_source;
403-
sd_event_source *stdin_event_source;
405+
struct keyboard_config *keyboard_config;
406+
404407
int64_t next_unused_flutter_device_id;
405408
double cursor_x, cursor_y;
406409
} input;
@@ -452,6 +455,7 @@ extern struct flutterpi flutterpi;
452455

453456
struct input_device_data {
454457
int64_t flutter_device_id_offset;
458+
struct keyboard_state *keyboard_state;
455459
double x, y;
456460
int64_t buttons;
457461
uint64_t timestamp;

0 commit comments

Comments
 (0)