From: Charmaine Lee Date: Tue, 25 Apr 2017 20:27:51 +0000 (-0600) Subject: svga: Move rendertarget view related fields to hw_clear state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc30ac5c24d662718b6aa4fbc9917aa34ba55160;p=mesa.git svga: Move rendertarget view related fields to hw_clear state This patch moves the rendertarget view related fields from svga_hw_draw_state to svga_hw_clear_state where all the hw framebuffer related state resides. Reviewed-by: Brian Paul --- diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index a6f3b34890d..71505f646a5 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -241,6 +241,8 @@ svga_context_create(struct pipe_screen *screen, void *priv, unsigned flags) memset(&svga->state.hw_clear, 0xcd, sizeof(svga->state.hw_clear)); memset(&svga->state.hw_clear.framebuffer, 0x0, sizeof(svga->state.hw_clear.framebuffer)); + svga->state.hw_clear.num_rendertargets = 0; + svga->state.hw_clear.dsv = NULL; memset(&svga->state.hw_draw, 0xcd, sizeof(svga->state.hw_draw)); memset(&svga->state.hw_draw.views, 0x0, sizeof(svga->state.hw_draw.views)); @@ -251,8 +253,6 @@ svga_context_create(struct pipe_screen *screen, void *priv, unsigned flags) memset(svga->state.hw_draw.sampler_views, 0, sizeof(svga->state.hw_draw.sampler_views)); svga->state.hw_draw.num_views = 0; - svga->state.hw_draw.num_rendertargets = 0; - svga->state.hw_draw.dsv = NULL; svga->state.hw_draw.rasterizer_discard = FALSE; /* Initialize the shader pointers */ diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 3789a46bf50..a214f2cf902 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -324,6 +324,11 @@ struct svga_hw_clear_state struct pipe_framebuffer_state framebuffer; struct svga_prescale prescale; + + /* VGPU10 state */ + unsigned num_rendertargets; + struct pipe_surface *rtv[SVGA3D_MAX_RENDER_TARGETS]; + struct pipe_surface *dsv; }; struct svga_hw_view_state @@ -393,10 +398,6 @@ struct svga_hw_draw_state struct pipe_sampler_view *sampler_views[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 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 7fe09579c31..bb92c54ff3f 100644 --- a/src/gallium/drivers/svga/svga_state_framebuffer.c +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c @@ -247,9 +247,9 @@ emit_fb_vgpu10(struct svga_context *svga) } /* 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]))) { + if ((num_color != svga->state.hw_clear.num_rendertargets) || + (dsv != svga->state.hw_clear.dsv) || + memcmp(rtv, svga->state.hw_clear.rtv, num_color * sizeof(rtv[0]))) { ret = SVGA3D_vgpu10_SetRenderTargets(svga->swc, num_color, rtv, dsv); if (ret != PIPE_OK) @@ -258,9 +258,9 @@ emit_fb_vgpu10(struct svga_context *svga) /* number of render targets sent to the device, not including trailing * unbound render targets. */ - svga->state.hw_draw.num_rendertargets = last_rtv + 1; - svga->state.hw_draw.dsv = dsv; - memcpy(svga->state.hw_draw.rtv, rtv, num_color * sizeof(rtv[0])); + svga->state.hw_clear.num_rendertargets = last_rtv + 1; + svga->state.hw_clear.dsv = dsv; + memcpy(svga->state.hw_clear.rtv, rtv, num_color * sizeof(rtv[0])); for (i = 0; i < ss->max_color_buffers; i++) { if (hw->cbufs[i] != curr->cbufs[i]) { @@ -335,7 +335,7 @@ svga_reemit_framebuffer_bindings(struct svga_context *svga) enum pipe_error svga_rebind_framebuffer_bindings(struct svga_context *svga) { - struct svga_hw_draw_state *hw = &svga->state.hw_draw; + struct svga_hw_clear_state *hw = &svga->state.hw_clear; unsigned i; enum pipe_error ret; diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index 486d900e117..02df0ca3efc 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -751,15 +751,15 @@ svga_propagate_rendertargets(struct svga_context *svga) * not the svga->curr.framebuffer surfaces, because it's the former * surfaces which may be backing surface views (the actual render targets). */ - for (i = 0; i < svga->state.hw_draw.num_rendertargets; i++) { - struct pipe_surface *s = svga->state.hw_draw.rtv[i]; + for (i = 0; i < svga->state.hw_clear.num_rendertargets; i++) { + struct pipe_surface *s = svga->state.hw_clear.rtv[i]; if (s) { svga_propagate_surface(svga, s, FALSE); } } - if (svga->state.hw_draw.dsv) { - svga_propagate_surface(svga, svga->state.hw_draw.dsv, FALSE); + if (svga->state.hw_clear.dsv) { + svga_propagate_surface(svga, svga->state.hw_clear.dsv, FALSE); } }