From patchwork Tue Feb 28 16:52:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v5,1/4] tests/kms_plane_scaling: Prep work From: Swati Sharma X-Patchwork-Id: 524470 Message-Id: <20230228165300.29384-2-swati2.sharma@intel.com> To: intel-gfx-trybot@lists.freedesktop.org Cc: Swati Sharma Date: Tue, 28 Feb 2023 22:22:57 +0530 struct can be reused to add more test cases. v2: -don't declare list of lists[JP] Signed-off-by: Swati Sharma --- tests/kms_plane_scaling.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c index 74554915f..ecb4087f4 100644 --- a/tests/kms_plane_scaling.c +++ b/tests/kms_plane_scaling.c @@ -43,6 +43,15 @@ typedef struct { bool extended; } data_t; +struct invalid_paramtests { + const char *testname; + uint32_t planesize[2]; + struct { + enum igt_atomic_plane_properties prop; + uint32_t value; + } params[8]; +}; + const struct { const char * const describe; const char * const name; @@ -901,14 +910,7 @@ static void invalid_parameter_tests(data_t *d) igt_plane_t *plane; int rval; - const struct { - const char *testname; - uint32_t planesize[2]; - struct { - enum igt_atomic_plane_properties prop; - uint32_t value; - } params[8]; - } paramtests[] = { + static const struct invalid_paramtests paramtests[] = { { .testname = "less-than-1-height-src", .planesize = {256, 8}, From patchwork Tue Feb 28 16:52:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v5,2/4] tests/kms_plane_scaling: Minor fixes From: Swati Sharma X-Patchwork-Id: 524471 Message-Id: <20230228165300.29384-3-swati2.sharma@intel.com> To: intel-gfx-trybot@lists.freedesktop.org Cc: Swati Sharma Date: Tue, 28 Feb 2023 22:22:58 +0530 Minor fixes are done in the existing test. v2: -indentation (JP) -added invalid_parameter_tests() inside igt_subtest_group macro (JP) v3: -moved 2x-scaler-multi-pipe test in the end Signed-off-by: Swati Sharma --- tests/kms_plane_scaling.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c index ecb4087f4..c384a0316 100644 --- a/tests/kms_plane_scaling.c +++ b/tests/kms_plane_scaling.c @@ -931,9 +931,9 @@ static void invalid_parameter_tests(data_t *d) plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); igt_create_fb(d->drm_fd, 256, 256, - DRM_FORMAT_XRGB8888, - DRM_FORMAT_MOD_NONE, - &fb); + DRM_FORMAT_XRGB8888, + DRM_FORMAT_MOD_NONE, + &fb); } igt_describe("test parameters which should not be accepted"); @@ -943,14 +943,13 @@ static void invalid_parameter_tests(data_t *d) igt_plane_set_position(plane, 0, 0); igt_plane_set_fb(plane, &fb); igt_plane_set_size(plane, - paramtests[i].planesize[0], - paramtests[i].planesize[1]); - + paramtests[i].planesize[0], + paramtests[i].planesize[1]); for (uint32_t j = 0; paramtests[i].params[j].prop != ~0; j++) igt_plane_set_prop_value(plane, - paramtests[i].params[j].prop, - paramtests[i].params[j].value); + paramtests[i].params[j].prop, + paramtests[i].params[j].value); rval = igt_display_try_commit2(&d->display, COMMIT_ATOMIC); @@ -1124,12 +1123,13 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) } } + igt_subtest_group + invalid_parameter_tests(&data); + igt_describe("Tests scaling with multi-pipe."); igt_subtest_f("2x-scaler-multi-pipe") test_scaler_with_multi_pipe_plane(&data); - invalid_parameter_tests(&data); - igt_fixture { igt_display_fini(&data.display); close(data.drm_fd); From patchwork Tue Feb 28 16:52:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v5,3/4] tests/kms_plane_scaling: Add test to validate max source size From: Swati Sharma X-Patchwork-Id: 524472 Message-Id: <20230228165300.29384-4-swati2.sharma@intel.com> To: intel-gfx-trybot@lists.freedesktop.org Cc: Swati Sharma Date: Tue, 28 Feb 2023 22:22:59 +0530 i915 specific test is added to validate max source size. This test is expected to return -EINVAL for platforms where we have max source width 4096 whereas it will pass on platforms having max source width 5120. We have created fb of size 5120x4320 (=size of source) and downscaled to 3840x2160(=size of dest). On MTL(disp_ver=14), in dmesg we can see [drm:skl_update_scaler [i915]] scaler_user index 0.0: src 5120x4320 dst 3840x2160 size is out of scaler range. since max source width supported is 4096 whereas same test will pass on ADLP(display_ver=13) since max source width supported is 5120. v2: -updated comment (JP) -not declare list of tests (JP) -fixed indentation (JP) -added i915_max_source_size_test() inside igt_subtest_group() (JP) v3: -added restriction to run this test only when HDISPLAY=3840 v4: -remove inner loop (JP) -test for HDISPLAY >= 3840 (JP) v5: -override mode with lowest vrefresh to avoid cdclk lim (JP) Signed-off-by: Swati Sharma --- tests/kms_plane_scaling.c | 118 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c index c384a0316..489e3093e 100644 --- a/tests/kms_plane_scaling.c +++ b/tests/kms_plane_scaling.c @@ -26,6 +26,8 @@ #include "igt_vec.h" #include +#define HDISPLAY_4K 3840 + IGT_TEST_DESCRIPTION("Test display plane scaling"); enum scaler_combo_test_type { @@ -964,6 +966,119 @@ static void invalid_parameter_tests(data_t *d) } } +static drmModeModeInfo *find_mode(data_t *data, igt_output_t *output, const uint32_t planesize[]) +{ + drmModeModeInfo *mode = NULL; + + for (int i = 0; i < output->config.connector->count_modes; i++) { + if (output->config.connector->modes[i].hdisplay == planesize[0] && + output->config.connector->modes[i].vdisplay == planesize[1] ) { + if (mode && + mode->vrefresh < output->config.connector->modes[i].vrefresh) + continue; + + mode = &output->config.connector->modes[i]; + } + } + + return mode; +} + +/* + * Max source/destination width/height for i915 driver. + * These numbers are coming from + * drivers/gpu/drm/i915/display/skl_scaler.c in kernel sources. + * + * DISPLAY_VER < 11 + * max_src_w = 4096 + * max_src_h = 4096 + * max_dst_w = 4096 + * max_dst_h = 4096 + * + * DISPLAY_VER = 11 + * max_src_w = 5120 + * max_src_h = 4096 + * max_dst_w = 5120 + * max_dst_h = 4096 + * + * DISPLAY_VER = 12-13 + * max_src_w = 5120 + * max_src_h = 8192 + * max_dst_w = 8192 + * max_dst_h = 8192 + * + * DISPLAY_VER = 14 + * max_src_w = 4096 + * max_src_h = 8192 + * max_dst_w = 8192 + * max_dst_h = 8192 + */ + +static void i915_max_source_size_test(data_t *d) +{ + enum pipe pipe = PIPE_A; + drmModeModeInfo *mode = NULL; + igt_output_t *output; + igt_fb_t fb; + igt_plane_t *plane; + int rval; + + static const struct invalid_paramtests paramtests[] = { + { + .testname = "max-src-size", + .planesize = {3840, 2160}, + }, + }; + + igt_fixture { + igt_require_intel(d->drm_fd); + + output = igt_get_single_output_for_pipe(&d->display, pipe); + igt_require(output); + + mode = igt_output_get_mode(output); + igt_require(mode->hdisplay >= HDISPLAY_4K); + + igt_output_set_pipe(output, pipe); + plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + + igt_create_fb(d->drm_fd, 5120, 4320, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_MOD_NONE, + &fb); + } + + igt_describe("test for validating max source size."); + igt_subtest_with_dynamic("i915-max-source-size") { + for (uint32_t i = 0; i < ARRAY_SIZE(paramtests); i++) { + mode = find_mode(d, output, paramtests[i].planesize); + if (mode) { + igt_output_override_mode(output, mode); + igt_output_set_pipe(output, pipe); + igt_dynamic(paramtests[i].testname) { + igt_plane_set_position(plane, 0, 0); + igt_plane_set_fb(plane, &fb); + igt_plane_set_size(plane, + paramtests[i].planesize[0], + paramtests[i].planesize[1]); + + rval = igt_display_try_commit2(&d->display, COMMIT_ATOMIC); + + if (intel_display_ver(d->devid) < 11 || intel_display_ver(d->devid) >= 14) + igt_assert_eq(rval, -EINVAL); + else + igt_assert_eq(rval, 0); + } + } + } + } + + igt_fixture { + igt_remove_fb(d->drm_fd, &fb); + igt_output_set_pipe(output, PIPE_NONE); + } +} + static int opt_handler(int opt, int opt_index, void *_data) { data_t *data = _data; @@ -1126,6 +1241,9 @@ igt_main_args("", long_opts, help_str, opt_handler, &data) igt_subtest_group invalid_parameter_tests(&data); + igt_subtest_group + i915_max_source_size_test(&data); + igt_describe("Tests scaling with multi-pipe."); igt_subtest_f("2x-scaler-multi-pipe") test_scaler_with_multi_pipe_plane(&data); From patchwork Tue Feb 28 16:53:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v5,4/4] HAX: Add i915-max-source-size to fast-feedback.testlist From: Swati Sharma X-Patchwork-Id: 524473 Message-Id: <20230228165300.29384-5-swati2.sharma@intel.com> To: intel-gfx-trybot@lists.freedesktop.org Cc: Swati Sharma Date: Tue, 28 Feb 2023 22:23:00 +0530 CI Signed-off-by: Swati Sharma --- tests/intel-ci/fast-feedback.testlist | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist index d9fcb62d6..e303f6df4 100644 --- a/tests/intel-ci/fast-feedback.testlist +++ b/tests/intel-ci/fast-feedback.testlist @@ -129,6 +129,7 @@ igt@kms_psr@cursor_plane_move igt@kms_psr@sprite_plane_onoff igt@kms_psr@primary_mmap_gtt igt@kms_setmode@basic-clone-single-crtc +igt@kms_plane_scaling@i915-max-source-size igt@i915_pm_backlight@basic-brightness igt@i915_pm_rpm@basic-pci-d3-state igt@i915_pm_rpm@basic-rte