[Mesa-dev] [PATCH 2/2] i965: Optimize intel_batchbuffer_emit_dword().
Chris Wilson
chris at chris-wilson.co.uk
Thu Jul 9 01:13:53 PDT 2015
On Wed, Jul 08, 2015 at 05:08:11PM -0700, Matt Turner wrote:
> On Wed, Jul 8, 2015 at 4:53 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > static void upload_viewport_state_pointers(struct brw_context *brw)
> > {
> > BEGIN_BATCH(4);
> > brw->batch.map[0] = (_3DSTATE_VIEWPORT_STATE_POINTERS << 16 | (4 - 2) |
> > GEN6_CC_VIEWPORT_MODIFY |
> > GEN6_SF_VIEWPORT_MODIFY |
> > GEN6_CLIP_VIEWPORT_MODIFY);
> > brw->batch.map[1] = (brw->clip.vp_offset);
> > brw->batch.map[2] = (brw->sf.vp_offset);
> > brw->batch.map[3] = (brw->cc.vp_offset);
> > brw->batch.map += 4;
> > ADVANCE_BATCH();
> > }
> > -Chris
>
> Ah, thanks. I see.
>
> I'll give it another shot.
Playing a bit more, I get reasonable code generation using
uint32_t *out = BEGIN_BATCH(4);
*out++ = (_3DSTATE_VIEWPORT_STATE_POINTERS << 16 | (4 - 2) |
GEN6_CC_VIEWPORT_MODIFY |
GEN6_SF_VIEWPORT_MODIFY |
GEN6_CLIP_VIEWPORT_MODIFY);
*out++ = (brw->clip.vp_offset);
*out++ = (brw->sf.vp_offset);
*out++ = (brw->cc.vp_offset);
ADVANCE_BATCH(out);
with BEGIN_BATCH(n) {
uint32_t *ptr = brw->batch.map;
brw->batch.map + =n;
return ptr;
}
That also gives a simple ADVANCE_BATCH(out) assert(out == brw->batch.map),
and works with a little fudging (out - brw->batch.base) for OUT_RELOC.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the mesa-dev
mailing list