Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id C346510E5CC for ; Wed, 23 Mar 2022 07:24:05 +0000 (UTC) From: Bhanuprakash Modem To: igt-dev@lists.freedesktop.org Date: Wed, 23 Mar 2022 12:52:23 +0530 Message-Id: <20220323072223.566016-1-bhanuprakash.modem@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t] tests/kms_setmode: Limit the execution on simulation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: Restrict the execution of all subtests to two pipes on simulation environment. If we want to execute on all pipes, need to pass an extra flag "-e" as a command line argument. Example: ./build/tests/kms_setmode -e --r basic Cc: Karthik B S Signed-off-by: Bhanuprakash Modem --- tests/kms_setmode.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c index d5cb45d438..5f879fb633 100644 --- a/tests/kms_setmode.c +++ b/tests/kms_setmode.c @@ -37,10 +37,14 @@ /* max combinations with repetitions */ #define MAX_COMBINATION_ELEMS MAX_CRTCS +/* restricted pipe count */ +#define CRTC_RESTRICT_CNT 2 + static int drm_fd; static drmModeRes *drm_resources; static int filter_test_id; static bool dry_run; +static bool extended = false; const drmModeModeInfo mode_640_480 = { .name = "640x480", @@ -801,6 +805,18 @@ static void get_combinations(int n, int k, bool allow_repetitions, iterate_combinations(n, k, allow_repetitions, 0, 0, &comb, set); } +static int get_crtc_count(int count_crtcs, bool extend) +{ + if (igt_run_in_simulation()) { + if ((count_crtcs <= CRTC_RESTRICT_CNT) || extend) + return count_crtcs; + else + return CRTC_RESTRICT_CNT; + } + + return count_crtcs; +} + static void test_combinations(const struct test_config *tconf, int connector_count) { @@ -808,6 +824,7 @@ static void test_combinations(const struct test_config *tconf, struct combination_set crtc_combs; struct connector_config *cconfs; int i; + int crtc_count = get_crtc_count(tconf->resources->count_crtcs, extended); if (connector_count > 2 && (tconf->flags & TEST_STEALING)) return; @@ -815,17 +832,15 @@ static void test_combinations(const struct test_config *tconf, igt_assert(tconf->resources); connector_combs.capacity = pow(tconf->resources->count_connectors, - tconf->resources->count_crtcs + 1); - crtc_combs.capacity = pow(tconf->resources->count_crtcs, - tconf->resources->count_crtcs + 1); - + crtc_count + 1); + crtc_combs.capacity = pow(crtc_count, + crtc_count + 1); connector_combs.items = malloc(connector_combs.capacity * sizeof(struct combination)); crtc_combs.items = malloc(crtc_combs.capacity * sizeof(struct combination)); get_combinations(tconf->resources->count_connectors, connector_count, false, &connector_combs); - get_combinations(tconf->resources->count_crtcs, connector_count, - true, &crtc_combs); + get_combinations(crtc_count, connector_count, true, &crtc_combs); igt_info("Testing: %s %d connector combinations\n", tconf->name, connector_count); @@ -866,9 +881,10 @@ free_cconfs: static void run_test(const struct test_config *tconf) { int connector_num; + int crtc_count = get_crtc_count(tconf->resources->count_crtcs, extended); connector_num = tconf->flags & TEST_CLONE ? 2 : 1; - for (; connector_num <= tconf->resources->count_crtcs; connector_num++) + for (; connector_num <= crtc_count; connector_num++) test_combinations(tconf, connector_num); } @@ -878,6 +894,9 @@ static int opt_handler(int opt, int opt_index, void *data) case 'd': dry_run = true; break; + case 'e': + extended = true; + break; case 't': filter_test_id = atoi(optarg); break; @@ -890,9 +909,10 @@ static int opt_handler(int opt, int opt_index, void *data) const char *help_str = " -d\t\tDon't run any test, only print what would be done. (still needs DRM access)\n" - " -t \tRun only the test with this id."; + " -t \tRun only the test with this id\n" + " -e \t\tRun on all pipes. (Default it will Run only two pipes)\n"; -igt_main_args("dt:", NULL, help_str, opt_handler, NULL) +igt_main_args("det:", NULL, help_str, opt_handler, NULL) { const struct { enum test_flags flags; -- 2.35.1