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

Unified Diff: ui/ozone/platform/wayland/wayland_surface_factory.cc

Issue 1704243003: ozone/platform/wayland: Implement SurfaceOzoneEGL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, drop dependency on pointer patchset Created 4 years, 10 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: ui/ozone/platform/wayland/wayland_surface_factory.cc
diff --git a/ui/ozone/platform/wayland/wayland_surface_factory.cc b/ui/ozone/platform/wayland/wayland_surface_factory.cc
index ff667e3f59994e8772b8f890e4ef896e79bfaf46..2e33f79f7b195bdca7062b3c6f53e331760eee75 100644
--- a/ui/ozone/platform/wayland/wayland_surface_factory.cc
+++ b/ui/ozone/platform/wayland/wayland_surface_factory.cc
@@ -11,12 +11,17 @@
#include "base/memory/shared_memory.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/vsync_provider.h"
+#include "ui/ozone/common/egl_util.h"
#include "ui/ozone/platform/wayland/wayland_display.h"
#include "ui/ozone/platform/wayland/wayland_object.h"
#include "ui/ozone/platform/wayland/wayland_window.h"
#include "ui/ozone/public/surface_ozone_canvas.h"
#include "ui/ozone/public/surface_ozone_egl.h"
+#if defined(USE_WAYLAND_EGL)
+#include "ui/ozone/platform/wayland/wayland_egl_surface.h"
+#endif
+
namespace ui {
static void DeleteSharedMemory(void* pixels, void* context) {
@@ -124,16 +129,21 @@ WaylandSurfaceFactory::WaylandSurfaceFactory(WaylandDisplay* display)
WaylandSurfaceFactory::~WaylandSurfaceFactory() {}
intptr_t WaylandSurfaceFactory::GetNativeDisplay() {
- NOTIMPLEMENTED();
- return 0;
+ DCHECK(display_);
+ return reinterpret_cast<intptr_t>(display_->display());
}
bool WaylandSurfaceFactory::LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
- // This Ozone implementation does not support multi-process rendering so
- // disable EGL unconditionally for now.
+#if defined(USE_WAYLAND_EGL)
+ if (!display_)
+ return false;
+ setenv("EGL_PLATFORM", "wayland", 0);
+ return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address);
+#else
return false;
+#endif
}
scoped_ptr<SurfaceOzoneCanvas> WaylandSurfaceFactory::CreateCanvasForWidget(
@@ -146,8 +156,18 @@ scoped_ptr<SurfaceOzoneCanvas> WaylandSurfaceFactory::CreateCanvasForWidget(
scoped_ptr<SurfaceOzoneEGL> WaylandSurfaceFactory::CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
- NOTREACHED();
+#if defined(USE_WAYLAND_EGL)
+ DCHECK(display_);
spang 2016/02/24 16:12:11 It's not useful to DCHECK if you immediately deref
Michael Forney 2016/02/24 22:46:41 Done.
+ WaylandWindow* window = display_->GetWindow(widget);
+ DCHECK(window);
+ auto surface = make_scoped_ptr(
+ new WaylandEGLSurface(window, window->GetBounds().size()));
+ if (!surface->Initialize())
+ return nullptr;
+ return std::move(surface);
+#else
return nullptr;
+#endif
}
scoped_refptr<NativePixmap> WaylandSurfaceFactory::CreateNativePixmap(
« ui/ozone/platform/wayland/BUILD.gn ('K') | « ui/ozone/platform/wayland/wayland_egl_surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698