Skip to contentSkip to conversation

tests: Add tests for new exec flags to export two bsd rings

PATCH In review Zhipeng Gong 3 participants 8 messages Aug 7, 2014 – Dec 3, 2014 Library code

lore
Share & tools
lore
#0 lore raw

cover tests: Add tests for new exec flags to export two bsd rings

The Broadwell GT3 machine has two independent BSD rings that can be used to process the video commands. New execution flags are added to export the two rings to userspace so that userspace can specify the bsd ring.

Zhipeng Gong (3):
i-g-t: check whether kernel has dual bsd ring tests/gem_exec_params: check the invalid flags for dual bsd ring test/gem_dummy_reloc_loop: add tests for dual bsd ring

 lib/ioctl_wrappers.c         | 16 ++++++++++++++++
 lib/ioctl_wrappers.h         |  1 +
 tests/gem_dummy_reloc_loop.c | 16 ++++++++++++++++
 tests/gem_exec_params.c      |  6 ++++++
 4 files changed, 39 insertions(+)
Signature · 1 line
2.0.3
#1 lore raw

PATCH 1/3 i-g-t: check whether kernel has dual bsd ring

---
 lib/ioctl_wrappers.c | 16 ++++++++++++++++
 lib/ioctl_wrappers.h |  1 +
 2 files changed, 17 insertions(+)
lib/ioctl_wrappers.c +16 -0
index c4e1080..03163a0 100644
@@ -754,6 +754,22 @@ bool gem_has_vebox(int fd)
 	return gem_has_enable_ring(fd,LOCAL_I915_PARAM_HAS_VEBOX);
 }
 
+#define LOCAL_I915_PARAM_HAS_BSD2 29
+/**
+ * gem_has_bsd2:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether the BSD2 ring is available. This is simply
+ * a specific version of gem_has_enable_ring() for the BSD2 ring.
+ *
+ * Note that recent Bspec calls this the VCS ring for Video Command Submission.
+ *
+ * Returns: Whether the BSD ring is avaible or not.
+ */
+bool gem_has_bsd2(int fd)
+{
+	return gem_has_enable_ring(fd,I915_PARAM_HAS_BSD2);
+}
 /**
  * gem_available_aperture_size:
  * @fd: open i915 drm file descriptor
lib/ioctl_wrappers.h +1 -0
index 310d82e..2979634 100644
@@ -83,6 +83,7 @@ bool gem_has_enable_ring(int fd,int param);
 bool gem_has_bsd(int fd);
 bool gem_has_blt(int fd);
 bool gem_has_vebox(int fd);
+bool gem_has_bsd2(int fd);
 bool gem_uses_aliasing_ppgtt(int fd);
 int gem_available_fences(int fd);
 uint64_t gem_available_aperture_size(int fd);
Signature · 1 line
2.0.3
Reviewed-by Tested-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] i-g-t: check whether kernel has dual bsd ring

Quoted 19 lines · Zhipeng Gong
---
 lib/ioctl_wrappers.c | 16 ++++++++++++++++
 lib/ioctl_wrappers.h |  1 +
 2 files changed, 17 insertions(+)
lib/ioctl_wrappers.c +5 -0
index c4e1080..03163a0 100644
@@ -754,6 +754,22 @@ bool gem_has_vebox(int fd)
        return gem_has_enable_ring(fd,LOCAL_I915_PARAM_HAS_VEBOX);
 }
 
+#define LOCAL_I915_PARAM_HAS_BSD2 29
+/**
+ * gem_has_bsd2:
+ * @fd: open i915 drm file descriptor
+ *

lib/ioctl_wrappers.c bool gem_has_vebox(int fd) · line 771

Quoted 10 lines
lib/ioctl_wrappers.c +10 -0
+ * Feature test macro to query whether the BSD2 ring is available. This is simply
+ * a specific version of gem_has_enable_ring() for the BSD2 ring.
+ *
+ * Note that recent Bspec calls this the VCS ring for Video Command Submission.
+ *
+ * Returns: Whether the BSD ring is avaible or not.
+ */
+bool gem_has_bsd2(int fd)
+{
+       return gem_has_enable_ring(fd,I915_PARAM_HAS_BSD2);

You add a LOCAL_ but execute without it. Compilation fails without libdrm patches I just sent:
http://lists.freedesktop.org/archives/intel-gfx/2014-December/056568.html
http://lists.freedesktop.org/archives/intel-gfx/2014-December/056569.html

So, or use the local or remove it considering that it is on libdrm. Thomas, how do you prefer it?

With that fixed feel free to use:

Quoted 23 lines
lib/ioctl_wrappers.c +1 -0
+}
 /**
  * gem_available_aperture_size:
  * @fd: open i915 drm file descriptor
lib/ioctl_wrappers.h +1 -1
index 310d82e..2979634 100644
@@ -83,6 +83,7 @@ bool gem_has_enable_ring(int fd,int param);
 bool gem_has_bsd(int fd);
 bool gem_has_blt(int fd);
 bool gem_has_vebox(int fd);
+bool gem_has_bsd2(int fd);
 bool gem_uses_aliasing_ppgtt(int fd);
 int gem_available_fences(int fd);
 uint64_t gem_available_aperture_size(int fd);
--

2.0.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 1/3] i-g-t: check whether kernel has dual bsd ring

Quoted 36 lines · Rodrigo Vivi
Quoted 19 lines · Zhipeng Gong
---
 lib/ioctl_wrappers.c | 16 ++++++++++++++++
 lib/ioctl_wrappers.h |  1 +
 2 files changed, 17 insertions(+)
lib/ioctl_wrappers.c +5 -0
index c4e1080..03163a0 100644
@@ -754,6 +754,22 @@ bool gem_has_vebox(int fd)
        return gem_has_enable_ring(fd,LOCAL_I915_PARAM_HAS_VEBOX);
 }
 
+#define LOCAL_I915_PARAM_HAS_BSD2 29
+/**
+ * gem_has_bsd2:
+ * @fd: open i915 drm file descriptor
+ *

lib/ioctl_wrappers.c bool gem_has_vebox(int fd) · line 771

Quoted 10 lines
lib/ioctl_wrappers.c +10 -0
+ * Feature test macro to query whether the BSD2 ring is available. This is simply
+ * a specific version of gem_has_enable_ring() for the BSD2 ring.
+ *
+ * Note that recent Bspec calls this the VCS ring for Video Command Submission.
+ *
+ * Returns: Whether the BSD ring is avaible or not.
+ */
+bool gem_has_bsd2(int fd)
+{
+       return gem_has_enable_ring(fd,I915_PARAM_HAS_BSD2);

You add a LOCAL_ but execute without it. Compilation fails without libdrm patches I just sent:
http://lists.freedesktop.org/archives/intel-gfx/2014-December/056568.html
http://lists.freedesktop.org/archives/intel-gfx/2014-December/056569.html

Quoted 2 lines

So, or use the local or remove it considering that it is on libdrm. Thomas, how do you prefer it?

We need the LOCAL_ otherwise we have a big depency chain for merging (since i-g-t can only depend upon stuff in released libdrm versions).

After a few libdrm releases you can clean up and remove the LOCAL_ stuff (and bump the libdrm dep in igt ofc).
-Daniel

Quoted 38 lines

With that fixed feel free to use:

Quoted 23 lines
lib/ioctl_wrappers.c +1 -0
+}
 /**
  * gem_available_aperture_size:
  * @fd: open i915 drm file descriptor
lib/ioctl_wrappers.h +1 -1
index 310d82e..2979634 100644
@@ -83,6 +83,7 @@ bool gem_has_enable_ring(int fd,int param);
 bool gem_has_bsd(int fd);
 bool gem_has_blt(int fd);
 bool gem_has_vebox(int fd);
+bool gem_has_bsd2(int fd);
 bool gem_uses_aliasing_ppgtt(int fd);
 int gem_available_fences(int fd);
 uint64_t gem_available_aperture_size(int fd);
--

2.0.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 2/3 tests/gem_exec_params: check the invalid flags for dual bsd ring

In reply to Zhipeng Gong
---
 tests/gem_exec_params.c | 6 ++++++
 1 file changed, 6 insertions(+)
tests/gem_exec_params.c +6 -0
index 769969d..b18ef4e 100644
@@ -126,6 +126,12 @@ igt_main
 		RUN_FAIL(EINVAL);
 	}
 
+	igt_subtest("invalid-bsd-ring") {
+		igt_require(gem_has_bsd2(fd));
+		execbuf.flags = I915_EXEC_BSD | I915_EXEC_BSD_MASK;
+		RUN_FAIL(EINVAL);
+	}
+
 	igt_subtest("rel-constants-invalid-ring") {
 		igt_require(gem_has_bsd(fd));
 		execbuf.flags = I915_EXEC_BSD | I915_EXEC_CONSTANTS_ABSOLUTE;
Signature · 1 line
2.0.3
Reviewed-by Tested-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] tests/gem_exec_params: check the invalid flags for dual bsd ring

This also depends on libdrm patches or adding locals.

With that fixed also feel free to use

Quoted 29 lines · Zhipeng Gong
---
 tests/gem_exec_params.c | 6 ++++++
 1 file changed, 6 insertions(+)
tests/gem_exec_params.c +6 -1
index 769969d..b18ef4e 100644
@@ -126,6 +126,12 @@ igt_main
                RUN_FAIL(EINVAL);
        }
 
+       igt_subtest("invalid-bsd-ring") {
+               igt_require(gem_has_bsd2(fd));
+               execbuf.flags = I915_EXEC_BSD | I915_EXEC_BSD_MASK;
+               RUN_FAIL(EINVAL);
+       }
+
        igt_subtest("rel-constants-invalid-ring") {
                igt_require(gem_has_bsd(fd));
                execbuf.flags = I915_EXEC_BSD | I915_EXEC_CONSTANTS_ABSOLUTE;
--

2.0.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 3/3 test/gem_dummy_reloc_loop: add tests for dual bsd ring

In reply to Zhipeng Gong
---
 tests/gem_dummy_reloc_loop.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
tests/gem_dummy_reloc_loop.c +16 -0
index 4fe0786..6913537 100644
@@ -265,6 +265,22 @@ igt_main
 	}
 #endif
 
+	igt_subtest("bsd-ring1") {
+		igt_require(gem_has_bsd2(fd));
+		sleep(2);
+		igt_info("running dummy loop on bsd-ring1\n");
+		dummy_reloc_loop(I915_EXEC_BSD|I915_EXEC_BSD_RING1);
+		igt_info("dummy loop run on bsd-ring1 completed\n");
+	}
+
+	igt_subtest("bsd-ring2") {
+		igt_require(gem_has_bsd2(fd));
+		sleep(2);
+		igt_info("running dummy loop on bsd-ring2\n");
+		dummy_reloc_loop(I915_EXEC_BSD|I915_EXEC_BSD_RING2);
+		igt_info("dummy loop run on bsd-ring2 completed\n");
+	}
+
 	igt_subtest("mixed") {
 		if (num_rings > 1) {
 			sleep(2);
Signature · 1 line
2.0.3
Reviewed-by Tested-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] test/gem_dummy_reloc_loop: add tests for dual bsd ring

This also depends on libdrm patches or adding locals.

With that fixed also feel free to use

Quoted 39 lines · Zhipeng Gong
---
 tests/gem_dummy_reloc_loop.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
tests/gem_dummy_reloc_loop.c +16 -1
index 4fe0786..6913537 100644
@@ -265,6 +265,22 @@ igt_main
        }
 #endif
 
+       igt_subtest("bsd-ring1") {
+               igt_require(gem_has_bsd2(fd));
+               sleep(2);
+               igt_info("running dummy loop on bsd-ring1\n");
+               dummy_reloc_loop(I915_EXEC_BSD|I915_EXEC_BSD_RING1);
+               igt_info("dummy loop run on bsd-ring1 completed\n");
+       }
+
+       igt_subtest("bsd-ring2") {
+               igt_require(gem_has_bsd2(fd));
+               sleep(2);
+               igt_info("running dummy loop on bsd-ring2\n");
+               dummy_reloc_loop(I915_EXEC_BSD|I915_EXEC_BSD_RING2);
+               igt_info("dummy loop run on bsd-ring2 completed\n");
+       }
+
        igt_subtest("mixed") {
                if (num_rings > 1) {
                        sleep(2);
--

2.0.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx