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

Unified Diff: components/exo/display.cc

Issue 1427743004: exo: Add support for wl_drm version 2 to wayland bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wayland-drm-third-party
Patch Set: fix unit test and nit Created 5 years, 1 month 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 | « components/exo/display.h ('k') | components/exo/display_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/display.cc
diff --git a/components/exo/display.cc b/components/exo/display.cc
index b13c7fe828224065966c2dc9e8bd5422c79a5567..51a353ace0d2c9d435c6338a5e7c62150b84f46f 100644
--- a/components/exo/display.cc
+++ b/components/exo/display.cc
@@ -11,6 +11,14 @@
#include "components/exo/sub_surface.h"
#include "components/exo/surface.h"
+#if defined(USE_OZONE)
+#include "components/exo/buffer.h"
+#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
+#include "third_party/khronos/GLES2/gl2.h"
+#include "third_party/khronos/GLES2/gl2ext.h"
+#include "ui/aura/env.h"
+#endif
+
namespace exo {
////////////////////////////////////////////////////////////////////////////////
@@ -37,6 +45,33 @@ scoped_ptr<SharedMemory> Display::CreateSharedMemory(
return make_scoped_ptr(new SharedMemory(handle));
}
+#if defined(USE_OZONE)
+scoped_ptr<Buffer> Display::CreatePrimeBuffer(base::ScopedFD fd,
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ int stride) {
+ TRACE_EVENT1("exo", "Display::CreatePrimeBuffer", "size", size.ToString());
+
+ gfx::GpuMemoryBufferHandle handle;
+ handle.type = gfx::OZONE_NATIVE_PIXMAP;
+ handle.native_pixmap_handle.fd = base::FileDescriptor(fd.Pass());
+ handle.native_pixmap_handle.stride = stride;
+
+ scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
+ aura::Env::GetInstance()
+ ->context_factory()
+ ->GetGpuMemoryBufferManager()
+ ->CreateGpuMemoryBufferFromHandle(handle, size, format);
+ if (!gpu_memory_buffer) {
+ LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle";
+ return nullptr;
+ }
+
+ return make_scoped_ptr(
+ new Buffer(gpu_memory_buffer.Pass(), GL_TEXTURE_EXTERNAL_OES));
+}
+#endif
+
scoped_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) {
TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface",
surface->AsTracedValue());
« no previous file with comments | « components/exo/display.h ('k') | components/exo/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698