public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 09/19] lib/kms: Replace get_num_scalers() with igt_crtc_num_scalers()
Date: Wed, 25 Feb 2026 14:50:58 +0200	[thread overview]
Message-ID: <20260225125108.31119-10-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260225125108.31119-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the pipe based (and badly namespaced) get_num_scalers()
with igt_crtc_num_scalers() that takes an igt_crtc_t.

Note that I had to play some games with cocci in the semantic
patch (the weird '+ { return 0; }') to get it to actually
remove the old docs for get_num_scalers().

 #include "scripts/iterators.cocci"

@@
expression DISPLAY, PIPE;
@@
- get_num_scalers(DISPLAY, PIPE)
+ igt_crtc_num_scalers(igt_crtc_for_pipe(DISPLAY, PIPE))

@@
typedef igt_crtc_t;
igt_crtc_t *CRTC;
@@
- igt_crtc_for_pipe(..., CRTC->pipe)
+ CRTC

@@
identifier DISPLAY, PIPE;
@@
int get_num_scalers(igt_display_t *DISPLAY, enum pipe PIPE);
+ int igt_crtc_num_scalers(igt_crtc_t *crtc);

@@
identifier DISPLAY, PIPE;
@@
get_num_scalers(igt_display_t *DISPLAY, enum pipe PIPE)
+ { return 0; }
+
+/**
+ * igt_crtc_num_scalers:
+ * @crtc: the CRTC
+ *
+ * Returns: Number of scalers supported on the CRTC.
+ */
+int igt_crtc_num_scalers(igt_crtc_t *crtc)
{
+ igt_display_t *DISPLAY = crtc->display;
<...
(
- kmstest_pipe_name(PIPE)
+ igt_crtc_name(crtc)
|
- PIPE
+ crtc->pipe
)
...>
}

@@
@@
- get_num_scalers(...) { ... }

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.c             | 14 +++++++-------
 lib/igt_kms.h             |  2 +-
 tests/kms_hdr.c           |  2 +-
 tests/kms_plane_scaling.c | 24 ++++++++++++------------
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b39e262303b5..2170e775b3a5 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -7340,14 +7340,14 @@ int igt_get_dp_mst_connector_id(igt_output_t *output)
 }
 
 /**
- * get_num_scalers:
- * @display: the display
- * @pipe: display pipe
+ * igt_crtc_num_scalers:
+ * @crtc: the CRTC
  *
- * Returns: Number of scalers supported per pipe.
+ * Returns: Number of scalers supported on the CRTC.
  */
-int get_num_scalers(igt_display_t *display, enum pipe pipe)
+int igt_crtc_num_scalers(igt_crtc_t *crtc)
 {
+	igt_display_t *display = crtc->display;
 	char buf[8120];
 	char *start_loc1, *start_loc2;
 	int dir, res;
@@ -7355,7 +7355,7 @@ int get_num_scalers(igt_display_t *display, enum pipe pipe)
 	int drm_fd = display->drm_fd;
 	char dest[20] = ":pipe ";
 
-	strcat(dest, kmstest_pipe_name(pipe));
+	strcat(dest, igt_crtc_name(crtc));
 
 	if (is_intel_device(drm_fd) &&
 	    intel_display_ver(intel_get_drm_devid(drm_fd)) >= 9) {
@@ -7384,7 +7384,7 @@ int get_num_scalers(igt_display_t *display, enum pipe pipe)
 		 * as a rough approximation of the # of scalars.. it may
 		 * undercount on some hw, but it will not overcount
 		 */
-		for_each_plane_on_pipe(display, pipe, plane) {
+		for_each_plane_on_pipe(display, crtc->pipe, plane) {
 			for (unsigned i = 0; i < plane->format_mod_count; i++) {
 				if (igt_format_is_yuv(plane->formats[i])) {
 					num_scalers++;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 86991da20de3..2d1f14330617 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1284,7 +1284,7 @@ bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
 bool intel_pipe_output_combo_valid(igt_display_t *display);
 bool igt_check_output_is_dp_mst(igt_output_t *output);
 int igt_get_dp_mst_connector_id(igt_output_t *output);
-int get_num_scalers(igt_display_t *display, enum pipe pipe);
+int igt_crtc_num_scalers(igt_crtc_t *crtc);
 int igt_get_current_lane_count(int drm_fd, igt_output_t *output);
 int igt_get_current_link_rate(int drm_fd, igt_output_t *output);
 int igt_get_max_link_rate(int drm_fd, igt_output_t *output);
diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index 5a2e3f1cfdcc..f677c6629430 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -251,7 +251,7 @@ static void test_bpc_switch_on_output(data_t *data, igt_crtc_t *crtc,
 	 * smaller plane size in following tests.
 	 */
 	igt_plane_set_fb(data->primary, &afb);
-	if (get_num_scalers(display, crtc->pipe) >= 1)
+	if (igt_crtc_num_scalers(crtc) >= 1)
 		igt_plane_set_size(data->primary, data->w, data->h);
 	else
 		igt_plane_set_size(data->primary, 512, 512);
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 1d91ad1493b1..ac301924f937 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -1097,8 +1097,8 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
 	igt_output_set_crtc(output2,
 			    crtc2);
 
-	igt_require(get_num_scalers(display, crtc1->pipe) >= 2);
-	igt_require(get_num_scalers(display, crtc2->pipe) >= 2);
+	igt_require(igt_crtc_num_scalers(crtc1) >= 2);
+	igt_require(igt_crtc_num_scalers(crtc2) >= 2);
 
 	plane[0] = igt_output_get_plane(output1, 0);
 	igt_require(plane[0]);
@@ -1187,7 +1187,7 @@ static void invalid_parameter_tests(data_t *d)
 		igt_output_set_crtc(output, crtc);
 		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
-		igt_require(get_num_scalers(&d->display, crtc->pipe) >= 1);
+		igt_require(igt_crtc_num_scalers(crtc) >= 1);
 
 		igt_create_fb(d->drm_fd, 256, 256,
 			      DRM_FORMAT_XRGB8888,
@@ -1380,7 +1380,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 							igt_info("Trying on %s\n", igt_output_name(output));
 							if (!pipe_output_combo_valid(&data.display, crtc, output))
 								continue;
-							if (get_num_scalers(&data.display, crtc->pipe) < 1)
+							if (igt_crtc_num_scalers(crtc) < 1)
 								continue;
 
 							ret = test_scaler_with_pixel_format_pipe(&data,
@@ -1409,7 +1409,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 							igt_info("Trying on %s\n", igt_output_name(output));
 							if (!pipe_output_combo_valid(&data.display, crtc, output))
 								continue;
-							if (get_num_scalers(&data.display, crtc->pipe) < 1)
+							if (igt_crtc_num_scalers(crtc) < 1)
 								continue;
 
 							ret = test_scaler_with_rotation_pipe(&data,
@@ -1438,7 +1438,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 							igt_info("Trying on %s\n", igt_output_name(output));
 							if (!pipe_output_combo_valid(&data.display, crtc, output))
 								continue;
-							if (get_num_scalers(&data.display, crtc->pipe) < 1)
+							if (igt_crtc_num_scalers(crtc) < 1)
 								continue;
 
 							ret = test_scaler_with_modifier_pipe(&data,
@@ -1466,7 +1466,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 						igt_info("Trying on %s\n", igt_output_name(output));
 						if (!pipe_output_combo_valid(&data.display, crtc, output))
 							continue;
-						if (get_num_scalers(&data.display, crtc->pipe) < 1)
+						if (igt_crtc_num_scalers(crtc) < 1)
 							continue;
 
 						ret = test_scaler_with_pixel_format_pipe(&data, 0.0, true,
@@ -1492,7 +1492,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 						igt_info("Trying on %s\n", igt_output_name(output));
 						if (!pipe_output_combo_valid(&data.display, crtc, output))
 							continue;
-						if (get_num_scalers(&data.display, crtc->pipe) < 1)
+						if (igt_crtc_num_scalers(crtc) < 1)
 							continue;
 
 						ret = test_scaler_with_rotation_pipe(&data, 0.0, true,
@@ -1517,7 +1517,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 						igt_info("Trying on %s\n", igt_output_name(output));
 						if (!pipe_output_combo_valid(&data.display, crtc, output))
 							continue;
-						if (get_num_scalers(&data.display, crtc->pipe) < 1)
+						if (igt_crtc_num_scalers(crtc) < 1)
 							continue;
 
 						ret = test_scaler_with_modifier_pipe(&data, 0.0, true,
@@ -1544,7 +1544,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 								 igt_output_name(output));
 							if (!pipe_output_combo_valid(&data.display, crtc, output))
 								continue;
-							if (get_num_scalers(&data.display, crtc->pipe) < 2)
+							if (igt_crtc_num_scalers(crtc) < 2)
 								continue;
 							ret = test_planes_scaling_combo(&data,
 								scaler_with_2_planes_tests[index].sf_plane1,
@@ -1569,7 +1569,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 				igt_require_intel(data.drm_fd);
 				for_each_crtc(&data.display, crtc) {
 					for_each_valid_output_on_pipe(&data.display, crtc->pipe, output) {
-						if (get_num_scalers(&data.display, crtc->pipe) < 1)
+						if (igt_crtc_num_scalers(crtc) < 1)
 							continue;
 						/*
 						 * Need to find mode with lowest vrefresh else
@@ -1600,7 +1600,7 @@ int igt_main_args("", long_opts, help_str, opt_handler, &data)
 			for_each_crtc_with_valid_output(&data.display, crtc, output) {
 				if (!pipe_output_combo_valid(&data.display, crtc, output))
 					continue;
-				if (get_num_scalers(&data.display, crtc->pipe) < 1)
+				if (igt_crtc_num_scalers(crtc) < 1)
 						continue;
 
 				igt_dynamic_f("pipe-%s-%s-invalid-num-scalers",
-- 
2.52.0


  parent reply	other threads:[~2026-02-25 12:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 12:50 [PATCH i-g-t 00/19] lib/kms: Clean up more of igt_kms API Ville Syrjala
2026-02-25 12:50 ` [PATCH i-g-t 01/19] tests/kms_plane_multiple: Clean up n_planes stuff Ville Syrjala
2026-02-25 12:50 ` [PATCH i-g-t 02/19] tests/kms_async_flips: Remove redundant data.crtc_id Ville Syrjala
2026-02-25 13:58   ` Jani Nikula
2026-02-25 12:50 ` [PATCH i-g-t 03/19] tests/kms_lease: Consolidate igt_crtc_for_pipe() calls Ville Syrjala
2026-02-25 12:50 ` [PATCH i-g-t 04/19] tests/kms: " Ville Syrjala
2026-02-25 12:50 ` [PATCH i-g-t 05/19] lib/kms: Introduce igt_first_crtc_with_single_output() Ville Syrjala
2026-02-25 13:59   ` Jani Nikula
2026-02-25 12:50 ` [PATCH i-g-t 06/19] tests/kms: Use igt_first_crtc_with_single_output() Ville Syrjala
2026-02-25 12:50 ` [PATCH i-g-t 07/19] lib/kms: Introduce and use igt_first_crtc() Ville Syrjala
2026-02-25 14:00   ` Jani Nikula
2026-02-25 12:50 ` [PATCH i-g-t 08/19] tests/kms: Stop using igt_require_pipe() Ville Syrjala
2026-02-25 12:50 ` Ville Syrjala [this message]
2026-02-25 12:50 ` [PATCH i-g-t 10/19] lib/kms: Pass igt_crtc_t* to igt_max_bpc_constraint() Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 11/19] lib/kms: Introduce for_each_plane_on_crtc() Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 12/19] tests/kms: Use for_each_plane_on_crtc() Ville Syrjala
2026-02-25 13:53   ` Jani Nikula
2026-02-25 12:51 ` [PATCH i-g-t 13/19] lib/kms: Nuke for_each_plane_on_pipe() Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 14/19] tests/kms: Switch to for_each_valid_output_on_crtc_local() Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 15/19] tests/kms: Replace igt_pipe_connector_valid() with igt_crtc_connector_valid() Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 16/19] lib/kms: Intreoduce for_each_valid_output_on_crtc() Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 17/19] tests/intel/kms_frontbuffer_tracking: Use for_each_valid_output_on_crtc() Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 18/19] tests/kms: " Ville Syrjala
2026-02-25 12:51 ` [PATCH i-g-t 19/19] lib/kms: Nuke for_each_valid_output_on_pipe() Ville Syrjala
2026-02-25 14:06   ` Jani Nikula
2026-02-25 14:07 ` [PATCH i-g-t 00/19] lib/kms: Clean up more of igt_kms API Jani Nikula
2026-02-25 23:34 ` ✗ Xe.CI.BAT: failure for " Patchwork
2026-02-26  0:05 ` ✓ i915.CI.BAT: success " Patchwork
2026-02-26  1:57 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-26 22:06 ` ✓ Xe.CI.BAT: success for lib/kms: Clean up more of igt_kms API (rev2) Patchwork
2026-02-26 22:09 ` ✓ i915.CI.BAT: " Patchwork
2026-02-27  2:55 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-27  4:24 ` ✗ i915.CI.Full: " 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=20260225125108.31119-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