svga: Remove the surface_invalidate winsys function
Instead unconditionally call SVGA3D_InvalidateGBSurface() since it's needed also for Linux for dirty buffers and operation without SurfaceDMA. For non-guest-backed operation, remove the surface cache surface invalidation altogether. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
#include "svga_screen.h"
|
||||
#include "svga_screen_cache.h"
|
||||
#include "svga_context.h"
|
||||
|
||||
#include "svga_cmd.h"
|
||||
|
||||
#define SVGA_SURFACE_CACHE_ENABLED 1
|
||||
|
||||
@@ -291,7 +291,12 @@ svga_screen_cache_add(struct svga_screen *svgascreen,
|
||||
|
||||
SVGA_DBG(DEBUG_CACHE|DEBUG_DMA,
|
||||
"cache sid %p\n", entry->handle);
|
||||
LIST_ADD(&entry->head, &cache->validated);
|
||||
|
||||
/* If we don't have gb objects, we don't need to invalidate. */
|
||||
if (sws->have_gb_objects)
|
||||
LIST_ADD(&entry->head, &cache->validated);
|
||||
else
|
||||
LIST_ADD(&entry->head, &cache->invalidated);
|
||||
|
||||
cache->total_size += surf_size;
|
||||
}
|
||||
@@ -355,6 +360,7 @@ svga_screen_cache_flush(struct svga_screen *svgascreen,
|
||||
entry = LIST_ENTRY(struct svga_host_surface_cache_entry, curr, head);
|
||||
|
||||
assert(entry->handle);
|
||||
assert(svga_have_gb_objects(svga));
|
||||
|
||||
if (sws->surface_is_flushed(sws, entry->handle)) {
|
||||
/* remove entry from the validated list */
|
||||
@@ -363,7 +369,7 @@ 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.
|
||||
*/
|
||||
if (svga->swc->surface_invalidate(svga->swc, entry->handle) != PIPE_OK) {
|
||||
if (SVGA3D_InvalidateGBSurface(svga->swc, entry->handle) != PIPE_OK) {
|
||||
MAYBE_UNUSED enum pipe_error ret;
|
||||
|
||||
/* Even though surface invalidation here is done after the command
|
||||
@@ -375,7 +381,7 @@ svga_screen_cache_flush(struct svga_screen *svgascreen,
|
||||
* this function itself is called inside svga_context_flush().
|
||||
*/
|
||||
svga->swc->flush(svga->swc, NULL);
|
||||
ret = svga->swc->surface_invalidate(svga->swc, entry->handle);
|
||||
ret = SVGA3D_InvalidateGBSurface(svga->swc, entry->handle);
|
||||
assert(ret == PIPE_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -591,9 +591,9 @@ 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.
|
||||
*/
|
||||
if (svga->swc->surface_invalidate(svga->swc, stex->handle) != PIPE_OK) {
|
||||
if (SVGA3D_InvalidateGBSurface(svga->swc, stex->handle) != PIPE_OK) {
|
||||
svga_context_flush(svga, NULL);
|
||||
ret = svga->swc->surface_invalidate(svga->swc, stex->handle);
|
||||
ret = SVGA3D_InvalidateGBSurface(svga->swc, stex->handle);
|
||||
assert(ret == PIPE_OK);
|
||||
}
|
||||
stex->validated = TRUE;
|
||||
|
||||
@@ -411,13 +411,6 @@ struct svga_winsys_context
|
||||
struct svga_winsys_surface *surface,
|
||||
boolean *rebind);
|
||||
|
||||
/**
|
||||
* Invalidate the content of this surface
|
||||
*/
|
||||
enum pipe_error
|
||||
(*surface_invalidate)(struct svga_winsys_context *swc,
|
||||
struct svga_winsys_surface *surface);
|
||||
|
||||
/**
|
||||
* Create and define a DX GB shader that resides in the device COTable.
|
||||
* Caller of this function will issue the DXDefineShader command.
|
||||
|
||||
@@ -816,7 +816,6 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws)
|
||||
vswc->base.flush = vmw_swc_flush;
|
||||
vswc->base.surface_map = vmw_svga_winsys_surface_map;
|
||||
vswc->base.surface_unmap = vmw_svga_winsys_surface_unmap;
|
||||
vswc->base.surface_invalidate = vmw_svga_winsys_surface_invalidate;
|
||||
|
||||
vswc->base.shader_create = vmw_svga_winsys_vgpu10_shader_create;
|
||||
vswc->base.shader_destroy = vmw_svga_winsys_vgpu10_shader_destroy;
|
||||
|
||||
@@ -176,19 +176,6 @@ vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc,
|
||||
mtx_unlock(&vsrf->mutex);
|
||||
}
|
||||
|
||||
enum pipe_error
|
||||
vmw_svga_winsys_surface_invalidate(struct svga_winsys_context *swc,
|
||||
struct svga_winsys_surface *surf)
|
||||
{
|
||||
/* this is a noop since surface invalidation is not needed for DMA path.
|
||||
* DMA is enabled when guest-backed surface is not enabled or
|
||||
* guest-backed dma is enabled. Since guest-backed dma is enabled
|
||||
* when guest-backed surface is enabled, that implies DMA is always enabled;
|
||||
* hence, surface invalidation is not needed.
|
||||
*/
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
void
|
||||
vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
|
||||
struct vmw_svga_winsys_surface *src)
|
||||
|
||||
@@ -94,8 +94,4 @@ void
|
||||
vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc,
|
||||
struct svga_winsys_surface *srf,
|
||||
boolean *rebind);
|
||||
enum pipe_error
|
||||
vmw_svga_winsys_surface_invalidate(struct svga_winsys_context *swc,
|
||||
struct svga_winsys_surface *srf);
|
||||
|
||||
#endif /* VMW_SURFACE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user