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

Side by Side Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.cc

Issue 1417753007: ui: Revert gfx::BufferUsage::SCANOUT to gfx::BufferUsage::GPU_READ_WRITE change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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 | « components/mus/gles2/command_buffer_local.cc ('k') | content/browser/gpu/gpu_internals_ui.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/gpu/browser_gpu_memory_buffer_manager.h" 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 enable_native_gpu_memory_buffers = false; 123 enable_native_gpu_memory_buffers = false;
124 force_native_gpu_read_write_formats = false; 124 force_native_gpu_read_write_formats = false;
125 } 125 }
126 126
127 if (enable_native_gpu_memory_buffers) { 127 if (enable_native_gpu_memory_buffers) {
128 const gfx::BufferFormat kNativeFormats[] = { 128 const gfx::BufferFormat kNativeFormats[] = {
129 gfx::BufferFormat::R_8, gfx::BufferFormat::RGBA_4444, 129 gfx::BufferFormat::R_8, gfx::BufferFormat::RGBA_4444,
130 gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::BGRA_8888, 130 gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::BGRA_8888,
131 gfx::BufferFormat::UYVY_422, gfx::BufferFormat::YUV_420_BIPLANAR}; 131 gfx::BufferFormat::UYVY_422, gfx::BufferFormat::YUV_420_BIPLANAR};
132 const gfx::BufferUsage kNativeUsages[] = { 132 const gfx::BufferUsage kNativeUsages[] = {
133 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::GPU_READ_WRITE, 133 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT,
134 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, 134 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
135 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT}; 135 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT};
136 for (auto& format : kNativeFormats) { 136 for (auto& format : kNativeFormats) {
137 for (auto& usage : kNativeUsages) { 137 for (auto& usage : kNativeUsages) {
138 if (IsNativeGpuMemoryBufferFactoryConfigurationSupported(format, usage)) 138 if (IsNativeGpuMemoryBufferFactoryConfigurationSupported(format, usage))
139 configurations.insert(std::make_pair(format, usage)); 139 configurations.insert(std::make_pair(format, usage));
140 } 140 }
141 } 141 }
142 } 142 }
143 143
144 if (force_native_gpu_read_write_formats) { 144 if (force_native_gpu_read_write_formats) {
145 const gfx::BufferFormat kGPUReadWriteFormats[] = { 145 const gfx::BufferFormat kGPUReadWriteFormats[] = {
146 gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::RGBX_8888, 146 gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::RGBX_8888,
147 gfx::BufferFormat::BGRA_8888, gfx::BufferFormat::BGRX_8888, 147 gfx::BufferFormat::BGRA_8888, gfx::BufferFormat::BGRX_8888,
148 gfx::BufferFormat::UYVY_422, gfx::BufferFormat::YUV_420_BIPLANAR}; 148 gfx::BufferFormat::UYVY_422, gfx::BufferFormat::YUV_420_BIPLANAR};
149 for (auto& format : kGPUReadWriteFormats) { 149 for (auto& format : kGPUReadWriteFormats) {
150 if (IsNativeGpuMemoryBufferFactoryConfigurationSupported( 150 if (IsNativeGpuMemoryBufferFactoryConfigurationSupported(
151 format, gfx::BufferUsage::GPU_READ_WRITE)) { 151 format, gfx::BufferUsage::SCANOUT)) {
152 configurations.insert( 152 configurations.insert(
153 std::make_pair(format, gfx::BufferUsage::GPU_READ_WRITE)); 153 std::make_pair(format, gfx::BufferUsage::SCANOUT));
154 } 154 }
155 } 155 }
156 } 156 }
157 157
158 return configurations; 158 return configurations;
159 } 159 }
160 160
161 BrowserGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr; 161 BrowserGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr;
162 162
163 } // namespace 163 } // namespace
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return request.result.Pass(); 284 return request.result.Pass();
285 } 285 }
286 286
287 scoped_ptr<gfx::GpuMemoryBuffer> 287 scoped_ptr<gfx::GpuMemoryBuffer>
288 BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForScanout( 288 BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForScanout(
289 const gfx::Size& size, 289 const gfx::Size& size,
290 gfx::BufferFormat format, 290 gfx::BufferFormat format,
291 int32 surface_id) { 291 int32 surface_id) {
292 DCHECK_GT(surface_id, 0); 292 DCHECK_GT(surface_id, 0);
293 return AllocateGpuMemoryBufferForSurface( 293 return AllocateGpuMemoryBufferForSurface(
294 size, format, gfx::BufferUsage::GPU_READ_WRITE, surface_id); 294 size, format, gfx::BufferUsage::SCANOUT, surface_id);
295 } 295 }
296 296
297 void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess( 297 void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess(
298 gfx::GpuMemoryBufferId id, 298 gfx::GpuMemoryBufferId id,
299 const gfx::Size& size, 299 const gfx::Size& size,
300 gfx::BufferFormat format, 300 gfx::BufferFormat format,
301 gfx::BufferUsage usage, 301 gfx::BufferUsage usage,
302 base::ProcessHandle child_process_handle, 302 base::ProcessHandle child_process_handle,
303 int child_client_id, 303 int child_client_id,
304 const AllocationCallback& callback) { 304 const AllocationCallback& callback) {
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 return gpu_client_tracing_id_; 738 return gpu_client_tracing_id_;
739 } 739 }
740 740
741 // In normal cases, |client_id| is a child process id, so we can perform 741 // In normal cases, |client_id| is a child process id, so we can perform
742 // the standard conversion. 742 // the standard conversion.
743 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( 743 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId(
744 client_id); 744 client_id);
745 } 745 }
746 746
747 } // namespace content 747 } // namespace content
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_local.cc ('k') | content/browser/gpu/gpu_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698