Commit bd709ad9 authored by kalyan.kondapally's avatar kalyan.kondapally Committed by Commit bot

Dont set SwapInterval with Surfaceless.

EglSwapInterval doesn't take any effect when using a Surfacless
Context and will just return EGL_BAD_SURFACE in this case. This
patch adds checks to track if the current context is surfaceless
and ignores swap interval call in that case.

Tested by building Chromium with ChromesOS and
Ozone builds options and by launching chromium with the
following run time options:
chrome --no-sandbox --ozone-platform=gbm --ozone-use-surfaceless

After this change, I don't see any more EGL error as result of setting the SwapInterval
with surfaceless context during the launch time.
i.e. libEGL debug: EGL user error 0x300d (EGL_BAD_SURFACE) in eglSwapInterval

BUG=380861

Review URL: https://codereview.chromium.org/693313002

Cr-Commit-Position: refs/heads/master@{#302506}
parent 3b9ba02c
...@@ -173,7 +173,13 @@ void* GLContextEGL::GetHandle() { ...@@ -173,7 +173,13 @@ void* GLContextEGL::GetHandle() {
} }
void GLContextEGL::SetSwapInterval(int interval) { void GLContextEGL::SetSwapInterval(int interval) {
DCHECK(IsCurrent(NULL)); DCHECK(IsCurrent(NULL) && GLSurface::GetCurrent());
// This is a surfaceless context. eglSwapInterval doesn't take any effect in
// this case and will just return EGL_BAD_SURFACE.
if (GLSurface::GetCurrent()->IsSurfaceless())
return;
if (!eglSwapInterval(display_, interval)) { if (!eglSwapInterval(display_, interval)) {
LOG(ERROR) << "eglSwapInterval failed with error " LOG(ERROR) << "eglSwapInterval failed with error "
<< GetLastEGLErrorString(); << GetLastEGLErrorString();
......
...@@ -682,6 +682,10 @@ bool SurfacelessEGL::IsOffscreen() { ...@@ -682,6 +682,10 @@ bool SurfacelessEGL::IsOffscreen() {
return true; return true;
} }
bool SurfacelessEGL::IsSurfaceless() const {
return true;
}
bool SurfacelessEGL::SwapBuffers() { bool SurfacelessEGL::SwapBuffers() {
LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL."; LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL.";
return false; return false;
......
...@@ -131,6 +131,7 @@ class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { ...@@ -131,6 +131,7 @@ class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL {
bool Initialize() override; bool Initialize() override;
void Destroy() override; void Destroy() override;
bool IsOffscreen() override; bool IsOffscreen() override;
bool IsSurfaceless() const override;
bool SwapBuffers() override; bool SwapBuffers() override;
gfx::Size GetSize() override; gfx::Size GetSize() override;
bool Resize(const gfx::Size& size) override; bool Resize(const gfx::Size& size) override;
......
...@@ -144,7 +144,6 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL { ...@@ -144,7 +144,6 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
SwapBuffers(); SwapBuffers();
return true; return true;
} }
virtual bool IsSurfaceless() const override { return true; }
private: private:
virtual ~GLSurfaceOzoneSurfaceless() { virtual ~GLSurfaceOzoneSurfaceless() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment