[Mesa-dev] [PATCH 6/8] intel: Don't flush the old context in intelMakeCurrent

Neil Roberts neil at linux.intel.com
Thu Oct 16 10:18:38 PDT 2014

Ian Romanick <idr at freedesktop.org> writes:

> I'm a little bit skeptical of this.  _mesa_make_current doesn't call
> intelMakeCurrent.  intelMakeCurrent calls _mesa_make_current, and it
> calls _mesa_make_current much later in this function.  By the time
> _mesa_make_current is called, a bunch of driver state has been
> changed... and I bet the later call to _mesa_flush will do bad things.
> This also seems like a really tough bug to trigger. :(

Hrm, looking at it a bit more with gdb, it looks like the call to
_mesa_flush in intelMakeCurrent is never actually used at least with
GLX. The reason is that MakeContextCurrent in glxcurrent.c first calls
unbind if there is a context before calling bind. This calls
intelUnbindContext which in turn calls _mesa_make_current(NULL…). So I
guess that means whenever intelMakeCurrent is called then curCtx is
always NULL.

The call to _mesa_flush in _mesa_make_current was added in 93102b4c. In
the log message for that commit it says that that was to fix a
regression since b4bb668020. That commit is actually the one that adds
_mesa_make_current(NULL) in intelUnbindContext so I guess that makes

If it's true that the flush is never actually hit then I think it would
be good to remove it regardless of this patch series. However if we are
worried that not flushing when switching contexts will mess up some
expectations in intelMakeCurrent then we have a bigger problem that the
extension is not going to work at all. I guess I should try to explore
intelMakeCurrent in a bit more detail to try to determine whether it's
ok not to flush.

- Neil

More information about the mesa-dev mailing list