Skip to content

Commit

Permalink
Fix eglMakeCurrent and eglDestroySurface validation checks
Browse files Browse the repository at this point in the history
eglMakeCurrent and eglDestroySurface validation checks fail and exit
earlier after device lost were detected, preventing the release of
surface and underling swap chain.
This makes it impossible to recreate device after device lost.

b/329326128
  • Loading branch information
alexanderbobrovnik committed Jan 10, 2025
1 parent 2ee62f0 commit acc760f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions third_party/angle/src/libANGLE/validationEGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,8 @@ Error ValidateMakeCurrent(Display *display, Surface *draw, Surface *read, gl::Co
ANGLE_TRY(ValidateContext(display, context));
}

if (display->isInitialized() && display->isDeviceLost())
if (display->isInitialized() && display->isDeviceLost() &&
(context != EGL_NO_CONTEXT || draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
{
return EglContextLost();
}
Expand Down Expand Up @@ -3059,7 +3060,17 @@ Error ValidateDestroySurface(const Display *display,
const Surface *surface,
const EGLSurface eglSurface)
{
ANGLE_TRY(ValidateSurface(display, surface));
ANGLE_TRY(ValidateDisplayPointer(display));

if (!display->isInitialized())
{
return EglNotInitialized() << "display is not initialized.";
}

if (!display->isValidSurface(surface))
{
return EglBadSurface();
}

if (eglSurface == EGL_NO_SURFACE)
{
Expand Down

0 comments on commit acc760f

Please sign in to comment.