summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_surface.c
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2017-06-21 15:35:38 -0700
committerBrian Paul <[email protected]>2017-06-22 13:33:48 -0600
commit3fbdab8778d3b55ed6053a3781e92aeff85ca174 (patch)
tree3222d94ad76883ba77815f9cbac2d70ff0797176 /src/gallium/drivers/svga/svga_surface.c
parent08cb8cf2566719307203d6a7ae4c1d8b56342bd1 (diff)
svga: fix pre-mature flushing of the command buffer
When surface_invalidate is called to invalidate a newly created surface in svga_validate_surface_view(), it is possible that the command buffer is already full, and in this case, currently, the associated wddm winsys function will flush the command buffer and resend the invalidate surface command. However, this can pre-maturely flush the command buffer if there is still pending image updates to be patched. To fix the problem, this patch will add a return status to the surface_invalidate interface and if it returns FALSE, the caller will call svga_context_flush() to do the proper context flush. Note, we don't call svga_context_flush() if surface_invalidate() fails when flushing the screen surface cache though, because it is already in the process of context flush, all the image updates are already patched, calling svga_context_flush() can trigger a deadlock. So in this case, we call the winsys context flush interface directly to flush the command buffer. Fixes driver errors and graphics corruption running Tropics. VMware bug 1891975. Also tested with MTT glretrace, piglit and various OpenGL apps such as Heaven, CinebenchR15, NobelClinicianViewer, Lightsmark, GoogleEarth. cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_surface.c')
-rw-r--r--src/gallium/drivers/svga/svga_surface.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index 04173266ff0..29d91fd3221 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -531,7 +531,11 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s)
* need to update the host-side copy with the invalid
* content when the associated mob is first bound to the surface.
*/
- svga->swc->surface_invalidate(svga->swc, stex->handle);
+ if (svga->swc->surface_invalidate(svga->swc, stex->handle) != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = svga->swc->surface_invalidate(svga->swc, stex->handle);
+ assert(ret == PIPE_OK);
+ }
stex->validated = TRUE;
}