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

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

Issue 10411066: Revert 137988 - VAVDA is the hardware video decode accelerator for Chrome on Linux and ChromeOS for… (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
« no previous file with comments | « content/common/gpu/media/DEPS ('k') | content/common/gpu/media/h264_dpb.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/common/gpu/gpu_channel.h" 17 #include "content/common/gpu/gpu_channel.h"
18 #include "content/common/gpu/gpu_command_buffer_stub.h" 18 #include "content/common/gpu/gpu_command_buffer_stub.h"
19 #include "content/common/gpu/gpu_messages.h" 19 #include "content/common/gpu/gpu_messages.h"
20 #include "gpu/command_buffer/common/command_buffer.h" 20 #include "gpu/command_buffer/common/command_buffer.h"
21 #include "ipc/ipc_message_macros.h" 21 #include "ipc/ipc_message_macros.h"
22 #include "ipc/ipc_message_utils.h" 22 #include "ipc/ipc_message_utils.h"
23 23
24 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
24 #if defined(OS_WIN) 25 #if defined(OS_WIN)
25 #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
28 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
26 #endif // OS_WIN 29 #endif // OS_WIN
27
28 #if defined(OS_CHROMEOS)
29 #if defined(ARCH_CPU_ARMEL)
30 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
31 #elif defined(ARCH_CPU_X86_FAMILY)
32 #include "ui/gl/gl_context_glx.h"
33 #include "ui/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)
39 #include "ui/gl/gl_context.h" 30 #include "ui/gl/gl_context.h"
40 #include "ui/gl/gl_surface_egl.h" 31 #include "ui/gl/gl_surface_egl.h"
41 #endif // OS_WIN || OS_CHROMEOS 32 #endif
42 33
43 #include "gpu/command_buffer/service/texture_manager.h" 34 #include "gpu/command_buffer/service/texture_manager.h"
44 #include "ui/gfx/size.h" 35 #include "ui/gfx/size.h"
45 36
46 using gpu::gles2::TextureManager; 37 using gpu::gles2::TextureManager;
47 38
48 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( 39 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
49 IPC::Message::Sender* sender, 40 IPC::Message::Sender* sender,
50 int32 host_route_id, 41 int32 host_route_id,
51 GpuCommandBufferStub* stub) 42 GpuCommandBufferStub* stub)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 115 }
125 116
126 void GpuVideoDecodeAccelerator::Initialize( 117 void GpuVideoDecodeAccelerator::Initialize(
127 const media::VideoCodecProfile profile, 118 const media::VideoCodecProfile profile,
128 IPC::Message* init_done_msg) { 119 IPC::Message* init_done_msg) {
129 DCHECK(!video_decode_accelerator_.get()); 120 DCHECK(!video_decode_accelerator_.get());
130 DCHECK(!init_done_msg_); 121 DCHECK(!init_done_msg_);
131 DCHECK(init_done_msg); 122 DCHECK(init_done_msg);
132 init_done_msg_ = init_done_msg; 123 init_done_msg_ = init_done_msg;
133 124
134 #if defined(OS_CHROMEOS) || defined(OS_WIN) 125 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
135 DCHECK(stub_ && stub_->decoder()); 126 DCHECK(stub_ && stub_->decoder());
136 #if defined(OS_WIN) 127 #if defined(OS_WIN)
137 if (base::win::GetVersion() < base::win::VERSION_WIN7) { 128 if (base::win::GetVersion() < base::win::VERSION_WIN7) {
138 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 129 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
139 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 130 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
140 return; 131 return;
141 } 132 }
142 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; 133 DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
143 DXVAVideoDecodeAccelerator* video_decoder = 134 DXVAVideoDecodeAccelerator* video_decoder =
144 new DXVAVideoDecodeAccelerator(this); 135 new DXVAVideoDecodeAccelerator(this);
145 #elif defined(OS_CHROMEOS) // OS_WIN 136 #else // OS_WIN
146 #if defined(ARCH_CPU_ARMEL)
147 OmxVideoDecodeAccelerator* video_decoder = 137 OmxVideoDecodeAccelerator* video_decoder =
148 new OmxVideoDecodeAccelerator(this); 138 new OmxVideoDecodeAccelerator(this);
149 video_decoder->SetEglState( 139 video_decoder->SetEglState(
150 gfx::GLSurfaceEGL::GetHardwareDisplay(), 140 gfx::GLSurfaceEGL::GetHardwareDisplay(),
151 stub_->decoder()->GetGLContext()->GetHandle()); 141 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
161 #endif // OS_WIN 142 #endif // OS_WIN
162 video_decode_accelerator_ = video_decoder; 143 video_decode_accelerator_ = video_decoder;
163 if (!video_decode_accelerator_->Initialize(profile)) 144 if (!video_decode_accelerator_->Initialize(profile))
164 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 145 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
165 #else // Update RenderViewImpl::createMediaPlayer when adding clauses. 146 #else // Update RenderViewImpl::createMediaPlayer when adding clauses.
166 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 147 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
167 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 148 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
168 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) 149 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
169 } 150 }
170 151
171 void GpuVideoDecodeAccelerator::OnDecode( 152 void GpuVideoDecodeAccelerator::OnDecode(
172 base::SharedMemoryHandle handle, int32 id, int32 size) { 153 base::SharedMemoryHandle handle, int32 id, int32 size) {
173 DCHECK(video_decode_accelerator_.get()); 154 DCHECK(video_decode_accelerator_.get());
174 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); 155 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size));
175 } 156 }
176 157
177 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( 158 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
178 const std::vector<int32>& buffer_ids, 159 const std::vector<int32>& buffer_ids,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 235
255 void GpuVideoDecodeAccelerator::NotifyResetDone() { 236 void GpuVideoDecodeAccelerator::NotifyResetDone() {
256 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 237 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
257 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 238 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
258 } 239 }
259 240
260 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { 241 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) {
261 DCHECK(sender_); 242 DCHECK(sender_);
262 return sender_->Send(message); 243 return sender_->Send(message);
263 } 244 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/DEPS ('k') | content/common/gpu/media/h264_dpb.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698