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

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

Issue 2968503003: Allow presenting DXGI share handles as overlays. (Closed)
Patch Set: fix build Created 3 years, 5 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 | gpu/ipc/service/direct_composition_surface_win_unittest.cc » ('j') | 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 0d6000250cd4344e0bb939d66ffaac4a9bc1d060..2e070bf1b186b0d193ad77b3a87975af64d42c5f 100644
--- a/gpu/ipc/service/direct_composition_surface_win.cc
+++ b/gpu/ipc/service/direct_composition_surface_win.cc
@@ -465,8 +465,8 @@ bool DCLayerTree::SwapChainPresenter::UploadVideoImages(
void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
const ui::DCRendererLayerParams& params) {
- gl::GLImageDXGI* image_dxgi =
- gl::GLImageDXGI::FromGLImage(params.image[0].get());
+ gl::GLImageDXGIBase* image_dxgi =
+ gl::GLImageDXGIBase::FromGLImage(params.image[0].get());
gl::GLImageMemory* y_image_memory = nullptr;
gl::GLImageMemory* uv_image_memory = nullptr;
if (params.image.size() >= 2) {
@@ -548,9 +548,13 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
base::win::ScopedComPtr<ID3D11Texture2D> input_texture;
UINT input_level;
+ base::win::ScopedComPtr<IDXGIKeyedMutex> keyed_mutex;
if (image_dxgi) {
input_texture = image_dxgi->texture();
input_level = (UINT)image_dxgi->level();
+ if (!input_texture)
+ return;
+ input_texture.CopyTo(keyed_mutex.GetAddressOf());
staging_texture_.Reset();
} else {
DCHECK(y_image_memory);
@@ -615,6 +619,14 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
}
{
+ if (keyed_mutex) {
sunnyps 2017/07/11 01:56:28 nit: Can you add a comment about this?
+ const int kMaxSyncTime = 1000; // ms
+ HRESULT hr = keyed_mutex->AcquireSync(0, kMaxSyncTime);
+ if (FAILED(hr)) {
+ DLOG(ERROR) << "Error acquiring keyed mutex: " << std::hex << hr;
+ return;
+ }
+ }
D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC in_desc = {};
in_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D;
in_desc.Texture2D.ArraySlice = input_level;
@@ -646,6 +658,10 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
hr = video_context_->VideoProcessorBlt(video_processor_.Get(),
out_view_.Get(), 0, 1, &stream);
CHECK(SUCCEEDED(hr));
+ if (keyed_mutex) {
+ HRESULT hr = keyed_mutex->ReleaseSync(0);
+ DCHECK(SUCCEEDED(hr));
+ }
}
if (first_present) {
« no previous file with comments | « no previous file | gpu/ipc/service/direct_composition_surface_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698