|
@@ -120,6 +120,19 @@ int Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ /* By default, we wait for the Wayland frame callback and then issue the pageflip (eglSwapBuffers),
|
|
|
+ * but if we want low latency (double buffer scheme), we issue the pageflip and then wait
|
|
|
+ * immediately for the Wayland frame callback.
|
|
|
+ */
|
|
|
+ if (data->double_buffer) {
|
|
|
+ /* Feed the frame to Wayland. This will set it so the wl_surface_frame callback can fire again. */
|
|
|
+ if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, data->egl_surface)) {
|
|
|
+ return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers");
|
|
|
+ }
|
|
|
+
|
|
|
+ WAYLAND_wl_display_flush(data->waylandData->display);
|
|
|
+ }
|
|
|
+
|
|
|
/* Control swap interval ourselves. See comments on Wayland_GLES_SetSwapInterval */
|
|
|
if (swap_interval != 0 && data->surface_status == WAYLAND_SURFACE_STATUS_SHOWN) {
|
|
|
SDL_VideoData *videodata = _this->internal;
|
|
@@ -161,12 +174,14 @@ int Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|
|
SDL_AtomicSet(&data->swap_interval_ready, 0);
|
|
|
}
|
|
|
|
|
|
- /* Feed the frame to Wayland. This will set it so the wl_surface_frame callback can fire again. */
|
|
|
- if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, data->egl_surface)) {
|
|
|
- return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers");
|
|
|
- }
|
|
|
+ if (!data->double_buffer) {
|
|
|
+ /* Feed the frame to Wayland. This will set it so the wl_surface_frame callback can fire again. */
|
|
|
+ if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, data->egl_surface)) {
|
|
|
+ return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers");
|
|
|
+ }
|
|
|
|
|
|
- WAYLAND_wl_display_flush(data->waylandData->display);
|
|
|
+ WAYLAND_wl_display_flush(data->waylandData->display);
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
|
}
|