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

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, fix scoped_ptr NULL check, make use_wayland_egl default to true Created 4 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/ozone/platform/wayland/wayland_egl_surface.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 545016f7771e98d3134b76efc3f6ba769a6b0b62..f254eb4c58afe7cf04e757e772d8037ea753e033 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,21 +129,24 @@ WaylandSurfaceFactory::WaylandSurfaceFactory(WaylandDisplay* display)
WaylandSurfaceFactory::~WaylandSurfaceFactory() {}
intptr_t WaylandSurfaceFactory::GetNativeDisplay() {
- NOTIMPLEMENTED();
- return 0;
+ 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(
gfx::AcceleratedWidget widget) {
- DCHECK(display_);
WaylandWindow* window = display_->GetWindow(widget);
DCHECK(window);
return make_scoped_ptr(new WaylandCanvasSurface(display_, window));
@@ -146,8 +154,17 @@ scoped_ptr<SurfaceOzoneCanvas> WaylandSurfaceFactory::CreateCanvasForWidget(
scoped_ptr<SurfaceOzoneEGL> WaylandSurfaceFactory::CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
- NOTREACHED();
+#if defined(USE_WAYLAND_EGL)
+ 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(
« no previous file with comments | « 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