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

Unified Diff: content/browser/compositor/buffer_queue.cc

Issue 962723002: Change CHROMIUM_image declarations to support multi planar input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ImageFactory::CreateImageForGpuMemoryBuffer interface changes. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
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/05 19:35:32 I don't think this code need to support multiple p
emircan 2015/03/09 21:07:22 Done. Reverted to original single buffer usage. I
+
+ 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";

Powered by Google App Engine
This is Rietveld 408576698