Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9b7590e authored by Romain Hunault's avatar Romain Hunault 🚴🏻
Browse files

ColorFade: fix EGL crash on exynos4 mali blobs

parent 525e8fef
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.opengl.GLES20;
import android.opengl.GLES11Ext;
import android.os.SystemProperties;
import android.util.Slog;
import android.view.DisplayInfo;
import android.view.Surface.OutOfResourcesException;
@@ -71,6 +72,9 @@ final class ColorFade {
    // See code for details.
    private static final int DEJANK_FRAMES = 3;

    private static final boolean DESTROY_SURFACE_AFTER_DETACH =
            SystemProperties.getBoolean("ro.egl.destroy_after_detach", false);

    private final int mDisplayId;

    // Set to true when the animation context has been fully prepared.
@@ -330,10 +334,15 @@ final class ColorFade {
                destroyScreenshotTexture();
                destroyGLShaders();
                destroyGLBuffers();
                if (!DESTROY_SURFACE_AFTER_DETACH) {
                    destroyEglSurface();
                }
            } finally {
                detachEglContext();
            }
            if (DESTROY_SURFACE_AFTER_DETACH) {
                destroyEglSurface();
            }
            // This is being called with no active context so shouldn't be
            // needed but is safer to not change for now.
            GLES20.glFlush();