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

Side by Side Diff: content/common/gpu/media/dxva_video_decode_accelerator.cc

Issue 775863005: gpu: Make GPU command decoder know right format of a GPU video texture in Win. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dxva_video_decode_accelerator.cc to fetch BGRA Created 6 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/gpu/media/dxva_video_decode_accelerator.h" 5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
6 6
7 #if !defined(OS_WIN) 7 #if !defined(OS_WIN)
8 #error This file should only be built on Windows. 8 #error This file should only be built on Windows.
9 #endif // !defined(OS_WIN) 9 #endif // !defined(OS_WIN)
10 10
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EGLBoolean ret = eglQuerySurfacePointerANGLE( 291 EGLBoolean ret = eglQuerySurfacePointerANGLE(
292 egl_display, 292 egl_display,
293 picture_buffer->decoding_surface_, 293 picture_buffer->decoding_surface_,
294 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, 294 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE,
295 &share_handle); 295 &share_handle);
296 296
297 RETURN_ON_FAILURE(share_handle && ret == EGL_TRUE, 297 RETURN_ON_FAILURE(share_handle && ret == EGL_TRUE,
298 "Failed to query ANGLE surface pointer", 298 "Failed to query ANGLE surface pointer",
299 linked_ptr<DXVAPictureBuffer>(NULL)); 299 linked_ptr<DXVAPictureBuffer>(NULL));
300 300
301 // FIXME: after moving to D3D11, use RGBA surface. crbug.com/438691
301 HRESULT hr = decoder.device_->CreateTexture( 302 HRESULT hr = decoder.device_->CreateTexture(
302 buffer.size().width(), 303 buffer.size().width(),
303 buffer.size().height(), 304 buffer.size().height(),
304 1, 305 1,
305 D3DUSAGE_RENDERTARGET, 306 D3DUSAGE_RENDERTARGET,
306 use_rgb ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8, 307 use_rgb ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8,
307 D3DPOOL_DEFAULT, 308 D3DPOOL_DEFAULT,
308 picture_buffer->decoding_texture_.Receive(), 309 picture_buffer->decoding_texture_.Receive(),
309 &share_handle); 310 &share_handle);
310 311
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 void DXVAVideoDecodeAccelerator::Destroy() { 691 void DXVAVideoDecodeAccelerator::Destroy() {
691 DCHECK(CalledOnValidThread()); 692 DCHECK(CalledOnValidThread());
692 Invalidate(); 693 Invalidate();
693 delete this; 694 delete this;
694 } 695 }
695 696
696 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { 697 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() {
697 return false; 698 return false;
698 } 699 }
699 700
701 // FIXME: after moving to D3D11, remove this workaround. crbug.com/438691
702 unsigned DXVAVideoDecodeAccelerator::GetSufaceInternalFormat() const {
703 return GL_BGRA_EXT;
704 }
705
700 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { 706 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) {
701 HMODULE decoder_dll = NULL; 707 HMODULE decoder_dll = NULL;
702 708
703 // Profile must fall within the valid range for one of the supported codecs. 709 // Profile must fall within the valid range for one of the supported codecs.
704 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { 710 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) {
705 // We mimic the steps CoCreateInstance uses to instantiate the object. This 711 // We mimic the steps CoCreateInstance uses to instantiate the object. This
706 // was previously done because it failed inside the sandbox, and now is done 712 // was previously done because it failed inside the sandbox, and now is done
707 // as a more minimal approach to avoid other side-effects CCI might have (as 713 // as a more minimal approach to avoid other side-effects CCI might have (as
708 // we are still in a reduced sandbox). 714 // we are still in a reduced sandbox).
709 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); 715 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll");
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 int32 picture_buffer_id) { 1366 int32 picture_buffer_id) {
1361 OutputBuffers::iterator it = stale_output_picture_buffers_.find( 1367 OutputBuffers::iterator it = stale_output_picture_buffers_.find(
1362 picture_buffer_id); 1368 picture_buffer_id);
1363 DCHECK(it != stale_output_picture_buffers_.end()); 1369 DCHECK(it != stale_output_picture_buffers_.end());
1364 DVLOG(1) << "Dismissing picture id: " << it->second->id(); 1370 DVLOG(1) << "Dismissing picture id: " << it->second->id();
1365 client_->DismissPictureBuffer(it->second->id()); 1371 client_->DismissPictureBuffer(it->second->id());
1366 stale_output_picture_buffers_.erase(it); 1372 stale_output_picture_buffers_.erase(it);
1367 } 1373 }
1368 1374
1369 } // namespace content 1375 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698