On Wed, Mar 25, 2015 at 02:21:00PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
> 
> This tests the new EXEC_OBJECT_PAD_TO_SIZE exec_object2 flag.
> 
> It uses the fact DRM allocation policy is set as ABI and allocates
> space in order.

Ssh. That's not what I meant to say. I meant that the policy is not ABI,
and we abuse our internal knowledge to get a working test, as we do
elsewhere in igt.

> That means that we should be able to easily get
> two bos mapped at adjacent GTT addresses and then test that the
> pad to size flag will move them apart.

> +     /* Try to get two buffer object next to each other in GTT space. */
> +     for (try = 0, idx = 0; try < max_tries;) {
> +             eb_handles[0] = handles[0];
> +             eb_handles[1] = loc_handles[idx];
> +             eb_handles[2] = loc_handles[idx + 1];
> +
> +             igt_assert(exec(fd, eb_handles, (uint32_t[2]){0, 0},
> +                             offsets) == 0);
> +
> +             if (offsets[1] > offsets[0]) {
> +                     distance = offsets[1] - offsets[0];
> +                     if (distance == PAGE_SIZE)
> +                             neighbours = true;
> +                     pad_to_size[0] = ALIGN(distance + PAGE_SIZE, PAGE_SIZE);
> +             } else {
> +                     distance = offsets[0] - offsets[1];
> +                     if (distance == PAGE_SIZE)
> +                             neighbours = true;
> +                     pad_to_size[1] = ALIGN(distance + PAGE_SIZE, PAGE_SIZE);
> +             }
> +
> +             if (neighbours)
> +                     break;

What's important to make this trick work is to allocate new handles
every time. That way we fill up the GTT and thereby hope to skip over
the fragmented part.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to