From b1c964447aeb12db49fe2e2d568dd51565d70ab4 Mon Sep 17 00:00:00 2001 From: Charmaine Lee Date: Mon, 3 Apr 2017 12:57:18 -0700 Subject: [PATCH] svga: remove redundant surface propagation Currently, surface propagation for colliding render target resource is done at framebuffer emit time for vgpu10. This patch adds the surface propagation for non-vgpu10 path to emit_fb_vgpu9() and removes the redundant surface copy at set time. Tested with MTT glretrace, piglit, NobelClinicianViewer, Turbine, Cinebench. Reviewed-by: Neha Bhende --- src/gallium/drivers/svga/svga_pipe_misc.c | 12 ------------ src/gallium/drivers/svga/svga_state_framebuffer.c | 8 ++++++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c index 725cf33f8c0..e5d37419cc2 100644 --- a/src/gallium/drivers/svga/svga_pipe_misc.c +++ b/src/gallium/drivers/svga/svga_pipe_misc.c @@ -121,18 +121,6 @@ svga_set_framebuffer_state(struct pipe_context *pipe, dst->height = fb->height; dst->nr_cbufs = fb->nr_cbufs; - /* Check if we need to propagate any of the render targets which we may - * be unbinding. - */ - for (i = 0; i < dst->nr_cbufs; i++) { - struct pipe_surface *s = i < fb->nr_cbufs ? fb->cbufs[i] : NULL; - if (dst->cbufs[i] && dst->cbufs[i] != s) { - if (svga_surface_needs_propagation(dst->cbufs[i])) { - svga_propagate_surface(svga, dst->cbufs[i], FALSE); - } - } - } - /* Check that all surfaces are the same size. * Actually, the virtual hardware may support rendertargets with * different size, depending on the host API and driver, diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c index 451266b63e8..146d9dcf5d3 100644 --- a/src/gallium/drivers/svga/svga_state_framebuffer.c +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c @@ -71,6 +71,10 @@ emit_fb_vgpu9(struct svga_context *svga) if (svga->curr.nr_fbs++ > MAX_RT_PER_BATCH) return PIPE_ERROR_OUT_OF_MEMORY; + /* Check to see if we need to propagate the render target surface */ + if (hw->cbufs[i] && svga_surface_needs_propagation(hw->cbufs[i])) + svga_propagate_surface(svga, hw->cbufs[i], TRUE); + ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i, curr->cbufs[i]); if (ret != PIPE_OK) @@ -85,6 +89,10 @@ emit_fb_vgpu9(struct svga_context *svga) if (ret != PIPE_OK) return ret; + /* Check to see if we need to propagate the depth stencil surface */ + if (hw->zsbuf && svga_surface_needs_propagation(hw->zsbuf)) + svga_propagate_surface(svga, hw->zsbuf, TRUE); + if (curr->zsbuf && util_format_is_depth_and_stencil(curr->zsbuf->format)) { ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL, -- 2.30.2