From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Mika Kahola <mika.kahola@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag
Date: Thu, 12 Jan 2017 14:45:33 +0100 [thread overview]
Message-ID: <2f065980-42e0-72aa-b61a-9e6e9cd7b881@linux.intel.com> (raw)
In-Reply-To: <1483099241-15898-2-git-send-email-mika.kahola@intel.com>
Op 30-12-16 om 13:00 schreef Mika Kahola:
> Add TEST_ONLY flag to test atomic modesetting commits without
> actual real-life commit.
>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
> tests/kms_plane_multiple.c | 79 ++++++++++++++++++++++++++++------------------
> 1 file changed, 49 insertions(+), 30 deletions(-)
>
> diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
> index 5e12be4..1a77a38 100644
> --- a/tests/kms_plane_multiple.c
> +++ b/tests/kms_plane_multiple.c
> @@ -61,10 +61,12 @@ struct {
> int iterations;
> bool user_seed;
> int seed;
> + bool test_only;
> } opt = {
> .iterations = 64,
> .user_seed = false,
> .seed = 1,
> + .test_only = false,
> };
>
> static inline uint32_t pipe_select(int pipe)
> @@ -228,7 +230,7 @@ prepare_planes(data_t *data, enum pipe pipe, color_t *color,
> static void
> test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
> igt_output_t *output, int max_planes,
> - uint64_t tiling)
> + uint64_t tiling, bool test_only)
> {
> char buf[256];
> struct drm_event *e = (void *)buf;
> @@ -240,6 +242,12 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
> int iterations = opt.iterations < 1 ? 1 : opt.iterations;
> bool loop_forever;
> char info[256];
> + int flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
> +
> + if (test_only)
> + flags |= DRM_MODE_ATOMIC_TEST_ONLY;
> + else
> + flags |= DRM_MODE_PAGE_FLIP_EVENT;
I would only pass ALLOW_MODESET for the TEST_ONLY case.
> if (opt.iterations == LOOP_FOREVER) {
> loop_forever = true;
> @@ -256,8 +264,9 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
>
> test_init(data, pipe);
>
> - test_grab_crc(data, output, pipe, true, &blue, tiling,
> - &test.reference_crc);
> + if (!test_only)
> + test_grab_crc(data, output, pipe, true, &blue, tiling,
> + &test.reference_crc);
You still want to do some kind of pipe setup, else the state of the pipe will depend on what was set before it.
I'm not sure what you want the state to be though.
> i = 0;
> while (i < iterations || loop_forever) {
> @@ -265,24 +274,27 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
>
> vblank_start = get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
>
> - igt_display_commit_atomic(&data->display,
> - DRM_MODE_PAGE_FLIP_EVENT,
> - &data->display);
> + ret = igt_display_try_commit_atomic(&data->display,
> + flags,
> + &data->display);
> + igt_assert(ret != -EINVAL);
Other failures are fine? I would leave igt_display_commit_atomic here, it catches errors for you. :)
> - igt_set_timeout(1, "Stuck on page flip");
> + if (!test_only) {
> + igt_set_timeout(1, "Stuck on page flip");
>
> - ret = read(data->display.drm_fd, buf, sizeof(buf));
> - igt_assert(ret >= 0);
> + ret = read(data->display.drm_fd, buf, sizeof(buf));
> + igt_assert(ret >= 0);
>
> - igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1);
> - igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
> - igt_reset_timeout();
> + igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1);
> + igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
> + igt_reset_timeout();
>
> - n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc);
> + n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc);
>
> - igt_assert_eq(n, MAX_CRCS);
> + igt_assert_eq(n, MAX_CRCS);
>
> - igt_assert_crc_equal(&test.reference_crc, crc);
> + igt_assert_crc_equal(&test.reference_crc, crc);
> + }
>
> i++;
> }
> @@ -345,7 +357,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
>
> static void
> test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
> - uint64_t tiling)
> + uint64_t tiling, bool test_only)
> {
> igt_output_t *output;
> int connected_outs;
> @@ -372,7 +384,8 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
> test_atomic_plane_position_with_output(data, pipe,
> output,
> max_planes,
> - tiling);
> + tiling,
> + test_only);
> else
> test_legacy_plane_position_with_output(data, pipe,
> output,
> @@ -387,54 +400,55 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
> }
>
> static void
> -run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes)
> +run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes,
> + bool test_only)
> {
> igt_subtest_f("legacy-pipe-%s-tiling-none-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, false, max_planes,
> - LOCAL_DRM_FORMAT_MOD_NONE);
> + LOCAL_DRM_FORMAT_MOD_NONE, test_only);
I'm pretty sure the legacy tests don't work with TEST_ONLY..
> igt_subtest_f("atomic-pipe-%s-tiling-none-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, true, max_planes,
> - LOCAL_I915_FORMAT_MOD_X_TILED);
> + LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
>
> igt_subtest_f("legacy-pipe-%s-tiling-x-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, false, max_planes,
> - LOCAL_I915_FORMAT_MOD_X_TILED);
> + LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
>
> igt_subtest_f("atomic-pipe-%s-tiling-x-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, true, max_planes,
> - LOCAL_I915_FORMAT_MOD_X_TILED);
> + LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
>
> igt_subtest_f("legacy-pipe-%s-tiling-y-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, false, max_planes,
> - LOCAL_I915_FORMAT_MOD_Y_TILED);
> + LOCAL_I915_FORMAT_MOD_Y_TILED, test_only);
>
> igt_subtest_f("atomic-pipe-%s-tiling-y-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, true, max_planes,
> - LOCAL_I915_FORMAT_MOD_Y_TILED);
> + LOCAL_I915_FORMAT_MOD_Y_TILED, test_only);
>
> igt_subtest_f("legacy-pipe-%s-tiling-yf-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, false, max_planes,
> - LOCAL_I915_FORMAT_MOD_Yf_TILED);
> + LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only);
>
> igt_subtest_f("atomic-pipe-%s-tiling-yf-planes-%d",
> kmstest_pipe_name(pipe), max_planes)
> test_plane_position(data, pipe, true, max_planes,
> - LOCAL_I915_FORMAT_MOD_Yf_TILED);
> + LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only);
> }
>
> static void
> -run_tests_for_pipe(data_t *data, enum pipe pipe)
> +run_tests_for_pipe(data_t *data, enum pipe pipe, bool test_only)
> {
> for (int planes = IGT_PLANE_PRIMARY; planes < IGT_MAX_PLANES; planes++)
> - run_tests_for_pipe_plane(data, pipe, planes);
> + run_tests_for_pipe_plane(data, pipe, planes, test_only);
> }
>
> static data_t data;
> @@ -455,6 +469,9 @@ static int opt_handler(int option, int option_index, void *input)
> opt.user_seed = true;
> opt.seed = strtol(optarg, NULL, 0);
> break;
> + case 't':
> + opt.test_only = true;
> + break;
> default:
> igt_assert(false);
> }
> @@ -464,13 +481,15 @@ static int opt_handler(int option, int option_index, void *input)
>
> const char *help_str =
> " --iterations Number of iterations for test coverage. -1 loop forever, default 64 iterations\n"
> - " --seed Seed for random number generator\n";
> + " --seed Seed for random number generator\n"
> + " --test-only test only atomic commit\n";
>
> int main(int argc, char *argv[])
> {
> struct option long_options[] = {
> { "iterations", required_argument, NULL, 'i'},
> { "seed", required_argument, NULL, 's'},
> + { "test-only", no_argument, NULL, 't'},
> { 0, 0, 0, 0 }
> };
I think it's best to just list the tests twice, once normal and once with test-only in the test name?
> @@ -489,7 +508,7 @@ int main(int argc, char *argv[])
> }
>
> for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++)
> - run_tests_for_pipe(&data, pipe);
> + run_tests_for_pipe(&data, pipe, opt.test_only);
>
> igt_fixture {
> igt_display_fini(&data.display);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-01-12 13:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-30 12:00 [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag Mika Kahola
2017-01-12 13:45 ` Maarten Lankhorst [this message]
2016-12-30 12:00 ` [PATCH i-g-t 2/5] tests/kms_atomic_transition: " Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 3/5] tests/kms_plane_scaling: " Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 4/5] tests/kms_rotation_crc: " Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit Mika Kahola
2017-01-12 10:11 ` Maarten Lankhorst
[not found] ` <1484216887.9014.8.camel@intel.com>
2017-01-12 11:37 ` Maarten Lankhorst
2017-01-23 13:26 ` Mika Kahola
2017-01-23 15:35 ` Maarten Lankhorst
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=2f065980-42e0-72aa-b61a-9e6e9cd7b881@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kahola@intel.com \
/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