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

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, 9 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) 24 #if defined(OS_CHROMEOS) || defined(OS_WIN)
25 #if defined(OS_WIN) 25 #if defined(OS_WIN)
26 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" 26 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
27 #else // OS_WIN 27 #else // OS_WIN
Ami GONE FROM CHROMIUM 2012/03/21 13:16:24 Having #else\n#if is confusing; replace with #elif
Pawel Osciak 2012/04/05 10:37:20 Done.
28 #if defined(ARCH_CPU_ARMEL)
28 #include "content/common/gpu/media/omx_video_decode_accelerator.h" 29 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
30 #elif defined(ARCH_CPU_X86_FAMILY)
31 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
32 #include "ui/gfx/gl/gl_context_glx.h"
33 #include "ui/gfx/gl/gl_surface_glx.h"
34 #endif // ARCH_CPU_ARMEL
35
36 #include "ui/gfx/gl/gl_context.h"
Ami GONE FROM CHROMIUM 2012/03/21 13:16:24 dup of l.40 below?
Pawel Osciak 2012/04/05 10:37:20 Done.
37
29 #endif // OS_WIN 38 #endif // OS_WIN
39
30 #include "ui/gfx/gl/gl_context.h" 40 #include "ui/gfx/gl/gl_context.h"
31 #include "ui/gfx/gl/gl_surface_egl.h" 41 #include "ui/gfx/gl/gl_surface_egl.h"
32 #endif 42 #endif // OS_CHROMEOS || OS_WIN
33 43
34 #include "gpu/command_buffer/service/texture_manager.h" 44 #include "gpu/command_buffer/service/texture_manager.h"
35 #include "ui/gfx/size.h" 45 #include "ui/gfx/size.h"
36 46
37 using gpu::gles2::TextureManager; 47 using gpu::gles2::TextureManager;
38 48
39 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( 49 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
40 IPC::Message::Sender* sender, 50 IPC::Message::Sender* sender,
41 int32 host_route_id, 51 int32 host_route_id,
42 GpuCommandBufferStub* stub) 52 GpuCommandBufferStub* stub)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 126
117 void GpuVideoDecodeAccelerator::Initialize( 127 void GpuVideoDecodeAccelerator::Initialize(
118 const media::VideoDecodeAccelerator::Profile profile, 128 const media::VideoDecodeAccelerator::Profile profile,
119 IPC::Message* init_done_msg, 129 IPC::Message* init_done_msg,
120 base::ProcessHandle renderer_process) { 130 base::ProcessHandle renderer_process) {
121 DCHECK(!video_decode_accelerator_.get()); 131 DCHECK(!video_decode_accelerator_.get());
122 DCHECK(!init_done_msg_); 132 DCHECK(!init_done_msg_);
123 DCHECK(init_done_msg); 133 DCHECK(init_done_msg);
124 init_done_msg_ = init_done_msg; 134 init_done_msg_ = init_done_msg;
125 135
126 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN) 136 #if defined(OS_CHROMEOS) || defined(OS_WIN)
127 DCHECK(stub_ && stub_->decoder()); 137 DCHECK(stub_ && stub_->decoder());
128 #if defined(OS_WIN) 138 #if defined(OS_WIN)
129 if (base::win::GetVersion() < base::win::VERSION_WIN7) { 139 if (base::win::GetVersion() < base::win::VERSION_WIN7) {
130 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 140 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
131 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 141 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
132 return; 142 return;
133 } 143 }
134 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; 144 DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
135 DXVAVideoDecodeAccelerator* video_decoder = 145 DXVAVideoDecodeAccelerator* video_decoder =
136 new DXVAVideoDecodeAccelerator(this, renderer_process); 146 new DXVAVideoDecodeAccelerator(this, renderer_process);
137 #else // OS_WIN 147 #elif defined(OS_CHROMEOS) // OS_WIN
148 #if defined(ARCH_CPU_ARMEL)
138 OmxVideoDecodeAccelerator* video_decoder = 149 OmxVideoDecodeAccelerator* video_decoder =
139 new OmxVideoDecodeAccelerator(this); 150 new OmxVideoDecodeAccelerator(this);
140 video_decoder->SetEglState( 151 video_decoder->SetEglState(
141 gfx::GLSurfaceEGL::GetHardwareDisplay(), 152 gfx::GLSurfaceEGL::GetHardwareDisplay(),
142 stub_->decoder()->GetGLContext()->GetHandle()); 153 stub_->decoder()->GetGLContext()->GetHandle());
154 #elif defined(ARCH_CPU_X86_FAMILY)
155 DLOG(INFO) << "Initializing VAAPI HW decoder.";
Ami GONE FROM CHROMIUM 2012/03/21 13:16:24 drop
Pawel Osciak 2012/04/05 10:37:20 Ok, although there is a similar print for DXVA a f
156 VaapiVideoDecodeAccelerator* video_decoder =
157 new VaapiVideoDecodeAccelerator(this);
158 gfx::GLContextGLX* glx_context =
159 (gfx::GLContextGLX*) stub_->decoder()->GetGLContext();
Ami GONE FROM CHROMIUM 2012/03/21 13:16:24 Both this and the cast below should be static_cast
Pawel Osciak 2012/04/05 10:37:20 Done.
160 Display* display = glx_context->GetDisplay();
161 GLXContext glx_context_handle = (GLXContext)glx_context->GetHandle();
162 video_decoder->SetGlxState(display, glx_context_handle);
163 #endif // ARCH_CPU_ARMEL
143 #endif // OS_WIN 164 #endif // OS_WIN
144 video_decode_accelerator_ = video_decoder; 165 video_decode_accelerator_ = video_decoder;
145 if (!video_decode_accelerator_->Initialize(profile)) 166 if (!video_decode_accelerator_->Initialize(profile))
146 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 167 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
147 #else // Update RenderViewImpl::createMediaPlayer when adding clauses. 168 #else // Update RenderViewImpl::createMediaPlayer when adding clauses.
148 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 169 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
149 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 170 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
150 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 171 #endif // defined(OS_CHROMEOS) || defined(OS_WIN)
151 } 172 }
152 173
153 void GpuVideoDecodeAccelerator::OnDecode( 174 void GpuVideoDecodeAccelerator::OnDecode(
154 base::SharedMemoryHandle handle, int32 id, int32 size) { 175 base::SharedMemoryHandle handle, int32 id, int32 size) {
155 DCHECK(video_decode_accelerator_.get()); 176 DCHECK(video_decode_accelerator_.get());
156 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); 177 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size));
157 } 178 }
158 179
159 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( 180 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
160 const std::vector<int32>& buffer_ids, 181 const std::vector<int32>& buffer_ids,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 257
237 void GpuVideoDecodeAccelerator::NotifyResetDone() { 258 void GpuVideoDecodeAccelerator::NotifyResetDone() {
238 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 259 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
239 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 260 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
240 } 261 }
241 262
242 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { 263 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) {
243 DCHECK(sender_); 264 DCHECK(sender_);
244 return sender_->Send(message); 265 return sender_->Send(message);
245 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698