diff options
author | Brian Paul <[email protected]> | 2018-02-22 09:32:33 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-03-02 12:23:50 -0700 |
commit | 0a7deaa0d6d14fcc21cad08d9acae688ed7c9fcb (patch) | |
tree | 6a64e98338b63b90a08262b677ed6b4cc695410b | |
parent | 35c5cf895920a24062af73d108d20110c2057305 (diff) |
svga: let svga_update_state_retry() return a bool
This will allow minor simplifications elsewhere.
Reviewed-by: Charmaine Lee <[email protected]>
Reviewed-by: Neha Bhende <[email protected]>
-rw-r--r-- | src/gallium/drivers/svga/svga_state.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_state.h | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/gallium/drivers/svga/svga_state.c b/src/gallium/drivers/svga/svga_state.c index 9ca6a18e0f0..dad78389a23 100644 --- a/src/gallium/drivers/svga/svga_state.c +++ b/src/gallium/drivers/svga/svga_state.c @@ -237,19 +237,24 @@ done: } -void +/** + * Update state. If the first attempt fails, flush the command buffer + * and retry. + * \return true if success, false if second attempt fails. + */ +bool svga_update_state_retry(struct svga_context *svga, unsigned max_level) { enum pipe_error ret; ret = svga_update_state( svga, max_level ); - if (ret == PIPE_ERROR_OUT_OF_MEMORY) { + if (ret != PIPE_OK) { svga_context_flush(svga, NULL); ret = svga_update_state( svga, max_level ); } - assert( ret == PIPE_OK ); + return ret == PIPE_OK; } diff --git a/src/gallium/drivers/svga/svga_state.h b/src/gallium/drivers/svga/svga_state.h index 04b20e161fe..d75617860e6 100644 --- a/src/gallium/drivers/svga/svga_state.h +++ b/src/gallium/drivers/svga/svga_state.h @@ -91,9 +91,7 @@ extern struct svga_tracked_state svga_update_swtnl_vdecl; enum pipe_error svga_update_state( struct svga_context *svga, unsigned level ); -void svga_update_state_retry( struct svga_context *svga, - unsigned level ); - +bool svga_update_state_retry(struct svga_context *svga, unsigned level); enum pipe_error svga_emit_initial_state( struct svga_context *svga ); |