Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: gpu/ipc/service/direct_composition_surface_win.cc

Issue 2896723004: Wait for GPU to finish before committing first video overlay frame. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/direct_composition_surface_win.cc
diff --git a/gpu/ipc/service/direct_composition_surface_win.cc b/gpu/ipc/service/direct_composition_surface_win.cc
index df3f7b3223632dc66bb5dc10b4220d53f76b40d3..afc31f5b20a0d877a8f622acd15b13a6530932ea 100644
--- a/gpu/ipc/service/direct_composition_surface_win.cc
+++ b/gpu/ipc/service/direct_composition_surface_win.cc
@@ -589,6 +589,17 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
base::win::ScopedComPtr<ID3D11DeviceContext> context;
d3d11_device_->GetImmediateContext(context.Receive());
context->CopyResource(dest_texture.get(), src_texture.get());
+
+ // Additionally wait for the GPU to finish executing its commands, or
+ // there still may be a black flicker when presenting expensive content
+ // (e.g. 4k video).
+ base::win::ScopedComPtr<IDXGIDevice2> dxgi_device2;
+ hr = d3d11_device_.QueryInterface(dxgi_device2.Receive());
+ DCHECK(SUCCEEDED(hr));
+ base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
+ base::WaitableEvent::InitialState::NOT_SIGNALED);
+ dxgi_device2->EnqueueSetEvent(event.handle());
+ event.Wait();
}
swap_chain_->Present(1, 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698