OLD | NEW |
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/command_line.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
12 | 13 |
13 #include "content/common/gpu/gpu_channel.h" | 14 #include "content/common/gpu/gpu_channel.h" |
14 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
| 16 #include "content/public/common/content_switches.h" |
15 #include "gpu/command_buffer/common/command_buffer.h" | 17 #include "gpu/command_buffer/common/command_buffer.h" |
16 #include "ipc/ipc_message_macros.h" | 18 #include "ipc/ipc_message_macros.h" |
17 #include "ipc/ipc_message_utils.h" | 19 #include "ipc/ipc_message_utils.h" |
18 #include "ui/gl/gl_context.h" | 20 #include "ui/gl/gl_context.h" |
19 #include "ui/gl/gl_surface_egl.h" | 21 #include "ui/gl/gl_surface_egl.h" |
20 | 22 |
21 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
22 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
23 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 25 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
24 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 26 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
25 #include "content/common/gpu/media/omx_video_decode_accelerator.h" | 27 #include "content/common/gpu/media/omx_video_decode_accelerator.h" |
| 28 #include "content/common/gpu/media/exynos_video_decode_accelerator.h" |
26 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 29 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
27 #include "ui/gl/gl_context_glx.h" | 30 #include "ui/gl/gl_context_glx.h" |
28 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 31 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
29 #elif defined(OS_MACOSX) | 32 #elif defined(OS_MACOSX) |
30 #include "gpu/command_buffer/service/texture_manager.h" | 33 #include "gpu/command_buffer/service/texture_manager.h" |
31 #include "content/common/gpu/media/mac_video_decode_accelerator.h" | 34 #include "content/common/gpu/media/mac_video_decode_accelerator.h" |
32 #endif | 35 #endif |
33 | 36 |
34 #include "gpu/command_buffer/service/texture_manager.h" | 37 #include "gpu/command_buffer/service/texture_manager.h" |
35 #include "ui/gfx/size.h" | 38 #include "ui/gfx/size.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 #if defined(OS_WIN) | 168 #if defined(OS_WIN) |
166 if (base::win::GetVersion() < base::win::VERSION_WIN7) { | 169 if (base::win::GetVersion() < base::win::VERSION_WIN7) { |
167 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 170 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
168 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 171 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
169 return; | 172 return; |
170 } | 173 } |
171 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; | 174 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; |
172 video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator( | 175 video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator( |
173 this, make_context_current_)); | 176 this, make_context_current_)); |
174 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 177 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
175 video_decode_accelerator_.reset(new OmxVideoDecodeAccelerator( | 178 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseExynosVda)) { |
176 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 179 video_decode_accelerator_.reset(new ExynosVideoDecodeAccelerator( |
177 stub_->decoder()->GetGLContext()->GetHandle(), | 180 stub_->decoder()->GetGLContext(), this, make_context_current_)); |
178 this, | 181 } else { |
179 make_context_current_)); | 182 video_decode_accelerator_.reset(new OmxVideoDecodeAccelerator( |
| 183 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
| 184 stub_->decoder()->GetGLContext()->GetHandle(), |
| 185 this, |
| 186 make_context_current_)); |
| 187 } |
180 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 188 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
181 gfx::GLContextGLX* glx_context = | 189 gfx::GLContextGLX* glx_context = |
182 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); | 190 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); |
183 GLXContext glx_context_handle = | 191 GLXContext glx_context_handle = |
184 static_cast<GLXContext>(glx_context->GetHandle()); | 192 static_cast<GLXContext>(glx_context->GetHandle()); |
185 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( | 193 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( |
186 glx_context->display(), glx_context_handle, this, | 194 glx_context->display(), glx_context_handle, this, |
187 make_context_current_)); | 195 make_context_current_)); |
188 #elif defined(OS_MACOSX) | 196 #elif defined(OS_MACOSX) |
189 video_decode_accelerator_.reset(new MacVideoDecodeAccelerator( | 197 video_decode_accelerator_.reset(new MacVideoDecodeAccelerator( |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 if (stub_) { | 305 if (stub_) { |
298 stub_->RemoveDestructionObserver(this); | 306 stub_->RemoveDestructionObserver(this); |
299 stub_.reset(); | 307 stub_.reset(); |
300 } | 308 } |
301 } | 309 } |
302 | 310 |
303 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 311 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
304 DCHECK(sender_); | 312 DCHECK(sender_); |
305 return sender_->Send(message); | 313 return sender_->Send(message); |
306 } | 314 } |
OLD | NEW |