* [PATCH i-g-t] RFC: tests/kms_plane_lowres: Refactor test to handle tiling formats dynamically
@ 2024-11-14 10:03 Jeevan B
0 siblings, 0 replies; 2+ messages in thread
From: Jeevan B @ 2024-11-14 10:03 UTC (permalink / raw)
To: igt-dev; +Cc: Jeevan B
Refactored the test to dynamically handle different tiling formats.
Removed the hardcoded list of subtests and instead automatically checks
which tiling formats are supported for each plane.
Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
tests/kms_plane_lowres.c | 105 ++++++++++++++-------------------------
1 file changed, 36 insertions(+), 69 deletions(-)
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index ef85e8fb9..a2b81a129 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -42,21 +42,10 @@
#include <time.h>
/**
- * SUBTEST: tiling-none
+ * SUBTEST: tiling
* Description: Tests the visibility of the planes when switching between high
- * and low resolution with Linear buffer (no tiling)
+ * and low resolution with Supported Tiling Formats
* Functionality: plane
- *
- * SUBTEST: tiling-%s
- * Description: Tests the visibility of the planes when switching between high
- * and low resolution with %arg[1]
- *
- * arg[1]:
- *
- * @4: 4-tiling
- * @x: x-tiling
- * @y: y-tiling
- * @yf: yf-tiling
*/
IGT_TEST_DESCRIPTION("Test atomic mode setting with a plane by switching between high and low resolutions");
@@ -290,57 +279,6 @@ static void test_cleanup(data_t *data)
igt_display_commit2(&data->display, COMMIT_ATOMIC);
}
-static void run_test(data_t *data, uint64_t modifier)
-{
- enum pipe pipe;
- igt_output_t *output;
-
- if(!igt_display_has_format_mod(&data->display, DRM_FORMAT_XRGB8888, modifier))
- return;
-
- for_each_pipe(&data->display, pipe) {
- for_each_valid_output_on_pipe(&data->display, pipe, output) {
- data->pipe = pipe;
- data->output = output;
-
- igt_display_reset(&data->display);
- igt_output_set_pipe(data->output, data->pipe);
-
- if (!intel_pipe_output_combo_valid(&data->display))
- continue;
-
- data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
- IGT_PIPE_CRC_SOURCE_AUTO);
-
- igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), data->output->name)
- test_planes_on_pipe(data, modifier);
-
- test_cleanup(data);
- }
- }
-}
-
-static const struct {
- const char *name;
- uint64_t modifier;
-} subtests[] = {
- { .name = "tiling-none",
- .modifier = DRM_FORMAT_MOD_LINEAR,
- },
- { .name = "tiling-x",
- .modifier = I915_FORMAT_MOD_X_TILED,
- },
- { .name = "tiling-y",
- .modifier = I915_FORMAT_MOD_Y_TILED,
- },
- { .name = "tiling-yf",
- .modifier = I915_FORMAT_MOD_Yf_TILED,
- },
- { .name = "tiling-4",
- .modifier = I915_FORMAT_MOD_4_TILED,
- },
-};
-
igt_main
{
data_t data = {};
@@ -358,12 +296,41 @@ igt_main
igt_require(data.display.is_atomic);
}
- for (int i = 0; i < ARRAY_SIZE(subtests); i++) {
- igt_describe_f("Tests the visibility of the planes when switching between "
- "high and low resolution with %s\n", subtests[i].name);
+ igt_describe("Tests the visibility of the planes when switching between "
+ "high and low resolution\n");
+ igt_subtest_with_dynamic("tiling") {
+ enum pipe pipe;
+ igt_output_t *output;
+
+ for_each_pipe(&data.display, pipe) {
+ for_each_valid_output_on_pipe(&data.display, pipe, output) {
+ igt_plane_t *plane;
+ data.pipe = pipe;
+ data.output = output;
+
+ igt_display_reset(&data.display);
+ igt_output_set_pipe(data.output, data.pipe);
- igt_subtest_with_dynamic(subtests[i].name)
- run_test(&data, subtests[i].modifier);
+ if (!intel_pipe_output_combo_valid(&data.display))
+ continue;
+
+ data.pipe_crc = igt_pipe_crc_new(data.drm_fd, data.pipe,
+ IGT_PIPE_CRC_SOURCE_AUTO);
+
+ plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+
+ for (int i = 0; i < plane->format_mod_count; i++) {
+ if (plane->formats[i] != DRM_FORMAT_XRGB8888)
+ continue;
+
+ igt_dynamic_f("%s-pipe-%s-%s", igt_fb_modifier_name(plane->modifiers[i]),
+ kmstest_pipe_name(pipe), data.output->name);
+ test_planes_on_pipe(&data, plane->modifiers[i]);
+
+ test_cleanup(&data);
+ }
+ }
+ }
}
igt_fixture {
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH i-g-t] RFC: tests/kms_plane_lowres: Refactor test to handle tiling formats dynamically
@ 2025-05-14 8:59 Jeevan B
0 siblings, 0 replies; 2+ messages in thread
From: Jeevan B @ 2025-05-14 8:59 UTC (permalink / raw)
To: igt-dev; +Cc: uma.shankar, Jeevan B
This commit introduces functions to dynamically query the supported basic and
full tiling modes from the kernel (`igt_get_basic_tiling_mode()` and
`igt_get_full_tiling_mode()`). The goal is to eliminate hardcoding of tiling modes,
ensuring that the test environment reflects the actual supported configurations
for the platform.
By using this approach, we:
- Reduce the number of dynamic test cases, as only the supported tiling modes
are tested.
- Avoid unnecessary noise in test results by ensuring only relevant tiling
configurations are included.
- Improve test accuracy and reliability by directly aligning with the kernel's
reported capabilities.
WIP:
- Added basic tiling mode query function.
- Added full tiling mode query function.
- Introduced helper function for tiling modifier string conversion.
- Defined enums for basic and full tiling modes.
Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
lib/igt_kms.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 40 +++++++++++++++++++++++++++++
2 files changed, 110 insertions(+)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f3bc481f2..99b14bed5 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -7442,3 +7442,73 @@ int igt_backlight_write(int value, const char *fname, igt_backlight_context_t *c
return 0;
}
+
+int igt_get_basic_tiling_mode(int fd, uint64_t *modifiers,
+ enum igt_tiling_mode *basic_tiling)
+{
+/*
+ * Step 1: Define a local array of known basic tiling modes
+ * Map each basic tiling to its corresponding I915_TILING_* value
+ */
+
+ /*
+ * Step 2: Loop over each tiling mode supported using the kms_flip_tiling logic
+ *
+ * For each tiling:
+ * - Create a small test buffer
+ * - Attempt to set the tiling mode
+ * - If ioctl succeeds, store the tiling mode in basic_tiling[]
+ * - Store a default/zero modifier (optional)
+ */
+
+ /*
+ * Step 3: Return the number of tiling modes successfully supported
+ */
+return 0;
+}
+int igt_get_full_tiling_mode(int fd, uint64_t *modifiers,
+ enum igt_tiling_mode *basic_tiling,
+ enum igt_format_modifier *all_tiling)
+{
+/*
+ * Step 1: Define a static list of known Intel format modifiers
+ * Use enum values from IGT_FMT_MOD_* defined in igt_kms.h
+ */
+
+ /*
+ * Step 2: For each modifier:
+ * - Try to create an fb with that modifier
+ * - If the fb is successfully created:
+ * - Add the modifier to all_tiling[]
+ */
+
+ /*
+ * Step 3: Return the number of supported modifiers detected
+ */
+return 0;
+}
+
+const char *igt_modifier_str(uint64_t modifier)
+{
+ switch (modifier) {
+ case IGT_FMT_MOD_X_TILED: return "X_TILED";
+ case IGT_FMT_MOD_Y_TILED: return "Y_TILED";
+ case IGT_FMT_MOD_Yf_TILED: return "Yf_TILED";
+ case IGT_FMT_MOD_Y_TILED_CCS: return "Y_TILED_CCS";
+ case IGT_FMT_MOD_Yf_TILED_CCS: return "Yf_TILED_CCS";
+ case IGT_FMT_MOD_Y_TILED_GEN12_RC_CCS: return "GEN12_RC_CCS";
+ case IGT_FMT_MOD_Y_TILED_GEN12_MC_CCS: return "GEN12_MC_CCS";
+ case IGT_FMT_MOD_Y_TILED_GEN12_RC_CCS_CC: return "GEN12_RC_CCS_CC";
+ case IGT_FMT_MOD_4_TILED: return "4_TILED";
+ case IGT_FMT_MOD_4_TILED_DG2_RC_CCS: return "DG2_RC_CCS";
+ case IGT_FMT_MOD_4_TILED_DG2_MC_CCS: return "DG2_MC_CCS";
+ case IGT_FMT_MOD_4_TILED_DG2_RC_CCS_CC: return "DG2_RC_CCS_CC";
+ case IGT_FMT_MOD_4_TILED_MTL_RC_CCS: return "MTL_RC_CCS";
+ case IGT_FMT_MOD_4_TILED_MTL_MC_CCS: return "MTL_MC_CCS";
+ case IGT_FMT_MOD_4_TILED_MTL_RC_CCS_CC: return "MTL_RC_CCS_CC";
+ case IGT_FMT_MOD_4_TILED_LNL_CCS: return "LNL_CCS";
+ case IGT_FMT_MOD_4_TILED_BMG_CCS: return "BMG_CCS";
+
+ default: return "UNKNOWN";
+ }
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 0381c82ad..f03de1e3d 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -168,6 +168,36 @@ enum igt_atomic_crtc_properties {
IGT_NUM_CRTC_PROPS
};
+/* Basic tiling format modifiers */
+enum igt_basic_tiling_mode {
+ IGT_TILING_NONE = 0,
+ IGT_TILING_X = 1,
+ IGT_TILING_Y = 2,
+ IGT_TILING_Yf = 3,
+ IGT_TILING_4 = 4,
+};
+
+/* Full tiling format modifiers */
+enum igt_full_tiling_mode {
+ IGT_FMT_MOD_X_TILED = I915_FORMAT_MOD_X_TILED,
+ IGT_FMT_MOD_Y_TILED = I915_FORMAT_MOD_Y_TILED,
+ IGT_FMT_MOD_Yf_TILED = I915_FORMAT_MOD_Yf_TILED,
+ IGT_FMT_MOD_Y_TILED_CCS = I915_FORMAT_MOD_Y_TILED_CCS,
+ IGT_FMT_MOD_Yf_TILED_CCS = I915_FORMAT_MOD_Yf_TILED_CCS,
+ IGT_FMT_MOD_Y_TILED_GEN12_RC_CCS = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
+ IGT_FMT_MOD_Y_TILED_GEN12_MC_CCS = I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS,
+ IGT_FMT_MOD_Y_TILED_GEN12_RC_CCS_CC = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC,
+ IGT_FMT_MOD_4_TILED = I915_FORMAT_MOD_4_TILED,
+ IGT_FMT_MOD_4_TILED_DG2_RC_CCS = I915_FORMAT_MOD_4_TILED_DG2_RC_CCS,
+ IGT_FMT_MOD_4_TILED_DG2_MC_CCS = I915_FORMAT_MOD_4_TILED_DG2_MC_CCS,
+ IGT_FMT_MOD_4_TILED_DG2_RC_CCS_CC = I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC,
+ IGT_FMT_MOD_4_TILED_MTL_RC_CCS = I915_FORMAT_MOD_4_TILED_MTL_RC_CCS,
+ IGT_FMT_MOD_4_TILED_MTL_MC_CCS = I915_FORMAT_MOD_4_TILED_MTL_MC_CCS,
+ IGT_FMT_MOD_4_TILED_MTL_RC_CCS_CC = I915_FORMAT_MOD_4_TILED_MTL_RC_CCS_CC,
+ IGT_FMT_MOD_4_TILED_LNL_CCS = I915_FORMAT_MOD_4_TILED_LNL_CCS,
+ IGT_FMT_MOD_4_TILED_BMG_CCS = I915_FORMAT_MOD_4_TILED_BMG_CCS,
+};
+
/**
* igt_crtc_prop_names
*
@@ -1280,4 +1310,14 @@ void igt_set_link_params(int drm_fd, igt_output_t *output,
int igt_backlight_read(int *result, const char *fname, igt_backlight_context_t *context);
int igt_backlight_write(int value, const char *fname, igt_backlight_context_t *context);
+/* Queries */
+int igt_get_basic_tiling_mode(int fd, uint64_t *modifiers,
+ enum igt_tiling_mode *basic_tiling);
+int igt_get_full_tiling_mode(int fd, uint64_t *modifiers,
+ enum igt_tiling_mode *basic_tiling,
+ enum igt_format_modifier *all_tiling);
+
+/* Helpers */
+const char *igt_modifier_str(uint64_t modifier);
+
#endif /* __IGT_KMS_H__ */
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-14 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 8:59 [PATCH i-g-t] RFC: tests/kms_plane_lowres: Refactor test to handle tiling formats dynamically Jeevan B
-- strict thread matches above, loose matches on Subject: below --
2024-11-14 10:03 Jeevan B
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox