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

Unverified Commit dfc52958 authored by Dominggoes Isakh's avatar Dominggoes Isakh Committed by Michael Bestas
Browse files

ColorFade: fix EGL crash on exynos4 mali blobs

Change-Id: Ic14a3208486cf61a054cb9532d74c5a46d7f784d
parent 49936e12
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;
@@ -70,6 +71,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.
@@ -331,10 +335,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();