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

Side by Side Diff: content/renderer/media/renderer_gpu_video_accelerator_factories.cc

Issue 2648633005: cros: Support YUYV format for GPU memory buffer video frames
Patch Set: Enable YUYV GPU memory buffer video frames Created 3 years, 10 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/feature_info.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/media/renderer_gpu_video_accelerator_factories.h" 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/unguessable_token.h" 13 #include "base/unguessable_token.h"
14 #include "cc/output/context_provider.h" 14 #include "cc/output/context_provider.h"
15 #include "content/child/child_thread_impl.h" 15 #include "content/child/child_thread_impl.h"
16 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
17 #include "gpu/command_buffer/client/gles2_interface.h" 17 #include "gpu/command_buffer/client/gles2_interface.h"
18 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 18 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
19 #include "gpu/ipc/client/gpu_channel_host.h" 19 #include "gpu/ipc/client/gpu_channel_host.h"
20 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
20 #include "media/gpu/gpu_video_accelerator_util.h" 21 #include "media/gpu/gpu_video_accelerator_util.h"
21 #include "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h" 22 #include "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h"
22 #include "media/gpu/ipc/client/gpu_video_encode_accelerator_host.h" 23 #include "media/gpu/ipc/client/gpu_video_encode_accelerator_host.h"
23 #include "media/gpu/ipc/common/media_messages.h" 24 #include "media/gpu/ipc/common/media_messages.h"
24 #include "media/video/video_decode_accelerator.h" 25 #include "media/video/video_decode_accelerator.h"
25 #include "media/video/video_encode_accelerator.h" 26 #include "media/video/video_encode_accelerator.h"
26 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 27 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
27 28
28 namespace content { 29 namespace content {
29 30
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 269
269 media::GpuVideoAcceleratorFactories::OutputFormat 270 media::GpuVideoAcceleratorFactories::OutputFormat
270 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() { 271 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() {
271 DCHECK(task_runner_->BelongsToCurrentThread()); 272 DCHECK(task_runner_->BelongsToCurrentThread());
272 if (CheckContextLost()) 273 if (CheckContextLost())
273 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; 274 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED;
274 cc::ContextProvider::ScopedContextLock lock(context_provider_); 275 cc::ContextProvider::ScopedContextLock lock(context_provider_);
275 auto capabilities = context_provider_->ContextCapabilities(); 276 auto capabilities = context_provider_->ContextCapabilities();
276 if (capabilities.image_ycbcr_420v) 277 if (capabilities.image_ycbcr_420v)
277 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB; 278 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB;
278 if (capabilities.image_ycbcr_422) 279 if (capabilities.image_ycbcr_422) {
280 #if defined(OS_MACOSX)
281 // Mac supports UYVY IOSurface.
279 return media::GpuVideoAcceleratorFactories::OutputFormat::UYVY; 282 return media::GpuVideoAcceleratorFactories::OutputFormat::UYVY;
283 #elif defined(OS_CHROMEOS)
284 // Native GPU memory buffers are required.
285 if (gpu::IsNativeGpuMemoryBufferConfigurationSupported(
286 gfx::BufferFormat::YUYV_422,
287 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE)) {
288 // Ozone supports YUYV NativePixmap.
289 return media::GpuVideoAcceleratorFactories::OutputFormat::YUYV;
290 }
291 #endif
292 }
293
280 if (capabilities.texture_rg) 294 if (capabilities.texture_rg)
281 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_DUAL_GMB; 295 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_DUAL_GMB;
282 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; 296 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED;
283 } 297 }
284 298
285 namespace { 299 namespace {
286 class ScopedGLContextLockImpl 300 class ScopedGLContextLockImpl
287 : public media::GpuVideoAcceleratorFactories::ScopedGLContextLock { 301 : public media::GpuVideoAcceleratorFactories::ScopedGLContextLock {
288 public: 302 public:
289 ScopedGLContextLockImpl(cc::ContextProvider* context_provider) 303 ScopedGLContextLockImpl(cc::ContextProvider* context_provider)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 context_provider_refptr_ = nullptr; 351 context_provider_refptr_ = nullptr;
338 } 352 }
339 353
340 scoped_refptr<ui::ContextProviderCommandBuffer> 354 scoped_refptr<ui::ContextProviderCommandBuffer>
341 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { 355 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() {
342 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 356 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
343 return context_provider_refptr_; 357 return context_provider_refptr_;
344 } 358 }
345 359
346 } // namespace content 360 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/feature_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698