Skip to content

Commit

Permalink
Revert "[Windows] Update vsync on raster thread (flutter#45310)"
Browse files Browse the repository at this point in the history
This also reverts the ANGLE roll (for which the original fix was
landed) to 48e2c605adcd5bcc1622b18f357c7a73ebfb3543.

fixes: flutter/flutter#134262

This reverts commit 708d82d.
  • Loading branch information
cbracken committed Sep 18, 2023
1 parent ab30b68 commit 1215e4e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 24 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 0 additions & 7 deletions shell/platform/windows/angle_surface_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/windows/flutter_windows_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 1 addition & 6 deletions shell/platform/windows/flutter_windows_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
11 changes: 2 additions & 9 deletions shell/platform/windows/flutter_windows_view_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1287,13 +1287,6 @@ TEST(FlutterWindowsViewTest, UpdatesVSyncOnDwmUpdates) {
std::unique_ptr<MockAngleSurfaceManager> surface_manager =
std::make_unique<MockAngleSurfaceManager>();

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));
Expand Down

0 comments on commit 1215e4e

Please sign in to comment.