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

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

Issue 9814001: Add VAVDA, the VAAPI Video Decode Accelerator for Intel CPUs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
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/gpu_video_decode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 12
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include "base/win/windows_version.h" 14 #include "base/win/windows_version.h"
15 #endif // OS_WIN 15 #endif // OS_WIN
16 16
17 #include "gpu/command_buffer/common/command_buffer.h" 17 #include "gpu/command_buffer/common/command_buffer.h"
18 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
19 #include "ipc/ipc_message_utils.h" 19 #include "ipc/ipc_message_utils.h"
20 #include "content/common/gpu/gpu_channel.h" 20 #include "content/common/gpu/gpu_channel.h"
21 #include "content/common/gpu/gpu_command_buffer_stub.h" 21 #include "content/common/gpu/gpu_command_buffer_stub.h"
22 #include "content/common/gpu/gpu_messages.h" 22 #include "content/common/gpu/gpu_messages.h"
23 23
24 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
25 #if defined(OS_WIN) 24 #if defined(OS_WIN)
26 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" 25 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
27 #else // OS_WIN 26 #endif // OS_WIN
27
28 #if defined(OS_CHROMEOS)
29 #if defined(ARCH_CPU_ARMEL)
28 #include "content/common/gpu/media/omx_video_decode_accelerator.h" 30 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
29 #endif // OS_WIN 31 #elif defined(ARCH_CPU_X86_FAMILY)
32 #include "ui/gfx/gl/gl_context_glx.h"
33 #include "ui/gfx/gl/gl_surface_glx.h"
34 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
35 #endif // ARCH_CPU_ARMEL
36 #endif // OS_CHROMEOS
37
38 #if defined(OS_WIN) || defined(OS_CHROMEOS)
30 #include "ui/gfx/gl/gl_context.h" 39 #include "ui/gfx/gl/gl_context.h"
31 #include "ui/gfx/gl/gl_surface_egl.h" 40 #include "ui/gfx/gl/gl_surface_egl.h"
32 #endif 41 #endif // OS_WIN || OS_CHROMEOS
33 42
34 #include "gpu/command_buffer/service/texture_manager.h" 43 #include "gpu/command_buffer/service/texture_manager.h"
35 #include "ui/gfx/size.h" 44 #include "ui/gfx/size.h"
36 45
37 using gpu::gles2::TextureManager; 46 using gpu::gles2::TextureManager;
38 47
39 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( 48 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
40 IPC::Message::Sender* sender, 49 IPC::Message::Sender* sender,
41 int32 host_route_id, 50 int32 host_route_id,
42 GpuCommandBufferStub* stub) 51 GpuCommandBufferStub* stub)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 124 }
116 125
117 void GpuVideoDecodeAccelerator::Initialize( 126 void GpuVideoDecodeAccelerator::Initialize(
118 const media::VideoCodecProfile profile, 127 const media::VideoCodecProfile profile,
119 IPC::Message* init_done_msg) { 128 IPC::Message* init_done_msg) {
120 DCHECK(!video_decode_accelerator_.get()); 129 DCHECK(!video_decode_accelerator_.get());
121 DCHECK(!init_done_msg_); 130 DCHECK(!init_done_msg_);
122 DCHECK(init_done_msg); 131 DCHECK(init_done_msg);
123 init_done_msg_ = init_done_msg; 132 init_done_msg_ = init_done_msg;
124 133
125 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN) 134 #if defined(OS_CHROMEOS) || defined(OS_WIN)
126 DCHECK(stub_ && stub_->decoder()); 135 DCHECK(stub_ && stub_->decoder());
127 #if defined(OS_WIN) 136 #if defined(OS_WIN)
128 if (base::win::GetVersion() < base::win::VERSION_WIN7) { 137 if (base::win::GetVersion() < base::win::VERSION_WIN7) {
129 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 138 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
130 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 139 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
131 return; 140 return;
132 } 141 }
133 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; 142 DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
134 DXVAVideoDecodeAccelerator* video_decoder = 143 DXVAVideoDecodeAccelerator* video_decoder =
135 new DXVAVideoDecodeAccelerator(this); 144 new DXVAVideoDecodeAccelerator(this, renderer_process);
136 #else // OS_WIN 145 #elif defined(OS_CHROMEOS) // OS_WIN
146 #if defined(ARCH_CPU_ARMEL)
137 OmxVideoDecodeAccelerator* video_decoder = 147 OmxVideoDecodeAccelerator* video_decoder =
138 new OmxVideoDecodeAccelerator(this); 148 new OmxVideoDecodeAccelerator(this);
139 video_decoder->SetEglState( 149 video_decoder->SetEglState(
140 gfx::GLSurfaceEGL::GetHardwareDisplay(), 150 gfx::GLSurfaceEGL::GetHardwareDisplay(),
141 stub_->decoder()->GetGLContext()->GetHandle()); 151 stub_->decoder()->GetGLContext()->GetHandle());
152 #elif defined(ARCH_CPU_X86_FAMILY)
153 VaapiVideoDecodeAccelerator* video_decoder =
154 new VaapiVideoDecodeAccelerator(this);
155 gfx::GLContextGLX* glx_context =
156 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext());
157 GLXContext glx_context_handle =
158 static_cast<GLXContext>(glx_context->GetHandle());
159 video_decoder->SetGlxState(glx_context->display(), glx_context_handle);
160 #endif // ARCH_CPU_ARMEL
142 #endif // OS_WIN 161 #endif // OS_WIN
143 video_decode_accelerator_ = video_decoder; 162 video_decode_accelerator_ = video_decoder;
144 if (!video_decode_accelerator_->Initialize(profile)) 163 if (!video_decode_accelerator_->Initialize(profile))
145 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 164 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
146 #else // Update RenderViewImpl::createMediaPlayer when adding clauses. 165 #else // Update RenderViewImpl::createMediaPlayer when adding clauses.
147 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 166 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
148 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 167 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
149 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 168 #endif // defined(OS_CHROMEOS) || defined(OS_WIN)
150 } 169 }
151 170
152 void GpuVideoDecodeAccelerator::OnDecode( 171 void GpuVideoDecodeAccelerator::OnDecode(
153 base::SharedMemoryHandle handle, int32 id, int32 size) { 172 base::SharedMemoryHandle handle, int32 id, int32 size) {
154 DCHECK(video_decode_accelerator_.get()); 173 DCHECK(video_decode_accelerator_.get());
155 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); 174 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size));
156 } 175 }
157 176
158 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( 177 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
159 const std::vector<int32>& buffer_ids, 178 const std::vector<int32>& buffer_ids,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 254
236 void GpuVideoDecodeAccelerator::NotifyResetDone() { 255 void GpuVideoDecodeAccelerator::NotifyResetDone() {
237 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 256 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
238 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 257 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
239 } 258 }
240 259
241 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { 260 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) {
242 DCHECK(sender_); 261 DCHECK(sender_);
243 return sender_->Send(message); 262 return sender_->Send(message);
244 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698