[igt-dev] [PATCH i-g-t] tests/kms_flip_tiling: remove cut'n'paste
B, Jeevan
jeevan.b at intel.com
Wed Jun 24 14:46:02 UTC 2020
Hi,
Patch looks good to me.
>-----Original Message-----
>From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Juha-
>Pekka Heikkila
>Sent: Monday, June 22, 2020 7:29 PM
>To: igt-dev at lists.freedesktop.org
>Subject: [igt-dev] [PATCH i-g-t] tests/kms_flip_tiling: remove cut'n'paste
>
>convert all tests to be created in nested for-loops which will create tests for all
>flip changes.
>
>Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
>---
> tests/kms_flip_tiling.c | 186 +++++++---------------------------------
> 1 file changed, 33 insertions(+), 153 deletions(-)
>
>diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c index
>fb79de15..329e0bda 100644
>--- a/tests/kms_flip_tiling.c
>+++ b/tests/kms_flip_tiling.c
>@@ -153,6 +153,16 @@ igt_output_t *output;
>
> igt_main
> {
>+ const struct {
>+ uint64_t tiling_format;
>+ const char* name;
>+ } tiling_formats[] = {
>+ { LOCAL_DRM_FORMAT_MOD_NONE, "linear"},
>+ { LOCAL_I915_FORMAT_MOD_X_TILED, "x-tiled"},
>+ { LOCAL_I915_FORMAT_MOD_Y_TILED, "y-tiled"},
>+ { LOCAL_I915_FORMAT_MOD_Yf_TILED, "yf-tiled"},
>+ };
>+
> igt_fixture {
> data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> data.gen = intel_gen(intel_get_drm_devid(data.drm_fd));
>@@ -165,160 +175,30 @@ 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_subtest_f("flip-changes-tiling") {
>- uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_X_TILED,
>- LOCAL_DRM_FORMAT_MOD_NONE };
>- enum pipe pipe;
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- igt_subtest_f("flip-changes-tiling-Y") {
>- uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Y_TILED,
>- LOCAL_DRM_FORMAT_MOD_NONE };
>- enum pipe pipe;
>-
>- igt_require_fb_modifiers(data.drm_fd);
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- igt_require(data.gen >= 9);
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- igt_subtest_f("flip-changes-tiling-Yf") {
>- uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Yf_TILED,
>- LOCAL_DRM_FORMAT_MOD_NONE };
>- enum pipe pipe;
>-
>- igt_require_fb_modifiers(data.drm_fd);
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- igt_require(data.gen >= 9);
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- /*
>- * 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_subtest_f("flip-X-tiled") {
>- uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_X_TILED,
>- LOCAL_I915_FORMAT_MOD_X_TILED };
>- enum pipe pipe;
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- igt_subtest_f("flip-Y-tiled") {
>- uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Y_TILED,
>- LOCAL_I915_FORMAT_MOD_Y_TILED };
>- enum pipe pipe;
>-
>- igt_require_fb_modifiers(data.drm_fd);
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- igt_require(data.gen >= 9);
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- igt_subtest_f("flip-Yf-tiled") {
>- uint64_t tiling[2] = { LOCAL_I915_FORMAT_MOD_Yf_TILED,
>- LOCAL_I915_FORMAT_MOD_Yf_TILED };
>- enum pipe pipe;
>-
>- igt_require_fb_modifiers(data.drm_fd);
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- igt_require(data.gen >= 9);
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- /*
>- * 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_subtest_f("flip-to-X-tiled") {
>- uint64_t tiling[2] = { LOCAL_DRM_FORMAT_MOD_NONE,
>- LOCAL_I915_FORMAT_MOD_X_TILED };
>- enum pipe pipe;
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- igt_subtest_f("flip-to-Y-tiled") {
>- uint64_t tiling[2] = { LOCAL_DRM_FORMAT_MOD_NONE,
>- LOCAL_I915_FORMAT_MOD_Y_TILED };
>- enum pipe pipe;
>-
>- igt_require_fb_modifiers(data.drm_fd);
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- igt_require(data.gen >= 9);
>-
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
>- }
>-
>- igt_subtest_f("flip-to-Yf-tiled") {
>- uint64_t tiling[2] = { LOCAL_DRM_FORMAT_MOD_NONE,
>- LOCAL_I915_FORMAT_MOD_Yf_TILED };
>- enum pipe pipe;
>-
>- igt_require_fb_modifiers(data.drm_fd);
>-
>- for (int i = 0; i < ARRAY_SIZE(tiling); i++)
>-
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[i]));
>-
>- igt_require(data.gen >= 9);
>+ for (int i = 0; i < ARRAY_SIZE(tiling_formats); i++) {
>+ for (int j = 0; j < ARRAY_SIZE(tiling_formats); j++) {
>+
>+ igt_describe_f("Check using crcs flipping from %s fb to
>%s fb works correctly.\n",
>+ tiling_formats[i].name,
>tiling_formats[j].name);
>+ igt_subtest_f("flip-%s-to-%s", tiling_formats[i].name,
>tiling_formats[j].name) {
>+ uint64_t tiling[2] = {
>tiling_formats[i].tiling_format,
>+
>tiling_formats[j].tiling_format };
>+ enum pipe pipe;
>+
>+ for (int c = 0; c < ARRAY_SIZE(tiling); c++) {
>+ if (tiling[c] !=
>LOCAL_DRM_FORMAT_MOD_NONE &&
>+ tiling[c] !=
>LOCAL_I915_FORMAT_MOD_X_TILED) {
>+ igt_require(data.gen >= 9);
>+
> igt_require_fb_modifiers(data.drm_fd);
>+ }
>+
> igt_require(igt_display_has_format_mod(&data.display,
>data.testformat, tiling[c]));
>+ }
>+
>+
> for_each_pipe_with_valid_output(&data.display, pipe, output)
>+ test_flip_tiling(&data, pipe, output,
>tiling);
>+ }
>+ }
>
>- for_each_pipe_with_valid_output(&data.display, pipe,
>output)
>- test_flip_tiling(&data, pipe, output, tiling);
> }
>
> igt_fixture {
>--
>2.26.0
Reviewed-by: Jeevan B <jeevan.b at intel.com>
>
>_______________________________________________
>igt-dev mailing list
>igt-dev at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/igt-dev
Thanks
Jeevan B
More information about the igt-dev
mailing list