On Wed, Jul 08, 2015 at 05:08:11PM -0700, Matt Turner wrote:
> On Wed, Jul 8, 2015 at 4:53 PM, Chris Wilson <ch...@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
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to