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

Side by Side Diff: gpu/ipc/common/gpu_memory_buffer_support.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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "gpu/ipc/common/gpu_memory_buffer_support.h" 5 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "gpu/ipc/common/gpu_switches.h" 10 #include "gpu/ipc/common/gpu_switches.h"
11 #include "ui/gl/gl_bindings.h" 11 #include "ui/gl/gl_bindings.h"
12 #include "ui/gl/gl_switches.h" 12 #include "ui/gl/gl_switches.h"
13 13
14 #if defined(USE_OZONE) 14 #if defined(USE_OZONE)
15 #include "ui/ozone/public/client_native_pixmap_factory.h" 15 #include "ui/ozone/public/client_native_pixmap_factory.h"
16 #endif 16 #endif
17 17
18 namespace gpu { 18 namespace gpu {
19 19
20 bool AreNativeGpuMemoryBuffersEnabled() { 20 bool AreNativeGpuMemoryBuffersEnabled() {
21 // Disable native buffers when using Mesa. 21 // Disable native buffers when using OSMesa.
22 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 22 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
23 switches::kUseGL) == gl::kGLImplementationOSMesaName) { 23 switches::kUseGL) == gl::kGLImplementationOSMesaName) {
24 return false; 24 return false;
25 } 25 }
26 26
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 28 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
29 switches::kDisableNativeGpuMemoryBuffers); 29 switches::kDisableNativeGpuMemoryBuffers);
30 #else 30 #else
31 return base::CommandLine::ForCurrentProcess()->HasSwitch( 31 return base::CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, 99 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
100 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT}; 100 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT};
101 for (auto format : kNativeFormats) { 101 for (auto format : kNativeFormats) {
102 for (auto usage : kNativeUsages) { 102 for (auto usage : kNativeUsages) {
103 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage)) 103 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage))
104 configurations.insert(std::make_pair(format, usage)); 104 configurations.insert(std::make_pair(format, usage));
105 } 105 }
106 } 106 }
107 } 107 }
108 108
109 // Disable native buffers only when using Mesa. 109 // Disable native buffers only when using OSMesa.
110 bool force_native_gpu_read_write_formats = 110 bool force_native_gpu_read_write_formats =
111 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 111 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
112 switches::kUseGL) != gl::kGLImplementationOSMesaName; 112 switches::kUseGL) != gl::kGLImplementationOSMesaName;
113 if (force_native_gpu_read_write_formats) { 113 if (force_native_gpu_read_write_formats) {
114 const gfx::BufferFormat kGPUReadWriteFormats[] = { 114 const gfx::BufferFormat kGPUReadWriteFormats[] = {
115 gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_8888, 115 gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_8888,
116 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::BGRA_8888, 116 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::BGRA_8888,
117 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::UYVY_422, 117 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::UYVY_422,
118 gfx::BufferFormat::YVU_420, gfx::BufferFormat::YUV_420_BIPLANAR}; 118 gfx::BufferFormat::YVU_420, gfx::BufferFormat::YUV_420_BIPLANAR};
119 const gfx::BufferUsage kGPUReadWriteUsages[] = {gfx::BufferUsage::GPU_READ, 119 const gfx::BufferUsage kGPUReadWriteUsages[] = {gfx::BufferUsage::GPU_READ,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 break; 153 break;
154 } 154 }
155 NOTREACHED(); 155 NOTREACHED();
156 return GL_TEXTURE_2D; 156 return GL_TEXTURE_2D;
157 #else // defined(USE_OZONE) || defined(OS_MACOSX) 157 #else // defined(USE_OZONE) || defined(OS_MACOSX)
158 return GL_TEXTURE_2D; 158 return GL_TEXTURE_2D;
159 #endif 159 #endif
160 } 160 }
161 161
162 } // namespace gpu 162 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | media/renderers/gpu_video_accelerator_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698