[PATCH i-g-t v4] tests/kms_ccs: Convert subtests to dynamic subtests

Karthik B S karthik.b.s at intel.com
Thu Feb 22 04:30:57 UTC 2024


On 2/21/2024 5:13 PM, Juha-Pekka Heikkila wrote:
> Look good!
>
> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>

Thanks JP for the rb. Merging this.

The selftest failure is unrelated to this patch and the 
kms_ccs at .*xe2-ccs skips are expected.

>
> On 21.2.2024 5.05, Karthik B S wrote:
>> Signed-off-by: Karthik B S <karthik.b.s at intel.com>
>> ---
>>   tests/intel/kms_ccs.c | 193 +++++++++++-------------------------------
>>   1 file changed, 50 insertions(+), 143 deletions(-)
>>
>> diff --git a/tests/intel/kms_ccs.c b/tests/intel/kms_ccs.c
>> index 82714af93..4f8e30791 100644
>> --- a/tests/intel/kms_ccs.c
>> +++ b/tests/intel/kms_ccs.c
>> @@ -44,35 +44,16 @@
>>   #include "xe/xe_query.h"
>>     /**
>> - * SUBTEST: %s-%s-%s
>> - * Description: Test %arg[2] with given %arg[3] modifier
>> + * SUBTEST: %s-%s
>> + * Description: Test %arg[1] with given %arg[2] modifier
>>    *
>>    * arg[1]:
>>    *
>> - * @pipe-A:                    Pipe A
>> - * @pipe-B:                    Pipe B
>> - * @pipe-C:                    Pipe C
>> - * @pipe-D:                    Pipe D
>> - * @pipe-E:                    Pipe E
>> - * @pipe-F:                    Pipe F
>> - * @pipe-G:                    Pipe G
>> - * @pipe-H:                    Pipe H
>> - * @pipe-I:                    Pipe I
>> - * @pipe-J:                    Pipe J
>> - * @pipe-K:                    Pipe K
>> - * @pipe-L:                    Pipe L
>> - * @pipe-M:                    Pipe M
>> - * @pipe-N:                    Pipe N
>> - * @pipe-O:                    Pipe O
>> - * @pipe-P:                    Pipe P
>> - *
>> - * arg[2]:
>> - *
>>    * @bad-aux-stride:            Bad AUX stride
>>    * @ccs-on-another-bo:         CCS with different BO
>>    * @missing-ccs-buffer:        Missing CCS buffer
>>    *
>> - * arg[3]:
>> + * arg[2]:
>>    *
>>    * @y-tiled-ccs:               Y tiled ccs
>>    * @y-tiled-gen12-mc-ccs:      Y tiled gen12 mc ccs
>> @@ -85,33 +66,14 @@
>>    */
>>     /**
>> - * SUBTEST: %s-%s-%s
>> - * Description: Test %arg[2] with %arg[3] modifier
>> + * SUBTEST: %s-%s
>> + * Description: Test %arg[1] with %arg[2] modifier
>>    *
>>    * arg[1]:
>>    *
>> - * @pipe-A:                      Pipe A
>> - * @pipe-B:                      Pipe B
>> - * @pipe-C:                      Pipe C
>> - * @pipe-D:                      Pipe D
>> - * @pipe-E:                      Pipe E
>> - * @pipe-F:                      Pipe F
>> - * @pipe-G:                      Pipe G
>> - * @pipe-H:                      Pipe H
>> - * @pipe-I:                      Pipe I
>> - * @pipe-J:                      Pipe J
>> - * @pipe-K:                      Pipe K
>> - * @pipe-L:                      Pipe L
>> - * @pipe-M:                      Pipe M
>> - * @pipe-N:                      Pipe N
>> - * @pipe-O:                      Pipe O
>> - * @pipe-P:                      Pipe P
>> - *
>> - * arg[2]:
>> - *
>>    * @bad-pixel-format:            Bad pixel format
>>    *
>> - * arg[3]:
>> + * arg[2]:
>>    *
>>    * @4-tiled-dg2-mc-ccs:        4 tiled mc ccs
>>    * @4-tiled-dg2-rc-ccs:        4 tiled dg2 rc ccs
>> @@ -127,35 +89,16 @@
>>    */
>>     /**
>> - * SUBTEST: %s-%s-%s
>> - * Description: Test %arg[2] with %arg[3] modifier
>> + * SUBTEST: %s-%s
>> + * Description: Test %arg[1] with %arg[2] modifier
>>    *
>>    * arg[1]:
>>    *
>> - * @pipe-A:                      Pipe A
>> - * @pipe-B:                      Pipe B
>> - * @pipe-C:                      Pipe C
>> - * @pipe-D:                      Pipe D
>> - * @pipe-E:                      Pipe E
>> - * @pipe-F:                      Pipe F
>> - * @pipe-G:                      Pipe G
>> - * @pipe-H:                      Pipe H
>> - * @pipe-I:                      Pipe I
>> - * @pipe-J:                      Pipe J
>> - * @pipe-K:                      Pipe K
>> - * @pipe-L:                      Pipe L
>> - * @pipe-M:                      Pipe M
>> - * @pipe-N:                      Pipe N
>> - * @pipe-O:                      Pipe O
>> - * @pipe-P:                      Pipe P
>> - *
>> - * arg[2]:
>> - *
>>    * @crc-primary-basic:           Primary plane CRC compatibility
>>    * @crc-sprite-planes-basic:     Sprite plane CRC compatability
>>    * @random-ccs-data:             Random CCS data
>>    *
>> - * arg[3]:
>> + * arg[2]:
>>    *
>>    * @4-tiled-xe2-ccs:           4 tiled xe2 pat controlled ccs
>>    * @4-tiled-dg2-mc-ccs:        4 tiled mc ccs
>> @@ -172,35 +115,16 @@
>>    */
>>     /**
>> - * SUBTEST: %s-%s-%s
>> - * Description: Test %arg[2] with %arg[3] modifier
>> + * SUBTEST: %s-%s
>> + * Description: Test %arg[1] with %arg[2] modifier
>>    * Functionality: ccs, rotation, tiling
>>    *
>>    * arg[1]:
>>    *
>> - * @pipe-A:                      Pipe A
>> - * @pipe-B:                      Pipe B
>> - * @pipe-C:                      Pipe C
>> - * @pipe-D:                      Pipe D
>> - * @pipe-E:                      Pipe E
>> - * @pipe-F:                      Pipe F
>> - * @pipe-G:                      Pipe G
>> - * @pipe-H:                      Pipe H
>> - * @pipe-I:                      Pipe I
>> - * @pipe-J:                      Pipe J
>> - * @pipe-K:                      Pipe K
>> - * @pipe-L:                      Pipe L
>> - * @pipe-M:                      Pipe M
>> - * @pipe-N:                      Pipe N
>> - * @pipe-O:                      Pipe O
>> - * @pipe-P:                      Pipe P
>> - *
>> - * arg[2]:
>> - *
>>    * @bad-rotation-90:             90 degree rotation
>>    * @crc-primary-rotation-180:    180 degree rotation
>>    *
>> - * arg[3]:
>> + * arg[2]:
>>    *
>>    * @4-tiled-xe2-ccs:           4 tiled xe2 pat controlled ccs
>>    * @4-tiled-dg2-mc-ccs:        4 tiled mc ccs
>> @@ -956,24 +880,10 @@ static void test_output(data_t *data, const int 
>> testnum)
>>   {
>>       uint16_t dev_id;
>>   -    igt_fixture {
>> -        bool found = false;
>> +    igt_fixture
>>           dev_id = intel_get_drm_devid(data->drm_fd);
>>   -        data->flags = tests[testnum].flags;
>> -
>> -        for_each_valid_output_on_pipe(&data->display, data->pipe, 
>> data->output) {
>> -            igt_display_reset(&data->display);
>> -
>> -            igt_output_set_pipe(data->output, data->pipe);
>> -            if (intel_pipe_output_combo_valid(&data->display)) {
>> -                found = true;
>> -                break;
>> -            }
>> -
>> -        }
>> -        igt_require_f(found, "No valid pipe/output combo found.\n");
>> -    }
>> +    data->flags = tests[testnum].flags;
>>         for (int i = 0; i < ARRAY_SIZE(ccs_modifiers); i++) {
>>           if (((ccs_modifiers[i].modifier == 
>> I915_FORMAT_MOD_4_TILED_DG2_RC_CCS ||
>> @@ -987,10 +897,7 @@ static void test_output(data_t *data, const int 
>> testnum)
>>           data->ccs_modifier = ccs_modifiers[i].modifier;
>>             igt_describe(tests[testnum].description);
>> -        igt_subtest_f("pipe-%s-%s-%s", kmstest_pipe_name(data->pipe),
>> -                  tests[testnum].testname, ccs_modifiers[i].str) {
>> -            int valid_tests = 0;
>> -
>> +        igt_subtest_with_dynamic_f("%s-%s", tests[testnum].testname, 
>> ccs_modifiers[i].str) {
>>               if (ccs_modifiers[i].modifier == 
>> I915_FORMAT_MOD_4_TILED) {
>>                   igt_require_f(AT_LEAST_GEN(dev_id, 20),
>>                             "Xe2 platform needed.\n");
>> @@ -999,37 +906,46 @@ static void test_output(data_t *data, const int 
>> testnum)
>>                             "Older than Xe2 platform needed.\n");
>>               }
>>   -            if (data->flags == TEST_RANDOM)
>> -                igt_info("Testing with seed %d\n", data->seed);
>> -
>> -            if (data->flags & TEST_ALL_PLANES) {
>> - igt_display_require_output_on_pipe(&data->display, data->pipe);
>> -
>> -                for_each_plane_on_pipe(&data->display, data->pipe, 
>> data->plane) {
>> -                    for (int j = 0; j < ARRAY_SIZE(formats); j++) {
>> -                        data->format = formats[j];
>> -                        valid_tests += test_ccs(data);
>> + for_each_pipe_with_valid_output(&data->display, data->pipe, 
>> data->output) {
>> +                igt_display_reset(&data->display);
>> +
>> +                igt_output_set_pipe(data->output, data->pipe);
>> +                if (!intel_pipe_output_combo_valid(&data->display))
>> +                    continue;
>> +
>> +                igt_dynamic_f("pipe-%s-%s", 
>> kmstest_pipe_name(data->pipe),
>> +                                data->output->name) {
>> +                    int valid_tests = 0;
>> +
>> +                    if (data->flags == TEST_RANDOM)
>> +                        igt_info("Testing with seed %d\n", data->seed);
>> +
>> +                    if (data->flags & TEST_ALL_PLANES) {
>> + igt_display_require_output_on_pipe(&data->display, data->pipe);
>> +
>> + for_each_plane_on_pipe(&data->display, data->pipe, data->plane) {
>> +                            for (int j = 0; j < ARRAY_SIZE(formats); 
>> j++) {
>> +                                data->format = formats[j];
>> +                                valid_tests += test_ccs(data);
>> +                            }
>> +                        }
>> +                    } else {
>> +                        for (int j = 0; j < ARRAY_SIZE(formats); j++) {
>> +                            data->format = formats[j];
>> +                            valid_tests += test_ccs(data);
>> +                        }
>>                       }
>> -                }
>> -            } else {
>> -                for (int j = 0; j < ARRAY_SIZE(formats); j++) {
>> -                    data->format = formats[j];
>> -                    valid_tests += test_ccs(data);
>> +                    igt_require_f(valid_tests > 0,
>> +                              "no valid tests for %s on pipe %s\n",
>> +                              ccs_modifiers[i].str,
>> + kmstest_pipe_name(data->pipe));
>>                   }
>>               }
>> -            igt_require_f(valid_tests > 0,
>> -                      "no valid tests for %s on pipe %s\n",
>> -                      ccs_modifiers[i].str,
>> -                      kmstest_pipe_name(data->pipe));
>>           }
>>       }
>>   -    igt_fixture {
>> -        igt_output_set_pipe(data->output, PIPE_NONE);
>> -        igt_display_commit2(&data->display, data->display.is_atomic ?
>> -                    COMMIT_ATOMIC : COMMIT_LEGACY);
>> +    igt_fixture
>>           data->plane = NULL;
>> -    }
>>   }
>>     static int opt_handler(int opt, int opt_index, void *opt_data)
>> @@ -1060,8 +976,6 @@ static const char *help_str =
>>     igt_main_args("cs:", NULL, help_str, opt_handler, &data)
>>   {
>> -    enum pipe pipe;
>> -
>>       igt_fixture {
>>           data.drm_fd = drm_open_driver_master(DRIVER_INTEL | 
>> DRIVER_XE);
>>   @@ -1076,15 +990,8 @@ igt_main_args("cs:", NULL, help_str, 
>> opt_handler, &data)
>>               data.seed = time(NULL);
>>       }
>>   -    for_each_pipe_static(pipe) {
>> -        data.pipe = pipe;
>> -
>> -        igt_subtest_group {
>> -            for (int c = 0; c < ARRAY_SIZE(tests); c++) {
>> -                test_output(&data, c);
>> -            }
>> -        }
>> -    }
>> +    for (int c = 0; c < ARRAY_SIZE(tests); c++)
>> +        test_output(&data, c);
>>         igt_fixture {
>>           igt_display_fini(&data.display);
>


More information about the igt-dev mailing list