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

Unified Diff: content/common/gpu/gpu_channel.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: reveman@ comments. Created 5 years, 9 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/common/gpu/gpu_channel.cc
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index c12c762c6004f725973182513535274cc6ac2cc7..4df55ea251328faa550a26f32c0d5259bf73c8d3 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -827,18 +827,38 @@ uint64 GpuChannel::GetMemoryUsage() {
return size;
}
-scoped_refptr<gfx::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer(
- const gfx::GpuMemoryBufferHandle& handle,
+scoped_refptr<gfx::GLImage> GpuChannel::CreateImageForGpuMemoryBuffers(
+ const std::vector<gfx::GpuMemoryBufferHandle>& handles,
const gfx::Size& size,
- gfx::GpuMemoryBuffer::Format format,
+ const std::vector<gfx::GpuMemoryBuffer::Format>& formats,
uint32 internalformat) {
- switch (handle.type) {
+ size_t num_buffers =
+ gpu::ImageFactory::NumberOfPlanesForImageFormat(internalformat);
+
+ // Make sure that the gives vectors have the correct size.
+ DCHECK_EQ(handles.size(), num_buffers);
+ DCHECK_EQ(formats.size(), num_buffers);
+
+ // Check if all the handle types are equal, and if they aren't, return an
+ // empty image.
+ gfx::GpuMemoryBufferType handle_type = handles[0].type;
+ for (size_t i = 1; i < num_buffers; ++i) {
+ if (handles[i].type != handle_type)
+ return scoped_refptr<gfx::GLImage>();
+ }
+
+ switch (handle_type) {
case gfx::SHARED_MEMORY_BUFFER: {
+ if (num_buffers != 1) {
+ DLOG(ERROR)
+ << "SHARED_MEMORY_BUFFER doesn't support multi-plane formats.";
+ return scoped_refptr<gfx::GLImage>();
+ }
+
scoped_refptr<gfx::GLImageSharedMemory> image(
new gfx::GLImageSharedMemory(size, internalformat));
- if (!image->Initialize(handle, format))
+ if (!image->Initialize(handles[0], formats[0]))
return scoped_refptr<gfx::GLImage>();
-
return image;
}
default: {
@@ -848,11 +868,8 @@ scoped_refptr<gfx::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer(
return manager->gpu_memory_buffer_factory()
->AsImageFactory()
- ->CreateImageForGpuMemoryBuffer(handle,
- size,
- format,
- internalformat,
- client_id_);
+ ->CreateImageForGpuMemoryBuffers(handles, size, formats,
+ internalformat, client_id_);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698