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

Side by Side Diff: gpu/ipc/host/gpu_memory_buffer_support.cc

Issue 2689453002: Introduce gfx::BufferFormat::YUYV_422
Patch Set: rebase to ToT Created 3 years, 6 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 | « gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc ('k') | ui/gfx/buffer_format_util.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 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/host/gpu_memory_buffer_support.h" 5 #include "gpu/ipc/host/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_memory_buffer_support.h" 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
(...skipping 20 matching lines...) Expand all
31 switches::kEnableNativeGpuMemoryBuffers); 31 switches::kEnableNativeGpuMemoryBuffers);
32 #endif 32 #endif
33 } 33 }
34 34
35 GpuMemoryBufferConfigurationSet GetNativeGpuMemoryBufferConfigurations() { 35 GpuMemoryBufferConfigurationSet GetNativeGpuMemoryBufferConfigurations() {
36 GpuMemoryBufferConfigurationSet configurations; 36 GpuMemoryBufferConfigurationSet configurations;
37 37
38 #if defined(USE_OZONE) || defined(OS_MACOSX) 38 #if defined(USE_OZONE) || defined(OS_MACOSX)
39 if (AreNativeGpuMemoryBuffersEnabled()) { 39 if (AreNativeGpuMemoryBuffersEnabled()) {
40 const gfx::BufferFormat kNativeFormats[] = { 40 const gfx::BufferFormat kNativeFormats[] = {
41 gfx::BufferFormat::R_8, gfx::BufferFormat::RG_88, 41 gfx::BufferFormat::R_8,
42 gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_4444, 42 gfx::BufferFormat::RG_88,
43 gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::BGRA_8888, 43 gfx::BufferFormat::BGR_565,
44 gfx::BufferFormat::RGBA_F16, gfx::BufferFormat::UYVY_422, 44 gfx::BufferFormat::RGBA_4444,
45 gfx::BufferFormat::YVU_420, gfx::BufferFormat::YUV_420_BIPLANAR}; 45 gfx::BufferFormat::RGBA_8888,
46 gfx::BufferFormat::BGRA_8888,
47 gfx::BufferFormat::RGBA_F16,
48 gfx::BufferFormat::UYVY_422,
49 gfx::BufferFormat::YUYV_422,
50 gfx::BufferFormat::YVU_420,
51 gfx::BufferFormat::YUV_420_BIPLANAR};
46 const gfx::BufferUsage kNativeUsages[] = { 52 const gfx::BufferUsage kNativeUsages[] = {
47 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT, 53 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT,
48 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, 54 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
49 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT}; 55 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT};
50 for (auto format : kNativeFormats) { 56 for (auto format : kNativeFormats) {
51 for (auto usage : kNativeUsages) { 57 for (auto usage : kNativeUsages) {
52 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage)) 58 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage))
53 configurations.insert(std::make_pair(format, usage)); 59 configurations.insert(std::make_pair(format, usage));
54 } 60 }
55 } 61 }
56 } 62 }
57 63
58 // Disable native buffers only when using software GL. 64 // Disable native buffers only when using software GL.
59 bool force_native_gpu_read_write_formats = 65 bool force_native_gpu_read_write_formats =
60 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 66 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
61 switches::kUseGL) != 67 switches::kUseGL) !=
62 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation()); 68 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation());
63 if (force_native_gpu_read_write_formats) { 69 if (force_native_gpu_read_write_formats) {
64 const gfx::BufferFormat kGPUReadWriteFormats[] = { 70 const gfx::BufferFormat kGPUReadWriteFormats[] = {
65 gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_8888, 71 gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_8888,
66 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::BGRA_8888, 72 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::BGRA_8888,
67 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::UYVY_422, 73 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::UYVY_422,
68 gfx::BufferFormat::YVU_420, gfx::BufferFormat::YUV_420_BIPLANAR}; 74 gfx::BufferFormat::YUYV_422, gfx::BufferFormat::YVU_420,
75 gfx::BufferFormat::YUV_420_BIPLANAR};
69 const gfx::BufferUsage kGPUReadWriteUsages[] = { 76 const gfx::BufferUsage kGPUReadWriteUsages[] = {
70 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT, 77 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT,
71 gfx::BufferUsage::SCANOUT_CPU_READ_WRITE}; 78 gfx::BufferUsage::SCANOUT_CPU_READ_WRITE};
72 for (auto format : kGPUReadWriteFormats) { 79 for (auto format : kGPUReadWriteFormats) {
73 for (auto usage : kGPUReadWriteUsages) { 80 for (auto usage : kGPUReadWriteUsages) {
74 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage)) 81 if (IsNativeGpuMemoryBufferConfigurationSupported(format, usage))
75 configurations.insert(std::make_pair(format, usage)); 82 configurations.insert(std::make_pair(format, usage));
76 } 83 }
77 } 84 }
78 } 85 }
(...skipping 25 matching lines...) Expand all
104 break; 111 break;
105 } 112 }
106 NOTREACHED(); 113 NOTREACHED();
107 return GL_TEXTURE_2D; 114 return GL_TEXTURE_2D;
108 #else // defined(USE_OZONE) || defined(OS_MACOSX) 115 #else // defined(USE_OZONE) || defined(OS_MACOSX)
109 return GL_TEXTURE_2D; 116 return GL_TEXTURE_2D;
110 #endif 117 #endif
111 } 118 }
112 119
113 } // namespace gpu 120 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc ('k') | ui/gfx/buffer_format_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698