From 0a7deaa0d6d14fcc21cad08d9acae688ed7c9fcb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Feb 2018 09:32:33 -0700 Subject: [PATCH] svga: let svga_update_state_retry() return a bool This will allow minor simplifications elsewhere. Reviewed-by: Charmaine Lee Reviewed-by: Neha Bhende --- src/gallium/drivers/svga/svga_state.c | 11 ++++++++--- 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 ); -- 2.30.2