From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 09/17] tests/kms_color*: Use igt_crtc_t instead of enum pipe
Date: Wed, 11 Feb 2026 18:33:56 +0200 [thread overview]
Message-ID: <20260211163404.2018-10-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260211163404.2018-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Convert the use of enum pipe to igt_crtc_t in
tests/kms_color*.
The use of function pointers makes this a bit more
complicated than your average test.
#include "scripts/iterators.cocci"
@func@
typedef igt_crtc_t;
identifier FUNC, PIPE;
parameter list[N] P;
@@
FUNC(P
- ,enum pipe PIPE
+ ,igt_crtc_t *crtc
,...)
{
<...
(
- igt_crtc_for_pipe(..., PIPE)
+ crtc
|
- kmstest_pipe_name(PIPE)
+ igt_crtc_name(crtc)
|
- PIPE
+ crtc->pipe
)
...>
}
@depends on func@
identifier func.FUNC;
expression PIPE;
expression list[func.N] EP;
@@
FUNC(EP
- ,PIPE
+ ,igt_crtc_for_pipe(display, PIPE)
,...)
@@
identifier FUNC, CRTC;
@@
FUNC(..., igt_crtc_t *CRTC, ...)
{
...
(
- igt_crtc_t *CRTC = CRTC;
|
- igt_crtc_t *CRTC = igt_crtc_for_pipe(...);
|
- igt_crtc_t *CRTC;
...
- CRTC = igt_crtc_for_pipe(...);
)
...
}
@func_ptr@
parameter list[N] P;
identifier F, PIPE;
type T;
@@
struct {
...
T (*F)(P
- ,enum pipe PIPE
+ ,igt_crtc_t *crtc
,...);
...
}
@depends on func_ptr@
identifier func_ptr.F;
expression list[func_ptr.N] EP;
expression PIPE, X;
@@
X.F(EP
- ,PIPE
+ ,igt_crtc_for_pipe(display, PIPE)
,...)
@@
igt_crtc_t *CRTC;
@@
- igt_crtc_for_pipe(..., CRTC->pipe)
+ CRTC
@@
identifier DISPLAY;
expression E;
@@
- igt_display_t *DISPLAY = E;
... when != DISPLAY
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/chamelium/kms_chamelium_color.c | 49 ++++++++++++++-------------
tests/kms_color.c | 46 ++++++++++++-------------
tests/kms_color_helper.c | 23 +++++++------
tests/kms_color_helper.h | 8 ++---
tests/kms_color_pipeline.c | 10 +++---
5 files changed, 67 insertions(+), 69 deletions(-)
diff --git a/tests/chamelium/kms_chamelium_color.c b/tests/chamelium/kms_chamelium_color.c
index d77b924ac672..70dbedf82acc 100644
--- a/tests/chamelium/kms_chamelium_color.c
+++ b/tests/chamelium/kms_chamelium_color.c
@@ -429,10 +429,8 @@ static bool test_pipe_limited_range_ctm(data_t *data,
}
static void
-prep_pipe(data_t *data, enum pipe p)
+prep_pipe(data_t *data, igt_crtc_t *crtc)
{
- igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
igt_require_pipe(&data->display, crtc->pipe);
if (igt_crtc_has_prop(crtc, IGT_CRTC_DEGAMMA_LUT_SIZE)) {
@@ -450,14 +448,12 @@ prep_pipe(data_t *data, enum pipe p)
}
}
-static int test_setup(data_t *data, enum pipe p)
+static int test_setup(data_t *data, igt_crtc_t *crtc)
{
- igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
int i = 0;
igt_display_reset(&data->display);
- prep_pipe(data, crtc->pipe);
+ prep_pipe(data, crtc);
igt_require(crtc->n_planes >= 0);
data->primary = igt_crtc_get_plane_type(crtc, DRM_PLANE_TYPE_PRIMARY);
@@ -489,10 +485,11 @@ static int test_setup(data_t *data, enum pipe p)
}
static void
-run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
- bool (*test_t)(data_t*, igt_plane_t*, struct chamelium_port*))
+run_gamma_degamma_tests_for_pipe(data_t *data, igt_crtc_t *crtc,
+ bool (*test_t)(data_t*, igt_plane_t*, struct chamelium_port*))
{
- int port_idx = test_setup(data, p);
+ int port_idx = test_setup(data,
+ crtc);
igt_require(port_idx >= 0);
@@ -500,15 +497,15 @@ run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
data->drm_format = DRM_FORMAT_XRGB8888;
data->mode = igt_output_get_mode(data->output);
- if (!pipe_output_combo_valid(data, p))
+ if (!pipe_output_combo_valid(data, crtc))
return;
- igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p), data->output->name)
+ igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc), data->output->name)
igt_assert(test_t(data, data->primary, data->ports[port_idx]));
}
static void
-run_ctm_tests_for_pipe(data_t *data, enum pipe p,
+run_ctm_tests_for_pipe(data_t *data, igt_crtc_t *crtc,
color_t *expected_colors,
double *ctm,
int iter)
@@ -519,7 +516,8 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
{ 0.0, 1.0, 0.0 },
{ 0.0, 0.0, 1.0 }
};
- int port_idx = test_setup(data, p);
+ int port_idx = test_setup(data,
+ crtc);
igt_require(port_idx >= 0);
/*
@@ -538,10 +536,10 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
data->drm_format = DRM_FORMAT_XRGB8888;
data->mode = igt_output_get_mode(data->output);
- if (!pipe_output_combo_valid(data, p))
+ if (!pipe_output_combo_valid(data, crtc))
return;
- igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p), data->output->name) {
+ igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc), data->output->name) {
bool success = false;
int i;
@@ -574,10 +572,11 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
}
static void
-run_limited_range_ctm_test_for_pipe(data_t *data, enum pipe p,
- bool (*test_t)(data_t*, igt_plane_t*, struct chamelium_port*))
+run_limited_range_ctm_test_for_pipe(data_t *data, igt_crtc_t *crtc,
+ bool (*test_t)(data_t*, igt_plane_t*, struct chamelium_port*))
{
- int port_idx = test_setup(data, p);
+ int port_idx = test_setup(data,
+ crtc);
igt_require(port_idx >= 0);
igt_require(igt_output_has_prop(data->output, IGT_CONNECTOR_BROADCAST_RGB));
@@ -586,10 +585,10 @@ run_limited_range_ctm_test_for_pipe(data_t *data, enum pipe p,
data->drm_format = DRM_FORMAT_XRGB8888;
data->mode = igt_output_get_mode(data->output);
- if (!pipe_output_combo_valid(data, p))
+ if (!pipe_output_combo_valid(data, crtc))
return;
- igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(p), data->output->name)
+ igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc), data->output->name)
igt_assert(test_t(data, data->primary, data->ports[port_idx]));
}
@@ -689,7 +688,7 @@ run_tests_for_pipe(data_t *data)
igt_subtest_with_dynamic_f("%s", gamma_degamma_tests[i].name) {
for_each_crtc(&data->display, crtc) {
run_gamma_degamma_tests_for_pipe(data,
- crtc->pipe,
+ crtc,
gamma_degamma_tests[i].test_t);
}
}
@@ -699,7 +698,8 @@ run_tests_for_pipe(data_t *data)
igt_describe_f("%s", ctm_tests[i].desc);
igt_subtest_with_dynamic_f("%s", ctm_tests[i].name) {
for_each_crtc(&data->display, crtc) {
- run_ctm_tests_for_pipe(data, crtc->pipe,
+ run_ctm_tests_for_pipe(data,
+ crtc,
ctm_tests[i].colors,
ctm_tests[i].ctm,
ctm_tests[i].iter);
@@ -710,7 +710,8 @@ run_tests_for_pipe(data_t *data)
igt_describe("Compare after applying ctm matrix & identity matrix");
igt_subtest_with_dynamic("ctm-limited-range") {
for_each_crtc(&data->display, crtc) {
- run_limited_range_ctm_test_for_pipe(data, crtc->pipe,
+ run_limited_range_ctm_test_for_pipe(data,
+ crtc,
test_pipe_limited_range_ctm);
}
}
diff --git a/tests/kms_color.c b/tests/kms_color.c
index b05d1ba0adab..fdc97d13dad6 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -711,10 +711,8 @@ static void test_pipe_limited_range_ctm(data_t *data,
#endif
static void
-prep_pipe(data_t *data, enum pipe p)
+prep_pipe(data_t *data, igt_crtc_t *crtc)
{
- igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
igt_require_pipe(&data->display, crtc->pipe);
if (igt_crtc_has_prop(crtc, IGT_CRTC_DEGAMMA_LUT_SIZE)) {
@@ -732,12 +730,9 @@ prep_pipe(data_t *data, enum pipe p)
}
}
-static void test_setup(data_t *data, enum pipe p)
+static void test_setup(data_t *data, igt_crtc_t *crtc)
{
- igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
-
- prep_pipe(data, crtc->pipe);
+ prep_pipe(data, crtc);
igt_require_pipe_crc(data->drm_fd);
igt_require(crtc->n_planes >= 0);
@@ -755,10 +750,10 @@ static void test_cleanup(data_t *data)
}
static void
-run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
+run_gamma_degamma_tests_for_pipe(data_t *data, igt_crtc_t *crtc,
bool (*test_t)(data_t*, igt_plane_t*))
{
- test_setup(data, p);
+ test_setup(data, crtc);
/*
* We assume an 8bits depth per color for degamma/gamma LUTs
@@ -768,7 +763,7 @@ run_gamma_degamma_tests_for_pipe(data_t *data, enum pipe p,
data->drm_format = DRM_FORMAT_XRGB8888;
data->mode = igt_output_get_mode(data->output);
- igt_require(pipe_output_combo_valid(data, p));
+ igt_require(pipe_output_combo_valid(data, crtc));
igt_assert(test_t(data, data->primary));
@@ -785,7 +780,7 @@ static void transform_color(color_t *color, const double *ctm, double offset)
}
static void
-run_ctm_tests_for_pipe(data_t *data, enum pipe p,
+run_ctm_tests_for_pipe(data_t *data, igt_crtc_t *crtc,
const color_t *fb_colors,
const double *ctm,
int iter)
@@ -795,7 +790,7 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
double delta;
int i;
- test_setup(data, p);
+ test_setup(data, crtc);
/* MediaTek can only support bit-ture in 10-bit depth pre color */
if (is_mtk_device(data->drm_fd))
@@ -810,7 +805,7 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
data->drm_format = depth_10bit ? DRM_FORMAT_XRGB2101010 : DRM_FORMAT_XRGB8888;
data->mode = igt_output_get_mode(data->output);
- igt_require(pipe_output_combo_valid(data, p));
+ igt_require(pipe_output_combo_valid(data, crtc));
if (!iter)
iter = 1;
@@ -844,10 +839,8 @@ run_ctm_tests_for_pipe(data_t *data, enum pipe p,
}
static void
-run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
+run_deep_color_tests_for_pipe(data_t *data, igt_crtc_t *crtc)
{
- igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
igt_output_t *output;
static const color_t blue_green_blue[] = {
{ 0.0, 0.0, 1.0 },
@@ -869,7 +862,7 @@ run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
igt_require_f((intel_display_ver(data->devid) >= 11),
"At least GEN 11 is required to validate Deep-color.\n");
- test_setup(data, crtc->pipe);
+ test_setup(data, crtc);
for_each_valid_output_on_pipe(&data->display, crtc->pipe, output) {
uint64_t max_bpc = get_max_bpc(output);
@@ -969,7 +962,7 @@ run_invalid_tests_for_pipe(data_t *data)
igt_crtc_t *crtc;
struct {
const char *name;
- void (*test_t) (data_t *data, enum pipe pipe);
+ void (*test_t) (data_t *data, igt_crtc_t *crtc);
const char *desc;
} tests[] = {
{ "invalid-gamma-lut-sizes", invalid_gamma_lut_sizes,
@@ -988,8 +981,10 @@ run_invalid_tests_for_pipe(data_t *data)
igt_subtest_with_dynamic_f("%s", tests[i].name) {
for_each_crtc(&data->display, crtc) {
igt_dynamic_f("pipe-%s", igt_crtc_name(crtc)) {
- prep_pipe(data, crtc->pipe);
- tests[i].test_t(data, crtc->pipe);
+ prep_pipe(data,
+ crtc);
+ tests[i].test_t(data,
+ crtc);
}
}
}
@@ -1132,7 +1127,8 @@ run_tests_for_pipe(data_t *data)
for_each_crtc_with_valid_output(&data->display, crtc, data->output) {
igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
igt_output_name(data->output))
- run_gamma_degamma_tests_for_pipe(data, crtc->pipe,
+ run_gamma_degamma_tests_for_pipe(data,
+ crtc,
gamma_degamma_tests[i].test_t);
}
}
@@ -1144,7 +1140,8 @@ run_tests_for_pipe(data_t *data)
for_each_crtc_with_valid_output(&data->display, crtc, data->output) {
igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
igt_output_name(data->output))
- run_ctm_tests_for_pipe(data, crtc->pipe,
+ run_ctm_tests_for_pipe(data,
+ crtc,
ctm_tests[i].fb_colors,
ctm_tests[i].ctm,
ctm_tests[i].iter);
@@ -1160,7 +1157,8 @@ run_tests_for_pipe(data_t *data)
igt_describe("Verify that deep color works correctly");
igt_subtest_with_dynamic("deep-color") {
for_each_crtc(&data->display, crtc) {
- run_deep_color_tests_for_pipe(data, crtc->pipe);
+ run_deep_color_tests_for_pipe(data,
+ crtc);
if (igt_run_in_simulation())
break;
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 554c1c72cbf6..aa47324dff6a 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -24,12 +24,12 @@
#include "kms_color_helper.h"
-bool pipe_output_combo_valid(data_t *data, enum pipe pipe)
+bool pipe_output_combo_valid(data_t *data, igt_crtc_t *crtc)
{
bool ret = true;
igt_output_set_crtc(data->output,
- igt_crtc_for_pipe(data->output->display, pipe));
+ crtc);
if (!intel_pipe_output_combo_valid(&data->display))
ret = false;
igt_output_set_crtc(data->output, NULL);
@@ -316,11 +316,10 @@ pipe_set_property_blob(igt_crtc_t *crtc,
}
static void
-invalid_lut_sizes(data_t *data, enum pipe p,
+invalid_lut_sizes(data_t *data, igt_crtc_t *crtc,
enum igt_atomic_crtc_properties prop, int size)
{
igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
struct drm_color_lut *lut;
size_t lut_size = size * sizeof(lut[0]);
@@ -349,21 +348,23 @@ invalid_lut_sizes(data_t *data, enum pipe p,
}
void
-invalid_gamma_lut_sizes(data_t *data, enum pipe p)
+invalid_gamma_lut_sizes(data_t *data, igt_crtc_t *crtc)
{
- invalid_lut_sizes(data, p, IGT_CRTC_GAMMA_LUT, data->gamma_lut_size);
+ invalid_lut_sizes(data, crtc,
+ IGT_CRTC_GAMMA_LUT,
+ data->gamma_lut_size);
}
void
-invalid_degamma_lut_sizes(data_t *data, enum pipe p)
+invalid_degamma_lut_sizes(data_t *data, igt_crtc_t *crtc)
{
- invalid_lut_sizes(data, p, IGT_CRTC_DEGAMMA_LUT, data->degamma_lut_size);
+ invalid_lut_sizes(data, crtc,
+ IGT_CRTC_DEGAMMA_LUT,
+ data->degamma_lut_size);
}
-void invalid_ctm_matrix_sizes(data_t *data, enum pipe p)
+void invalid_ctm_matrix_sizes(data_t *data, igt_crtc_t *crtc)
{
- igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
void *ptr;
igt_require(igt_crtc_has_prop(crtc, IGT_CRTC_CTM));
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 31f7382eb541..6a700d4610fe 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -68,7 +68,7 @@ typedef struct {
color_t coeffs[];
} gamma_lut_t;
-bool pipe_output_combo_valid(data_t *data, enum pipe pipe);
+bool pipe_output_combo_valid(data_t *data, igt_crtc_t *crtc);
bool panel_supports_deep_color(int fd, char *output_name);
uint64_t get_max_bpc(igt_output_t *output);
void paint_gradient_rectangles(data_t *data,
@@ -110,9 +110,9 @@ int pipe_set_property_blob_id(igt_crtc_t *pipe,
int pipe_set_property_blob(igt_crtc_t *pipe,
enum igt_atomic_crtc_properties prop,
void *ptr, size_t length);
-void invalid_gamma_lut_sizes(data_t *data, enum pipe p);
-void invalid_degamma_lut_sizes(data_t *data, enum pipe p);
-void invalid_ctm_matrix_sizes(data_t *data, enum pipe p);
+void invalid_gamma_lut_sizes(data_t *data, igt_crtc_t *crtc);
+void invalid_degamma_lut_sizes(data_t *data, igt_crtc_t *crtc);
+void invalid_ctm_matrix_sizes(data_t *data, igt_crtc_t *crtc);
#endif
diff --git a/tests/kms_color_pipeline.c b/tests/kms_color_pipeline.c
index 733ead1cd55c..7445b14568c5 100644
--- a/tests/kms_color_pipeline.c
+++ b/tests/kms_color_pipeline.c
@@ -46,11 +46,8 @@ static void test_cleanup(data_t *data)
igt_display_commit2(&data->display, COMMIT_ATOMIC);
}
-static void test_setup(data_t *data, enum pipe p)
+static void test_setup(data_t *data, igt_crtc_t *crtc)
{
- igt_display_t *display = &data->display;
- igt_crtc_t *crtc = igt_crtc_for_pipe(display, p);
-
igt_require_pipe_crc(data->drm_fd);
igt_require(crtc);
igt_require(crtc->n_planes > 0);
@@ -279,10 +276,11 @@ run_tests_for_plane(data_t *data)
output) {
data->output = output;
- if (!pipe_output_combo_valid(data, crtc->pipe))
+ if (!pipe_output_combo_valid(data, crtc))
continue;
- test_setup(data, crtc->pipe);
+ test_setup(data,
+ crtc);
if (!igt_plane_has_prop(data->primary, IGT_PLANE_COLOR_PIPELINE)) {
test_cleanup(data);
--
2.52.0
next prev parent reply other threads:[~2026-02-11 16:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 16:33 [PATCH i-g-t 00/17] tests/kms: Use igt_crtc_t instead of enum pipe Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 01/17] tests/kms_plane_alpha_blend: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 02/17] tests/kms: Remove unused 'pipe' function parameters Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 03/17] tests/kms: Remove const qualifier from " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 04/17] tests/intel/kms_busy: Use 'enum pipe' instead of 'int' Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 05/17] tests/kms_atomic_interruptible: s/crtc/drm_crtc/ Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 06/17] tests/intel/kms_psr2_su: Use igt_crtc_t instead of enum pipe Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 07/17] tests/intel/kms_dsc*: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 08/17] tests/kms_cursor_legacy: " Ville Syrjala
2026-02-11 16:33 ` Ville Syrjala [this message]
2026-02-11 16:33 ` [PATCH i-g-t 10/17] tests/kms_atomic_transition: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 11/17] tests/kms_plane: " Ville Syrjala
2026-02-11 16:33 ` [PATCH i-g-t 12/17] tests/intel/kms_pipe_b_c_ivb: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 13/17] tests/kms_vrr: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 14/17] tests/kms_display_modes: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 15/17] tests/kms_rotation_crc: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 16/17] tests/kms_properties: " Ville Syrjala
2026-02-11 16:34 ` [PATCH i-g-t 17/17] tests/kms: " Ville Syrjala
2026-02-11 17:35 ` ✗ Xe.CI.BAT: failure for " Patchwork
2026-02-11 17:47 ` ✓ i915.CI.BAT: success " Patchwork
2026-02-12 6:18 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-12 9:42 ` [PATCH i-g-t 00/17] " Jani Nikula
2026-02-13 2:09 ` ✗ Xe.CI.FULL: failure for " 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=20260211163404.2018-10-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.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