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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_ozone.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_ozone.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc b/content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc
new file mode 100644
index 0000000000000000000000000000000000000000..69717063d329d5320c6ac013ac17d26ab71d12cc
--- /dev/null
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc
@@ -0,0 +1,99 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
reveman 2014/08/11 19:43:06 2014
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/gpu/client/gpu_memory_buffer_impl_ozone.h"
+
+#include "base/numerics/safe_math.h"
reveman 2014/08/11 19:43:05 I don't think you need this.
achaulk 2014/08/12 19:03:57 Done.
+#include "content/common/gpu/client/gpu_memory_buffer_factory_host.h"
+#include "ui/gl/gl_bindings.h"
+
+namespace content {
+// static
+uint32_t GpuMemoryBufferImplOzone::next_buffer_id_ = 0;
+
+GpuMemoryBufferImplOzone::GpuMemoryBufferImplOzone(const gfx::Size& size,
+ unsigned internalformat,
+ int32 client_id)
+ : GpuMemoryBufferImpl(size, internalformat) {
+ handle_.type = gfx::OZONE_NATIVE_BUFFER;
+ handle_.global_id.secondary_id = client_id;
+}
+
+GpuMemoryBufferImplOzone::~GpuMemoryBufferImplOzone() {
+}
+
+// static
+void GpuMemoryBufferImplOzone::AllocateSharedMemoryForChildProcess(
+ const gfx::Size& size,
+ unsigned internalformat,
+ base::ProcessHandle child_process,
+ int client_id,
+ GpuMemoryBufferFactoryHost* gpu_factory_host,
+ const AllocationCallback& callback) {
+ gfx::GpuMemoryBufferHandle handle;
+ handle.global_id.primary_id = GetNextBufferId();
+ handle.global_id.secondary_id = client_id;
+ handle.type = gfx::OZONE_NATIVE_BUFFER;
+ gpu_factory_host->CreateGpuMemoryBuffer(
+ handle, size, internalformat, GL_IMAGE_SCANOUT_CHROMIUM, callback);
reveman 2014/08/11 19:43:05 You should pass usage as a parameter to this funct
achaulk 2014/08/12 19:03:57 Isn't that what IsConfigurationSupported is for?
+}
+
+// static
+bool GpuMemoryBufferImplOzone::IsLayoutSupported(const gfx::Size& size,
+ unsigned internalformat) {
+ return true;
reveman 2014/08/11 19:43:05 IsFormatSupported instead, if any size is supporte
achaulk 2014/08/12 19:03:57 Done.
+}
+
+// static
+bool GpuMemoryBufferImplOzone::IsUsageSupported(unsigned usage) {
+ switch (usage) {
+ case GL_IMAGE_SCANOUT_CHROMIUM:
+ return true;
+ default:
+ return false;
+ }
+}
+
+// static
+bool GpuMemoryBufferImplOzone::IsConfigurationSupported(const gfx::Size& size,
+ unsigned internalformat,
+ unsigned usage) {
+ return IsLayoutSupported(size, internalformat) && IsUsageSupported(usage);
+}
+
+bool GpuMemoryBufferImplOzone::Initialize() {
+ handle_.global_id.primary_id = GetNextBufferId();
reveman 2014/08/11 19:43:06 I don't understand how this would work. How is the
achaulk 2014/08/12 19:03:57 This is for the browser path which we haven't fina
+ return true;
+}
+
+bool GpuMemoryBufferImplOzone::InitializeFromHandle(
+ const gfx::GpuMemoryBufferHandle& handle) {
+ handle_ = handle;
+ return true;
+}
+
+void* GpuMemoryBufferImplOzone::Map() {
+ NOTREACHED();
+ return NULL;
+}
+
+void GpuMemoryBufferImplOzone::Unmap() {
+ NOTREACHED();
+}
+
+uint32 GpuMemoryBufferImplOzone::GetStride() const {
+ NOTREACHED();
+ return 0;
+}
+
+gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzone::GetHandle() const {
+ return handle_;
+}
+
+// static
+uint32_t GpuMemoryBufferImplOzone::GetNextBufferId() {
+ return next_buffer_id_++;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698