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

Side by Side Diff: ui/gl/gl_image_dxgi.cc

Issue 2917493002: CHECK that video textures and processors are created on right context. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_image_dxgi.h" 5 #include "ui/gl/gl_image_dxgi.h"
6 6
7 #include "third_party/khronos/EGL/egl.h" 7 #include "third_party/khronos/EGL/egl.h"
8 #include "third_party/khronos/EGL/eglext.h" 8 #include "third_party/khronos/EGL/eglext.h"
9 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/gl_image.h" 10 #include "ui/gl/gl_image.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!result) 111 if (!result)
112 return false; 112 return false;
113 result = eglStreamConsumerAcquireKHR(egl_display, stream_); 113 result = eglStreamConsumerAcquireKHR(egl_display, stream_);
114 if (!result) 114 if (!result)
115 return false; 115 return false;
116 116
117 d3d11_device_.CopyTo(video_device_.GetAddressOf()); 117 d3d11_device_.CopyTo(video_device_.GetAddressOf());
118 base::win::ScopedComPtr<ID3D11DeviceContext> context; 118 base::win::ScopedComPtr<ID3D11DeviceContext> context;
119 d3d11_device_->GetImmediateContext(context.GetAddressOf()); 119 d3d11_device_->GetImmediateContext(context.GetAddressOf());
120 context.CopyTo(video_context_.GetAddressOf()); 120 context.CopyTo(video_context_.GetAddressOf());
121
122 base::win::ScopedComPtr<ID3D10Multithread> multithread;
123 d3d11_device_.CopyTo(multithread.GetAddressOf());
124 CHECK(multithread->GetMultithreadProtected());
121 return true; 125 return true;
122 } 126 }
123 127
124 bool CopyingGLImageDXGI::InitializeVideoProcessor( 128 bool CopyingGLImageDXGI::InitializeVideoProcessor(
125 const base::win::ScopedComPtr<ID3D11VideoProcessor>& video_processor, 129 const base::win::ScopedComPtr<ID3D11VideoProcessor>& video_processor,
126 const base::win::ScopedComPtr<ID3D11VideoProcessorEnumerator>& enumerator) { 130 const base::win::ScopedComPtr<ID3D11VideoProcessorEnumerator>& enumerator) {
127 output_view_.Reset(); 131 output_view_.Reset();
128 132
133 base::win::ScopedComPtr<ID3D11Device> processor_device;
134 video_processor->GetDevice(processor_device.GetAddressOf());
135 CHECK_EQ(d3d11_device_.Get(), processor_device.Get());
136
129 d3d11_processor_ = video_processor; 137 d3d11_processor_ = video_processor;
130 enumerator_ = enumerator; 138 enumerator_ = enumerator;
131 D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC output_view_desc = { 139 D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC output_view_desc = {
132 D3D11_VPOV_DIMENSION_TEXTURE2D}; 140 D3D11_VPOV_DIMENSION_TEXTURE2D};
133 output_view_desc.Texture2D.MipSlice = 0; 141 output_view_desc.Texture2D.MipSlice = 0;
134 base::win::ScopedComPtr<ID3D11VideoProcessorOutputView> output_view; 142 base::win::ScopedComPtr<ID3D11VideoProcessorOutputView> output_view;
135 HRESULT hr = video_device_->CreateVideoProcessorOutputView( 143 HRESULT hr = video_device_->CreateVideoProcessorOutputView(
136 decoder_copy_texture_.Get(), enumerator_.Get(), &output_view_desc, 144 decoder_copy_texture_.Get(), enumerator_.Get(), &output_view_desc,
137 output_view_.GetAddressOf()); 145 output_view_.GetAddressOf());
138 if (FAILED(hr)) { 146 if (FAILED(hr)) {
139 DLOG(ERROR) << "Failed to get output view"; 147 DLOG(ERROR) << "Failed to get output view";
140 return false; 148 return false;
141 } 149 }
142 return true; 150 return true;
143 } 151 }
144 152
145 void CopyingGLImageDXGI::UnbindFromTexture() { 153 void CopyingGLImageDXGI::UnbindFromTexture() {
146 copied_ = false; 154 copied_ = false;
147 } 155 }
148 156
149 bool CopyingGLImageDXGI::BindTexImage(unsigned target) { 157 bool CopyingGLImageDXGI::BindTexImage(unsigned target) {
150 if (copied_) 158 if (copied_)
151 return true; 159 return true;
152 160
161 CHECK(video_device_);
162 base::win::ScopedComPtr<ID3D11Device> texture_device;
163 texture_->GetDevice(texture_device.GetAddressOf());
164 CHECK_EQ(d3d11_device_.Get(), texture_device.Get());
165
153 D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC input_view_desc = {0}; 166 D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC input_view_desc = {0};
154 input_view_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D; 167 input_view_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D;
155 input_view_desc.Texture2D.ArraySlice = (UINT)level_; 168 input_view_desc.Texture2D.ArraySlice = (UINT)level_;
156 input_view_desc.Texture2D.MipSlice = 0; 169 input_view_desc.Texture2D.MipSlice = 0;
157 base::win::ScopedComPtr<ID3D11VideoProcessorInputView> input_view; 170 base::win::ScopedComPtr<ID3D11VideoProcessorInputView> input_view;
158 HRESULT hr = video_device_->CreateVideoProcessorInputView( 171 HRESULT hr = video_device_->CreateVideoProcessorInputView(
159 texture_.Get(), enumerator_.Get(), &input_view_desc, 172 texture_.Get(), enumerator_.Get(), &input_view_desc,
160 input_view.GetAddressOf()); 173 input_view.GetAddressOf());
161 if (FAILED(hr)) { 174 if (FAILED(hr)) {
162 DLOG(ERROR) << "Failed to create video processor input view."; 175 DLOG(ERROR) << "Failed to create video processor input view.";
(...skipping 10 matching lines...) Expand all
173 DLOG(ERROR) << "Failed to process video"; 186 DLOG(ERROR) << "Failed to process video";
174 return false; 187 return false;
175 } 188 }
176 copied_ = true; 189 copied_ = true;
177 return true; 190 return true;
178 } 191 }
179 192
180 CopyingGLImageDXGI::~CopyingGLImageDXGI() {} 193 CopyingGLImageDXGI::~CopyingGLImageDXGI() {}
181 194
182 } // namespace gl 195 } // namespace gl
OLDNEW
« 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