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

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

Issue 2892123002: 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 b0a2af8ef4f683d95531970e0d54ed202b115446..921f0a30459877412875226e4ef681d484665830 100644
--- a/gpu/ipc/service/direct_composition_surface_win.cc
+++ b/gpu/ipc/service/direct_composition_surface_win.cc
@@ -689,6 +689,17 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
base::win::ScopedComPtr<ID3D11DeviceContext> context;
d3d11_device_->GetImmediateContext(context.GetAddressOf());
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_.CopyTo(dxgi_device2.GetAddressOf());
+ 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