Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,26 @@ Comming soon. We are contributing to support this now. See: https://github.com/f

### Run Fluter app

Wayland compositor (weston) must be running before running the program when you use the Wayland backend.
#### Run with Wayland backend

Wayland compositor (weston) must be running before running the program.

```Shell
Comment thread
HidenoriMatsubayashi marked this conversation as resolved.
$ ./flutter-client ./sample/build/linux/x64/release/bundle
```

#### Note
#### Run with DRM backend

You need to switch from GUI which is running X11 or Wayland to the Character User Interface (CUI). In addition, `FLUTTER_DRM_DEVICE` must be set properly. The default value is `/dev/dri/card0`.

```Shell
$ Ctrl + Alt + F3 # Switching to CUI
$ FLUTTER_DRM_DEVICE="/dev/dri/card1" ./flutter-drm-backend ./sample/build/linux/x64/release/bundle
```

If you want to switch back from CUI to GUI, run `Ctrl + Alt + F2` keys in a terminal.

##### Note
You need to run this program by a user who has the permission to access the input devices(/dev/input/xxx), if you use the DRM backend. Generally, it is a root user or a user who belongs to an input group.

## 5. Settings of weston.ini file (Only when you use weston desktop-shell)
Expand Down
13 changes: 13 additions & 0 deletions examples/flutter-drm-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,16 @@ $ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-drm-backend ..
$ make
```

## Running Flutter app

You need to switch from GUI which is running X11 or Wayland to the Character User Interface (CUI). In addition, `FLUTTER_DRM_DEVICE` must be set properly. The default value is `/dev/dri/card0`.

```Shell
$ Ctrl + Alt + F3 # Switching to CUI
$ FLUTTER_DRM_DEVICE="/dev/dri/card1" ./flutter-drm-backend FLUTTER_BUNDLE_PATH
```
Comment thread
HidenoriMatsubayashi marked this conversation as resolved.

Note that replace `FLUTTER_BUNDLE_PATH` with the flutter bundle path you want to use like ./sample/build/linux/x64/release/bundle.

If you want to switch back from CUI to GUI, run `Ctrl + Alt + F2` keys in a terminal.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

namespace flutter {

static constexpr char kDrmDeviceFilename[] = "/dev/dri/card0";
static constexpr char kFlutterDrmDeviceEnvironmentKey[] = "FLUTTER_DRM_DEVICE";
static constexpr char kDrmDeviceDefaultFilename[] = "/dev/dri/card0";

const libinput_interface LinuxesWindowDrm::kLibinputInterface = {
.open_restricted = [](const char* path, int flags, void* user_data) -> int {
Expand All @@ -29,8 +30,7 @@ const libinput_interface LinuxesWindowDrm::kLibinputInterface = {

LinuxesWindowDrm::LinuxesWindowDrm(FlutterWindowMode window_mode, int32_t width,
int32_t height, bool show_cursor)
: display_valid_(false),
is_pending_cursor_add_event_(false) {
: display_valid_(false), is_pending_cursor_add_event_(false) {
window_mode_ = window_mode;
current_width_ = width;
current_height_ = height;
Expand Down Expand Up @@ -97,7 +97,13 @@ bool LinuxesWindowDrm::DispatchEvent() {
}

bool LinuxesWindowDrm::CreateRenderSurface(int32_t width, int32_t height) {
native_window_ = std::make_unique<NativeWindowDrm>(kDrmDeviceFilename);
auto device_filename = std::getenv(kFlutterDrmDeviceEnvironmentKey);
if ((!device_filename) || (device_filename[0] == '\0')) {
Comment thread
HidenoriMatsubayashi marked this conversation as resolved.
LINUXES_LOG(WARNING) << kFlutterDrmDeviceEnvironmentKey
<< " is not set, use " << kDrmDeviceDefaultFilename;
device_filename = const_cast<char*>(kDrmDeviceDefaultFilename);
}
native_window_ = std::make_unique<NativeWindowDrm>(device_filename);
if (!native_window_->IsValid()) {
LINUXES_LOG(ERROR) << "Failed to create the native window";
return false;
Expand Down