Re: [PATCH igt 1/2] igt/gem_exec_reloc: Trivial test for softpin ABI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 17, 2016 at 01:48:35PM +0000, Chris Wilson wrote:
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Reviewed-by: Michał Winiarski <michal.winiarski@xxxxxxxxx>

-Michał

> ---
>  tests/gem_exec_reloc.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/tests/gem_exec_reloc.c b/tests/gem_exec_reloc.c
> index c56fb43..e6db8e6 100644
> --- a/tests/gem_exec_reloc.c
> +++ b/tests/gem_exec_reloc.c
> @@ -528,6 +528,38 @@ static void basic_noreloc(int fd)
>  	gem_close(fd, obj.handle);
>  }
>  
> +static void basic_softpin(int fd)
> +{
> +	struct drm_i915_gem_exec_object2 obj;
> +	struct drm_i915_gem_execbuffer2 execbuf;
> +	uint64_t offset;
> +	uint32_t trash;
> +	uint32_t bbe = MI_BATCH_BUFFER_END;
> +
> +	igt_require(gem_has_softpin(fd));
> +
> +	memset(&obj, 0, sizeof(obj));
> +	obj.handle = gem_create(fd, 4096);
> +	gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
> +
> +	memset(&execbuf, 0, sizeof(execbuf));
> +	execbuf.buffers_ptr = (uintptr_t)&obj;
> +	execbuf.buffer_count = 1;
> +	gem_execbuf(fd, &execbuf);
> +
> +	trash = obj.handle;
> +	offset = obj.offset;
> +
> +	obj.handle = gem_create(fd, 4096);
> +	obj.flags = EXEC_OBJECT_PINNED;
> +
> +	gem_execbuf(fd, &execbuf);
> +	igt_assert_eq_u64(obj.offset, offset);
> +
> +	gem_close(fd, obj.handle);
> +	gem_close(fd, trash);
> +}
> +
>  igt_main
>  {
>  	uint64_t size;
> @@ -545,6 +577,9 @@ igt_main
>  	igt_subtest("basic-noreloc")
>  		basic_noreloc(fd);
>  
> +	igt_subtest("basic-softpin")
> +		basic_softpin(fd);
> +
>  	for (size = 4096; size <= 4ull*1024*1024*1024; size <<= 1) {
>  		igt_subtest_f("mmap-%u", find_last_set(size) - 1)
>  			from_mmap(fd, size, MEM);
> -- 
> 2.10.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux