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

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: 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_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..4aaaa728c41beb9118227d580e22596d4d53dc03 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,47 @@ void GpuCommandBufferStub::OnCreateImage(int32 id,
return;
}
- if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported(
- format, decoder_->GetCapabilities())) {
- LOG(ERROR) << "Format is not supported.";
+ if (!gpu::ImageFactory::IsImageFormatSupported(internalformat)) {
+ LOG(ERROR) << "Internalformat is not supported.";
return;
}
- if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(size,
- format)) {
- LOG(ERROR) << "Invalid image size for format.";
+ size_t num_buffers =
+ gpu::ImageFactory::NumberOfPlanesForImageFormat(internalformat);
+
+ // Checks to make sure that the input isn't coming from a malicious renderer.
+ if (handles.size() != num_buffers) {
+ LOG(ERROR) << "Invalid number of GpuMemoryBufferHandle given for "
+ "internalformat.";
return;
}
-
- if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
- internalformat, format)) {
- LOG(ERROR) << "Incompatible image format.";
+ if (formats.size() != num_buffers) {
+ LOG(ERROR) << "Invalid number of GpuMemoryBuffer::Format given for "
+ "internalformat.";
return;
}
- scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer(
- handle, size, format, internalformat);
+ for (size_t 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()->CreateImageForGpuMemoryBuffers(
+ handles, size, formats, internalformat);
if (!image.get())
return;

Powered by Google App Engine
This is Rietveld 408576698