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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.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_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index e14cf986092b9c8817dcd3024e2474890734c368..423d2e54f1fba61cffd3feea7262ee153e43cce1 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -940,11 +940,12 @@ void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback(
}
}
-void GpuCommandBufferStub::OnCreateImage(int32 id,
- gfx::GpuMemoryBufferHandle handle,
- gfx::Size size,
- gfx::GpuMemoryBuffer::Format format,
- uint32 internalformat) {
+void GpuCommandBufferStub::OnCreateImage(
+ int32 id,
+ std::vector<gfx::GpuMemoryBufferHandle> handles,
+ gfx::Size size,
+ std::vector<gfx::GpuMemoryBuffer::Format> formats,
+ uint32 internalformat) {
TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage");
if (!decoder_)
@@ -957,26 +958,32 @@ void GpuCommandBufferStub::OnCreateImage(int32 id,
return;
}
- if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported(
- format, decoder_->GetCapabilities())) {
- LOG(ERROR) << "Format is not supported.";
- return;
- }
+ int num_buffers =
+ gpu::ImageFactory::GpuMemoryBufferCountForImageFormat(internalformat);
+ CHECK_EQ(static_cast<int>(handles.size()), num_buffers);
reveman 2015/03/10 04:27:21 CHECKS here makes it possible for a malicious rend
emircan 2015/03/11 18:36:35 Done.
+ CHECK_EQ(static_cast<int>(formats.size()), num_buffers);
- if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(size,
- format)) {
- LOG(ERROR) << "Invalid image size for format.";
- return;
- }
-
- if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
- internalformat, format)) {
- LOG(ERROR) << "Incompatible image format.";
- return;
+ for (int i = 0; i < num_buffers; ++i) {
+ const gfx::GpuMemoryBuffer::Format& format = formats[i];
+ if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported(
+ format, decoder_->GetCapabilities())) {
+ LOG(ERROR) << "Format is not supported.";
+ return;
+ }
+ if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
+ size, format)) {
+ LOG(ERROR) << "Invalid image size for format.";
+ return;
+ }
+ if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
+ internalformat, i, format)) {
+ LOG(ERROR) << "Incompatible image format.";
+ return;
+ }
}
- scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer(
- handle, size, format, internalformat);
+ scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffers(
+ handles, size, formats, internalformat);
if (!image.get())
return;
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_memory_buffer_factory_io_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698