From b8835a3992edb7b01712ea83b5729ef0f6f94e4f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 22 Sep 2010 14:00:53 -0400 Subject: r600g: disable shader rebuild optimization & account cb flush packet Shader rebuild should be more clever, we should store along each shader all the value that change shader program rather than using flags in context (ie change sequence like : change vs buffer, draw, change vs buffer, switch shader will trigger useless shader rebuild). Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/r600_state2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/gallium/winsys/r600/drm') diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c index 32c7171b51..cde4ec37f9 100644 --- a/src/gallium/winsys/r600/drm/r600_state2.c +++ b/src/gallium/winsys/r600/drm/r600_state2.c @@ -914,6 +914,15 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) r600_context_flush(ctx); } } + + /* find number of color buffer */ + for (int i = 0; i < 8; i++) { + cb[i] = r600_context_reg_bo(ctx, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + (i << 2)); + if (cb[i]) { + ndwords += 7; + } + } + if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) { /* need to flush */ r600_context_flush(ctx); @@ -955,7 +964,6 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) /* flush color buffer */ for (int i = 0; i < 8; i++) { - cb[i] = r600_context_reg_bo(ctx, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + (i << 2)); if (cb[i]) { ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3); ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) | -- cgit v1.2.3