Commit 7b6d8a31 authored by jbauman's avatar jbauman Committed by Commit bot

Wait for GPU to finish before committing first video overlay frame.

The current code to do CopyResource helps in some cases, but with 4k
videos it still may flicker black before the first frame. Waiting for
the GPU commands to execute before the commit seems to help.

BUG=654631
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2892123002
Cr-Commit-Position: refs/heads/master@{#473373}
parent 6ae7018e
...@@ -689,6 +689,17 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain( ...@@ -689,6 +689,17 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
base::win::ScopedComPtr<ID3D11DeviceContext> context; base::win::ScopedComPtr<ID3D11DeviceContext> context;
d3d11_device_->GetImmediateContext(context.GetAddressOf()); d3d11_device_->GetImmediateContext(context.GetAddressOf());
context->CopyResource(dest_texture.Get(), src_texture.Get()); 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); swap_chain_->Present(1, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment