Mesa (master): svga: change error handling convention for svga_set_stream_output()
Brian Paul
brianp at kemper.freedesktop.org
Fri Jun 30 14:29:54 UTC 2017
Module: Mesa
Branch: master
Commit: 4f3974d7586070fe72a9ef09d3df3f24b4a49f43
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f3974d7586070fe72a9ef09d3df3f24b4a49f43
Author: Brian Paul <brianp at vmware.com>
Date: Thu Jun 22 14:45:07 2017 -0600
svga: change error handling convention for svga_set_stream_output()
In general, the functions which emit commands to the command buffer check
for failure and return a PIPE_ERROR_x code. It's up to the caller to
flush the buffer and retry the command.
But svga_set_stream_output() did its own flushing and the callers never
checked the return value (though, it would always be PIPE_OK) in practice.
This patch changes svga_set_stream_output() so that it does not call
svga_context_flush() when the buffer is full. And we update the callers
to check the return value as we do for other functions, like
svga_set_shader().
No Piglit regressions. Also tested w/ Nature demo.
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
---
src/gallium/drivers/svga/svga_pipe_streamout.c | 13 +++++--------
src/gallium/drivers/svga/svga_state_gs.c | 10 ++++++++--
src/gallium/drivers/svga/svga_state_vs.c | 7 +++++--
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/svga/svga_pipe_streamout.c b/src/gallium/drivers/svga/svga_pipe_streamout.c
index 4add087888..3f30e648c0 100644
--- a/src/gallium/drivers/svga/svga_pipe_streamout.c
+++ b/src/gallium/drivers/svga/svga_pipe_streamout.c
@@ -157,7 +157,6 @@ enum pipe_error
svga_set_stream_output(struct svga_context *svga,
struct svga_stream_output *streamout)
{
- enum pipe_error ret = PIPE_OK;
unsigned id = streamout ? streamout->id : SVGA3D_INVALID_ID;
if (!svga_have_vgpu10(svga)) {
@@ -168,17 +167,15 @@ svga_set_stream_output(struct svga_context *svga,
streamout, id);
if (svga->current_so != streamout) {
- /* Save current SO state */
- svga->current_so = streamout;
-
- ret = SVGA3D_vgpu10_SetStreamOutput(svga->swc, id);
+ enum pipe_error ret = SVGA3D_vgpu10_SetStreamOutput(svga->swc, id);
if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_vgpu10_SetStreamOutput(svga->swc, id);
+ return ret;
}
+
+ svga->current_so = streamout;
}
- return ret;
+ return PIPE_OK;
}
void
diff --git a/src/gallium/drivers/svga/svga_state_gs.c b/src/gallium/drivers/svga/svga_state_gs.c
index 217463882f..19f0887d2b 100644
--- a/src/gallium/drivers/svga/svga_state_gs.c
+++ b/src/gallium/drivers/svga/svga_state_gs.c
@@ -201,11 +201,17 @@ emit_hw_gs(struct svga_context *svga, unsigned dirty)
* it instead of the one from the vertex shader.
*/
if (svga_have_gs_streamout(svga)) {
- svga_set_stream_output(svga, gs->base.stream_output);
+ ret = svga_set_stream_output(svga, gs->base.stream_output);
+ if (ret != PIPE_OK) {
+ goto done;
+ }
}
else if (!svga_have_vs_streamout(svga)) {
/* turn off stream out */
- svga_set_stream_output(svga, NULL);
+ ret = svga_set_stream_output(svga, NULL);
+ if (ret != PIPE_OK) {
+ goto done;
+ }
}
/* SVGA_NEW_NEED_SWTNL */
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
index 325ef3ebad..a0ab868cbb 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -353,11 +353,14 @@ emit_hw_vs(struct svga_context *svga, unsigned dirty)
/* No GS stream out */
if (svga_have_vs_streamout(svga)) {
/* Set VS stream out */
- svga_set_stream_output(svga, vs->base.stream_output);
+ ret = svga_set_stream_output(svga, vs->base.stream_output);
}
else {
/* turn off stream out */
- svga_set_stream_output(svga, NULL);
+ ret = svga_set_stream_output(svga, NULL);
+ }
+ if (ret != PIPE_OK) {
+ goto done;
}
}
More information about the mesa-commit
mailing list