| 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.
|
| }
|
|
|