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

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: Added implementations of ImageFactory::CreateImageForGpuMemoryBuffers(). 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..0a3528a10300de4b1f8e308d322cf770521675ff 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -827,18 +827,39 @@ 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) {
+ int num_buffers =
+ gpu::ImageFactory::GpuMemoryBufferCountForImageFormat(internalformat);
+
+ // Make sure that the gives vectors have the correct size.
+ DCHECK_EQ(static_cast<int>(handles.size()), num_buffers);
+ DCHECK_EQ(static_cast<int>(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 (int 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: {
+ // TODO(emircan): See http://crbug.com/439520; support passing multiple
+ // buffers when new multi-planar formats are added.
+ if (num_buffers != 1) {
+ NOTIMPLEMENTED();
+ 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 +869,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