Skip to content

Commit

Permalink
egl: add async buffer swapping command option
Browse files Browse the repository at this point in the history
Fixed #220

Signed-off-by: Hidenori Matsubayashi <[email protected]>
  • Loading branch information
HidenoriMatsubayashi committed Aug 7, 2023
1 parent e5646da commit 63f9634
Show file tree
Hide file tree
Showing 39 changed files with 327 additions and 102 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ option(USE_DIRTY_REGION_MANAGEMENT "Use Flutter dirty region management" ON)
option(USE_GLES3 "Use OpenGL ES3 (default is OpenGL ES2)" OFF)
option(ENABLE_EGL_ALPHA_COMPONENT_OF_COLOR_BUFFER "Enable alpha component of the EGL color buffer" ON)
option(ENABLE_VSYNC "Enable embedder vsync" ON)
option(ENABLE_EGL_ASYNC_BUFFER_SWAPPING "Do not sync to compositor redraw (eglSwapInterval 0)" OFF)
option(BUILD_ELINUX_SO "Build .so file of elinux embedder" OFF)
option(ENABLE_ELINUX_EMBEDDER_LOG "Enable logger of eLinux embedder" ON)
option(FLUTTER_RELEASE "Build Flutter Engine with release mode" OFF)
Expand Down
7 changes: 0 additions & 7 deletions cmake/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ if(ENABLE_VSYNC)
)
endif()

# Do not sync to compositor redraw (eglSwapInterval 0).
if(ENABLE_EGL_ASYNC_BUFFER_SWAPPING)
add_definitions(
-DENABLE_EGL_ASYNC_BUFFER_SWAPPING
)
endif()

# Enable alpha component of the egl color buffer.
if(ENABLE_EGL_ALPHA_COMPONENT_OF_COLOR_BUFFER)
add_definitions(
Expand Down
50 changes: 40 additions & 10 deletions examples/flutter-drm-eglstream-backend/flutter_embedder_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class FlutterEmbedderOptions {
options_.AddDouble("force-scale-factor", "s",
"Force a scale factor instead using default value", 1.0,
false);
options_.AddWithoutValue(
"async-vblank", "v",
"Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false);

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
// no more options.
Expand Down Expand Up @@ -87,6 +91,8 @@ class FlutterEmbedderOptions {
scale_factor_ = 1.0;
}

enable_vsync_ = !options_.Exist("async-vblank");

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
use_onscreen_keyboard_ = false;
Expand Down Expand Up @@ -118,22 +124,45 @@ class FlutterEmbedderOptions {
return true;
}

std::string BundlePath() const { return bundle_path_; }
std::string WindowTitle() const { return window_title_; }
std::string WindowAppID() const { return window_app_id_; }
bool IsUseMouseCursor() const { return use_mouse_cursor_; }
bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; }
bool IsUseWindowDecoraation() const { return use_window_decoration_; }
std::string BundlePath() const {
return bundle_path_;
}
std::string WindowTitle() const {
return window_title_;
}
std::string WindowAppID() const {
return window_app_id_;
}
bool IsUseMouseCursor() const {
return use_mouse_cursor_;
}
bool IsUseOnscreenKeyboard() const {
return use_onscreen_keyboard_;
}
bool IsUseWindowDecoraation() const {
return use_window_decoration_;
}
flutter::FlutterViewController::ViewMode WindowViewMode() const {
return window_view_mode_;
}
int WindowWidth() const { return window_width_; }
int WindowHeight() const { return window_height_; }
int WindowWidth() const {
return window_width_;
}
int WindowHeight() const {
return window_height_;
}
flutter::FlutterViewController::ViewRotation WindowRotation() const {
return window_view_rotation_;
}
bool IsForceScaleFactor() const { return is_force_scale_factor_; }
double ScaleFactor() const { return scale_factor_; }
bool IsForceScaleFactor() const {
return is_force_scale_factor_;
}
double ScaleFactor() const {
return scale_factor_;
}
bool EnableVsync() const {
return enable_vsync_;
}

private:
commandline::CommandOptions options_;
Expand All @@ -152,6 +181,7 @@ class FlutterEmbedderOptions {
flutter::FlutterViewController::ViewRotation::kRotation_0;
bool is_force_scale_factor_;
double scale_factor_;
bool enable_vsync_;
};

#endif // FLUTTER_EMBEDDER_OPTIONS_
1 change: 1 addition & 0 deletions examples/flutter-drm-eglstream-backend/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int main(int argc, char** argv) {
view_properties.use_window_decoration = options.IsUseWindowDecoraation();
view_properties.force_scale_factor = options.IsForceScaleFactor();
view_properties.scale_factor = options.ScaleFactor();
view_properties.enable_vsync = options.EnableVsync();

// The Flutter instance hosted by this window.
FlutterWindow window(view_properties, project);
Expand Down
50 changes: 40 additions & 10 deletions examples/flutter-drm-gbm-backend/flutter_embedder_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class FlutterEmbedderOptions {
options_.AddDouble("force-scale-factor", "s",
"Force a scale factor instead using default value", 1.0,
false);
options_.AddWithoutValue(
"async-vblank", "v",
"Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false);

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
// no more options.
Expand Down Expand Up @@ -87,6 +91,8 @@ class FlutterEmbedderOptions {
scale_factor_ = 1.0;
}

enable_vsync_ = !options_.Exist("async-vblank");

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
use_onscreen_keyboard_ = false;
Expand Down Expand Up @@ -118,22 +124,45 @@ class FlutterEmbedderOptions {
return true;
}

std::string BundlePath() const { return bundle_path_; }
std::string WindowTitle() const { return window_title_; }
std::string WindowAppID() const { return window_app_id_; }
bool IsUseMouseCursor() const { return use_mouse_cursor_; }
bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; }
bool IsUseWindowDecoraation() const { return use_window_decoration_; }
std::string BundlePath() const {
return bundle_path_;
}
std::string WindowTitle() const {
return window_title_;
}
std::string WindowAppID() const {
return window_app_id_;
}
bool IsUseMouseCursor() const {
return use_mouse_cursor_;
}
bool IsUseOnscreenKeyboard() const {
return use_onscreen_keyboard_;
}
bool IsUseWindowDecoraation() const {
return use_window_decoration_;
}
flutter::FlutterViewController::ViewMode WindowViewMode() const {
return window_view_mode_;
}
int WindowWidth() const { return window_width_; }
int WindowHeight() const { return window_height_; }
int WindowWidth() const {
return window_width_;
}
int WindowHeight() const {
return window_height_;
}
flutter::FlutterViewController::ViewRotation WindowRotation() const {
return window_view_rotation_;
}
bool IsForceScaleFactor() const { return is_force_scale_factor_; }
double ScaleFactor() const { return scale_factor_; }
bool IsForceScaleFactor() const {
return is_force_scale_factor_;
}
double ScaleFactor() const {
return scale_factor_;
}
bool EnableVsync() const {
return enable_vsync_;
}

private:
commandline::CommandOptions options_;
Expand All @@ -152,6 +181,7 @@ class FlutterEmbedderOptions {
flutter::FlutterViewController::ViewRotation::kRotation_0;
bool is_force_scale_factor_;
double scale_factor_;
bool enable_vsync_;
};

#endif // FLUTTER_EMBEDDER_OPTIONS_
1 change: 1 addition & 0 deletions examples/flutter-drm-gbm-backend/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int main(int argc, char** argv) {
view_properties.use_window_decoration = options.IsUseWindowDecoraation();
view_properties.force_scale_factor = options.IsForceScaleFactor();
view_properties.scale_factor = options.ScaleFactor();
view_properties.enable_vsync = options.EnableVsync();

// The Flutter instance hosted by this window.
FlutterWindow window(view_properties, project);
Expand Down
50 changes: 40 additions & 10 deletions examples/flutter-external-texture-plugin/flutter_embedder_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class FlutterEmbedderOptions {
options_.AddDouble("force-scale-factor", "s",
"Force a scale factor instead using default value", 1.0,
false);
options_.AddWithoutValue(
"async-vblank", "v",
"Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false);

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
// no more options.
Expand Down Expand Up @@ -87,6 +91,8 @@ class FlutterEmbedderOptions {
scale_factor_ = 1.0;
}

enable_vsync_ = !options_.Exist("async-vblank");

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
use_onscreen_keyboard_ = false;
Expand Down Expand Up @@ -118,22 +124,45 @@ class FlutterEmbedderOptions {
return true;
}

std::string BundlePath() const { return bundle_path_; }
std::string WindowTitle() const { return window_title_; }
std::string WindowAppID() const { return window_app_id_; }
bool IsUseMouseCursor() const { return use_mouse_cursor_; }
bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; }
bool IsUseWindowDecoraation() const { return use_window_decoration_; }
std::string BundlePath() const {
return bundle_path_;
}
std::string WindowTitle() const {
return window_title_;
}
std::string WindowAppID() const {
return window_app_id_;
}
bool IsUseMouseCursor() const {
return use_mouse_cursor_;
}
bool IsUseOnscreenKeyboard() const {
return use_onscreen_keyboard_;
}
bool IsUseWindowDecoraation() const {
return use_window_decoration_;
}
flutter::FlutterViewController::ViewMode WindowViewMode() const {
return window_view_mode_;
}
int WindowWidth() const { return window_width_; }
int WindowHeight() const { return window_height_; }
int WindowWidth() const {
return window_width_;
}
int WindowHeight() const {
return window_height_;
}
flutter::FlutterViewController::ViewRotation WindowRotation() const {
return window_view_rotation_;
}
bool IsForceScaleFactor() const { return is_force_scale_factor_; }
double ScaleFactor() const { return scale_factor_; }
bool IsForceScaleFactor() const {
return is_force_scale_factor_;
}
double ScaleFactor() const {
return scale_factor_;
}
bool EnableVsync() const {
return enable_vsync_;
}

private:
commandline::CommandOptions options_;
Expand All @@ -152,6 +181,7 @@ class FlutterEmbedderOptions {
flutter::FlutterViewController::ViewRotation::kRotation_0;
bool is_force_scale_factor_;
double scale_factor_;
bool enable_vsync_;
};

#endif // FLUTTER_EMBEDDER_OPTIONS_
1 change: 1 addition & 0 deletions examples/flutter-external-texture-plugin/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int main(int argc, char** argv) {
view_properties.use_window_decoration = options.IsUseWindowDecoraation();
view_properties.force_scale_factor = options.IsForceScaleFactor();
view_properties.scale_factor = options.ScaleFactor();
view_properties.enable_vsync = options.EnableVsync();

// The Flutter instance hosted by this window.
FlutterWindow window(view_properties, project);
Expand Down
50 changes: 40 additions & 10 deletions examples/flutter-video-player-plugin/flutter_embedder_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class FlutterEmbedderOptions {
options_.AddDouble("force-scale-factor", "s",
"Force a scale factor instead using default value", 1.0,
false);
options_.AddWithoutValue(
"async-vblank", "v",
"Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false);

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
// no more options.
Expand Down Expand Up @@ -87,6 +91,8 @@ class FlutterEmbedderOptions {
scale_factor_ = 1.0;
}

enable_vsync_ = !options_.Exist("async-vblank");

#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
use_onscreen_keyboard_ = false;
Expand Down Expand Up @@ -118,22 +124,45 @@ class FlutterEmbedderOptions {
return true;
}

std::string BundlePath() const { return bundle_path_; }
std::string WindowTitle() const { return window_title_; }
std::string WindowAppID() const { return window_app_id_; }
bool IsUseMouseCursor() const { return use_mouse_cursor_; }
bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; }
bool IsUseWindowDecoraation() const { return use_window_decoration_; }
std::string BundlePath() const {
return bundle_path_;
}
std::string WindowTitle() const {
return window_title_;
}
std::string WindowAppID() const {
return window_app_id_;
}
bool IsUseMouseCursor() const {
return use_mouse_cursor_;
}
bool IsUseOnscreenKeyboard() const {
return use_onscreen_keyboard_;
}
bool IsUseWindowDecoraation() const {
return use_window_decoration_;
}
flutter::FlutterViewController::ViewMode WindowViewMode() const {
return window_view_mode_;
}
int WindowWidth() const { return window_width_; }
int WindowHeight() const { return window_height_; }
int WindowWidth() const {
return window_width_;
}
int WindowHeight() const {
return window_height_;
}
flutter::FlutterViewController::ViewRotation WindowRotation() const {
return window_view_rotation_;
}
bool IsForceScaleFactor() const { return is_force_scale_factor_; }
double ScaleFactor() const { return scale_factor_; }
bool IsForceScaleFactor() const {
return is_force_scale_factor_;
}
double ScaleFactor() const {
return scale_factor_;
}
bool EnableVsync() const {
return enable_vsync_;
}

private:
commandline::CommandOptions options_;
Expand All @@ -152,6 +181,7 @@ class FlutterEmbedderOptions {
flutter::FlutterViewController::ViewRotation::kRotation_0;
bool is_force_scale_factor_;
double scale_factor_;
bool enable_vsync_;
};

#endif // FLUTTER_EMBEDDER_OPTIONS_
1 change: 1 addition & 0 deletions examples/flutter-video-player-plugin/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int main(int argc, char** argv) {
view_properties.use_window_decoration = options.IsUseWindowDecoraation();
view_properties.force_scale_factor = options.IsForceScaleFactor();
view_properties.scale_factor = options.ScaleFactor();
view_properties.enable_vsync = options.EnableVsync();

// The Flutter instance hosted by this window.
FlutterWindow window(view_properties, project);
Expand Down
Loading

0 comments on commit 63f9634

Please sign in to comment.