[igt-dev] [PATCH i-g-t 07/15] gem_wsim: Infinite batch support

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu May 23 14:17:48 UTC 2019


On 23/05/2019 15:09, Chris Wilson wrote:
> Quoting Chris Wilson (2019-05-23 15:05:05)
>> Quoting Tvrtko Ursulin (2019-05-22 16:57:12)
>>> -static void
>>> +static unsigned int
>>>   terminate_bb(struct w_step *w, unsigned int flags)
>>>   {
>>>          const uint32_t bbe = 0xa << 23;
>>>          unsigned long mmap_start, mmap_len;
>>>          unsigned long batch_start = w->bb_sz;
>>> +       unsigned int r = 0;
>>>          uint32_t *ptr, *cs;
>>>   
>>>          igt_assert(((flags & RT) && (flags & SEQNO)) || !(flags & RT));
>>> @@ -838,6 +854,9 @@ terminate_bb(struct w_step *w, unsigned int flags)
>>>          if (flags & RT)
>>>                  batch_start -= 12 * sizeof(uint32_t);
>>>   
>>> +       if (w->unbound_duration)
>>> +               batch_start -= 4 * sizeof(uint32_t); /* MI_ARB_CHK + MI_BATCH_BUFFER_START */
>>> +
>>>          mmap_start = rounddown(batch_start, PAGE_SIZE);
>>>          mmap_len = ALIGN(w->bb_sz - mmap_start, PAGE_SIZE);
>>>   
>>> @@ -847,8 +866,19 @@ terminate_bb(struct w_step *w, unsigned int flags)
>>>          ptr = gem_mmap__wc(fd, w->bb_handle, mmap_start, mmap_len, PROT_WRITE);
>>>          cs = (uint32_t *)((char *)ptr + batch_start - mmap_start);
>>>   
>>> +       if (w->unbound_duration) {
>>> +               w->reloc[r++].offset = batch_start + 2 * sizeof(uint32_t);
>>> +               batch_start += 4 * sizeof(uint32_t);
>>> +
>>> +               *cs++ = w->preempt_us ? 0x5 << 23 /* MI_ARB_CHK; */ : MI_NOOP;
>>> +               w->recursive_bb_start = cs;
>>> +               *cs++ = MI_BATCH_BUFFER_START | 1 << 8 | 1;
>>> +               *cs++ = 0;
>>> +               *cs++ = 0;
>>
>> delta is zero, and mmap_len is consistent, so yup this gives a page of
>> nops before looping.
> 
> Waitasec... Only emitting ARB_CHK if preempt_us is set. You want an
> unbounded unpreemptible batch?
> 
> I suppose it's not without use (although I plan for it to be killed
> quickly and reset), but I would not advise for preempt_us to be 0 by
> default then.

Default is 100us (search for "w->preempt_us = 100;") and then for 
instance frame-split-60fps.wsim disables it to simulate media better 
("X.1.0", "X.2.0"). AFAIR you actually asked for preemptable by default.

Now that I think of it.. I really need a command line switch to control 
it globally. Or better per engine class to simulate media better. 
Blast.. feature creep never ends.

Regards,

Tvrtko


More information about the igt-dev mailing list