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

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 17265006: wayland patch for inspection Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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_surface_egl.h ('k') | ui/gl/gl_surface_wayland.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 84efbc61764e7211326b3814901c33e2e81c3be6..79be060c4ffa45444cfb095ba45912bdb157ffd9 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -28,6 +28,12 @@ extern "C" {
#include "ui/base/ozone/surface_factory_ozone.h"
#endif
+#if defined(USE_WAYLAND)
+#include "ui/wayland/wayland_display.h"
+#include "ui/wayland/wayland_window.h"
+#include <wayland-egl.h>
+#endif
+
using ui::GetLastEGLErrorString;
namespace gfx {
@@ -94,7 +100,9 @@ bool GLSurfaceEGL::InitializeOneOff() {
ui::SurfaceFactoryOzone::GetInstance()->InitializeHardware();
#endif
-#if defined(USE_X11)
+#if defined(USE_WAYLAND)
+ g_native_display = ui::WaylandDisplay::GetDisplay()->display();
+#elif defined(USE_X11)
g_native_display = base::MessagePumpForUI::GetDefaultXDisplay();
#else
g_native_display = EGL_DEFAULT_DISPLAY;
@@ -119,7 +127,12 @@ bool GLSurfaceEGL::InitializeOneOff() {
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
+ EGL_SURFACE_TYPE,
+#if defined(USE_WAYLAND)
+ EGL_WINDOW_BIT,
+#else
+ EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
+#endif
EGL_NONE
};
@@ -158,7 +171,7 @@ bool GLSurfaceEGL::InitializeOneOff() {
initialized = true;
#if defined(USE_X11) || defined(OS_ANDROID) \
- || defined(USE_OZONE)
+ || defined(USE_OZONE) || defined(USE_WAYLAND)
return true;
#else
g_software_native_display = EGL_SOFTWARE_DISPLAY_ANGLE;
@@ -267,7 +280,11 @@ bool NativeViewGLSurfaceEGL::Initialize(VSyncProvider* sync_provider) {
surface_ = eglCreateWindowSurface(
GetDisplay(),
GetConfig(),
+#if defined(USE_WAYLAND)
+ window_->egl_window(),
+#else
window_,
+#endif
gfx::g_driver_egl.ext.b_EGL_NV_post_sub_buffer ?
egl_window_attributes_sub_buffer :
NULL);
@@ -304,7 +321,7 @@ void NativeViewGLSurfaceEGL::Destroy() {
}
EGLConfig NativeViewGLSurfaceEGL::GetConfig() {
-#if !defined(USE_X11)
+#if !defined(USE_X11) || defined(USE_WAYLAND)
return software_ ? g_software_config : g_config;
#else
if (!config_) {
@@ -390,7 +407,6 @@ bool NativeViewGLSurfaceEGL::SwapBuffers() {
<< GetLastEGLErrorString();
return false;
}
-
return true;
}
@@ -408,6 +424,9 @@ gfx::Size NativeViewGLSurfaceEGL::GetSize() {
}
bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size) {
+#if defined(USE_WAYLAND)
+ window_->ScheduleResize(size.width(), size.height());
+#endif
if (size == GetSize())
return true;
@@ -501,6 +520,14 @@ bool PbufferGLSurfaceEGL::Initialize() {
return false;
}
+#if defined(USE_WAYLAND)
+ wsurf_ = ui::WaylandDisplay::GetDisplay()->CreateSurface();
+ wwindow_ = wl_egl_window_create(wsurf_, size_.width(), size_.height());
+ EGLSurface new_surface = eglCreateWindowSurface(GetDisplay(),
+ GetConfig(),
+ wwindow_,
+ NULL);
+#else
// Allocate the new pbuffer surface before freeing the old one to ensure
// they have different addresses. If they have the same address then a
// future call to MakeCurrent might early out because it appears the current
@@ -514,6 +541,7 @@ bool PbufferGLSurfaceEGL::Initialize() {
EGLSurface new_surface = eglCreatePbufferSurface(display,
GetConfig(),
pbuffer_attribs);
+#endif
if (!new_surface) {
LOG(ERROR) << "eglCreatePbufferSurface failed with error "
<< GetLastEGLErrorString();
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_wayland.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698