@@ -83,4 +83,8 @@ bool intel_check_memory(uint32_t count, uint32_t size, unsigned mode);
#define CHECK_RAM 0x1
#define CHECK_SWAP 0x2
+
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#define max(a, b) ((a) < (b) ? (a) : (b))
+
#endif /* IGT_AUX_H */
@@ -170,8 +170,6 @@ static int swapping_evictions(int fd, struct igt_eviction_test_ops *ops,
return 0;
}
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
static int forking_evictions(int fd, struct igt_eviction_test_ops *ops,
int surface_size, int working_surfaces,
int trash_surfaces, unsigned flags)
@@ -981,8 +981,6 @@ static int can_swap(void)
return 1;
}
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
static void test_forking_evictions(int fd, int size, int count,
unsigned flags)
{
@@ -84,8 +84,6 @@
#define DRM_CAP_TIMESTAMP_MONOTONIC 6
#endif
-#define max(a, b) ((a) > (b) ? (a) : (b))
-
drmModeRes *resources;
int drm_fd;
static drm_intel_bufmgr *bufmgr;
@@ -925,7 +923,7 @@ static unsigned int run_test_step(struct test_output *o)
if (o->flags & TEST_PAN) {
int count = do_flip ?
o->flip_state.count : o->vblank_state.count;
- int x_ofs = count * 10 > o->fb_width - o->kmode[0].hdisplay ? o->fb_width - o->kmode[0].hdisplay : count * 10;
+ int x_ofs = min(count * 10, o->fb_width - o->kmode[0].hdisplay);
/* Make sure DSPSURF changes value */
if (o->flags & TEST_HANG)
@@ -1396,7 +1394,7 @@ static int run_test(int duration, int flags)
igt_require(modes);
duration = duration * 1000 / modes;
- duration = duration < 500 ? 500 : duration;
+ duration = max(500, duration);
/* Find any connected displays */
for (i = 0; i < resources->count_connectors; i++) {
@@ -1460,7 +1458,7 @@ static int run_pair(int duration, int flags)
* configuration at all. So skip in that case. */
igt_require(modes);
duration = duration * 1000 / modes;
- duration = duration < 500 ? 500 : duration;
+ duration = max(duration, 500);
/* Find a pair of connected displays */
for (i = 0; i < resources->count_connectors; i++) {
@@ -36,9 +36,7 @@
#include "intel_io.h"
#include "igt_debugfs.h"
#include "drmtest.h"
-
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#define max(a,b) ((a) > (b) ? (a) : (b))
+#include "igt_aux.h"
enum test {
TEST_INVALID,
Signed-off-by: Thomas Wood <thomas.wood@intel.com> --- lib/igt_aux.h | 4 ++++ tests/eviction_common.c | 2 -- tests/gem_userptr_blits.c | 2 -- tests/kms_flip.c | 8 +++----- tools/intel_display_poller.c | 4 +--- 5 files changed, 8 insertions(+), 12 deletions(-)