aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_surface.c
diff options
context:
space:
mode:
authorNeha Bhende <[email protected]>2020-05-26 21:29:50 +0530
committerMarge Bot <[email protected]>2020-06-05 06:36:54 +0000
commitba37d408da30d87b6848d76242d9d797dbef80a0 (patch)
tree87447cb12f6f5b7ca80c69308ae636639842b4c0 /src/gallium/drivers/svga/svga_surface.c
parentccb4ea5a43e89fcc93fff98c881639223f1538e5 (diff)
svga: Performance fixes
This is a squash commit of in house performance fixes and misc bug fixes for GL4.1 support. Performance fixes: * started using system memory for constant buffer to gain 3X performance boost with metro redux Misc bug fixes: * fixed usage of vertexid in shader * added empty control point phase in hull shader for zero ouput control point * misc shader signature fixes * fixed clip_distance input declaration * clearing the dirty bit for the surface while using direct map if surface is already flushed and there is no pending primitive This patch also uses SVGA_RETRY macro for commands retries. Part of it is already used in previous patch. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Signed-off-by: Neha Bhende <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5317>
Diffstat (limited to 'src/gallium/drivers/svga/svga_surface.c')
-rw-r--r--src/gallium/drivers/svga/svga_surface.c61
1 files changed, 17 insertions, 44 deletions
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index d3dd23d2d81..68edf1c21db 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -54,7 +54,6 @@ svga_texture_copy_region(struct svga_context *svga,
unsigned dst_x, unsigned dst_y, unsigned dst_z,
unsigned width, unsigned height, unsigned depth)
{
- enum pipe_error ret;
SVGA3dCopyBox box;
assert(svga_have_vgpu10(svga));
@@ -69,16 +68,9 @@ svga_texture_copy_region(struct svga_context *svga,
box.srcy = src_y;
box.srcz = src_z;
- ret = SVGA3D_vgpu10_PredCopyRegion(svga->swc,
- dst_handle, dstSubResource,
- src_handle, srcSubResource, &box);
- if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_vgpu10_PredCopyRegion(svga->swc,
- dst_handle, dstSubResource,
- src_handle, srcSubResource, &box);
- assert(ret == PIPE_OK);
- }
+ SVGA_RETRY(svga, SVGA3D_vgpu10_PredCopyRegion
+ (svga->swc, dst_handle, dstSubResource,
+ src_handle, srcSubResource, &box));
}
@@ -93,7 +85,6 @@ svga_texture_copy_handle(struct svga_context *svga,
unsigned width, unsigned height, unsigned depth)
{
struct svga_surface dst, src;
- enum pipe_error ret;
SVGA3dCopyBox box, *boxes;
assert(svga);
@@ -124,18 +115,11 @@ svga_texture_copy_handle(struct svga_context *svga,
dst_handle, dst_level, dst_x, dst_y, dst_z);
*/
- ret = SVGA3D_BeginSurfaceCopy(svga->swc,
- &src.base,
- &dst.base,
- &boxes, 1);
- if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_BeginSurfaceCopy(svga->swc,
- &src.base,
- &dst.base,
- &boxes, 1);
- assert(ret == PIPE_OK);
- }
+ SVGA_RETRY(svga, SVGA3D_BeginSurfaceCopy(svga->swc,
+ &src.base,
+ &dst.base,
+ &boxes, 1));
+
*boxes = box;
SVGA_FIFOCommitAll(svga->swc);
}
@@ -563,7 +547,7 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s)
* associated resource. We will then use the cloned surface view for
* render target.
*/
- for (shader = PIPE_SHADER_VERTEX; shader <= PIPE_SHADER_GEOMETRY; shader++) {
+ for (shader = PIPE_SHADER_VERTEX; shader <= PIPE_SHADER_TESS_EVAL; shader++) {
if (svga_check_sampler_view_resource_collision(svga, s->handle, shader)) {
SVGA_DBG(DEBUG_VIEWS,
"same resource used in shaderResource and renderTarget 0x%x\n",
@@ -601,11 +585,7 @@ 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 (SVGA3D_InvalidateGBSurface(svga->swc, stex->handle) != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_InvalidateGBSurface(svga->swc, stex->handle);
- assert(ret == PIPE_OK);
- }
+ SVGA_RETRY(svga, SVGA3D_InvalidateGBSurface(svga->swc, stex->handle));
stex->validated = TRUE;
}
@@ -670,7 +650,6 @@ svga_surface_destroy(struct pipe_context *pipe,
struct svga_surface *s = svga_surface(surf);
struct svga_texture *t = svga_texture(surf->texture);
struct svga_screen *ss = svga_screen(surf->texture->screen);
- enum pipe_error ret = PIPE_OK;
SVGA_STATS_TIME_PUSH(ss->sws, SVGA_STATS_TIME_DESTROYSURFACE);
@@ -689,8 +668,6 @@ svga_surface_destroy(struct pipe_context *pipe,
}
if (s->view_id != SVGA3D_INVALID_ID) {
- unsigned try;
-
/* The SVGA3D device will generate a device error if the
* render target view or depth stencil view is destroyed from
* a context other than the one it was created with.
@@ -702,18 +679,14 @@ svga_surface_destroy(struct pipe_context *pipe,
}
else {
assert(svga_have_vgpu10(svga));
- for (try = 0; try < 2; try++) {
- if (util_format_is_depth_or_stencil(s->base.format)) {
- ret = SVGA3D_vgpu10_DestroyDepthStencilView(svga->swc, s->view_id);
- }
- else {
- ret = SVGA3D_vgpu10_DestroyRenderTargetView(svga->swc, s->view_id);
- }
- if (ret == PIPE_OK)
- break;
- svga_context_flush(svga, NULL);
+ if (util_format_is_depth_or_stencil(s->base.format)) {
+ SVGA_RETRY(svga, SVGA3D_vgpu10_DestroyDepthStencilView(svga->swc,
+ s->view_id));
+ }
+ else {
+ SVGA_RETRY(svga, SVGA3D_vgpu10_DestroyRenderTargetView(svga->swc,
+ s->view_id));
}
- assert(ret == PIPE_OK);
util_bitmask_clear(svga->surface_view_id_bm, s->view_id);
}
}