Skip to content

Commit 646ddd2

Browse files
committed
perf(tizen): disable EGL swap pacing on Wayland
1 parent 1e32e87 commit 646ddd2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

flutter/shell/platform/tizen/tizen_renderer_egl.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ bool TizenRendererEgl::CreateSurface(void* render_target,
5555
TEMP_DIAG_EGL("CreateSurface begin. render_target=" << render_target
5656
<< " display=" << render_target_display << " size=" << width
5757
<< "x" << height);
58+
swap_interval_configured_ = false;
5859
if (render_target_display) {
60+
uses_wayland_display_ = true;
5961
auto* wayland_display = static_cast<struct wl_display*>(render_target_display);
6062

6163
egl_display_ = eglGetDisplay(wayland_display);
@@ -70,6 +72,7 @@ bool TizenRendererEgl::CreateSurface(void* render_target,
7072
}
7173
}
7274
} else {
75+
uses_wayland_display_ = false;
7376
egl_display_ = eglGetDisplay(tbm_dummy_display_create());
7477
}
7578

@@ -180,6 +183,8 @@ void TizenRendererEgl::DestroySurface() {
180183
eglTerminate(egl_display_);
181184
egl_display_ = EGL_NO_DISPLAY;
182185
}
186+
uses_wayland_display_ = false;
187+
swap_interval_configured_ = false;
183188
}
184189

185190
bool TizenRendererEgl::ChooseEGLConfiguration() {
@@ -282,6 +287,16 @@ bool TizenRendererEgl::OnMakeCurrent() {
282287
FT_LOG(Error) << "Could not make the onscreen context current.";
283288
return false;
284289
}
290+
291+
if (uses_wayland_display_ && !swap_interval_configured_) {
292+
// EFL's public Wayland EGL path disables EGL's own swap pacing and lets
293+
// the Wayland/compositor path own presentation timing.
294+
swap_interval_configured_ = true;
295+
if (eglSwapInterval(egl_display_, 0) != EGL_TRUE) {
296+
PrintEGLError();
297+
FT_LOG(Warn) << "Could not disable EGL swap interval for Wayland.";
298+
}
299+
}
285300
return true;
286301
}
287302

flutter/shell/platform/tizen/tizen_renderer_egl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class TizenRendererEgl : public TizenRendererGL {
6363

6464
std::string egl_extension_str_;
6565
bool enable_impeller_;
66+
bool uses_wayland_display_ = false;
67+
bool swap_interval_configured_ = false;
6668
};
6769

6870
} // namespace flutter

0 commit comments

Comments
 (0)