summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-11 12:34:40 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-11 12:37:22 +0000
commit5a0139487f5a5caada56121395aa166fc9f08663 (patch)
treedf1bfa41b3992ca53a86ac09a868898aa1788d06
parenta02bbd8700690c98c6cf3ae98dd7ee3da9887b0a (diff)
sna/gen3: Ensure that depth read/writes are disabled before first use
Our goal is to achieve "single-stream" rendering where the entire RenderCache is allocated to the colour buffer (rather than split between colour and depth). In theory all that is required is for the pipeline not to reference the depth buffer at all, however it is not made clear when that evaluation is made. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen3_render.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 33bdfd24..ffde637f 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -94,6 +94,12 @@ static const struct blendinfo {
/* Add */ {0, 0, BLENDFACT_ONE, BLENDFACT_ONE},
};
+#define S6_COLOR_WRITE_ONLY \
+ (S6_COLOR_WRITE_ENABLE | \
+ BLENDFUNC_ADD << S6_CBUF_BLEND_FUNC_SHIFT | \
+ BLENDFACT_ONE << S6_CBUF_SRC_BLEND_FACT_SHIFT | \
+ BLENDFACT_ZERO << S6_CBUF_DST_BLEND_FACT_SHIFT)
+
static const struct formatinfo {
unsigned int fmt, xfmt;
uint32_t card_fmt;
@@ -140,6 +146,9 @@ static uint32_t gen3_get_blend_cntl(int op,
uint32_t sblend = gen3_blend_op[op].src_blend;
uint32_t dblend = gen3_blend_op[op].dst_blend;
+ if (op <= PictOpSrc) /* for clear and src disable blending */
+ return S6_COLOR_WRITE_ONLY;
+
/* If there's no dst alpha channel, adjust the blend op so that we'll
* treat it as always 1.
*/
@@ -1161,13 +1170,14 @@ static void gen3_emit_invariant(struct sna *sna)
CSB_TCB(6, 6) |
CSB_TCB(7, 7));
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | I1_LOAD_S(4) | I1_LOAD_S(5) | 2);
+ OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | I1_LOAD_S(4) | I1_LOAD_S(5) | I1_LOAD_S(6) | 3);
OUT_BATCH(0); /* Disable texture coordinate wrap-shortest */
OUT_BATCH((1 << S4_POINT_WIDTH_SHIFT) |
S4_LINE_WIDTH_ONE |
S4_CULLMODE_NONE |
S4_VFMT_XY);
OUT_BATCH(0); /* Disable fog/stencil. *Enable* write mask. */
+ OUT_BATCH(S6_COLOR_WRITE_ONLY); /* Disable blending, depth */
OUT_BATCH(_3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT);
OUT_BATCH(_3DSTATE_DEPTH_SUBRECT_DISABLE);
@@ -2191,6 +2201,8 @@ gen3_composite_set_target(struct sna *sna,
if (priv == NULL)
return FALSE;
+ /* XXX This should only be necessary if we fail to disable depth! */
+#if 0
if (priv->gpu_bo->pitch < 16) {
struct kgem_bo *bo;
@@ -2206,6 +2218,7 @@ gen3_composite_set_target(struct sna *sna,
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
priv->gpu_bo = bo;
}
+#endif
op->dst.bo = priv->gpu_bo;
op->damage = &priv->gpu_damage;