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

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

Issue 1416363002: Mac: Always use surfaceless mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add export 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
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 "content/browser/compositor/image_transport_factory.h" 7 #include "content/browser/compositor/image_transport_factory.h"
8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
9 #include "content/common/gpu/client/context_provider_command_buffer.h" 9 #include "content/common/gpu/client/context_provider_command_buffer.h"
10 #include "content/common/gpu/client/gl_helper.h" 10 #include "content/common/gpu/client/gl_helper.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return AllocatedSurface(); 211 return AllocatedSurface();
212 212
213 // We don't want to allow anything more than triple buffering. 213 // We don't want to allow anything more than triple buffering.
214 DCHECK_LT(allocated_count_, 4U); 214 DCHECK_LT(allocated_count_, 4U);
215 215
216 scoped_ptr<gfx::GpuMemoryBuffer> buffer( 216 scoped_ptr<gfx::GpuMemoryBuffer> buffer(
217 gpu_memory_buffer_manager_->AllocateGpuMemoryBufferForScanout( 217 gpu_memory_buffer_manager_->AllocateGpuMemoryBufferForScanout(
218 size_, gpu::ImageFactory::DefaultBufferFormatForImageFormat( 218 size_, gpu::ImageFactory::DefaultBufferFormatForImageFormat(
219 internal_format_), 219 internal_format_),
220 surface_id_)); 220 surface_id_));
221 if (!buffer) { 221 if (!buffer.get()) {
222 gl->DeleteTextures(1, &texture); 222 gl->DeleteTextures(1, &texture);
223 DLOG(ERROR) << "Failed to allocate GPU memory buffer"; 223 DLOG(ERROR) << "Failed to allocate GPU memory buffer";
224 return AllocatedSurface(); 224 return AllocatedSurface();
225 } 225 }
226 226
227 unsigned int id = gl->CreateImageCHROMIUM( 227 unsigned int id = gl->CreateImageCHROMIUM(
228 buffer->AsClientBuffer(), size_.width(), size_.height(), 228 buffer->AsClientBuffer(), size_.width(), size_.height(),
229 internal_format_); 229 internal_format_);
230 230
231 if (!id) { 231 if (!id) {
232 LOG(ERROR) << "Failed to allocate backing image surface"; 232 LOG(ERROR) << "Failed to allocate backing image surface";
233 gl->DeleteTextures(1, &texture); 233 gl->DeleteTextures(1, &texture);
234 return AllocatedSurface(); 234 return AllocatedSurface();
235 } 235 }
236 allocated_count_++; 236 allocated_count_++;
237 gl->BindTexture(texture_target_, texture); 237 gl->BindTexture(texture_target_, texture);
238 gl->BindTexImage2DCHROMIUM(texture_target_, id); 238 gl->BindTexImage2DCHROMIUM(texture_target_, id);
239 return AllocatedSurface(texture, id, gfx::Rect(size_)); 239 return AllocatedSurface(buffer.Pass(), texture, id, gfx::Rect(size_));
240 } 240 }
241 241
242 BufferQueue::AllocatedSurface::AllocatedSurface() : texture(0), image(0) {}
243
244 BufferQueue::AllocatedSurface::AllocatedSurface(
245 scoped_ptr<gfx::GpuMemoryBuffer> buffer,
246 unsigned int texture,
247 unsigned int image,
248 const gfx::Rect& rect)
249 : buffer(buffer.release()), texture(texture), image(image), damage(rect) {}
250
251 BufferQueue::AllocatedSurface::~AllocatedSurface() {}
252
242 } // namespace content 253 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/buffer_queue.h ('k') | content/browser/compositor/gpu_process_transport_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698