From patchwork Thu Oct 16 16:49:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 5092651 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 59996C11AC for ; Thu, 16 Oct 2014 16:50:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B388201D3 for ; Thu, 16 Oct 2014 16:50:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7CB4F201ED for ; Thu, 16 Oct 2014 16:50:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D45266E2B8; Thu, 16 Oct 2014 09:50:02 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by gabe.freedesktop.org (Postfix) with ESMTP id DE7566E2B4 for ; Thu, 16 Oct 2014 09:50:00 -0700 (PDT) Received: by mail-wi0-f178.google.com with SMTP id h11so5813685wiw.17 for ; Thu, 16 Oct 2014 09:50:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=RCSVOJYB959Gik8C7QAXtQa4mWK8KvibhNx52gkLhV8=; b=KfXsRLMx+VCsr+vaC97uA/orT6uiewwlM08PRm+wgmp1ml7pNdL7AtsvX7lI3xSihm 7p/hiwYESmVeDGi2LzOGKyuh3WBpshRGsleboxCRKJOllP3TYQwL4Mcy1AmxxhFcLZ1G Aj0BXe0sSjGMagmthWRPzJP7Idiq14hXOu+Z5Itlzl7LMF7xSpV0jkFSCfLhNHC4gJRA 6AtMHaTAHxCdhNxcHoyIjsCDS8dybjJido99chwNMFUyjOKc6A4sVjLA0BFPFingKMWJ rz1ahim3u7uQPZ1TjWXJl7z7O4eGpuvju5KnXvqrL620tlOxoLjNLcmsnZwTwzzTgb5W nnwQ== X-Gm-Message-State: ALoCoQksc6TrQ0MlgDg0fbKLa19VLAhAA+O7I5Pm9bAgclcESATIpa3kTBK0ARlRRsTy8YimekTS X-Received: by 10.194.77.4 with SMTP id o4mr3546633wjw.41.1413478199983; Thu, 16 Oct 2014 09:49:59 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id ic4sm2595840wid.19.2014.10.16.09.49.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Oct 2014 09:49:59 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Thu, 16 Oct 2014 17:49:49 +0100 Message-Id: <1413478193-7970-4-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1413478193-7970-1-git-send-email-thomas.wood@intel.com> References: <1413478193-7970-1-git-send-email-thomas.wood@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 3/7] lib: add common min and max macros X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Thomas Wood --- 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(-) diff --git a/lib/igt_aux.h b/lib/igt_aux.h index d74bb8c..415614b 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -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 */ diff --git a/tests/eviction_common.c b/tests/eviction_common.c index 6de68a2..03d8e8c 100644 --- a/tests/eviction_common.c +++ b/tests/eviction_common.c @@ -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) diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c index 7b3b26f..376f59d 100644 --- a/tests/gem_userptr_blits.c +++ b/tests/gem_userptr_blits.c @@ -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) { diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 901f013..f6c25a2 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -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++) { diff --git a/tools/intel_display_poller.c b/tools/intel_display_poller.c index ebc594a..2eab6c4 100644 --- a/tools/intel_display_poller.c +++ b/tools/intel_display_poller.c @@ -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,