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

Side by Side Diff: content/browser/compositor/buffer_queue.cc

Issue 1849313002: Pull gpu CmdBuf service/client shared GpuMemoryBuffer code to common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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 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/compositor/buffer_queue.h" 5 #include "content/browser/compositor/buffer_queue.h"
6 6
7 #include "base/containers/adapters.h" 7 #include "base/containers/adapters.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/compositor/gl_helper.h" 9 #include "content/browser/compositor/gl_helper.h"
10 #include "content/browser/compositor/image_transport_factory.h" 10 #include "content/browser/compositor/image_transport_factory.h"
11 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 11 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
12 #include "content/common/gpu/client/context_provider_command_buffer.h" 12 #include "content/common/gpu/client/context_provider_command_buffer.h"
13 #include "gpu/GLES2/gl2extchromium.h" 13 #include "gpu/GLES2/gl2extchromium.h"
14 #include "gpu/command_buffer/client/gles2_interface.h" 14 #include "gpu/command_buffer/client/gles2_interface.h"
15 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
15 #include "gpu/command_buffer/service/image_factory.h" 16 #include "gpu/command_buffer/service/image_factory.h"
16 #include "third_party/skia/include/core/SkRect.h" 17 #include "third_party/skia/include/core/SkRect.h"
17 #include "third_party/skia/include/core/SkRegion.h" 18 #include "third_party/skia/include/core/SkRegion.h"
18 #include "ui/gfx/gpu_memory_buffer.h" 19 #include "ui/gfx/gpu_memory_buffer.h"
19 #include "ui/gfx/skia_util.h" 20 #include "ui/gfx/skia_util.h"
20 21
21 namespace content { 22 namespace content {
22 23
23 BufferQueue::BufferQueue( 24 BufferQueue::BufferQueue(
24 scoped_refptr<cc::ContextProvider> context_provider, 25 scoped_refptr<cc::ContextProvider> context_provider,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 217 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
217 gl->GenTextures(1, &texture); 218 gl->GenTextures(1, &texture);
218 if (!texture) 219 if (!texture)
219 return nullptr; 220 return nullptr;
220 221
221 // We don't want to allow anything more than triple buffering. 222 // We don't want to allow anything more than triple buffering.
222 DCHECK_LT(allocated_count_, 4U); 223 DCHECK_LT(allocated_count_, 4U);
223 224
224 scoped_ptr<gfx::GpuMemoryBuffer> buffer( 225 scoped_ptr<gfx::GpuMemoryBuffer> buffer(
225 gpu_memory_buffer_manager_->AllocateGpuMemoryBufferForScanout( 226 gpu_memory_buffer_manager_->AllocateGpuMemoryBufferForScanout(
226 size_, gpu::ImageFactory::DefaultBufferFormatForImageFormat( 227 size_, gpu::DefaultBufferFormatForImageFormat(internal_format_),
227 internal_format_),
228 surface_id_)); 228 surface_id_));
229 if (!buffer.get()) { 229 if (!buffer.get()) {
230 gl->DeleteTextures(1, &texture); 230 gl->DeleteTextures(1, &texture);
231 DLOG(ERROR) << "Failed to allocate GPU memory buffer"; 231 DLOG(ERROR) << "Failed to allocate GPU memory buffer";
232 return nullptr; 232 return nullptr;
233 } 233 }
234 234
235 unsigned int id = gl->CreateImageCHROMIUM( 235 unsigned int id = gl->CreateImageCHROMIUM(
236 buffer->AsClientBuffer(), size_.width(), size_.height(), 236 buffer->AsClientBuffer(), size_.width(), size_.height(),
237 internal_format_); 237 internal_format_);
(...skipping 20 matching lines...) Expand all
258 buffer(buffer.release()), 258 buffer(buffer.release()),
259 texture(texture), 259 texture(texture),
260 image(image), 260 image(image),
261 damage(rect) {} 261 damage(rect) {}
262 262
263 BufferQueue::AllocatedSurface::~AllocatedSurface() { 263 BufferQueue::AllocatedSurface::~AllocatedSurface() {
264 buffer_queue->FreeSurfaceResources(this); 264 buffer_queue->FreeSurfaceResources(this);
265 } 265 }
266 266
267 } // namespace content 267 } // namespace content
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_local.cc ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698