summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/svga/svga_screen_cache.c16
-rw-r--r--src/gallium/drivers/svga/svga_surface.c6
-rw-r--r--src/gallium/drivers/svga/svga_winsys.h2
-rw-r--r--src/gallium/winsys/svga/drm/vmw_surface.c3
-rw-r--r--src/gallium/winsys/svga/drm/vmw_surface.h2
5 files changed, 24 insertions, 5 deletions
diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c
index bf66fc60105..0816ff68c8a 100644
--- a/src/gallium/drivers/svga/svga_screen_cache.c
+++ b/src/gallium/drivers/svga/svga_screen_cache.c
@@ -362,7 +362,21 @@ svga_screen_cache_flush(struct svga_screen *svgascreen,
/* It is now safe to invalidate the surface content.
* It will be done using the current context.
*/
- svga->swc->surface_invalidate(svga->swc, entry->handle);
+ if (svga->swc->surface_invalidate(svga->swc, entry->handle) != PIPE_OK) {
+ enum pipe_error ret;
+
+ /* Even though surface invalidation here is done after the command
+ * buffer is flushed, it is still possible that it will
+ * fail because there might be just enough of this command that is
+ * filling up the command buffer, so in this case we will call
+ * the winsys flush directly to flush the buffer.
+ * Note, we don't want to call svga_context_flush() here because
+ * this function itself is called inside svga_context_flush().
+ */
+ svga->swc->flush(svga->swc, NULL);
+ ret = svga->swc->surface_invalidate(svga->swc, entry->handle);
+ assert(ret == PIPE_OK);
+ }
/* add the entry to the invalidated list */
LIST_ADD(&entry->head, &cache->invalidated);
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;
}
diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
index 8b8b45b47f4..8823c115db5 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -407,7 +407,7 @@ struct svga_winsys_context
/**
* Invalidate the content of this surface
*/
- void
+ enum pipe_error
(*surface_invalidate)(struct svga_winsys_context *swc,
struct svga_winsys_surface *surface);
diff --git a/src/gallium/winsys/svga/drm/vmw_surface.c b/src/gallium/winsys/svga/drm/vmw_surface.c
index 80cc0914cc0..04aa932784b 100644
--- a/src/gallium/winsys/svga/drm/vmw_surface.c
+++ b/src/gallium/winsys/svga/drm/vmw_surface.c
@@ -176,7 +176,7 @@ vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc,
mtx_unlock(&vsrf->mutex);
}
-void
+enum pipe_error
vmw_svga_winsys_surface_invalidate(struct svga_winsys_context *swc,
struct svga_winsys_surface *surf)
{
@@ -186,6 +186,7 @@ vmw_svga_winsys_surface_invalidate(struct svga_winsys_context *swc,
* when guest-backed surface is enabled, that implies DMA is always enabled;
* hence, surface invalidation is not needed.
*/
+ return PIPE_OK;
}
void
diff --git a/src/gallium/winsys/svga/drm/vmw_surface.h b/src/gallium/winsys/svga/drm/vmw_surface.h
index d6f2381220a..0fdc8de1d56 100644
--- a/src/gallium/winsys/svga/drm/vmw_surface.h
+++ b/src/gallium/winsys/svga/drm/vmw_surface.h
@@ -94,7 +94,7 @@ void
vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc,
struct svga_winsys_surface *srf,
boolean *rebind);
-void
+enum pipe_error
vmw_svga_winsys_surface_invalidate(struct svga_winsys_context *swc,
struct svga_winsys_surface *srf);