[igt-dev] [PATCH i-g-t 1/3] tests/kms_psr2_sf: Move continuous testcase preparation for new tests
Kahola, Mika
mika.kahola at intel.com
Wed May 18 10:35:47 UTC 2022
The compiler nags about calling a plane_move_continuous_expected_output() with incorrect argument.
./tests/i915/kms_psr2_sf.c: In function ‘plane_move_continuous_expected_output’:
../tests/i915/kms_psr2_sf.c:420:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
420 | int ret;
| ^~~
../tests/i915/kms_psr2_sf.c: In function ‘expected_output’:
../tests/i915/kms_psr2_sf.c:480:45: error: incompatible type for argument 1 of ‘plane_move_continuous_expected_output’
480 | plane_move_continuous_expected_output(data->pos);
| ~~~~^~~~~
| |
| enum plane_move_postion
../tests/i915/kms_psr2_sf.c:417:59: note: expected ‘data_t *’ but argument is of type ‘enum plane_move_postion’
417 | static void plane_move_continuous_expected_output(data_t *data)
This is fixed later on in the series but if we want to compile each patch of the series successfully we would need to change the function call
plane_move_continuous_expected_output(data->pos);
with
plane_move_continuous_expected_output(data);
Still the compiler warns for unused variable 'ret' but that’s a minor thing.
With this function call fix, this is
Reviewed-by: Mika Kahola <mika.kahola at intel.com>
> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Jouni
> Högander
> Sent: Friday, May 6, 2022 10:11 AM
> To: igt-dev at lists.freedesktop.org
> Subject: [igt-dev] [PATCH i-g-t 1/3] tests/kms_psr2_sf: Move continuous
> testcase preparation for new tests
>
> Modify current move continuous testcase to ease up adding new testcases.
>
> Remove exceeding visible area as testcases to perform this are about to be
> added as separate testcases.
>
> Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
> ---
> tests/i915/kms_psr2_sf.c | 90 +++++++++++++++++++++++++++-------------
> 1 file changed, 61 insertions(+), 29 deletions(-)
>
> diff --git a/tests/i915/kms_psr2_sf.c b/tests/i915/kms_psr2_sf.c index
> d4cddb62..bf0eab23 100644
> --- a/tests/i915/kms_psr2_sf.c
> +++ b/tests/i915/kms_psr2_sf.c
> @@ -53,8 +53,11 @@ enum plane_move_postion {
> POS_TOP_RIGHT,
> POS_BOTTOM_LEFT,
> POS_BOTTOM_RIGHT,
> - POS_BOTTOM_LEFT_NEGATIVE,
> - POS_TOP_RIGHT_NEGATIVE,
> + POS_CENTER,
> + POS_TOP,
> + POS_BOTTOM,
> + POS_LEFT,
> + POS_RIGHT,
> };
>
> typedef struct {
> @@ -411,34 +414,42 @@ static void plane_move_expected_output(enum
> plane_move_postion pos)
> manual(expected);
> }
>
> -static void plane_move_continuous_expected_output(enum
> plane_move_postion pos)
> +static void plane_move_continuous_expected_output(data_t *data)
> {
> char expected[128] = {};
> + int ret;
>
> - switch (pos) {
> + switch (data->pos) {
> case POS_TOP_LEFT:
> - sprintf(expected,
> - "screen Green with Blue box on top left corner");
> + ret = sprintf(expected,
> + "screen Green with Blue box on top left corner");
> break;
> case POS_TOP_RIGHT:
> - sprintf(expected,
> - "screen Green with Blue box on top right corner");
> + ret = sprintf(expected,
> + "screen Green with Blue box on top right corner");
> break;
> case POS_BOTTOM_LEFT:
> - sprintf(expected,
> - "screen Green with Blue box on bottom left corner");
> + ret = sprintf(expected,
> + "screen Green with Blue box on bottom left
> corner");
> break;
> case POS_BOTTOM_RIGHT:
> - sprintf(expected,
> - "screen Green with Blue box on bottom right corner");
> + ret = sprintf(expected,
> + "screen Green with Blue box on bottom right
> corner");
> break;
> - case POS_BOTTOM_LEFT_NEGATIVE:
> - sprintf(expected,
> - "screen Green with Blue box on bottom left corner
> (partly exceeding area)");
> + case POS_CENTER:
> + ret = sprintf(expected, "screen Green with Blue box on center");
> break;
> - case POS_TOP_RIGHT_NEGATIVE:
> - sprintf(expected,
> - "screen Green with Blue box on top right corner (partly
> exceeding area)");
> + case POS_TOP:
> + ret = sprintf(expected, "screen Green with Blue box on top");
> + break;
> + case POS_BOTTOM:
> + ret = sprintf(expected, "screen Green with Blue box on
> bottom");
> + break;
> + case POS_LEFT:
> + ret = sprintf(expected, "screen Green with Blue box on left");
> + break;
> + case POS_RIGHT:
> + ret = sprintf(expected, "screen Green with Blue box on right");
> break;
> default:
> igt_assert(false);
> @@ -530,8 +541,7 @@ static void damaged_plane_move(data_t *data)
>
> expected_output(data);
> }
> -
> -static void plane_move_continuous(data_t *data)
> +static void get_target_coords(data_t *data, int *x, int *y)
> {
> int target_x, target_y;
>
> @@ -544,28 +554,50 @@ static void plane_move_continuous(data_t *data)
> target_x = data->mode->hdisplay - data->fb_test.width;
> target_y = 0;
> break;
> - case POS_TOP_RIGHT_NEGATIVE:
> - target_x = data->mode->hdisplay - data->fb_test.width;
> - target_y = -data->fb_test.width / 2;
> - break;
> case POS_BOTTOM_LEFT:
> target_x = 0;
> target_y = data->mode->vdisplay - data->fb_test.height;
> break;
> - case POS_BOTTOM_LEFT_NEGATIVE:
> - target_x = -data->fb_test.width / 2;
> - target_y = data->mode->vdisplay - data->fb_test.height;
> - break;
> case POS_BOTTOM_RIGHT:
> target_x = data->mode->hdisplay - data->fb_test.width;
> target_y = data->mode->vdisplay - data->fb_test.height;
> break;
> + case POS_CENTER:
> + target_x = data->mode->hdisplay / 2;
> + target_y = data->mode->vdisplay / 2;
> + break;
> + case POS_BOTTOM:
> + target_x = data->mode->hdisplay / 2;
> + target_y = data->mode->vdisplay - data->fb_test.height;
> + break;
> + case POS_TOP:
> + target_x = data->mode->hdisplay / 2;
> + target_y = 0;
> + break;
> + case POS_RIGHT:
> + target_x = data->mode->hdisplay - data->fb_test.width;
> + target_y = data->mode->vdisplay / 2;
> + break;
> + case POS_LEFT:
> + target_x = 0;
> + target_y = data->mode->vdisplay / 2;
> + break;
> default:
> igt_assert(false);
> }
>
> + *x = target_x;
> + *y = target_y;
> +}
> +
> +static void plane_move_continuous(data_t *data) {
> + int target_x, target_y;
> +
> igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
>
> + get_target_coords(data, &target_x, &target_y);
> +
> while (data->cur_x != target_x || data->cur_y != target_y) {
> if (data->cur_x < target_x)
> data->cur_x += min(target_x - data->cur_x, 20); @@ -
> 650,7 +682,7 @@ static void run(data_t *data)
> * over iterations.
> */
> data->cur_x = data->cur_y = 0;
> - for (i = POS_TOP_LEFT; i <= POS_TOP_RIGHT_NEGATIVE; i++) {
> + for (i = POS_TOP_LEFT; i <= POS_RIGHT; i++) {
> data->pos = i;
> plane_move_continuous(data);
> }
> --
> 2.25.1
More information about the igt-dev
mailing list