diff options
author | Charmaine Lee <[email protected]> | 2016-10-26 16:15:23 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-11-03 14:29:23 -0600 |
commit | 8a195e2fd59886b4f47c7761bda96478bb0f8f95 (patch) | |
tree | 0db28b278146bbd22e54f2ad45e9baa265e3bbda /src/gallium/drivers/svga/svga_surface.c | |
parent | 06bba2452f00d6fa8a4b233567995af0480a3f4d (diff) |
svga: invalidate new surface before it is bound to a render target view
Invalidate a "new" surface before it is bound to a render target view or
depth stencil view in order to avoid the unnecessary host side copy
of the surface data before it is rendered to.
Note that, recycled surface is already invalidated before it is reused.
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.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index 2ffdce5e10c..cf0052727df 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -120,6 +120,7 @@ svga_texture_view_surface(struct svga_context *svga, struct svga_winsys_surface *handle; uint32_t i, j; unsigned z_offset = 0; + boolean validated; SVGA_DBG(DEBUG_PERF, "svga: Create surface view: layer %d zslice %d mips %d..%d\n", @@ -156,7 +157,8 @@ svga_texture_view_surface(struct svga_context *svga, } SVGA_DBG(DEBUG_DMA, "surface_create for texture view\n"); - handle = svga_screen_surface_create(ss, bind_flags, PIPE_USAGE_DEFAULT, key); + handle = svga_screen_surface_create(ss, bind_flags, PIPE_USAGE_DEFAULT, + &validated, key); if (!handle) { key->cachable = 0; return NULL; @@ -434,6 +436,23 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s) if (s && s->view_id == SVGA3D_INVALID_ID) { SVGA3dResourceType resType; SVGA3dRenderTargetViewDesc desc; + struct svga_texture *stex = svga_texture(s->base.texture); + + if (stex->validated == FALSE) { + assert(stex->handle); + + /* We are about to render into a surface that has not been validated. + * First invalidate the surface so that the device does not + * need to update the host-side copy with the invalid + * content when the associated mob is first bound to the surface. + */ + ret = SVGA3D_InvalidateGBSurface(svga->swc, stex->handle); + if (ret != PIPE_OK) { + s = NULL; + goto done; + } + stex->validated = TRUE; + } desc.tex.mipSlice = s->real_level; desc.tex.firstArraySlice = s->real_layer + s->real_zslice; @@ -481,6 +500,7 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s) } } +done: SVGA_STATS_TIME_POP(svga_sws(svga)); return s ? &s->base : NULL; |