* [PATCH 1/2] gem_ring_sync_loop: check the rings supported by the kernel
@ 2012-11-15 7:58 Xiang, Haihao
2012-11-15 7:58 ` [PATCH 2/2] gem_ring_sync_loop: test the new ring Xiang, Haihao
0 siblings, 1 reply; 2+ messages in thread
From: Xiang, Haihao @ 2012-11-15 7:58 UTC (permalink / raw)
To: intel-gfx
From: "Xiang, Haihao" <haihao.xiang@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
---
tests/gem_ring_sync_loop.c | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c
index b689bcd..2875cf3 100644
--- a/tests/gem_ring_sync_loop.c
+++ b/tests/gem_ring_sync_loop.c
@@ -55,15 +55,46 @@ static drm_intel_bo *target_buffer;
#define MI_COND_BATCH_BUFFER_END (0x36<<23 | 1)
#define MI_DO_COMPARE (1<<21)
+static int
+get_num_rings(int fd)
+{
+ int num_rings = 1; /* render ring is always available */
+ drm_i915_getparam_t gp;
+ int ret, tmp;
+
+ memset(&gp, 0, sizeof(gp));
+ gp.value = &tmp;
+
+ gp.param = I915_PARAM_HAS_BSD;
+ ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ if ((ret == 0) & (*gp.value > 0))
+ num_rings++;
+ else
+ goto skip;
+
+ gp.param = I915_PARAM_HAS_BLT;
+ ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ if ((ret == 0) & (*gp.value > 0))
+ num_rings++;
+ else
+ goto skip;
+
+skip:
+ return num_rings;
+}
+
static void
-store_dword_loop(void)
+store_dword_loop(int fd)
{
int i;
+ int num_rings = get_num_rings(fd);
srandom(0xdeadbeef);
for (i = 0; i < 0x100000; i++) {
- int ring = random() % 3 + 1;
+ int ring = random() % num_rings + 1;
if (ring == I915_EXEC_RENDER) {
BEGIN_BATCH(4);
@@ -127,7 +158,7 @@ int main(int argc, char **argv)
exit(-1);
}
- store_dword_loop();
+ store_dword_loop(fd);
drm_intel_bo_unreference(target_buffer);
intel_batchbuffer_free(batch);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] gem_ring_sync_loop: test the new ring
2012-11-15 7:58 [PATCH 1/2] gem_ring_sync_loop: check the rings supported by the kernel Xiang, Haihao
@ 2012-11-15 7:58 ` Xiang, Haihao
0 siblings, 0 replies; 2+ messages in thread
From: Xiang, Haihao @ 2012-11-15 7:58 UTC (permalink / raw)
To: intel-gfx
From: "Xiang, Haihao" <haihao.xiang@intel.com>
The code is surround by a #ifdef...#endif to avoid to break compiling against
the current libdrm release
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
---
tests/gem_ring_sync_loop.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c
index 2875cf3..955bf34 100644
--- a/tests/gem_ring_sync_loop.c
+++ b/tests/gem_ring_sync_loop.c
@@ -81,6 +81,18 @@ get_num_rings(int fd)
else
goto skip;
+#ifdef I915_PARAM_HAS_VEBOX /* remove it once the upstream libdrm support VEBOX */
+
+ gp.param = I915_PARAM_HAS_VEBOX;
+ ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ if ((ret == 0) & (*gp.value > 0))
+ num_rings++;
+ else
+ goto skip;
+
+#endif
+
skip:
return num_rings;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-15 8:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-15 7:58 [PATCH 1/2] gem_ring_sync_loop: check the rings supported by the kernel Xiang, Haihao
2012-11-15 7:58 ` [PATCH 2/2] gem_ring_sync_loop: test the new ring Xiang, Haihao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox