[Mesa-dev] [PATCH 2/2] i965: Optimize intel_batchbuffer_emit_dword().
Martin Peres
martin.peres at linux.intel.com
Thu Jul 9 07:56:50 PDT 2015
On 09/07/15 11:13, Chris Wilson wrote:
> 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
Hey guys,
I tried Chris' patches
(http://cgit.freedesktop.org/~ickle/mesa/log/?h=brw-batch) and found the
following results:
Baseline is commit 7916e0d12968f68e3916b221798049e2ea6c2340: i965:
AMD_pinned_memory and userptr
commit 195a0598da480f9ca2c499b668b76d836b8b65ea: ptr
customer benchmark: +0.5%
Synmark Oglbatch7: -2.29%
Glxgears: +4.78%
commit 37a093052dc92a5976134658b31ff82f25a3d01e: out
customer benchmark: +2.6% (103.1% of baseline)
Synmark Oglbatch7: +2.21% (99.8% of baseline)
Glxgears: +0% (104.78% of baseline)
This is done by iterating 10 times each benchmark for every commit. So,
this looks like in average, this is a net positive! Thanks Matt and Chris!
Martin
PS: Sorry for the commit number, they are taken from my branch that gets
rid of the DRI2/3-related commits of Chris' branch.
More information about the mesa-dev
mailing list