From: "Xiang, Haihao" <haihao.xiang@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/2] gem_ring_sync_loop: check the rings supported by the kernel
Date: Thu, 15 Nov 2012 15:58:09 +0800 [thread overview]
Message-ID: <1352966290-25762-1-git-send-email-haihao.xiang@intel.com> (raw)
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
next reply other threads:[~2012-11-15 8:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 7:58 Xiang, Haihao [this message]
2012-11-15 7:58 ` [PATCH 2/2] gem_ring_sync_loop: test the new ring Xiang, Haihao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352966290-25762-1-git-send-email-haihao.xiang@intel.com \
--to=haihao.xiang@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.