From: Karthik B S <karthik.b.s@intel.com>
To: Bhanuprakash Modem <bhanuprakash.modem@intel.com>,
<igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test Cleanup
Date: Wed, 7 Sep 2022 14:15:40 +0530 [thread overview]
Message-ID: <e9d8db3e-60a9-6367-91e5-70aab1a2a7b9@intel.com> (raw)
In-Reply-To: <20220907070108.535793-1-bhanuprakash.modem@intel.com>
On 9/7/2022 12:31 PM, Bhanuprakash Modem wrote:
> Sanitize the system state before starting the subtest.
>
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
> ---
> tests/kms_atomic_transition.c | 77 +++++++++++++++++------------------
> 1 file changed, 37 insertions(+), 40 deletions(-)
>
> diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> index 3f0ceb3d..4c62e909 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -47,9 +47,10 @@ struct plane_parms {
>
> typedef struct {
> int drm_fd;
> - struct igt_fb fb, argb_fb, sprite_fb;
> + struct igt_fb fbs[2], argb_fb, sprite_fb;
> igt_display_t display;
> bool extended;
> + igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES];
> } data_t;
>
> /* globals for fence support */
> @@ -62,10 +63,11 @@ run_primary_test(data_t *data, enum pipe pipe, igt_output_t *output)
> {
> drmModeModeInfo *mode;
> igt_plane_t *primary;
> - igt_fb_t fb;
> + igt_fb_t *fb = &data->fbs[0];
> int i, ret;
> unsigned flags = DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET;
>
> + igt_display_reset(&data->display);
> igt_output_set_pipe(output, pipe);
> primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>
> @@ -76,9 +78,9 @@ run_primary_test(data_t *data, enum pipe pipe, igt_output_t *output)
> igt_skip_on_f(ret == -EINVAL, "Primary plane cannot be disabled separately from output\n");
>
> igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> - DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &fb);
> + DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, fb);
>
> - igt_plane_set_fb(primary, &fb);
> + igt_plane_set_fb(primary, fb);
>
> for (i = 0; i < 4; i++) {
> igt_display_commit2(&data->display, COMMIT_ATOMIC);
> @@ -87,20 +89,15 @@ run_primary_test(data_t *data, enum pipe pipe, igt_output_t *output)
> igt_wait_for_vblank(data->drm_fd,
> data->display.pipes[pipe].crtc_offset);
>
> - igt_plane_set_fb(primary, (i & 1) ? &fb : NULL);
> + igt_plane_set_fb(primary, (i & 1) ? fb : NULL);
> igt_display_commit2(&data->display, COMMIT_ATOMIC);
>
> if (i & 1)
> igt_wait_for_vblank(data->drm_fd,
> data->display.pipes[pipe].crtc_offset);
>
> - igt_plane_set_fb(primary, (i & 1) ? NULL : &fb);
> + igt_plane_set_fb(primary, (i & 1) ? NULL : fb);
> }
> -
> - igt_plane_set_fb(primary, NULL);
> - igt_output_set_pipe(output, PIPE_NONE);
> - igt_remove_fb(data->drm_fd, &fb);
> - igt_display_commit2(&data->display, COMMIT_ATOMIC);
> }
>
> static void *fence_inc_thread(void *arg)
> @@ -507,7 +504,7 @@ run_transition_test(data_t *data, enum pipe pipe, igt_output_t *output,
> override_mode.flags ^= DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC;
>
> igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> - DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &data->fb);
> + DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, &data->fbs[0]);
>
> igt_output_set_pipe(output, pipe);
>
> @@ -521,7 +518,7 @@ run_transition_test(data_t *data, enum pipe pipe, igt_output_t *output,
> igt_output_set_pipe(output, pipe);
> }
>
> - setup_parms(data, pipe, mode, &data->fb, &data->argb_fb, &data->sprite_fb, parms, &iter_max);
> + setup_parms(data, pipe, mode, &data->fbs[0], &data->argb_fb, &data->sprite_fb, parms, &iter_max);
>
> igt_display_commit2(&data->display, COMMIT_ATOMIC);
>
> @@ -663,7 +660,8 @@ static void test_cleanup(data_t *data, enum pipe pipe, igt_output_t *output, boo
>
> igt_display_commit2(&data->display, COMMIT_ATOMIC);
>
> - igt_remove_fb(data->drm_fd, &data->fb);
> + igt_remove_fb(data->drm_fd, &data->fbs[0]);
> + igt_remove_fb(data->drm_fd, &data->fbs[1]);
> igt_remove_fb(data->drm_fd, &data->argb_fb);
> igt_remove_fb(data->drm_fd, &data->sprite_fb);
> }
> @@ -803,10 +801,8 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
>
> static void run_modeset_tests(data_t *data, int howmany, bool nonblocking, bool fencing)
> {
> - struct igt_fb fbs[2];
> int i, j;
> unsigned iter_max;
> - igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES] = { 0 };
> igt_output_t *output;
> uint16_t width = 0, height = 0;
>
> @@ -823,9 +819,9 @@ retry:
> }
>
> igt_create_pattern_fb(data->drm_fd, width, height,
> - DRM_FORMAT_XRGB8888, 0, &fbs[0]);
> + DRM_FORMAT_XRGB8888, 0, &data->fbs[0]);
> igt_create_color_pattern_fb(data->drm_fd, width, height,
> - DRM_FORMAT_XRGB8888, 0, .5, .5, .5, &fbs[1]);
> + DRM_FORMAT_XRGB8888, 0, .5, .5, .5, &data->fbs[1]);
>
> for_each_pipe(&data->display, i) {
> igt_pipe_t *pipe = &data->display.pipes[i];
> @@ -836,7 +832,7 @@ retry:
> j += 1;
>
> if (is_i915_device(data->drm_fd))
> - pipe_crcs[i] = igt_pipe_crc_new(data->drm_fd, i, INTEL_PIPE_CRC_SOURCE_AUTO);
> + data->pipe_crcs[i] = igt_pipe_crc_new(data->drm_fd, i, INTEL_PIPE_CRC_SOURCE_AUTO);
>
> for_each_valid_output_on_pipe(&data->display, i, output) {
> if (output->pending_pipe != PIPE_NONE)
> @@ -848,8 +844,8 @@ retry:
> }
>
> if (mode) {
> - igt_plane_set_fb(plane, &fbs[1]);
> - igt_fb_set_size(&fbs[1], plane, mode->hdisplay, mode->vdisplay);
> + igt_plane_set_fb(plane, &data->fbs[1]);
> + igt_fb_set_size(&data->fbs[1], plane, mode->hdisplay, mode->vdisplay);
> igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
>
> if (fencing)
> @@ -883,13 +879,13 @@ retry:
> if (igt_hweight(i) > howmany)
> continue;
>
> - event_mask = set_combinations(data, i, &fbs[0]);
> + event_mask = set_combinations(data, i, &data->fbs[0]);
> if (!event_mask && i)
> continue;
>
> commit_display(data, event_mask, nonblocking);
>
> - collect_crcs_mask(pipe_crcs, i, crcs[0]);
> + collect_crcs_mask(data->pipe_crcs, i, crcs[0]);
>
> for (j = iter_max - 1; j > i + 1; j--) {
> if (igt_hweight(j) > howmany)
> @@ -898,28 +894,28 @@ retry:
> if (igt_hweight(i) < howmany && igt_hweight(j) < howmany)
> continue;
>
> - event_mask = set_combinations(data, j, &fbs[1]);
> + event_mask = set_combinations(data, j, &data->fbs[1]);
> if (!event_mask)
> continue;
>
> commit_display(data, event_mask, nonblocking);
>
> - collect_crcs_mask(pipe_crcs, j, crcs[1]);
> + collect_crcs_mask(data->pipe_crcs, j, crcs[1]);
>
> refresh_primaries(data, j);
> commit_display(data, j, nonblocking);
> - collect_crcs_mask(pipe_crcs, j, crcs[2]);
> + collect_crcs_mask(data->pipe_crcs, j, crcs[2]);
>
> - event_mask = set_combinations(data, i, &fbs[0]);
> + event_mask = set_combinations(data, i, &data->fbs[0]);
> if (!event_mask)
> continue;
>
> commit_display(data, event_mask, nonblocking);
> - collect_crcs_mask(pipe_crcs, i, crcs[3]);
> + collect_crcs_mask(data->pipe_crcs, i, crcs[3]);
>
> refresh_primaries(data, i);
> commit_display(data, i, nonblocking);
> - collect_crcs_mask(pipe_crcs, i, crcs[4]);
> + collect_crcs_mask(data->pipe_crcs, i, crcs[4]);
>
> if (!is_i915_device(data->drm_fd))
> continue;
> @@ -935,17 +931,6 @@ retry:
> }
> }
> }
> -
> - set_combinations(data, 0, NULL);
> - igt_display_commit2(&data->display, COMMIT_ATOMIC);
> -
> - if (is_i915_device(data->drm_fd)) {
> - for_each_pipe(&data->display, i)
> - igt_pipe_crc_free(pipe_crcs[i]);
> - }
> -
> - igt_remove_fb(data->drm_fd, &fbs[1]);
> - igt_remove_fb(data->drm_fd, &fbs[0]);
> }
>
> static void run_modeset_transition(data_t *data, int requested_outputs, bool nonblocking, bool fencing)
> @@ -980,6 +965,18 @@ static void run_modeset_transition(data_t *data, int requested_outputs, bool non
>
> igt_dynamic_f("%ix-outputs", requested_outputs)
> run_modeset_tests(data, requested_outputs, nonblocking, fencing);
> +
> + /* Cleanup */
> + set_combinations(data, 0, NULL);
> + igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> + if (is_i915_device(data->drm_fd)) {
> + for_each_pipe(&data->display, pipe)
> + igt_pipe_crc_free(data->pipe_crcs[pipe]);
> + }
> +
> + igt_remove_fb(data->drm_fd, &data->fbs[0]);
> + igt_remove_fb(data->drm_fd, &data->fbs[1]);
> }
>
> static int opt_handler(int opt, int opt_index, void *_data)
next prev parent reply other threads:[~2022-09-07 8:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 4:06 [igt-dev] [i-g-t 0/2] tests/kms_atomic_transition: IGT test cleanup Bhanuprakash Modem
2022-09-05 4:06 ` [igt-dev] [i-g-t 1/2] tests/kms_atomic_transition: Convert tests to dynamic Bhanuprakash Modem
2022-09-06 12:53 ` Karthik B S
2022-09-05 4:06 ` [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test Cleanup Bhanuprakash Modem
2022-09-06 12:57 ` Karthik B S
2022-09-06 14:12 ` [igt-dev] [i-g-t V2 " Bhanuprakash Modem
2022-09-07 7:01 ` [igt-dev] [i-g-t " Bhanuprakash Modem
2022-09-07 8:45 ` Karthik B S [this message]
2022-09-05 4:44 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_atomic_transition: IGT test cleanup Patchwork
2022-09-05 5:49 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-09-06 15:26 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_atomic_transition: IGT test cleanup (rev2) Patchwork
2022-09-06 18:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-09-07 7:32 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_atomic_transition: IGT test cleanup (rev3) Patchwork
2022-09-07 8:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-02-09 6:23 [igt-dev] [i-g-t 1/2] tests/kms_atomic_transition: Reduce the execution time on simulation Bhanuprakash Modem
2023-02-09 6:23 ` [igt-dev] [i-g-t 2/2] tests/kms_atomic_transition: Test cleanup Bhanuprakash Modem
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e9d8db3e-60a9-6367-91e5-70aab1a2a7b9@intel.com \
--to=karthik.b.s@intel.com \
--cc=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox