Module: Mesa
Branch: master
Commit: 0a7deaa0d6d14fcc21cad08d9acae688ed7c9fcb
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a7deaa0d6d14fcc21cad08d9acae688ed7c9fcb

Author: Brian Paul <bri...@vmware.com>
Date:   Thu Feb 22 09:32:33 2018 -0700

svga: let svga_update_state_retry() return a bool

This will allow minor simplifications elsewhere.

Reviewed-by: Charmaine Lee <charmai...@vmware.com>
Reviewed-by: Neha Bhende <bhen...@vmware.com>

---

 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 9ca6a18e0f..dad78389a2 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 04b20e161f..d75617860e 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 );
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to