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

Commit 0e00045e authored by Mike Stroyan's avatar Mike Stroyan Committed by android-build-merger
Browse files

Merge "egl: handle failed eglMakeCurrent EGL_NO_CONTEXT" into oc-dev

am: 2153f5e3

Change-Id: I6c36e59dc595bd6a494561a49b98b0f2d479ecfe
parents 1b8bd96e 2153f5e3
Loading
Loading
Loading
Loading
+14 −18
Original line number Diff line number Diff line
@@ -829,19 +829,15 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
            egl_tls_t::setContext(EGL_NO_CONTEXT);
        }
    } else {

        if (cur_c != NULL) {
            // Force return to current context for drivers that cannot handle errors
            EGLBoolean restore_result = EGL_FALSE;

            // get a reference to the old current objects
            ContextRef _c2(dp.get(), cur_c);
            SurfaceRef _d2(dp.get(), cur_c->draw);
            SurfaceRef _r2(dp.get(), cur_c->read);

        if (cur_c == NULL) {
            restore_result = dp->makeCurrent(c, cur_c,
                    EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT,
                    EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
        } else {
            c = cur_c;
            impl_ctx = c->context;
            impl_draw = EGL_NO_SURFACE;
@@ -857,7 +853,6 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
            restore_result = dp->makeCurrent(c, cur_c,
                    cur_c->draw, cur_c->read, cur_c->context,
                    impl_draw, impl_read, impl_ctx);
        }
            if (restore_result == EGL_TRUE) {
                _c2.acquire();
                _r2.acquire();
@@ -865,6 +860,7 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
            } else {
                ALOGE("Could not restore original EGL context");
            }
        }
        // this will ALOGE the error
        egl_connection_t* const cnx = &gEGLImpl;
        result = setError(cnx->egl.eglGetError(), (EGLBoolean)EGL_FALSE);