i965g: add lots of error checks and early returns
authorKeith Whitwell <keithw@vmware.com>
Thu, 5 Nov 2009 13:57:05 +0000 (13:57 +0000)
committerKeith Whitwell <keithw@vmware.com>
Thu, 5 Nov 2009 14:01:37 +0000 (14:01 +0000)
commitc796aed5ddad011d66e631c4cafdbf779e73f213
treed8a510233b281c9d6a0690632948f10a03819a84
parent31b8b1dd36d9f07a7893a89ee985d83c4d0bb95b
i965g: add lots of error checks and early returns

Any allocation that may fail should be checked, and propogate the
error upwards.  At the highest level we will flush batch and retry.

This is an alternate strategy to what the original DRI driver did of
attempting to flush batch from the lowest levels (eg inside
BEGIN_BATCH).  The trouble with that strategy was that flushes could
occur at unexpected times, and additionally there was a need for a
wierd notification mechanism to propogate the 'lost context' state
back up to higher levels.

Propogating the errors directly gives us a lot of flexibility how to
deal with these states, at the expense of a lot more checking in the
code.

Will add some sanity checks later to make sure that out-of-memory
conditions are properly escalated and not lost halfway up the stack.
35 files changed:
src/gallium/drivers/i965/brw_batchbuffer.c
src/gallium/drivers/i965/brw_batchbuffer.h
src/gallium/drivers/i965/brw_cc.c
src/gallium/drivers/i965/brw_clip.c
src/gallium/drivers/i965/brw_clip_state.c
src/gallium/drivers/i965/brw_context.c
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/i965/brw_curbe.c
src/gallium/drivers/i965/brw_draw.c
src/gallium/drivers/i965/brw_draw_upload.c
src/gallium/drivers/i965/brw_eu.c
src/gallium/drivers/i965/brw_eu.h
src/gallium/drivers/i965/brw_gs.c
src/gallium/drivers/i965/brw_gs_state.c
src/gallium/drivers/i965/brw_pipe_query.c
src/gallium/drivers/i965/brw_pipe_shader.c
src/gallium/drivers/i965/brw_pipe_vertex.c
src/gallium/drivers/i965/brw_screen_buffers.c
src/gallium/drivers/i965/brw_screen_surface.c
src/gallium/drivers/i965/brw_screen_texture.c
src/gallium/drivers/i965/brw_sf.c
src/gallium/drivers/i965/brw_sf_state.c
src/gallium/drivers/i965/brw_state.h
src/gallium/drivers/i965/brw_state_cache.c
src/gallium/drivers/i965/brw_state_upload.c
src/gallium/drivers/i965/brw_vs.c
src/gallium/drivers/i965/brw_vs_state.c
src/gallium/drivers/i965/brw_vs_surface_state.c
src/gallium/drivers/i965/brw_winsys.h
src/gallium/drivers/i965/brw_wm.c
src/gallium/drivers/i965/brw_wm_constant_buffer.c
src/gallium/drivers/i965/brw_wm_sampler_state.c
src/gallium/drivers/i965/brw_wm_state.c
src/gallium/drivers/i965/brw_wm_surface_state.c
src/gallium/winsys/drm/i965/xlib/xlib_i965.c