[Mesa-dev] Early calls to st_validate_state
imirkin at alum.mit.edu
Thu Jun 25 18:04:14 PDT 2015
A user reported a crash in wine in finalize_textures (called via
st_validate_state). In this particular case it was happening through
st_BlitFramebuffer (piglit test sent), but there are a number of
callsites of st_validate_state from st/mesa.
The reason it dies is that the fragment program isn't specified. Of
course if that assumption were relaxed, it'd just crash later on in
the process. Even though we specify _MaintainTexEnvProgram, that only
gets bound somewhere down the line.
One solution, which solved a number of different crashes for this user
was to call _mesa_update_state(ctx) when making a context current for
the first time. This normalizes a bunch of state, including setting
the fragment/vertex programs which avoids the crash. Is this the right
Another thought I had was to call _mesa_update_state() from
st_validate_state directly -- all the various state updates rely on
mesa state being reasonable, and it seems to make sense to first flush
those changes (which might e.g. update the currently-bound program, or
all sorts of other things), and only then process the st's updates.
However I'm unfamiliar with the reasoning behind the current system,
so perhaps I'm also just missing something. Thoughts welcome.
More information about the mesa-dev