summaryrefslogtreecommitdiff
path: root/tests/i915/kms_flip_tiling.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2021-10-13 17:37:56 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2021-10-18 16:54:27 +0300
commit87302b06b99faf42c5543908174c2606ce22443e (patch)
tree26bd2a633424ed5f9c45a4c0397edff620f3b1cd /tests/i915/kms_flip_tiling.c
parent1d6f0c878291c328c76d5ebeae50a9329ab7a24f (diff)
tests/i915/kms_flip_tiling: Generalize away copy-pasta
Replace the huge swaths of copypasta by just looping over the set of modifiers reported by the plane, and testing each against the others (and itself). v2: Nuke redundant igt_plane_has_format_mod() checks (Karthik) Reviewed-by: Karthik B S <karthik.b.s@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/i915/kms_flip_tiling.c')
-rw-r--r--tests/i915/kms_flip_tiling.c216
1 files changed, 30 insertions, 186 deletions
diff --git a/tests/i915/kms_flip_tiling.c b/tests/i915/kms_flip_tiling.c
index 5c5200f3..f165b761 100644
--- a/tests/i915/kms_flip_tiling.c
+++ b/tests/i915/kms_flip_tiling.c
@@ -161,195 +161,39 @@ igt_main
igt_display_require(&data.display, data.drm_fd);
}
- /*
- * Test that a page flip from a tiled buffer to a linear one works
- * correctly. First, it sets the crtc with the linear buffer and
- * generates a reference crc for the pipe. Then, the crtc is set with
- * the tiled one and page flip to the linear one issued. A new crc is
- * generated and compared to the reference one.
- */
-
- igt_describe("Check pageflip from tiled buffer to linear one works correctly with x tiling");
- igt_subtest_with_dynamic("flip-changes-tiling") {
- uint64_t modifier[2] = { I915_FORMAT_MOD_X_TILED,
- DRM_FORMAT_MOD_LINEAR };
- enum pipe pipe;
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- igt_describe("Check pageflip from tiled buffer to linear one works correctly with y tiling");
- igt_subtest_with_dynamic("flip-changes-tiling-Y") {
- uint64_t modifier[2] = { I915_FORMAT_MOD_Y_TILED,
- DRM_FORMAT_MOD_LINEAR };
- enum pipe pipe;
-
- igt_require_fb_modifiers(data.drm_fd);
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- igt_require(data.gen >= 9);
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- igt_describe("Check pageflip from tiled buffer to linear one works correctly with yf tiling");
- igt_subtest_with_dynamic("flip-changes-tiling-Yf") {
- uint64_t modifier[2] = { I915_FORMAT_MOD_Yf_TILED,
- DRM_FORMAT_MOD_LINEAR };
- enum pipe pipe;
-
- igt_require_fb_modifiers(data.drm_fd);
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- igt_require(data.gen >= 9);
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- /*
- * Test that a page flip from a tiled buffer to another tiled one works
- * correctly. First, it sets the crtc with the tiled buffer and
- * generates a reference crc for the pipe. Then a page flip to second
- * tiled buffer is issued. A new crc is generated and compared to the
- * reference one.
- */
-
- igt_describe("Check pageflip from tiled buffer to another tiled one works correctly with x tiling");
- igt_subtest_with_dynamic("flip-X-tiled") {
- uint64_t modifier[2] = { I915_FORMAT_MOD_X_TILED,
- I915_FORMAT_MOD_X_TILED };
- enum pipe pipe;
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- igt_describe("Check pageflip from tiled buffer to another tiled one works correctly with y tiling");
- igt_subtest_with_dynamic("flip-Y-tiled") {
- uint64_t modifier[2] = { I915_FORMAT_MOD_Y_TILED,
- I915_FORMAT_MOD_Y_TILED };
- enum pipe pipe;
-
- igt_require_fb_modifiers(data.drm_fd);
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- igt_require(data.gen >= 9);
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- igt_describe("Check pageflip from tiled buffer to another tiled one works correctly with yf tiling");
- igt_subtest_with_dynamic("flip-Yf-tiled") {
- uint64_t modifier[2] = { I915_FORMAT_MOD_Yf_TILED,
- I915_FORMAT_MOD_Yf_TILED };
- enum pipe pipe;
-
- igt_require_fb_modifiers(data.drm_fd);
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- igt_require(data.gen >= 9);
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- /*
- * Test that a page flip from a linear buffer to a tiled one works
- * correctly. First, it sets the crtc with the linear buffer and
- * generates a reference crc for the pipe. Then a page flip to a tiled
- * buffer is issued. A new crc is generated and compared to the
- * reference one.
- */
-
- igt_describe("Check pageflip from linear buffer to tiled one works correctly with x tiling");
- igt_subtest_with_dynamic("flip-to-X-tiled") {
- uint64_t modifier[2] = { DRM_FORMAT_MOD_LINEAR,
- I915_FORMAT_MOD_X_TILED };
+ igt_describe("Check pageflip between modifiers");
+ igt_subtest_with_dynamic("flip-change-tiling") {
enum pipe pipe;
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- igt_describe("Check pageflip from linear buffer to tiled one works correctly with y tiling");
- igt_subtest_with_dynamic("flip-to-Y-tiled") {
- uint64_t modifier[2] = { DRM_FORMAT_MOD_LINEAR,
- I915_FORMAT_MOD_Y_TILED };
- enum pipe pipe;
-
- igt_require_fb_modifiers(data.drm_fd);
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- igt_require(data.gen >= 9);
-
- for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
- }
- }
-
- igt_describe("Check pageflip from linear buffer to tiled one works correctly with yf tiling");
- igt_subtest_with_dynamic("flip-to-Yf-tiled") {
- uint64_t modifier[2] = { DRM_FORMAT_MOD_LINEAR,
- I915_FORMAT_MOD_Yf_TILED };
- enum pipe pipe;
-
- igt_require_fb_modifiers(data.drm_fd);
-
- for (int i = 0; i < ARRAY_SIZE(modifier); i++)
- igt_require(igt_display_has_format_mod(&data.display, data.testformat, modifier[i]));
-
- igt_require(data.gen >= 9);
-
for_each_pipe_with_valid_output(&data.display, pipe, output) {
- igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(pipe))
- test_flip_tiling(&data, pipe, output, modifier);
- test_cleanup(&data, pipe, output);
+ igt_plane_t *plane;
+
+ igt_output_set_pipe(output, pipe);
+
+ 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] != data.testformat)
+ continue;
+
+ for (int j = 0; j < plane->format_mod_count; j++) {
+ uint64_t modifier[2] = {
+ plane->modifiers[i],
+ plane->modifiers[j],
+ };
+
+ if (plane->formats[j] != data.testformat)
+ continue;
+
+ igt_dynamic_f("%s-pipe-%s-%s-to-%s",
+ igt_output_name(output),
+ kmstest_pipe_name(pipe),
+ igt_fb_modifier_name(modifier[0]),
+ igt_fb_modifier_name(modifier[1]))
+ test_flip_tiling(&data, pipe, output, modifier);
+ test_cleanup(&data, pipe, output);
+ }
+ }
}
}