intel: When checking for updating front buffer reading, use the right fb.
authorEric Anholt <eric@anholt.net>
Mon, 3 Mar 2014 18:13:46 +0000 (10:13 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 11 Mar 2014 19:46:59 +0000 (12:46 -0700)
commit66073ef438623f27dbbd01ba25189e5d4f0d9ae0
tree6fc624c9a6dbf425c7382d1da176943997c92d29
parente1a9a54464c31f7b3b69d686d82f425dffb65f40
intel: When checking for updating front buffer reading, use the right fb.

It's the ctx->ReadBuffer that gets read from, not the ctx->DrawBuffer.
So, if you happened to have a ctx->ReadBuffer that was the winsys buffer,
and it had previously been intel_prepare_render()ed but not invalidated
since then, and you called glReadBuffer() to switch to front buffer
instead of back buffer reading on the winsys fbo while your drawbuffer was
a user FBO, you'd never get the front buffer's miptree fetched, and
segfault.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i915/intel_buffers.c
src/mesa/drivers/dri/i965/intel_buffers.c