From 0a532593f14905c40223223316e30a14e62d594c Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 18 Sep 2023 23:34:29 +0100 Subject: [PATCH] Revert "[Windows] Update vsync on raster thread (#45310)" (flutter/engine#46000) This also reverts the ANGLE roll (for which the original fix was landed) to 48e2c605adcd5bcc1622b18f357c7a73ebfb3543. fixes: https://github.com/flutter/flutter/issues/134262 This reverts commit 2bec12f0b4d76d9f60d55d057e16cd2788083ade. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- DEPS | 2 +- engine/src/flutter/ci/licenses_golden/excluded_files | 2 -- .../shell/platform/windows/angle_surface_manager.cc | 7 ------- .../shell/platform/windows/flutter_windows_engine.h | 2 +- .../shell/platform/windows/flutter_windows_view.cc | 7 +------ .../windows/flutter_windows_view_unittests.cc | 11 ++--------- 6 files changed, 5 insertions(+), 26 deletions(-) diff --git a/DEPS b/DEPS index 2c75ef6431..c59de1fbaa 100644 --- a/DEPS +++ b/DEPS @@ -631,7 +631,7 @@ deps = { Var('swiftshader_git') + '/SwiftShader.git' + '@' + '5f9ed9b16931c7155171d31f75004f73f0a3abc8', 'src/third_party/angle': - Var('chromium_git') + '/angle/angle.git' + '@' + '48e2c605adcd5bcc1622b18f357c7a73ebfb3543', + Var('chromium_git') + '/angle/angle.git' + '@' + '6a09e41ce6ea8c93524faae1a925eb01562f53b1', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator' + '@' + '7de5cc00de50e71a3aab22dea52fbb7ff4efceb6', diff --git a/engine/src/flutter/ci/licenses_golden/excluded_files b/engine/src/flutter/ci/licenses_golden/excluded_files index 41298f9154..e8a291b374 100644 --- a/engine/src/flutter/ci/licenses_golden/excluded_files +++ b/engine/src/flutter/ci/licenses_golden/excluded_files @@ -991,7 +991,6 @@ ../../../third_party/angle/.git ../../../third_party/angle/.gitattributes ../../../third_party/angle/.gitignore -../../../third_party/angle/.gitmodules ../../../third_party/angle/.gn ../../../third_party/angle/.style.yapf ../../../third_party/angle/.vpython @@ -1130,7 +1129,6 @@ ../../../third_party/angle/src/third_party/ceval/package.json ../../../third_party/angle/src/third_party/libXNVCtrl/README.chromium ../../../third_party/angle/src/third_party/volk -../../../third_party/angle/testing ../../../third_party/angle/third_party ../../../third_party/angle/tools ../../../third_party/angle/util diff --git a/engine/src/flutter/shell/platform/windows/angle_surface_manager.cc b/engine/src/flutter/shell/platform/windows/angle_surface_manager.cc index 2165130ba1..7deafc2d0b 100644 --- a/engine/src/flutter/shell/platform/windows/angle_surface_manager.cc +++ b/engine/src/flutter/shell/platform/windows/angle_surface_manager.cc @@ -343,13 +343,6 @@ void AngleSurfaceManager::SetVSyncEnabled(bool enabled) { LogEglError("Unable to update the swap interval"); return; } - - if (eglMakeCurrent(egl_display_, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT) != EGL_TRUE) { - LogEglError( - "Unable to release the context after updating the swap interval"); - return; - } } bool AngleSurfaceManager::GetDevice(ID3D11Device** device) { diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h index 04d33e7583..cdbcd375fd 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h @@ -199,7 +199,7 @@ class FlutterWindowsEngine { bool MarkExternalTextureFrameAvailable(int64_t texture_id); // Posts the given callback onto the raster thread. - virtual bool PostRasterThreadTask(fml::closure callback); + bool PostRasterThreadTask(fml::closure callback); // Invoke on the embedder's vsync callback to schedule a frame. void OnVsync(intptr_t baton); diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_view.cc b/engine/src/flutter/shell/platform/windows/flutter_windows_view.cc index 20ac21558e..d668d2f447 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_view.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_view.cc @@ -669,12 +669,7 @@ void FlutterWindowsView::UpdateSemanticsEnabled(bool enabled) { void FlutterWindowsView::OnDwmCompositionChanged() { if (engine_->surface_manager()) { - // Update the surface with the new composition state. - // Switch to the raster thread as this requires making the context current. - auto needs_vsync = binding_handler_->NeedsVSync(); - engine_->PostRasterThreadTask([this, needs_vsync]() { - engine_->surface_manager()->SetVSyncEnabled(needs_vsync); - }); + engine_->surface_manager()->SetVSyncEnabled(binding_handler_->NeedsVSync()); } } diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_view_unittests.cc b/engine/src/flutter/shell/platform/windows/flutter_windows_view_unittests.cc index 93a7f3024d..b7ce34c05b 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_view_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_view_unittests.cc @@ -110,8 +110,8 @@ class MockFlutterWindowsEngine : public FlutterWindowsEngine { public: MockFlutterWindowsEngine() : FlutterWindowsEngine(GetTestProject()) {} - MOCK_METHOD(bool, Stop, (), (override)); - MOCK_METHOD(bool, PostRasterThreadTask, (fml::closure), (override)); + MOCK_METHOD(bool, Stop, (), ()); + MOCK_METHOD(bool, PostRasterThreadTask, (fml::closure), ()); private: FML_DISALLOW_COPY_AND_ASSIGN(MockFlutterWindowsEngine); @@ -1287,13 +1287,6 @@ TEST(FlutterWindowsViewTest, UpdatesVSyncOnDwmUpdates) { std::unique_ptr surface_manager = std::make_unique(); - EXPECT_CALL(*engine.get(), PostRasterThreadTask) - .Times(2) - .WillRepeatedly([](fml::closure callback) { - callback(); - return true; - }); - EXPECT_CALL(*window_binding_handler.get(), NeedsVSync) .WillOnce(Return(true)) .WillOnce(Return(false));