On Mon, 2017-01-30 at 13:43 +0100, Maarten Lankhorst wrote:
> Op 30-01-17 om 12:37 schreef Mika Kahola:
> > 
> > Validate atomic commit correctness before actual commit.
> > 
> > For: VIZ-6956
> > 
> > v2: Add flag to toggle TEST_ONLY for atomic commit.
> >     Remove DRM_MODE_PAGE_FLIP_EVENT flag, if enabled, before trying
> > atomic
> >     commit with TEST_ONLY flag (Maarten)
> > 
> > Cc: Maarten Lankhorst <maarten.lankho...@linux.intel.com>
> > 
> > Signed-off-by: Mika Kahola <mika.kah...@intel.com>
> > <snip>
> Hey,
> 
> Way too complicated, I thought of something like this instead too run
> a whole test with TEST_ONLY.
Ok, let's go with this approach. 

To follow JIRA description for this test I was thinking to add yet
another subtest for each kms_* that tests first with TEST_ONLY flag and
if that fails with -EINVAL then test with the real deal.

> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 77de678e121b..c935203f5b5c 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -2332,7 +2332,23 @@ static int igt_atomic_commit(igt_display_t
> *display, uint32_t flags, void *user_
>               igt_atomic_prepare_connector_commit(output, req);
>       }
>  
> -     ret = drmModeAtomicCommit(display->drm_fd, req, flags,
> user_data);
> +     if (display->force_test_atomic &&
> +         !(flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
> +             unsigned int test_flags = flags &
> ~DRM_MODE_PAGE_FLIP_EVENT;
> +             int test_ret;
> +
> +             test_flags |= DRM_MODE_ATOMIC_TEST_ONLY;
> +
> +             test_ret = drmModeAtomicCommit(display->drm_fd, req,
> test_flags, user_data);
> +             ret = drmModeAtomicCommit(display->drm_fd, req,
> flags, user_data);
> +
> +             if (test_ret)
> +                     igt_assert_eq(test_ret, ret);
> +             else
> +                     igt_assert(ret != -EINVAL);
> +     } else
> +             ret = drmModeAtomicCommit(display->drm_fd, req,
> flags, user_data);
> +
>       drmModeAtomicFree(req);
>       return ret;
>  
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 81be77f5a16f..8ac7eb074fe7 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -335,7 +335,7 @@ struct igt_display {
>       igt_output_t *outputs;
>       igt_pipe_t *pipes;
>       bool has_cursor_plane;
> -     bool is_atomic;
> +     bool is_atomic, force_test_atomic;
>  };
>  
>  void igt_display_init(igt_display_t *display, int drm_fd);
> 
-- 
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to