diff mbox

[i-g-t] tests/gem_exec_params: test all valid execution flags

Message ID 1454336677-34165-1-git-send-email-daniele.ceraolospurio@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniele Ceraolo Spurio Feb. 1, 2016, 2:24 p.m. UTC
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

The control subtest has been extended to check the execution flags for
all the rings that are present in the HW.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 tests/gem_exec_params.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

Comments

Daniel Vetter Feb. 10, 2016, 8:16 a.m. UTC | #1
On Mon, Feb 01, 2016 at 02:24:37PM +0000, daniele.ceraolospurio@intel.com wrote:
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> The control subtest has been extended to check the execution flags for
> all the rings that are present in the HW.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Applied, thanks.
-Daniel

> ---
>  tests/gem_exec_params.c | 39 ++++++++++++++++++++++++++++++++-------
>  1 file changed, 32 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/gem_exec_params.c b/tests/gem_exec_params.c
> index 06dfd63..e192150 100644
> --- a/tests/gem_exec_params.c
> +++ b/tests/gem_exec_params.c
> @@ -46,6 +46,30 @@
>  #define LOCAL_I915_EXEC_BSD_RING2 (2<<13)
>  #define LOCAL_I915_EXEC_RESOURCE_STREAMER (1<<15)
>  
> +static bool has_ring(int fd, unsigned ring_exec_flags)
> +{
> +	switch (ring_exec_flags & I915_EXEC_RING_MASK) {
> +	case 0:
> +	case I915_EXEC_RENDER:
> +		return true;
> +
> +	case I915_EXEC_BSD:
> +		if (ring_exec_flags & LOCAL_I915_EXEC_BSD_MASK)
> +			return gem_has_bsd2(fd);
> +		else
> +			return gem_has_bsd(fd);
> +
> +	case I915_EXEC_BLT:
> +		return gem_has_blt(fd);
> +
> +	case I915_EXEC_VEBOX:
> +		return gem_has_vebox(fd);
> +	}
> +
> +	igt_assert_f(0, "invalid exec flag 0x%x\n", ring_exec_flags);
> +	return false;
> +}
> +
>  struct drm_i915_gem_execbuffer2 execbuf;
>  struct drm_i915_gem_exec_object2 gem_exec[1];
>  uint32_t batch[2] = {MI_BATCH_BUFFER_END};
> @@ -54,6 +78,8 @@ int fd;
>  
>  igt_main
>  {
> +	const struct intel_execution_engine *e;
> +
>  	igt_fixture {
>  		fd = drm_open_driver(DRIVER_INTEL);
>  
> @@ -85,13 +111,12 @@ igt_main
>  	}
>  
>  	igt_subtest("control") {
> -		igt_assert(drmIoctl(fd,
> -				    DRM_IOCTL_I915_GEM_EXECBUFFER2,
> -				    &execbuf) == 0);
> -		execbuf.flags = I915_EXEC_RENDER;
> -		igt_assert(drmIoctl(fd,
> -				    DRM_IOCTL_I915_GEM_EXECBUFFER2,
> -				    &execbuf) == 0);
> +		for (e = intel_execution_engines; e->name; e++) {
> +			if (has_ring(fd, e->exec_id | e->flags)) {
> +				execbuf.flags = e->exec_id | e->flags;
> +				gem_execbuf(fd, &execbuf);
> +			}
> +		}
>  	}
>  
>  #define RUN_FAIL(expected_errno) do { \
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/gem_exec_params.c b/tests/gem_exec_params.c
index 06dfd63..e192150 100644
--- a/tests/gem_exec_params.c
+++ b/tests/gem_exec_params.c
@@ -46,6 +46,30 @@ 
 #define LOCAL_I915_EXEC_BSD_RING2 (2<<13)
 #define LOCAL_I915_EXEC_RESOURCE_STREAMER (1<<15)
 
+static bool has_ring(int fd, unsigned ring_exec_flags)
+{
+	switch (ring_exec_flags & I915_EXEC_RING_MASK) {
+	case 0:
+	case I915_EXEC_RENDER:
+		return true;
+
+	case I915_EXEC_BSD:
+		if (ring_exec_flags & LOCAL_I915_EXEC_BSD_MASK)
+			return gem_has_bsd2(fd);
+		else
+			return gem_has_bsd(fd);
+
+	case I915_EXEC_BLT:
+		return gem_has_blt(fd);
+
+	case I915_EXEC_VEBOX:
+		return gem_has_vebox(fd);
+	}
+
+	igt_assert_f(0, "invalid exec flag 0x%x\n", ring_exec_flags);
+	return false;
+}
+
 struct drm_i915_gem_execbuffer2 execbuf;
 struct drm_i915_gem_exec_object2 gem_exec[1];
 uint32_t batch[2] = {MI_BATCH_BUFFER_END};
@@ -54,6 +78,8 @@  int fd;
 
 igt_main
 {
+	const struct intel_execution_engine *e;
+
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 
@@ -85,13 +111,12 @@  igt_main
 	}
 
 	igt_subtest("control") {
-		igt_assert(drmIoctl(fd,
-				    DRM_IOCTL_I915_GEM_EXECBUFFER2,
-				    &execbuf) == 0);
-		execbuf.flags = I915_EXEC_RENDER;
-		igt_assert(drmIoctl(fd,
-				    DRM_IOCTL_I915_GEM_EXECBUFFER2,
-				    &execbuf) == 0);
+		for (e = intel_execution_engines; e->name; e++) {
+			if (has_ring(fd, e->exec_id | e->flags)) {
+				execbuf.flags = e->exec_id | e->flags;
+				gem_execbuf(fd, &execbuf);
+			}
+		}
 	}
 
 #define RUN_FAIL(expected_errno) do { \