summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2016-06-28 16:09:59 -0700
committerBrian Paul <[email protected]>2016-07-05 16:58:29 -0600
commit32651c67d14b9aa408eaae9c9a36bc04c399ee39 (patch)
treede6e8f688f6b4052a0bc826e83daabcb794f822d /src/gallium/drivers/svga
parentaa7d42a5f9d8f491ca3a1fdaa61ee7058398f80f (diff)
svga: avoid emitting redundant DXSetRenderTargets command
Tested with Lightsmark2008, MTT piglit, glretrace, conform. Reviewed-by: Sinclair Yeh <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_context.h4
-rw-r--r--src/gallium/drivers/svga/svga_state_framebuffer.c46
2 files changed, 32 insertions, 18 deletions
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index 4f1c07ec4b1..49c6030325f 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -368,6 +368,10 @@ struct svga_hw_draw_state
unsigned num_samplers[PIPE_SHADER_TYPES];
SVGA3dSamplerId samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+ unsigned num_rendertargets;
+ struct pipe_surface *rtv[SVGA3D_MAX_RENDER_TARGETS];
+ struct pipe_surface *dsv;
+
/* used for rebinding */
unsigned num_sampler_views[PIPE_SHADER_TYPES];
unsigned default_constbuf_size[PIPE_SHADER_TYPES];
diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
index 4b0400bf80a..12efc4960d5 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -169,7 +169,7 @@ emit_fb_vgpu10(struct svga_context *svga)
struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer;
const unsigned num_color = MAX2(curr->nr_cbufs, hw->nr_cbufs);
unsigned i;
- enum pipe_error ret;
+ enum pipe_error ret = PIPE_OK;
assert(svga_have_vgpu10(svga));
@@ -204,28 +204,38 @@ emit_fb_vgpu10(struct svga_context *svga)
dsv = NULL;
}
- ret = SVGA3D_vgpu10_SetRenderTargets(svga->swc, num_color, rtv, dsv);
- if (ret != PIPE_OK)
- return ret;
+ /* avoid emitting redundant SetRenderTargets command */
+ if ((num_color != svga->state.hw_draw.num_rendertargets) ||
+ (dsv != svga->state.hw_draw.dsv) ||
+ memcmp(rtv, svga->state.hw_draw.rtv, num_color * sizeof(rtv[0]))) {
- for (i = 0; i < ss->max_color_buffers; i++) {
- if (hw->cbufs[i] != curr->cbufs[i]) {
- /* propagate the backed view surface before unbinding it */
- if (hw->cbufs[i] && svga_surface(hw->cbufs[i])->backed) {
- svga_propagate_surface(svga,
- &svga_surface(hw->cbufs[i])->backed->base);
+ ret = SVGA3D_vgpu10_SetRenderTargets(svga->swc, num_color, rtv, dsv);
+ if (ret != PIPE_OK)
+ return ret;
+
+ svga->state.hw_draw.num_rendertargets = num_color;
+ svga->state.hw_draw.dsv = dsv;
+ memcpy(svga->state.hw_draw.rtv, rtv, num_color * sizeof(rtv[0]));
+
+ for (i = 0; i < ss->max_color_buffers; i++) {
+ if (hw->cbufs[i] != curr->cbufs[i]) {
+ /* propagate the backed view surface before unbinding it */
+ if (hw->cbufs[i] && svga_surface(hw->cbufs[i])->backed) {
+ svga_propagate_surface(svga,
+ &svga_surface(hw->cbufs[i])->backed->base);
+ }
+ pipe_surface_reference(&hw->cbufs[i], curr->cbufs[i]);
}
- pipe_surface_reference(&hw->cbufs[i], curr->cbufs[i]);
}
- }
- hw->nr_cbufs = curr->nr_cbufs;
+ hw->nr_cbufs = curr->nr_cbufs;
- if (hw->zsbuf != curr->zsbuf) {
- /* propagate the backed view surface before unbinding it */
- if (hw->zsbuf && svga_surface(hw->zsbuf)->backed) {
- svga_propagate_surface(svga, &svga_surface(hw->zsbuf)->backed->base);
+ if (hw->zsbuf != curr->zsbuf) {
+ /* propagate the backed view surface before unbinding it */
+ if (hw->zsbuf && svga_surface(hw->zsbuf)->backed) {
+ svga_propagate_surface(svga, &svga_surface(hw->zsbuf)->backed->base);
+ }
+ pipe_surface_reference(&hw->zsbuf, curr->zsbuf);
}
- pipe_surface_reference(&hw->zsbuf, curr->zsbuf);
}
return ret;