Index: content/browser/compositor/buffer_queue.cc |
diff --git a/content/browser/compositor/buffer_queue.cc b/content/browser/compositor/buffer_queue.cc |
index 689288f6d63b75d10c0b329fb32205d234ee1140..e42d937e802b8e2c397e177b50603b72ce732639 100644 |
--- a/content/browser/compositor/buffer_queue.cc |
+++ b/content/browser/compositor/buffer_queue.cc |
@@ -4,6 +4,7 @@ |
#include "content/browser/compositor/buffer_queue.h" |
+#include "base/memory/scoped_vector.h" |
#include "content/browser/compositor/image_transport_factory.h" |
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
#include "content/common/gpu/client/context_provider_command_buffer.h" |
@@ -167,19 +168,32 @@ BufferQueue::AllocatedSurface BufferQueue::GetNextSurface() { |
// We don't want to allow anything more than triple buffering. |
DCHECK_LT(allocated_count_, 4U); |
- scoped_ptr<gfx::GpuMemoryBuffer> buffer( |
- gpu_memory_buffer_manager_->AllocateGpuMemoryBufferForScanout( |
- size_, gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormat( |
- internalformat_), |
- surface_id_)); |
- if (!buffer) { |
- gl->DeleteTextures(1, &texture); |
- DLOG(ERROR) << "Failed to allocate GPU memory buffer"; |
- return AllocatedSurface(); |
+ std::vector<gfx::GpuMemoryBuffer::Format> gpu_memory_buffer_formats; |
+ gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormats( |
+ internalformat_, &gpu_memory_buffer_formats); |
+ int num_buffers = gpu_memory_buffer_formats.size(); |
+ |
+ DCHECK_GE(num_buffers, 1); |
reveman
2015/03/04 05:56:00
I think it's correct to assume that the number of
emircan
2015/03/04 23:31:50
I agree that it is 1 currently. But if we were to
reveman
2015/03/05 19:35:31
I read the DCHECK wrong in my initial comment. I t
emircan
2015/03/09 21:07:22
Done. Reverted to original single buffer usage.
|
+ |
+ ScopedVector<gfx::GpuMemoryBuffer> buffers; |
+ ClientBuffer client_buffers[num_buffers]; |
+ for (int i = 0; i < num_buffers; ++i) { |
+ buffers.push_back( |
+ gpu_memory_buffer_manager_->AllocateGpuMemoryBufferForScanout( |
+ size_, gpu_memory_buffer_formats[i], |
+ surface_id_)); |
+ |
+ if (!buffers[i]) { |
+ gl->DeleteTextures(1, &texture); |
+ DLOG(ERROR) << "Failed to allocate GPU memory buffer"; |
+ return AllocatedSurface(); |
+ } |
+ |
+ client_buffers[i] = buffers[i]->AsClientBuffer(); |
} |
- unsigned int id = gl->CreateImageCHROMIUM( |
- buffer->AsClientBuffer(), size_.width(), size_.height(), internalformat_); |
+ unsigned int id = gl->CreateImageCHROMIUM(client_buffers, size_.width(), |
+ size_.height(), internalformat_); |
if (!id) { |
LOG(ERROR) << "Failed to allocate backing image surface"; |