diff options
author | Rob Clark <[email protected]> | 2016-10-26 16:52:52 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-11-07 10:23:26 -0500 |
commit | a5e733c6b52e93de3000647d075f5ca2f55fcb71 (patch) | |
tree | dbc49a71b25e44f209040d3adb46f12be5d93baf /src/mesa/main | |
parent | cc495055cdfe7e39002180d095d09fe4b6905eb9 (diff) |
mesa: drop current draw/read buffer when ctx is released
This fixes a problem seen with gallium drivers vs android wallpaper.
Basically, what happens is:
EGLSurface tmpSurface = mEgl.eglCreatePbufferSurface(mEglDisplay, mEglConfig, attribs);
mEgl.eglMakeCurrent(mEglDisplay, tmpSurface, tmpSurface, mEglContext);
int[] maxSize = new int[1];
Rect frame = surfaceHolder.getSurfaceFrame();
glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxSize, 0);
mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
mEgl.eglDestroySurface(mEglDisplay, tmpSurface);
... check maxSize vs frame size and bail if needed ...
mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay, mEglConfig, surfaceHolder, null);
... error checking ...
mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
When the window-surface is created, it ends up with the same ptr address
as the recently freed tmpSurface pbuffer surface. Which after many
levels of indirection, results in st_framebuffer_validate() ending up with
the same/old framebuffer object, and in the end never calling the
DRIimageLoaderExtension::getBuffers(). Then in droid_swap_buffers(), the
dri2_surf is still the old pbuffer surface (with dri2_surf->buffer being
NULL, obviously, so when wallpaper app calls eglSwapBuffers() nothing
gets enqueued to the compositor). Resulting in a black/blank background
layer.
Note that at the EGL layer, when the context is unbound, EGL drops it's
references to the draw and read buffer as well.
Signed-off-by: Rob Clark <[email protected]>
Tested-by: Robert Foss <[email protected]>
Acked-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/context.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index c62575c08ab..80bee16d453 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1651,6 +1651,10 @@ _mesa_make_current( struct gl_context *newCtx, if (!newCtx) { _glapi_set_dispatch(NULL); /* none current */ + if (curCtx) { + _mesa_reference_framebuffer(&curCtx->WinSysDrawBuffer, NULL); + _mesa_reference_framebuffer(&curCtx->WinSysReadBuffer, NULL); + } } else { _glapi_set_dispatch(newCtx->CurrentDispatch); |