From cf2af021b9baf459edf522253f65aa4d4abc10f8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 26 Jan 2016 13:35:08 +1000 Subject: [PATCH] r600g: make framebuffer atom rely on dual src blend state. In order to make ARB_shader_image_load_store, we have to share the CB space with RATs, so we should only steal the dual src space if we have dual src enabled. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600_pipe.h | 1 + src/gallium/drivers/r600/r600_state.c | 2 +- src/gallium/drivers/r600/r600_state_common.c | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index c5dd9f71dd9..5ffe6e8996f 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1584,7 +1584,7 @@ static void evergreen_emit_framebuffer_state(struct r600_context *rctx, struct r radeon_emit(cs, reloc); } /* set CB_COLOR1_INFO for possible dual-src blending */ - if (i == 1 && state->cbufs[0]) { + if (rctx->framebuffer.dual_src_blend && i == 1 && state->cbufs[0]) { radeon_set_context_reg(cs, R_028C70_CB_COLOR0_INFO + 1 * 0x3C, cb->cb_color_info | tex->cb_color_info); i++; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index cf8eba38fe2..1d65cb317d8 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -187,6 +187,7 @@ struct r600_framebuffer { bool export_16bpc; bool cb0_is_integer; bool is_msaa_resolve; + bool dual_src_blend; }; struct r600_sample_mask { diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 006bb629d60..6139bd2f05e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1337,7 +1337,7 @@ static void r600_emit_framebuffer_state(struct r600_context *rctx, struct r600_a radeon_emit(cs, cb[i] ? cb[i]->cb_color_info : 0); } /* set CB_COLOR1_INFO for possible dual-src blending */ - if (i == 1 && cb[0]) { + if (rctx->framebuffer.dual_src_blend && i == 1 && cb[0]) { radeon_emit(cs, cb[0]->cb_color_info); i++; } diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 5bce71c871d..6f8279fb5e6 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -187,6 +187,10 @@ static void r600_bind_blend_state_internal(struct r600_context *rctx, if (update_cb) { r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom); } + if (rctx->framebuffer.dual_src_blend != blend->dual_src_blend) { + rctx->framebuffer.dual_src_blend = blend->dual_src_blend; + r600_mark_atom_dirty(rctx, &rctx->framebuffer.atom); + } } static void r600_bind_blend_state(struct pipe_context *ctx, void *state) -- 2.30.2