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

Unified Diff: ui/gl/gl_surface_ozone.cc

Issue 1738973004: Fix EGL configs with GLSurfaceOzoneSurfaceless. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added format SURFACE_SURFACELESS. 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/gl/gl_surface_egl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_ozone.cc
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc
index 2ca519da4ac932d8324790d7e4be2cb6151a7326..d28d081adbae32bc79ce166c18e06a6a03555edc 100644
--- a/ui/gl/gl_surface_ozone.cc
+++ b/ui/gl/gl_surface_ozone.cc
@@ -55,6 +55,15 @@ bool EglGetConfigAttribute(EGLDisplay display,
return eglGetConfigAttrib(display, config, attribute, value);
}
+// Populates EglConfigCallbacks with appropriate callbacks.
+ui::EglConfigCallbacks GetEglConfigCallbacks(EGLDisplay display) {
+ ui::EglConfigCallbacks callbacks;
+ callbacks.choose_config = base::Bind(EglChooseConfig, display);
+ callbacks.get_config_attribute = base::Bind(EglGetConfigAttribute, display);
+ callbacks.get_last_error_string = base::Bind(&ui::GetLastEGLErrorString);
+ return callbacks;
+}
+
void WaitForFence(EGLDisplay display, EGLSyncKHR fence) {
eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
EGL_FOREVER_KHR);
@@ -137,14 +146,8 @@ bool GLSurfaceOzoneEGL::ScheduleOverlayPlane(int z_order,
EGLConfig GLSurfaceOzoneEGL::GetConfig() {
if (!config_) {
- // Setup callbacks for configuring EGL on platform.
- EGLDisplay display = GetDisplay();
- ui::EglConfigCallbacks egl;
- egl.choose_config = base::Bind(EglChooseConfig, display);
- egl.get_config_attribute = base::Bind(EglGetConfigAttribute, display);
- egl.get_last_error_string = base::Bind(&ui::GetLastEGLErrorString);
-
- config_ = ozone_surface_->GetEGLSurfaceConfig(egl);
+ ui::EglConfigCallbacks callbacks = GetEglConfigCallbacks(GetDisplay());
+ config_ = ozone_surface_->GetEGLSurfaceConfig(callbacks);
}
if (config_)
return config_;
@@ -208,6 +211,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
int width,
int height,
const SwapCompletionCallback& callback) override;
+ EGLConfig GetConfig() override;
protected:
struct PendingFrame {
@@ -399,6 +403,16 @@ void GLSurfaceOzoneSurfaceless::PostSubBufferAsync(
SwapBuffersAsync(callback);
}
+EGLConfig GLSurfaceOzoneSurfaceless::GetConfig() {
+ if (!config_) {
+ ui::EglConfigCallbacks callbacks = GetEglConfigCallbacks(GetDisplay());
+ config_ = ozone_surface_->GetEGLSurfaceConfig(callbacks);
+ }
+ if (config_)
+ return config_;
+ return SurfacelessEGL::GetConfig();
+}
+
GLSurfaceOzoneSurfaceless::~GLSurfaceOzoneSurfaceless() {
Destroy(); // The EGL surface must be destroyed before SurfaceOzone.
}
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698