[igt-dev] [PATCH i-g-t 2/2] igt: Use lib gem_execbuf where possible
Antonio Argenziano
antonio.argenziano at intel.com
Wed Jan 31 23:45:47 UTC 2018
Replace custom execbuf ioctl wrapper with the ones in lib.
Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala at intel.com>
---
tests/gem_busy.c | 7 +------
tests/gem_close_race.c | 3 +--
tests/gem_ctx_exec.c | 15 +++++----------
tests/gem_evict_alignment.c | 7 ++-----
tests/gem_exec_await.c | 7 +------
tests/gem_exec_bad_domains.c | 6 +-----
tests/gem_exec_blt.c | 4 ++--
tests/gem_exec_fence.c | 7 +------
tests/gem_exec_latency.c | 7 +------
tests/gem_exec_lut_handle.c | 2 +-
tests/gem_exec_params.c | 9 ++-------
tests/gem_exec_schedule.c | 16 ++++------------
tests/gem_gtt_hog.c | 2 +-
tests/gem_lut_handle.c | 11 ++---------
tests/gem_pwrite_pread.c | 12 ++++++------
tests/gem_ringfill.c | 7 +------
tests/gen3_mixed_blits.c | 10 +++++-----
tests/gen3_render_linear_blits.c | 6 +++---
tests/gen3_render_mixed_blits.c | 6 +++---
tests/gen3_render_tiledx_blits.c | 4 ++--
tests/gen3_render_tiledy_blits.c | 6 +++---
tests/pm_rpm.c | 6 +++---
22 files changed, 51 insertions(+), 109 deletions(-)
diff --git a/tests/gem_busy.c b/tests/gem_busy.c
index c349c291..444c1dd1 100644
--- a/tests/gem_busy.c
+++ b/tests/gem_busy.c
@@ -332,11 +332,6 @@ static void alarm_handler(int sig)
{
}
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
- return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
static unsigned int measure_ring_size(int fd)
{
struct sigaction sa = { .sa_handler = alarm_handler };
@@ -373,7 +368,7 @@ static unsigned int measure_ring_size(int fd)
last = -1;
count = 0;
do {
- if (__execbuf(fd, &execbuf) == 0) {
+ if (__gem_execbuf(fd, &execbuf) == 0) {
count++;
continue;
}
diff --git a/tests/gem_close_race.c b/tests/gem_close_race.c
index d9a45387..bc1127b1 100644
--- a/tests/gem_close_race.c
+++ b/tests/gem_close_race.c
@@ -119,8 +119,7 @@ static void selfcopy(int fd, uint32_t handle, int loops)
gem_pwrite.size = sizeof(buf);
gem_pwrite.data_ptr = to_user_pointer(buf);
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite) == 0) {
- while (loops-- &&
- drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0)
+ while (loops-- && __gem_execbuf(fd, &execbuf) == 0)
;
}
diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index 15937cf3..fa21e518 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -52,7 +52,6 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 gem_exec;
- int ret = 0;
gem_exec.handle = handle;
gem_exec.relocation_count = 0;
@@ -75,10 +74,7 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
i915_execbuffer2_set_context_id(execbuf, ctx_id);
execbuf.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
- &execbuf);
-
- return ret;
+ return __gem_execbuf(fd, &execbuf);
}
static void big_exec(int fd, uint32_t handle, int ring)
@@ -116,7 +112,7 @@ static void big_exec(int fd, uint32_t handle, int ring)
execbuf.buffer_count = 1;
i915_execbuffer2_set_context_id(execbuf, ctx_id1);
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
for (i = 0; i < num_buffers; i++) {
uint32_t tmp_handle = gem_create(fd, 4096);
@@ -127,8 +123,7 @@ static void big_exec(int fd, uint32_t handle, int ring)
execbuf.buffer_count = i + 1;
/* figure out how many buffers we can exactly fit */
- while (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
- &execbuf) != 0) {
+ while (__gem_execbuf(fd, &execbuf) != 0) {
i--;
gem_close(fd, gem_exec[i].handle);
gem_exec[i].handle = handle;
@@ -140,10 +135,10 @@ static void big_exec(int fd, uint32_t handle, int ring)
i - 1, num_buffers);
/* double check that it works */
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
i915_execbuffer2_set_context_id(execbuf, ctx_id2);
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
gem_sync(fd, handle);
}
diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c
index 239be728..a80aa414 100644
--- a/tests/gem_evict_alignment.c
+++ b/tests/gem_evict_alignment.c
@@ -61,7 +61,7 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo,
struct drm_i915_gem_exec_object2 *obj;
struct drm_i915_gem_execbuffer2 exec;
uint32_t handle;
- int n, ret, i=0;
+ int n, i=0;
batch[i++] = (XY_SRC_COPY_BLT_CMD |
XY_SRC_COPY_BLT_WRITE_ALPHA |
@@ -121,10 +121,7 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo,
i915_execbuffer2_set_context_id(exec, 0);
exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
- if (ret)
- ret = errno;
- igt_assert_eq(ret, error);
+ igt_assert_eq(__gem_execbuf(fd, &exec), error);
gem_close(fd, handle);
free(obj);
diff --git a/tests/gem_exec_await.c b/tests/gem_exec_await.c
index 28b280ff..5ea2b5ec 100644
--- a/tests/gem_exec_await.c
+++ b/tests/gem_exec_await.c
@@ -280,11 +280,6 @@ static void alarm_handler(int sig)
{
}
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
- return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
static unsigned int measure_ring_size(int fd)
{
struct sigaction sa = { .sa_handler = alarm_handler };
@@ -315,7 +310,7 @@ static unsigned int measure_ring_size(int fd)
last = count = 0;
do {
- if (__execbuf(fd, &execbuf) == 0) {
+ if (__gem_execbuf(fd, &execbuf) == 0) {
count++;
continue;
}
diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c
index 9a7487e3..cd2c8956 100644
--- a/tests/gem_exec_bad_domains.c
+++ b/tests/gem_exec_bad_domains.c
@@ -95,7 +95,6 @@ static void multi_write_domain(int fd)
struct drm_i915_gem_exec_object2 exec[2];
struct drm_i915_gem_relocation_entry reloc[1];
uint32_t handle, handle_target;
- int ret;
handle = gem_create(fd, 4096);
handle_target = gem_create(fd, 4096);
@@ -137,10 +136,7 @@ static void multi_write_domain(int fd)
i915_execbuffer2_set_context_id(execbuf, 0);
execbuf.rsvd2 = 0;
- ret = drmIoctl(fd,
- DRM_IOCTL_I915_GEM_EXECBUFFER2,
- &execbuf);
- igt_assert(ret != 0 && errno == EINVAL);
+ igt_assert_eq(__gem_execbuf(fd, &execbuf), -EINVAL);
gem_close(fd, handle);
gem_close(fd, handle_target);
diff --git a/tests/gem_exec_blt.c b/tests/gem_exec_blt.c
index 8c0453f6..8d61dc87 100644
--- a/tests/gem_exec_blt.c
+++ b/tests/gem_exec_blt.c
@@ -228,12 +228,12 @@ static void run(int object_size, bool dumb)
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
- if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf)) {
+ if (__gem_execbuf(fd, &execbuf)) {
len = gem_linear_blt(fd, buf, src, dst, object_size, reloc);
igt_assert(len == execbuf.batch_len);
gem_write(fd, handle, 0, buf, len);
execbuf.flags = ring;
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
}
gem_sync(fd, handle);
diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c
index 6ee944ff..f3be8748 100644
--- a/tests/gem_exec_fence.c
+++ b/tests/gem_exec_fence.c
@@ -355,11 +355,6 @@ static void alarm_handler(int sig)
{
}
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
- return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
static unsigned int measure_ring_size(int fd)
{
struct sigaction sa = { .sa_handler = alarm_handler };
@@ -396,7 +391,7 @@ static unsigned int measure_ring_size(int fd)
last = -1;
count = 0;
do {
- if (__execbuf(fd, &execbuf) == 0) {
+ if (__gem_execbuf(fd, &execbuf) == 0) {
count++;
continue;
}
diff --git a/tests/gem_exec_latency.c b/tests/gem_exec_latency.c
index 850404b9..7fa31abe 100644
--- a/tests/gem_exec_latency.c
+++ b/tests/gem_exec_latency.c
@@ -96,11 +96,6 @@ static void set_timeout(int seconds)
alarm(seconds);
}
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
- return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
static unsigned int measure_ring_size(int fd)
{
struct drm_i915_gem_exec_object2 obj[2];
@@ -122,7 +117,7 @@ static unsigned int measure_ring_size(int fd)
count = 0;
set_timeout(1);
- while (__execbuf(fd, &execbuf) == 0)
+ while (__gem_execbuf(fd, &execbuf) == 0)
count++;
set_timeout(0);
diff --git a/tests/gem_exec_lut_handle.c b/tests/gem_exec_lut_handle.c
index 9793133c..98e6ae5a 100644
--- a/tests/gem_exec_lut_handle.c
+++ b/tests/gem_exec_lut_handle.c
@@ -77,7 +77,7 @@ static int has_exec_lut(int fd)
execbuf.buffer_count = 1;
execbuf.flags = LOCAL_I915_EXEC_HANDLE_LUT;
- return drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0;
+ return __gem_execbuf(fd, &execbuf) == 0;
}
#define ELAPSED(a,b) (1e6*((b)->tv_sec - (a)->tv_sec) + ((b)->tv_usec - (a)->tv_usec))
diff --git a/tests/gem_exec_params.c b/tests/gem_exec_params.c
index ffa21659..a012341f 100644
--- a/tests/gem_exec_params.c
+++ b/tests/gem_exec_params.c
@@ -233,10 +233,7 @@ igt_main
}
#define RUN_FAIL(expected_errno) do { \
- igt_assert(drmIoctl(fd, \
- DRM_IOCTL_I915_GEM_EXECBUFFER2, \
- &execbuf) == -1); \
- igt_assert_eq(errno, expected_errno); \
+ igt_assert_eq(errno, __gem_execbuf(fd, &execbuf)); \
} while(0)
igt_subtest("no-bsd") {
@@ -350,9 +347,7 @@ igt_main
RUN_FAIL(EPERM);
igt_device_set_master(fd);
- igt_assert(drmIoctl(fd,
- DRM_IOCTL_I915_GEM_EXECBUFFER2,
- &execbuf) == 0);
+ gem_execbuf(fd, &execbuf);
igt_device_drop_master(fd); /* Only needs temporary master */
}
diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c
index b8a67350..64632928 100644
--- a/tests/gem_exec_schedule.c
+++ b/tests/gem_exec_schedule.c
@@ -646,14 +646,6 @@ static void alarm_handler(int sig)
{
}
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
- int err = 0;
- if (ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf))
- err = -errno;
- return err;
-}
-
static unsigned int measure_ring_size(int fd, unsigned int ring)
{
struct sigaction sa = { .sa_handler = alarm_handler };
@@ -692,7 +684,7 @@ static unsigned int measure_ring_size(int fd, unsigned int ring)
last = -1;
count = 0;
do {
- if (__execbuf(fd, &execbuf) == 0) {
+ if (__gem_execbuf(fd, &execbuf) == 0) {
count++;
continue;
}
@@ -922,7 +914,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
last = -1;
count = 0;
do {
- if (__execbuf(fd, &execbuf) == 0) {
+ if (__gem_execbuf(fd, &execbuf) == 0) {
count++;
continue;
}
@@ -962,7 +954,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
* able to add ourselves to *our* ring without interruption.
*/
igt_debug("HP child executing\n");
- result[2] = __execbuf(fd, &execbuf) == 0;
+ result[2] = __gem_execbuf(fd, &execbuf) == 0;
gem_context_destroy(fd, execbuf.rsvd1);
}
@@ -976,7 +968,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
itv.it_value.tv_usec = 50000;
setitimer(ITIMER_REAL, &itv, NULL);
igt_debug("LP parent executing\n");
- igt_assert_eq(__execbuf(fd, &execbuf), -EINTR);
+ igt_assert_eq(__gem_execbuf(fd, &execbuf), -EINTR);
igt_assert_f(result[1], "Child was not released!\n");
igt_assert_f(result[2],
"High priority child unable to submit within 10ms\n");
diff --git a/tests/gem_gtt_hog.c b/tests/gem_gtt_hog.c
index a3dbfad4..ca730649 100644
--- a/tests/gem_gtt_hog.c
+++ b/tests/gem_gtt_hog.c
@@ -113,7 +113,7 @@ static void busy(data_t *data, uint32_t handle, int size, int loops)
gem_pwrite.data_ptr = to_user_pointer(buf);
if (drmIoctl(data->fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite) == 0) {
while (loops--)
- drmIoctl(data->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(data->fd, &execbuf);
}
drmIoctl(data->fd, DRM_IOCTL_GEM_CLOSE, &create.handle);
diff --git a/tests/gem_lut_handle.c b/tests/gem_lut_handle.c
index 10516b4f..27758f39 100644
--- a/tests/gem_lut_handle.c
+++ b/tests/gem_lut_handle.c
@@ -84,12 +84,7 @@ static int exec(int fd, uint32_t handle, unsigned int flags)
i915_execbuffer2_set_context_id(execbuf, 0);
execbuf.rsvd2 = 0;
- if (drmIoctl(fd,
- DRM_IOCTL_I915_GEM_EXECBUFFER2,
- &execbuf))
- return -errno;
-
- return 0;
+ return __gem_execbuf(fd, &execbuf);
}
static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsigned flags)
@@ -156,9 +151,7 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign
i915_execbuffer2_set_context_id(execbuf, 0);
execbuf.rsvd2 = 0;
- ret = drmIoctl(fd,
- DRM_IOCTL_I915_GEM_EXECBUFFER2,
- &execbuf);
+ ret = __gem_execbuf(fd, &execbuf);
if (ret < 0)
ret = -errno;
diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c
index e1543f22..383a57f7 100644
--- a/tests/gem_pwrite_pread.c
+++ b/tests/gem_pwrite_pread.c
@@ -100,7 +100,7 @@ static void copy(int fd, uint32_t src, uint32_t dst, void *buf, int len, int loo
while (loops--) {
gem_write(fd, src, 0, buf, len);
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
gem_read(fd, dst, 0, buf, len);
}
@@ -120,7 +120,7 @@ static void as_gtt_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len,
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
memcpy(src_ptr, buf, len);
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
gem_set_domain(fd, dst,
I915_GEM_DOMAIN_GTT, 0);
memcpy(buf, dst_ptr, len);
@@ -145,7 +145,7 @@ static void as_cpu_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len,
I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
memcpy(src_ptr, buf, len);
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
gem_set_domain(fd, dst,
I915_GEM_DOMAIN_CPU, 0);
memcpy(buf, dst_ptr, len);
@@ -167,7 +167,7 @@ static void test_copy(int fd, uint32_t src, uint32_t dst, uint32_t *buf, int len
gem_write(fd, src, 0, buf, len);
memset(buf, 0, len);
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
gem_read(fd, dst, 0, buf, len);
gem_close(fd, exec[2].handle);
@@ -189,7 +189,7 @@ static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len)
for (i = 0; i < len/4; i++)
src_ptr[i] = i;
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
gem_close(fd, exec[2].handle);
gem_set_domain(fd, dst, I915_GEM_DOMAIN_GTT, 0);
@@ -213,7 +213,7 @@ static void test_as_cpu_mmap(int fd, uint32_t src, uint32_t dst, int len)
for (i = 0; i < len/4; i++)
src_ptr[i] = i;
- do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(fd, &execbuf);
gem_close(fd, exec[2].handle);
gem_set_domain(fd, dst, I915_GEM_DOMAIN_CPU, 0);
diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index c3376a67..c51c3911 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -270,11 +270,6 @@ static void alarm_handler(int sig)
{
}
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
- return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
static unsigned int measure_ring_size(int fd)
{
struct sigaction sa = { .sa_handler = alarm_handler };
@@ -311,7 +306,7 @@ static unsigned int measure_ring_size(int fd)
last = -1;
count = 0;
do {
- if (__execbuf(fd, &execbuf) == 0) {
+ if (__gem_execbuf(fd, &execbuf) == 0) {
count++;
continue;
}
diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c
index 1159b4eb..147b7b87 100644
--- a/tests/gen3_mixed_blits.c
+++ b/tests/gen3_mixed_blits.c
@@ -310,10 +310,10 @@ render_copy(int fd,
i915_execbuffer2_set_context_id(exec, 0);
exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
- while (ret && errno == EBUSY) {
+ ret = __gem_execbuf(fd, &exec);
+ while (ret == EBUSY) {
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
}
igt_assert_eq(ret, 0);
@@ -388,10 +388,10 @@ static void blt_copy(int fd, uint32_t dst, uint32_t src)
i915_execbuffer2_set_context_id(exec, 0);
exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
while (ret && errno == EBUSY) {
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
}
igt_assert_eq(ret, 0);
diff --git a/tests/gen3_render_linear_blits.c b/tests/gen3_render_linear_blits.c
index e56bff93..980a1eed 100644
--- a/tests/gen3_render_linear_blits.c
+++ b/tests/gen3_render_linear_blits.c
@@ -280,10 +280,10 @@ copy(int fd, uint32_t dst, uint32_t src)
i915_execbuffer2_set_context_id(exec, 0);
exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
- while (ret && errno == EBUSY) {
+ ret = __gem_execbuf(fd, &exec);
+ while (ret == EBUSY) {
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
}
igt_assert_eq(ret, 0);
diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c
index 6cc8d056..7dab181d 100644
--- a/tests/gen3_render_mixed_blits.c
+++ b/tests/gen3_render_mixed_blits.c
@@ -293,10 +293,10 @@ copy(int fd,
i915_execbuffer2_set_context_id(exec, 0);
exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
- while (ret && errno == EBUSY) {
+ ret = __gem_execbuf(fd, &exec);
+ while (ret == EBUSY) {
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
}
igt_assert_eq(ret, 0);
diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c
index 6706d3a3..b7a632fa 100644
--- a/tests/gen3_render_tiledx_blits.c
+++ b/tests/gen3_render_tiledx_blits.c
@@ -280,10 +280,10 @@ copy(int fd, uint32_t dst, uint32_t src)
i915_execbuffer2_set_context_id(exec, 0);
exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
while (ret && errno == EBUSY) {
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
}
igt_assert_eq(ret, 0);
diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c
index 44e88d4d..5a495534 100644
--- a/tests/gen3_render_tiledy_blits.c
+++ b/tests/gen3_render_tiledy_blits.c
@@ -280,10 +280,10 @@ copy(int fd, uint32_t dst, uint32_t src)
i915_execbuffer2_set_context_id(exec, 0);
exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
- while (ret && errno == EBUSY) {
+ ret = __gem_execbuf(fd, &exec);
+ while (ret == EBUSY) {
drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+ ret = __gem_execbuf(fd, &exec);
}
igt_assert_eq(ret, 0);
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index d2a6705e..04be8c54 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -1116,7 +1116,7 @@ static void submit_blt_cmd(uint32_t dst_handle, uint16_t x, uint16_t y,
execbuf.flags = I915_EXEC_BLT;
i915_execbuffer2_set_context_id(execbuf, 0);
- do_ioctl(drm_fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(drm_fd, &execbuf);
*presumed_dst_offset = relocs[0].presumed_offset;
@@ -1257,7 +1257,7 @@ static void gem_execbuf_stress_subtest(int rounds, int wait_flags)
i915_execbuffer2_set_context_id(execbuf, 0);
for (i = 0; i < rounds; i++) {
- do_ioctl(drm_fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(drm_fd, &execbuf);
if (wait_flags & WAIT_STATUS)
igt_assert(wait_for_suspended());
@@ -1387,7 +1387,7 @@ static void system_suspend_execbuf_subtest(void)
igt_assert(wait_for_suspended());
for (i = 0; i < 20; i++) {
- do_ioctl(drm_fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ gem_execbuf(drm_fd, &execbuf);
igt_assert(wait_for_suspended());
}
--
2.14.2
More information about the igt-dev
mailing list