diff options
author | Kenneth Graunke <[email protected]> | 2017-05-10 19:39:36 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-05-29 21:46:33 -0700 |
commit | 4ce103e01a8959d604d1de9b99e627b95ffaec45 (patch) | |
tree | d93cbbad3942c03e2a253fda3b25d5263c7a6743 | |
parent | 7f4645e89cb61d856f386d148566002652d2d4fd (diff) |
i965: Rework Sandybridge 3DSTATE_VIEWPORT_STATE_POINTERS.
On Gen7+ we emit 3DSTATE_VIEWPORT_STATE_POINTERS_{SF_CL,CC} when
emitting a new viewport.
This patch makes us take the same approach on Sandybridge - but because
we have a combined command, we just set the appropriate "change" bits.
This eliminates an atom, some dirty flagging, and some brw->*.vp_offset
writes. It does mean we'll emit two 3DSTATE_VIEWPORT_STATE_POINTERS
instead of one if both change, but that's probably fine.
Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/genX_state_upload.c | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index d13043f64d4..487f38340f8 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -1928,6 +1928,11 @@ genX(upload_cc_viewport)(struct brw_context *brw) brw_batch_emit(brw, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC), ptr) { ptr.CCViewportPointer = cc_vp_offset; } +#elif GEN_GEN == 6 + brw_batch_emit(brw, GENX(3DSTATE_VIEWPORT_STATE_POINTERS), vp) { + vp.CCViewportStateChange = 1; + vp.PointertoCC_VIEWPORT = cc_vp_offset; + } #else brw->cc.vp_offset = cc_vp_offset; ctx->NewDriverState |= BRW_NEW_CC_VP; @@ -2053,10 +2058,11 @@ genX(upload_sf_clip_viewport)(struct brw_context *brw) #else struct GENX(SF_VIEWPORT) sfv; struct GENX(CLIP_VIEWPORT) clv; + uint32_t sf_vp_offset, clip_vp_offset; uint32_t *sf_map = brw_state_batch(brw, 8 * 4 * viewport_count, - 32, &brw->sf.vp_offset); + 32, &sf_vp_offset); uint32_t *clip_map = brw_state_batch(brw, 4 * 4 * viewport_count, - 32, &brw->clip.vp_offset); + 32, &clip_vp_offset); #endif /* _NEW_BUFFERS */ @@ -2131,6 +2137,13 @@ genX(upload_sf_clip_viewport)(struct brw_context *brw) brw_batch_emit(brw, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP), ptr) { ptr.SFClipViewportPointer = sf_clip_vp_offset; } +#elif GEN_GEN == 6 + brw_batch_emit(brw, GENX(3DSTATE_VIEWPORT_STATE_POINTERS), vp) { + vp.SFViewportStateChange = 1; + vp.CLIPViewportStateChange = 1; + vp.PointertoCLIP_VIEWPORT = clip_vp_offset; + vp.PointertoSF_VIEWPORT = sf_vp_offset; + } #else brw->ctx.NewDriverState |= BRW_NEW_SF_VP | BRW_NEW_CLIP_VP; #endif @@ -4121,36 +4134,6 @@ static const struct brw_tracked_state genX(vf_topology) = { /* ---------------------------------------------------------------------- */ -#if GEN_GEN == 6 -static void -genX(upload_viewport_state_pointers)(struct brw_context *brw) -{ - brw_batch_emit(brw, GENX(3DSTATE_VIEWPORT_STATE_POINTERS), vp) { - vp.CCViewportStateChange = 1; - vp.SFViewportStateChange = 1; - vp.CLIPViewportStateChange = 1; - vp.PointertoCLIP_VIEWPORT = brw->clip.vp_offset; - vp.PointertoSF_VIEWPORT = brw->sf.vp_offset; - vp.PointertoCC_VIEWPORT = brw->cc.vp_offset; - } -} - -static const struct brw_tracked_state genX(viewport_state) = { - .dirty = { - .mesa = 0, - .brw = BRW_NEW_BATCH | - BRW_NEW_BLORP | - BRW_NEW_CC_VP | - BRW_NEW_CLIP_VP | - BRW_NEW_SF_VP | - BRW_NEW_STATE_BASE_ADDRESS, - }, - .emit = genX(upload_viewport_state_pointers), -}; -#endif - -/* ---------------------------------------------------------------------- */ - void genX(init_atoms)(struct brw_context *brw) { @@ -4220,7 +4203,6 @@ genX(init_atoms)(struct brw_context *brw) /* Command packets: */ &genX(cc_vp), - &genX(viewport_state), /* must do after *_vp stages */ &gen6_urb, &genX(blend_state), /* must do before cc unit */ |