[Mesa-dev] [PATCH] fix regression caused by b4bb6680200b5a898583392f4c831c02f41e63f7
Xiang, Haihao
haihao.xiang at intel.com
Wed Nov 10 18:14:14 PST 2010
On Thu, 2010-11-11 at 01:47 +0800, Jerome Glisse wrote:
> On Wed, Nov 10, 2010 at 12:28 PM, Eric Anholt <eric at anholt.net> wrote:
> > On Wed, 10 Nov 2010 08:25:19 +0800, "Xiang, Haihao" <haihao.xiang at intel.com> wrote:
> >> Any comment? If no problem, I will check in this fix.
> >
> > This should really be part of the core -- all drivers have to flush when
> > changing current context.
>
> Agree.
>
I think the core should take pending commands into account, or we saw
many rendering errors previously. The problem is that b4bb6680 set the
current context to NULL in some DRI drivers.
Anyway, how about this one?
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b60875b..292a9a6 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1381,6 +1381,7 @@ GLboolean
_mesa_make_current( struct gl_context *newCtx, struct gl_framebuffer *drawBuffer,
struct gl_framebuffer *readBuffer )
{
+ GET_CURRENT_CONTEXT(curCtx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(newCtx, "_mesa_make_current()\n");
@@ -1401,6 +1402,11 @@ _mesa_make_current( struct gl_context *newCtx, struct gl_framebuffer *drawBuffer
}
}
+ if (curCtx &&
+ (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && /* make sure this context is valid for flushing */
+ curCtx != newCtx)
+ _mesa_flush(curCtx);
+
/* We used to call _glapi_check_multithread() here. Now do it in drivers */
_glapi_set_context((void *) newCtx);
ASSERT(_mesa_get_current_context() == newCtx);
More information about the mesa-dev
mailing list