From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Subject: [PATCH i-g-t v2 3/4] tests/intel/kms_sharpness_filter: restructure igt_main
Date: Thu, 16 Apr 2026 18:54:20 +0300 [thread overview]
Message-ID: <20260416155421.2000-4-juhapekka.heikkila@gmail.com> (raw)
In-Reply-To: <20260416155421.2000-1-juhapekka.heikkila@gmail.com>
collect tests into list and call them through there
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
tests/intel/kms_sharpness_filter.c | 315 +++++++++++++++++------------
1 file changed, 182 insertions(+), 133 deletions(-)
diff --git a/tests/intel/kms_sharpness_filter.c b/tests/intel/kms_sharpness_filter.c
index b1c80eecd..98eb671d1 100644
--- a/tests/intel/kms_sharpness_filter.c
+++ b/tests/intel/kms_sharpness_filter.c
@@ -19,7 +19,7 @@
* Description: Verify basic content adaptive sharpness filter.
*
* SUBTEST: filter-strength
- * Description: Verify that varying strength (0-255), affects the degree of sharpeness applied.
+ * Description: Verify that varying strength (0-255), affects the degree of sharpness applied.
*
* SUBTEST: filter-modifiers
* Description: Verify content adaptive sharpness filter with varying modifiers.
@@ -88,6 +88,7 @@ IGT_TEST_DESCRIPTION("Test to validate content adaptive sharpness filter");
#define MAX_PIXELS_FOR_3_TAP_FILTER (1920 * 1080)
#define MAX_PIXELS_FOR_5_TAP_FILTER (3840 * 2160)
#define NROUNDS 10
+#define DEFAULT_FILTER_STRENGTH -1
enum test_type {
TEST_FILTER_BASIC,
@@ -142,6 +143,131 @@ static const uint32_t scaling_modes[] = {
DRM_MODE_SCALE_ASPECT,
};
+enum subtest_iter {
+ ITER_NONE,
+ ITER_STRENGTH,
+ ITER_MODIFIER,
+ ITER_ROTATION,
+ ITER_FORMAT,
+ ITER_SCALING_MODE,
+};
+
+static const struct subtest_entry {
+ const char *name;
+ const char *describe;
+ enum test_type type;
+ int filter_strength;
+ uint32_t format;
+ enum subtest_iter iter;
+} subtests[] = {
+ {
+ .name = "filter-basic",
+ .describe = "Verify basic content adaptive sharpness filter.",
+ .type = TEST_FILTER_BASIC,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ },
+ {
+ .name = "filter-strength",
+ .describe = "Verify that varying strength (0-255) affects the degree of sharpness applied.",
+ .type = TEST_FILTER_STRENGTH,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ .iter = ITER_STRENGTH,
+ },
+ {
+ .name = "filter-modifiers",
+ .describe = "Verify content adaptive sharpness filter with varying modifiers.",
+ .type = TEST_FILTER_MODIFIERS,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ .iter = ITER_MODIFIER,
+ },
+ {
+ .name = "filter-rotations",
+ .describe = "Verify content adaptive sharpness filter with varying rotations.",
+ .type = TEST_FILTER_ROTATION,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ .iter = ITER_ROTATION,
+ },
+ {
+ .name = "filter-formats",
+ .describe = "Verify content adaptive sharpness filter with varying formats.",
+ .type = TEST_FILTER_FORMATS,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ .iter = ITER_FORMAT,
+ },
+ {
+ .name = "filter-toggle",
+ .describe = "Verify toggling between enabling and disabling content adaptive sharpness filter.",
+ .type = TEST_FILTER_TOGGLE,
+ .filter_strength = MAX_FILTER_STRENGTH,
+ },
+ {
+ .name = "filter-tap",
+ .describe = "Verify content adaptive sharpness filter with resolution change; "
+ "resolution change will lead to selection of distinct taps.",
+ .type = TEST_FILTER_TAP,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ },
+ {
+ .name = "filter-dpms",
+ .describe = "Verify content adaptive sharpness filter with DPMS.",
+ .type = TEST_FILTER_DPMS,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ },
+ {
+ .name = "filter-suspend",
+ .describe = "Verify content adaptive sharpness filter with suspend.",
+ .type = TEST_FILTER_SUSPEND,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ },
+ {
+ .name = "filter-scaler-upscale",
+ .describe = "Verify content adaptive sharpness filter with 1 plane scaler enabled during upscaling.",
+ .type = TEST_FILTER_UPSCALE,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ },
+ {
+ .name = "filter-scaler-downscale",
+ .describe = "Verify content adaptive sharpness filter with 1 plane scaler enabled during downscaling.",
+ .type = TEST_FILTER_DOWNSCALE,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ },
+ {
+ .name = "invalid-filter-with-scaler",
+ .describe = "Negative check for content adaptive sharpness filter "
+ "when 2 plane scalers have already been enabled and "
+ "attempt is made to enable sharpness filter.",
+ .type = TEST_INVALID_FILTER_WITH_SCALER,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ },
+ {
+ .name = "invalid-filter-with-plane",
+ .describe = "Negative check for content adaptive sharpness filter "
+ "when 2 NV12 planes have already been enabled and "
+ "attempt is made to enable the sharpness filter.",
+ .type = TEST_INVALID_FILTER_WITH_PLANE,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ .format = DRM_FORMAT_NV12,
+ },
+ {
+ .name = "invalid-plane-with-filter",
+ .describe = "Negative check for content adaptive sharpness filter "
+ "when 1 NV12 plane and sharpness filter have already been enabled "
+ "and attempt is made to enable the second NV12 plane.",
+ .type = TEST_INVALID_PLANE_WITH_FILTER,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ .format = DRM_FORMAT_NV12,
+ },
+ {
+ .name = "invalid-filter-with-scaling-mode",
+ .describe = "Negative check for content adaptive sharpness filter "
+ "when scaling mode is already enabled and attempt is made "
+ "to enable sharpness filter.",
+ .type = TEST_INVALID_FILTER_WITH_SCALING_MODE,
+ .filter_strength = DEFAULT_FILTER_STRENGTH,
+ .iter = ITER_SCALING_MODE,
+ },
+};
+
typedef struct {
int drm_fd;
bool limited;
@@ -587,6 +713,48 @@ static void set_data_defaults(data_t *data)
data->filter_strength = MID_FILTER_STRENGTH;
}
+static int iter_count(enum subtest_iter iter)
+{
+ switch (iter) {
+ case ITER_STRENGTH:
+ return ARRAY_SIZE(filter_strength_list);
+ case ITER_MODIFIER:
+ return ARRAY_SIZE(modifiers);
+ case ITER_ROTATION:
+ return ARRAY_SIZE(rotations);
+ case ITER_FORMAT:
+ return ARRAY_SIZE(formats);
+ case ITER_SCALING_MODE:
+ return ARRAY_SIZE(scaling_modes);
+ default:
+ return 1;
+ }
+}
+
+static void apply_iter_param(data_t *data, const struct subtest_entry *st, int idx)
+{
+ switch (st->iter) {
+ case ITER_STRENGTH:
+ data->filter_strength = filter_strength_list[idx];
+ break;
+ case ITER_MODIFIER:
+ data->modifier = modifiers[idx].modifier;
+ data->modifier_name = modifiers[idx].name;
+ break;
+ case ITER_ROTATION:
+ data->rotation = rotations[idx];
+ break;
+ case ITER_FORMAT:
+ data->format = formats[idx];
+ break;
+ case ITER_SCALING_MODE:
+ data->scaling_mode = scaling_modes[idx];
+ break;
+ default:
+ break;
+ }
+}
+
static int opt_handler(int opt, int opt_index, void *_data)
{
data_t *data = _data;
@@ -619,142 +787,23 @@ int igt_main_args("l", NULL, help_str, opt_handler, &data)
igt_display_require_output(&data.display);
}
- igt_describe("Verify basic content adaptive sharpness filter.");
- igt_subtest_with_dynamic("filter-basic") {
- set_data_defaults(&data);
- run_sharpness_filter_test(&data, TEST_FILTER_BASIC);
- }
-
- igt_describe("Verify that varying strength(0-255), affects "
- "the degree of sharpeness applied.");
- igt_subtest_with_dynamic("filter-strength") {
- set_data_defaults(&data);
-
- for (int i = 0; i < ARRAY_SIZE(filter_strength_list); i++) {
- data.filter_strength = filter_strength_list[i];
-
- run_sharpness_filter_test(&data, TEST_FILTER_STRENGTH);
- }
- }
-
- igt_describe("Verify content adaptive sharpness filter with "
- "varying modifiers.");
- igt_subtest_with_dynamic("filter-modifiers") {
- set_data_defaults(&data);
-
- for (int i = 0; i < ARRAY_SIZE(modifiers); i++) {
- data.modifier = modifiers[i].modifier;
- data.modifier_name = modifiers[i].name;
-
- run_sharpness_filter_test(&data, TEST_FILTER_MODIFIERS);
- }
- }
-
- igt_describe("Verify content adaptive sharpness filter with "
- "varying rotations.");
- igt_subtest_with_dynamic("filter-rotations") {
- set_data_defaults(&data);
-
- for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
- data.rotation = rotations[i];
-
- run_sharpness_filter_test(&data, TEST_FILTER_ROTATION);
- }
- }
-
- igt_describe("Verify content adaptive sharpness filter with "
- "varying formats.");
- igt_subtest_with_dynamic("filter-formats") {
- set_data_defaults(&data);
-
- for (int i = 0; i < ARRAY_SIZE(formats); i++) {
- data.format = formats[i];
-
- run_sharpness_filter_test(&data, TEST_FILTER_FORMATS);
- }
- }
-
- igt_describe("Verify toggling between enabling and disabling "
- "content adaptive sharpness filter.");
- igt_subtest_with_dynamic("filter-toggle") {
- set_data_defaults(&data);
- data.filter_strength = MAX_FILTER_STRENGTH;
- run_sharpness_filter_test(&data, TEST_FILTER_TOGGLE);
- }
-
- igt_describe("Verify that following a resolution change, "
- "distict taps are selected.");
- igt_subtest_with_dynamic("filter-tap") {
- set_data_defaults(&data);
- run_sharpness_filter_test(&data, TEST_FILTER_TAP);
- }
-
- igt_describe("Verify content adaptive sharpness filter "
- "with DPMS.");
- igt_subtest_with_dynamic("filter-dpms") {
- set_data_defaults(&data);
- run_sharpness_filter_test(&data, TEST_FILTER_DPMS);
- }
-
- igt_describe("Verify content adaptive sharpness filter "
- "with suspend.");
- igt_subtest_with_dynamic("filter-suspend") {
- set_data_defaults(&data);
- run_sharpness_filter_test(&data, TEST_FILTER_SUSPEND);
- }
-
- igt_describe("Verify content adaptive sharpness filter "
- "with 1 plane scaler enabled.");
- igt_subtest_with_dynamic("filter-scaler-upscale") {
- set_data_defaults(&data);
- run_sharpness_filter_test(&data, TEST_FILTER_UPSCALE);
- }
-
- igt_describe("Verify content adaptive sharpness filter "
- "with 1 plane scaler enabled.");
- igt_subtest_with_dynamic("filter-scaler-downscale") {
- set_data_defaults(&data);
- run_sharpness_filter_test(&data, TEST_FILTER_DOWNSCALE);
- }
-
- igt_describe("Negative check for content adaptive sharpness filter "
- "when 2 plane scalers have already been enabled and "
- "attempt is made to enable sharpness filter.");
- igt_subtest_with_dynamic("invalid-filter-with-scaler") {
- set_data_defaults(&data);
- run_sharpness_filter_test(&data, TEST_INVALID_FILTER_WITH_SCALER);
- }
-
- igt_describe("Negative check for content adaptive sharpness filter "
- "when 2 NV12 planes have already been enabled and attempt is "
- "made to enable the sharpness filter.");
- igt_subtest_with_dynamic("invalid-filter-with-plane") {
- set_data_defaults(&data);
- data.format = DRM_FORMAT_NV12;
-
- run_sharpness_filter_test(&data, TEST_INVALID_FILTER_WITH_PLANE);
- }
-
- igt_describe("Negative check for content adaptive sharpness filter "
- "when 1 NV12 plane and sharpness filter have already been enabled "
- "and attempt is made to enable the second NV12 plane.");
- igt_subtest_with_dynamic("invalid-plane-with-filter") {
- set_data_defaults(&data);
- data.format = DRM_FORMAT_NV12;
+ for (int s = 0; s < ARRAY_SIZE(subtests); s++) {
+ const struct subtest_entry *p = &subtests[s];
- run_sharpness_filter_test(&data, TEST_INVALID_PLANE_WITH_FILTER);
- }
+ igt_describe(p->describe);
+ igt_subtest_with_dynamic(p->name) {
+ set_data_defaults(&data);
- igt_describe("Negative check for content adaptive sharpness filter "
- "when scaling mode is already enabled and attempt is made "
- "to enable sharpness filter.");
- igt_subtest_with_dynamic("invalid-filter-with-scaling-mode") {
- set_data_defaults(&data);
+ if (p->filter_strength != DEFAULT_FILTER_STRENGTH)
+ data.filter_strength = p->filter_strength;
- for (int k = 0; k < ARRAY_SIZE(scaling_modes); k++) {
- data.scaling_mode = scaling_modes[k];
+ if (p->format != 0)
+ data.format = p->format;
- run_sharpness_filter_test(&data, TEST_INVALID_FILTER_WITH_SCALING_MODE);
+ for (int i = 0; i < iter_count(p->iter); i++) {
+ apply_iter_param(&data, p, i);
+ run_sharpness_filter_test(&data, p->type);
+ }
}
}
--
2.43.0
next prev parent reply other threads:[~2026-04-16 15:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 15:54 [PATCH i-g-t v2 0/4] Refactor kms_sharpness_filter tests Juha-Pekka Heikkila
2026-04-16 15:54 ` [PATCH i-g-t v2 1/4] tests/intel/kms_sharpness_filter: sanitize subtest init Juha-Pekka Heikkila
2026-04-16 15:54 ` [PATCH i-g-t v2 2/4] tests/intel/kms_sharpness_filter: refactor test_sharpness_filter function Juha-Pekka Heikkila
2026-04-16 19:53 ` Sharma, Swati2
2026-04-16 15:54 ` Juha-Pekka Heikkila [this message]
2026-04-16 19:53 ` [PATCH i-g-t v2 3/4] tests/intel/kms_sharpness_filter: restructure igt_main Sharma, Swati2
2026-04-16 15:54 ` [PATCH i-g-t v2 4/4] tests/intel/kms_sharpness_filter: Find mode with lowest bw requirement for test Juha-Pekka Heikkila
2026-04-16 19:54 ` Sharma, Swati2
2026-04-17 7:28 ` Jani Nikula
2026-04-17 0:39 ` ✓ Xe.CI.BAT: success for Refactor kms_sharpness_filter tests (rev2) Patchwork
2026-04-17 0:53 ` ✓ i915.CI.BAT: " Patchwork
2026-04-17 3:10 ` ✗ Xe.CI.FULL: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260416155421.2000-4-juhapekka.heikkila@gmail.com \
--to=juhapekka.heikkila@gmail.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox