[igt-dev] [PATCH i-g-t 5/6] tests/kms_color: Split invalid_lut_sizes() into gamma vs. degamma versions
Ville Syrjälä
ville.syrjala at linux.intel.com
Wed Apr 3 14:20:11 UTC 2019
On Wed, Apr 03, 2019 at 03:52:08PM +0200, Daniel Vetter wrote:
> On Tue, Apr 02, 2019 at 07:33:47PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >
> > Split the invalid-lut-sizes test into separate gamma and degamma tests.
> > This way we can report SKIP for the thing we don't have. Also make the
> > CTM invalid sizes test report a skip too.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > ---
> > tests/kms_color.c | 103 ++++++++++++++++++++++++++--------------------
> > 1 file changed, 59 insertions(+), 44 deletions(-)
> >
> > diff --git a/tests/kms_color.c b/tests/kms_color.c
> > index 554356a04f75..fd4c9a6dd812 100644
> > --- a/tests/kms_color.c
> > +++ b/tests/kms_color.c
> > @@ -1091,57 +1091,70 @@ pipe_set_property_blob(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop, v
> > }
> >
> > static void
> > -invalid_lut_sizes(data_t *data)
> > +invalid_gamma_lut_sizes(data_t *data)
> > {
> > igt_display_t *display = &data->display;
> > igt_pipe_t *pipe = &display->pipes[0];
> > - size_t degamma_lut_size = data->degamma_lut_size * sizeof(struct drm_color_lut);
> > size_t gamma_lut_size = data->gamma_lut_size * sizeof(struct drm_color_lut);
> > + struct drm_color_lut *gamma_lut;
> > +
> > + igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT));
> >
> > - struct drm_color_lut *degamma_lut = malloc(degamma_lut_size * 2);
> > - struct drm_color_lut *gamma_lut = malloc(gamma_lut_size * 2);
> > + gamma_lut = malloc(gamma_lut_size * 2);
> >
> > igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> >
> > - if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT)) {
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > - degamma_lut, 1), -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > - degamma_lut, degamma_lut_size + 1),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > - degamma_lut, degamma_lut_size - 1),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > - degamma_lut, degamma_lut_size + sizeof(struct drm_color_lut)),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT, pipe->crtc_id),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT, 4096 * 4096),
> > - -EINVAL);
> > - }
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > + gamma_lut, 1),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > + gamma_lut, gamma_lut_size + 1),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > + gamma_lut, gamma_lut_size - 1),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > + gamma_lut, gamma_lut_size + sizeof(struct drm_color_lut)),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT, pipe->crtc_id),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT, 4096 * 4096),
> > + -EINVAL);
> >
> > - if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT)) {
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > - gamma_lut, 1),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > - gamma_lut, gamma_lut_size + 1),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > - gamma_lut, gamma_lut_size - 1),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_GAMMA_LUT,
> > - gamma_lut, gamma_lut_size + sizeof(struct drm_color_lut)),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT, pipe->crtc_id),
> > - -EINVAL);
> > - igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_GAMMA_LUT, 4096 * 4096),
> > - -EINVAL);
> > - }
> > + free(gamma_lut);
> > +}
> > +
> > +static void
> > +invalid_degamma_lut_sizes(data_t *data)
> > +{
> > + igt_display_t *display = &data->display;
> > + igt_pipe_t *pipe = &display->pipes[0];
> > + size_t degamma_lut_size = data->degamma_lut_size * sizeof(struct drm_color_lut);
> > + struct drm_color_lut *degamma_lut;
> > +
> > + igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT));
> > +
> > + degamma_lut = malloc(degamma_lut_size * 2);
> > +
> > + igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> > +
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > + degamma_lut, 1), -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > + degamma_lut, degamma_lut_size + 1),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > + degamma_lut, degamma_lut_size - 1),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
> > + degamma_lut, degamma_lut_size + sizeof(struct drm_color_lut)),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT, pipe->crtc_id),
> > + -EINVAL);
> > + igt_assert_eq(pipe_set_property_blob_id(pipe, IGT_CRTC_DEGAMMA_LUT, 4096 * 4096),
> > + -EINVAL);
> >
> > free(degamma_lut);
> > - free(gamma_lut);
> > }
> >
> > static void
> > @@ -1151,8 +1164,7 @@ invalid_ctm_matrix_sizes(data_t *data)
> > igt_pipe_t *pipe = &display->pipes[0];
> > void *ptr;
> >
> > - if (!igt_pipe_obj_has_prop(pipe, IGT_CRTC_CTM))
> > - return;
> > + igt_require(igt_pipe_obj_has_prop(pipe, IGT_CRTC_CTM));
>
> Ah, you fixed that one too. I guess I should have kept reviewing before
> typing that quick patch of mine :-)
Yeah, well I probably shouldn't have hidden it in this patch. But
lazyness won out for whatever reason and I didn't split it out.
>
> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
>
> >
> > ptr = malloc(sizeof(struct drm_color_ctm) * 4);
> >
> > @@ -1195,8 +1207,11 @@ igt_main
> > igt_subtest_group
> > run_tests_for_pipe(&data, pipe);
> >
> > - igt_subtest_f("pipe-invalid-lut-sizes")
> > - invalid_lut_sizes(&data);
> > + igt_subtest_f("pipe-invalid-gamma-lut-sizes")
> > + invalid_gamma_lut_sizes(&data);
> > +
> > + igt_subtest_f("pipe-invalid-degamma-lut-sizes")
> > + invalid_degamma_lut_sizes(&data);
> >
> > igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
> > invalid_ctm_matrix_sizes(&data);
> > --
> > 2.19.2
> >
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Ville Syrjälä
Intel
More information about the igt-dev
mailing list