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

Unified Diff: content/common/gpu/client/command_buffer_proxy_impl.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: Handle through IPC. 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/common/gpu/client/command_buffer_proxy_impl.cc
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 75cffa2fdd0f5340391b23bbd493ab4b7bae6b19..c8a5b31ab56de11b99d6e24febbf0133f6cbf5be 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -347,7 +347,7 @@ gpu::Capabilities CommandBufferProxyImpl::GetCapabilities() {
return capabilities_;
}
-int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer,
+int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer* const buffers,
size_t width,
size_t height,
unsigned internalformat) {
@@ -359,32 +359,46 @@ int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager =
channel_->gpu_memory_buffer_manager();
- gfx::GpuMemoryBuffer* gpu_memory_buffer =
- gpu_memory_buffer_manager->GpuMemoryBufferFromClientBuffer(buffer);
- DCHECK(gpu_memory_buffer);
- // This handle is owned by the GPU process and must be passed to it or it
- // will leak. In otherwords, do not early out on error between here and the
- // sending of the CreateImage IPC below.
- bool requires_sync_point = false;
- gfx::GpuMemoryBufferHandle handle =
- channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(),
- &requires_sync_point);
-
- DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
- internalformat, gpu_memory_buffer->GetFormat()));
+ int num_buffers =
+ gpu::ImageFactory::GpuMemoryBufferCountForImageFormat(internalformat);
+
+ gfx::GpuMemoryBuffer* gpu_memory_buffers[num_buffers];
+ gfx::GpuMemoryBufferHandle* handles[num_buffers];
reveman 2015/03/04 05:56:00 A pointer to a handle is different from before. I
emircan 2015/03/04 23:31:50 Changed it std::vector<gfx::GpuMemoryBufferHandle>
+ gfx::GpuMemoryBuffer::Format formats[num_buffers];
+ bool requires_sync_point[num_buffers];
+ for (int i = 0; i < num_buffers; ++i) {
+ gpu_memory_buffers[i] =
+ gpu_memory_buffer_manager->GpuMemoryBufferFromClientBuffer(buffers[0]);
+ DCHECK(gpu_memory_buffers[i]);
+
+ formats[i] = gpu_memory_buffers[i]->GetFormat();
+ DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
+ internalformat, formats[i]));
+
+ requires_sync_point[i] = false;
+
+ // This handle is owned by the GPU process and must be passed to it or it
+ // will leak. In other words, do not early out on error between here and the
+ // sending of the CreateImage IPC below.
+ handles[i] = channel_->ShareGpuMemoryBufferToGpuProcess(
+ gpu_memory_buffers[i]->GetHandle(), &requires_sync_point[i]);
+ }
+
if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_,
new_id,
- handle,
+ handles,
reveman 2015/03/04 05:56:00 This doesn't work. You can't pass pointers over IP
emircan 2015/03/04 23:31:50 Changed it std::vector<gfx::GpuMemoryBufferHandle>
gfx::Size(width, height),
- gpu_memory_buffer->GetFormat(),
+ formats,
reveman 2015/03/04 05:56:00 ditto
emircan 2015/03/04 23:31:50 Changed it std::vector<gfx::GpuMemoryBuffer::Forma
internalformat))) {
return -1;
}
- if (requires_sync_point) {
- gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffer,
- InsertSyncPoint());
+ for (size_t i = 0; i < num_buffers; ++i) {
+ if (requires_sync_point[i]) {
+ gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffers[i],
+ InsertSyncPoint());
+ }
}
return new_id;
@@ -404,15 +418,29 @@ int32_t CommandBufferProxyImpl::CreateGpuMemoryBufferImage(
unsigned internalformat,
unsigned usage) {
CheckLock();
- scoped_ptr<gfx::GpuMemoryBuffer> buffer(
- channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer(
- gfx::Size(width, height),
- gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormat(internalformat),
- gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage)));
- if (!buffer)
- return -1;
- return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
+ 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/04 05:56:00 if we're going to assume one buffer here, why deal
emircan 2015/03/04 23:31:50 We assume >=1 buffer. I tried to account for the
reveman 2015/03/05 19:35:31 Sorry, misread that DCHECK.
+ DCHECK(channel_->gpu_memory_buffer_manager());
reveman 2015/03/04 05:56:00 any reason for adding this DCHECK? doesn't look li
emircan 2015/03/04 23:31:50 Removed.
+
+ ScopedVector<gfx::GpuMemoryBuffer> buffers;
+ ClientBuffer client_buffers[num_buffers];
+ for (int i = 0; i < num_buffers; ++i) {
+ buffers.push_back(
+ channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer(
+ gfx::Size(width, height), gpu_memory_buffer_formats[i],
+ gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage)));
+
+ if (!buffers[i])
+ return -1;
+
+ client_buffers[i] = buffers[i]->AsClientBuffer();
+ }
+ return CreateImage(client_buffers, width, height, internalformat);
}
int CommandBufferProxyImpl::GetRouteID() const {

Powered by Google App Engine
This is Rietveld 408576698