diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/drv_hangman.c | 4 | ||||
-rw-r--r-- | tests/eviction_common.c | 5 | ||||
-rw-r--r-- | tests/gem_seqno_wrap.c | 5 | ||||
-rw-r--r-- | tests/gem_stress.c | 7 | ||||
-rw-r--r-- | tests/kms_flip.c | 12 |
5 files changed, 9 insertions, 24 deletions
diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c index cdbded2f..ec28c9d8 100644 --- a/tests/drv_hangman.c +++ b/tests/drv_hangman.c @@ -33,6 +33,7 @@ #include "intel_chipset.h" #include "drmtest.h" +#include "igt_aux.h" #include "igt_debugfs.h" #include "ioctl_wrappers.h" @@ -117,8 +118,7 @@ static void read_dfs(const char *fname, char *d, int maxlen) static void _assert_dfs_entry(const char *fname, const char *s, bool inverse) { char tmp[1024]; - const int l = strlen(s) < sizeof(tmp) ? - strlen(s) : sizeof(tmp); + const int l = min(strlen(s), sizeof(tmp)); read_dfs(fname, tmp, l + 1); if (!inverse) { diff --git a/tests/eviction_common.c b/tests/eviction_common.c index 52578e25..4a12dcbc 100644 --- a/tests/eviction_common.c +++ b/tests/eviction_common.c @@ -54,11 +54,8 @@ struct igt_eviction_test_ops static void exchange_uint32_t(void *array, unsigned i, unsigned j) { uint32_t *i_arr = array; - uint32_t i_tmp; - i_tmp = i_arr[i]; - i_arr[i] = i_arr[j]; - i_arr[j] = i_tmp; + swap(i_arr[i], i_arr[j]); } static int minor_evictions(int fd, struct igt_eviction_test_ops *ops, diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c index be4ab3dd..7da7fdf1 100644 --- a/tests/gem_seqno_wrap.c +++ b/tests/gem_seqno_wrap.c @@ -171,11 +171,8 @@ static void render_copyfunc(struct igt_buf *src, static void exchange_uint(void *array, unsigned i, unsigned j) { unsigned *i_arr = array; - unsigned i_tmp; - i_tmp = i_arr[i]; - i_arr[i] = i_arr[j]; - i_arr[j] = i_tmp; + swap(i_arr[i], i_arr[j]); } static void run_sync_test(int num_buffers, bool verify) diff --git a/tests/gem_stress.c b/tests/gem_stress.c index 6e3a64c4..9f20bde2 100644 --- a/tests/gem_stress.c +++ b/tests/gem_stress.c @@ -570,11 +570,8 @@ static void init_set(unsigned set) static void exchange_uint(void *array, unsigned i, unsigned j) { unsigned *i_arr = array; - unsigned i_tmp; - i_tmp = i_arr[i]; - i_arr[i] = i_arr[j]; - i_arr[j] = i_tmp; + swap(i_arr[i], i_arr[j]); } static void copy_tiles(unsigned *permutation) @@ -741,7 +738,7 @@ static void init(void) if (options.num_buffers == 0) { tmp = gem_aperture_size(drm_fd); - tmp = tmp > 256*(1024*1024) ? 256*(1024*1024) : tmp; + tmp = min(256 * (1024 * 1024), tmp); num_buffers = 2 * tmp / options.scratch_buf_size / 3; num_buffers /= 2; igt_info("using %u buffers\n", num_buffers); diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 041f46a6..e579ce0e 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -165,7 +165,7 @@ static unsigned long gettime_us(void) static void emit_dummy_load__bcs(struct test_output *o) { int i, limit; - drm_intel_bo *dummy_bo, *target_bo, *tmp_bo; + drm_intel_bo *dummy_bo, *target_bo; struct igt_fb *fb_info = &o->fb_info[o->current_fb_id]; unsigned pitch = fb_info->stride; @@ -197,9 +197,7 @@ static void emit_dummy_load__bcs(struct test_output *o) ADVANCE_BATCH(); } - tmp_bo = dummy_bo; - dummy_bo = target_bo; - target_bo = tmp_bo; + swap(dummy_bo, target_bo); } intel_batchbuffer_flush(batch); @@ -282,16 +280,12 @@ static void emit_dummy_load__rcs(struct test_output *o) dst = &sb[1]; for (i = 0; i < limit; i++) { - struct igt_buf *tmp; - copyfunc(batch, NULL, src, 0, 0, o->fb_width, o->fb_height, dst, 0, 0); - tmp = src; - src = dst; - dst = tmp; + swap(src, dst); } intel_batchbuffer_flush(batch); |