[Mesa-dev] [PATCH 4/4] radeonsi: Write htile state to SI hardware.
Marek Olšák
maraeo at gmail.com
Thu Dec 5 09:17:38 PST 2013
On Tue, Dec 3, 2013 at 9:33 PM, Andreas Hartmetz <ahartmetz at gmail.com> wrote:
> ---
> src/gallium/drivers/radeonsi/si_state.c | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
> index 24c9cf3..7b1a6df 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -757,7 +757,19 @@ static void *si_create_dsa_state(struct pipe_context *ctx,
> db_depth_control |= S_028800_Z_ENABLE(state->depth.enabled) |
> S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
> S_028800_ZFUNC(state->depth.func);
> - db_render_override |= S_02800C_FORCE_HIZ_ENABLE(V_02800C_FORCE_DISABLE);
> +
> + struct r600_context *rctx = (struct r600_context *)ctx;
> + struct pipe_surface *surf = rctx->framebuffer.zsbuf;
> + struct r600_texture *rtex = 0;
> + if (surf) {
> + rtex = (struct r600_texture*)surf->texture;
> + }
> + if (rtex && rtex->htile_buffer) {
> + /* Force off means no force, DB_SHADER_CONTROL decides */
> + db_render_override |= S_02800C_FORCE_HIZ_ENABLE(V_02800C_FORCE_OFF);
> + } else {
> + db_render_override |= S_02800C_FORCE_HIZ_ENABLE(V_02800C_FORCE_DISABLE);
> + }
This won't work. create_dsa_state is called only once when that state
object is created. The other states may get changed before the state
object is used. You shouldn't use mutable variables of pipe_context
and r600_context in any of the create functions.
DB_RENDER_OVERRIDE should probably be set by set_framebuffer_state.
Marek
More information about the mesa-dev
mailing list