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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_linux.cc

Issue 458313002: Browser side OZONE_NATIVE_BUFFER allocation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more ifdefs Created 6 years, 4 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/gpu_memory_buffer_impl_linux.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc b/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc
index 0fc371b99dac9f24de68c5c5d347bec58863eca8..cf9341a5185b674c66f01befc33818dc6e11f4cd 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc
@@ -4,15 +4,33 @@
#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
+#include "content/common/gpu/client/gpu_memory_buffer_impl_ozone.h"
#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
namespace content {
+#if defined(USE_OZONE)
reveman 2014/08/11 19:43:05 No idefs in these files. Please add a platform spe
achaulk 2014/08/12 19:03:56 Ok
+namespace {
+const int kBrowserClientId = 1;
+} // namespace
+#endif // defined(USE_OZONE)
// static
scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create(
const gfx::Size& size,
unsigned internalformat,
unsigned usage) {
+#if defined(USE_OZONE)
+ if (GpuMemoryBufferImplOzone::IsConfigurationSupported(
+ size, internalformat, usage)) {
+ scoped_ptr<GpuMemoryBufferImplOzone> buffer(
+ new GpuMemoryBufferImplOzone(size, internalformat, kBrowserClientId));
+ if (!buffer->Initialize())
+ return scoped_ptr<GpuMemoryBufferImpl>();
+
+ return buffer.PassAs<GpuMemoryBufferImpl>();
+ }
+#endif // defined(USE_OZONE)
reveman 2014/08/11 19:43:05 do we need browser compositor support for this?
achaulk 2014/08/12 19:03:57 Not for using them. We will eventually to render t
reveman 2014/08/12 20:19:11 I'm failing to see how this works. Latest patch is
achaulk 2014/08/12 21:38:01 That is something that we will need to figure out
+
if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
size, internalformat, usage)) {
scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer(
@@ -32,7 +50,22 @@ void GpuMemoryBufferImpl::AllocateForChildProcess(
unsigned internalformat,
unsigned usage,
base::ProcessHandle child_process,
+ int client_id,
+ GpuMemoryBufferFactoryHost* gpu_factory_host,
const AllocationCallback& callback) {
+#if defined(USE_OZONE)
+ if (GpuMemoryBufferImplOzone::IsConfigurationSupported(
+ size, internalformat, usage)) {
+ GpuMemoryBufferImplOzone::AllocateSharedMemoryForChildProcess(
+ size,
+ internalformat,
+ child_process,
+ client_id,
+ gpu_factory_host,
+ callback);
+ return;
+ }
+#endif // defined(USE_OZONE)
if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
size, internalformat, usage)) {
GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess(
@@ -64,6 +97,16 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
return buffer.PassAs<GpuMemoryBufferImpl>();
}
+#if defined(USE_OZONE)
+ case gfx::OZONE_NATIVE_BUFFER: {
+ scoped_ptr<GpuMemoryBufferImplOzone> buffer(
+ new GpuMemoryBufferImplOzone(size, internalformat, 0));
+ if (!buffer->InitializeFromHandle(handle))
+ return scoped_ptr<GpuMemoryBufferImpl>();
+
+ return buffer.PassAs<GpuMemoryBufferImpl>();
+ }
+#endif // defined(USE_OZONE)
default:
return scoped_ptr<GpuMemoryBufferImpl>();
}

Powered by Google App Engine
This is Rietveld 408576698