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

Unified Diff: ui/gl/gl_image_foobar.cc

Issue 186123006: zero copy - NOT FOR REVIEW Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minus ui-map-image and ui-impl-side setting, plus tiled mode Created 6 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
« no previous file with comments | « ui/gl/gl_image_foobar.h ('k') | ui/gl/gl_image_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_foobar.cc
diff --git a/ui/gl/gl_image_foobar.cc b/ui/gl/gl_image_foobar.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f5137c15933cd06e18218464d73f96a45c92c744
--- /dev/null
+++ b/ui/gl/gl_image_foobar.cc
@@ -0,0 +1,60 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/debug/trace_event.h"
+
+#include "ui/gl/gl_bindings.h"
+#include "ui/gl/gl_image_foobar.h"
+
+namespace gfx {
+
+GLImageFoobar::GLImageFoobar(gfx::Size size) : size_(size), prime_fd(-1) {
+}
+
+GLImageFoobar::~GLImageFoobar() {
+ Destroy();
+}
+
+bool GLImageFoobar::Initialize(gfx::GpuMemoryBufferHandle buffer) {
+ prime_fd = dup(buffer.handle.fd);
+ return prime_fd >= 0;
+}
+
+void GLImageFoobar::Destroy() {
+ if (prime_fd >= 0)
+ close(prime_fd);
+}
+
+gfx::Size GLImageFoobar::GetSize() {
+ return size_;
+}
+
+#define MAGIC(x) ( (void*) ((((uintptr_t)x) << 48) + 0xf00ba4f00ba4) )
+
+bool GLImageFoobar::BindTexImage(unsigned target) {
+ TRACE_EVENT0("zcopy", "BindTexImage");
+ glTexImage2D(
+ target,
+ 0, // mip level
+ GL_BGRA_EXT,
+ size_.width(),
+ size_.height(),
+ 0, // border
+ GL_BGRA_EXT,
+ GL_UNSIGNED_BYTE,
+ MAGIC(prime_fd)
+ );
+ return true;
+}
+
+void GLImageFoobar::ReleaseTexImage(unsigned target) {
+}
+
+void GLImageFoobar::WillUseTexImage() {
+}
+
+void GLImageFoobar::DidUseTexImage() {
+}
+
+} // namespace gfx
« no previous file with comments | « ui/gl/gl_image_foobar.h ('k') | ui/gl/gl_image_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698