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

Unified Diff: ui/gl/gl_image_x11.cc

Issue 288343004: working copy of "zero_copy" Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 years, 6 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.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_x11.cc
===================================================================
--- ui/gl/gl_image_x11.cc (revision 277402)
+++ ui/gl/gl_image_x11.cc (working copy)
@@ -4,7 +4,9 @@
#include "ui/gl/gl_image.h"
+#include <linux/types.h>
#include "base/debug/trace_event.h"
+#include "ui/gl/gl_image_egl.h"
#include "ui/gl/gl_image_glx.h"
#include "ui/gl/gl_image_shm.h"
#include "ui/gl/gl_image_stub.h"
@@ -12,6 +14,10 @@
namespace gfx {
+#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
+ ((__u32)(c) << 16) | ((__u32)(d) << 24))
+#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4')
+
scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) {
TRACE_EVENT0("gpu", "GLImage::CreateGLImage");
switch (GetGLImplementation()) {
@@ -52,6 +58,28 @@
return image;
}
+
+ case DMA_BUFFER: {
+ // TODO(kalyan): We should get stride as part of buffer handle ?
+ EGLint attr[] = {
+ EGL_WIDTH, size.width(),
+ EGL_HEIGHT, size.height(),
+ EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888,
+ EGL_DMA_BUF_PLANE0_FD_EXT, buffer.handle.fd,
+ EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
+ EGL_DMA_BUF_PLANE0_PITCH_EXT, buffer.stride,
+ EGL_NONE
+ };
+
+ scoped_refptr<GLImageEGL> image(
+ new GLImageEGL(size));
+ if (!image->Initialize(EGL_LINUX_DMA_BUF_EXT,
+ (EGLClientBuffer)NULL,
+ attr))
+ return NULL;
+
+ return image;
+ }
default:
NOTREACHED();
return NULL;
« no previous file with comments | « ui/gl/gl.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698