From: Matt Roper <matthew.d.roper@intel.com>
To: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 6/6] test/kms_pipe_color: add test to verify legacy ioctl resets GAMMA_LUT
Date: Thu, 10 Mar 2016 15:56:39 -0800 [thread overview]
Message-ID: <20160310235639.GA8050@intel.com> (raw)
In-Reply-To: <1457614025-22910-7-git-send-email-lionel.g.landwerlin@intel.com>
On Thu, Mar 10, 2016 at 12:47:05PM +0000, Lionel Landwerlin wrote:
> The GAMMA_LUT property must be updated when the legacy ioctl is
> triggered to ensure the new property does not impact older userspace
> code.
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> ---
> tests/kms_pipe_color.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 101 insertions(+)
>
> diff --git a/tests/kms_pipe_color.c b/tests/kms_pipe_color.c
> index 0241cf2..d17bf7f 100644
> --- a/tests/kms_pipe_color.c
> +++ b/tests/kms_pipe_color.c
> @@ -516,6 +516,104 @@ static void test_pipe_legacy_gamma(data_t *data,
> free(blue_lut);
> }
>
> +static drmModePropertyBlobPtr
> +get_gamma_lut_blob(data_t *data, igt_pipe_t *pipe)
> +{
> + uint64_t prop_value;
> + drmModePropertyPtr prop;
> + drmModePropertyBlobPtr blob;
> +
> + igt_assert(igt_pipe_get_property(pipe, "GAMMA_LUT",
> + NULL, &prop_value, &prop));
> + igt_assert(prop->flags & DRM_MODE_PROP_BLOB);
> +
> + blob = drmModeGetPropertyBlob(data->drm_fd, prop_value);
> +
> + drmModeFreeProperty(prop);
> +
> + return blob;
> +}
> +
> +/*
> + * Verify that setting the legacy gamma LUT resets the gamma LUT set
> + * through the GAMMA_LUT property.
> + */
> +static void test_pipe_legacy_gamma_reset(data_t *data,
> + igt_plane_t *primary)
> +{
> + drmModeCrtc *kms_crtc;
> + double *gamma_zero;
> + uint32_t i, legacy_lut_size;
> + uint16_t *red_lut, *green_lut, *blue_lut;
> + struct _drm_color_lut *lut;
> + drmModePropertyBlobPtr blob;
> + igt_output_t *output;
> +
> + gamma_zero = malloc(sizeof(double) * data->gamma_lut_size);
> + for (i = 0; i < data->gamma_lut_size; i++)
> + gamma_zero[i] = 0.0;
> +
> + for_each_connected_output(&data->display, output) {
> + igt_output_set_pipe(output, primary->pipe->pipe);
> +
> + /* Set a gamma LUT using the property and verify the
> + * content of the property. */
> + set_gamma(data, primary->pipe, gamma_zero);
> + igt_display_commit(&data->display);
> +
> + blob = get_gamma_lut_blob(data, primary->pipe);
> + igt_assert(blob &&
> + blob->length == (sizeof(struct _drm_color_lut) *
> + data->gamma_lut_size));
> +
> + lut = (struct _drm_color_lut *) blob->data;
> + for (i = 0; i < data->gamma_lut_size; i++)
> + igt_assert(lut[i].red == 0 &&
> + lut[i].green == 0 &&
> + lut[i].blue == 0);
> +
> + drmModeFreePropertyBlob(blob);
> +
> + /* Set a gamma LUT using the legacy ioctl and verify
> + * the content of the GAMMA_LUT property is
> + * changed. */
> + kms_crtc = drmModeGetCrtc(data->drm_fd, primary->pipe->crtc_id);
> + legacy_lut_size = kms_crtc->gamma_size;
> + drmModeFreeCrtc(kms_crtc);
> +
> + red_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> + green_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> + blue_lut = malloc(sizeof(uint16_t) * legacy_lut_size);
> +
> + for (i = 0; i < legacy_lut_size; i++)
> + red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
> +
> + igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd,
> + primary->pipe->crtc_id,
> + legacy_lut_size,
> + red_lut, green_lut, blue_lut),
> + 0);
> + igt_display_commit(&data->display);
> +
> + blob = get_gamma_lut_blob(data, primary->pipe);
> + igt_assert(blob &&
> + blob->length == (sizeof(struct _drm_color_lut) *
> + legacy_lut_size));
> +
> + lut = (struct _drm_color_lut *) blob->data;
> + for (i = 0; i < legacy_lut_size; i++)
> + igt_assert(lut[i].red == 0xffff &&
> + lut[i].green == 0xffff &&
> + lut[i].blue == 0xffff);
> +
> + drmModeFreePropertyBlob(blob);
I think it might also be worth grabbing the degamma and CTM properties
here and making sure they've been turned off by invoking the legacy
gamma.
Aside from that, this looks good (and the other patches looked good when
I reviewed them before), so with that final check added you can consider
the test series
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> +
> + igt_output_set_pipe(output, PIPE_ANY);
> + }
> +
> + free(gamma_zero);
> +}
> +
> /*
> * Draw 3 rectangles using before colors with the ctm matrix apply and verify
> * the CRC is equal to using after colors with an identify ctm matrix.
> @@ -894,6 +992,9 @@ run_tests_for_pipe(data_t *data, enum pipe p)
> igt_subtest_f("legacy-gamma-pipe%d", p)
> test_pipe_legacy_gamma(data, primary);
>
> + igt_subtest_f("legacy-gamma-reset-pipe%d", p)
> + test_pipe_legacy_gamma_reset(data, primary);
> +
> igt_fixture {
> for_each_connected_output(&data->display, output)
> output_set_property_enum(output, "Broadcast RGB", "Full");
> --
> 2.7.0
>
--
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-03-10 23:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 12:46 [PATCH i-g-t 0/6] New pipe level color management tests Lionel Landwerlin
2016-03-10 12:47 ` [PATCH i-g-t 1/6] lib: kms: add crtc_id to igt_pipe_t Lionel Landwerlin
2016-03-10 12:47 ` [PATCH i-g-t 2/6] lib: kms: add helpers for color management properties on pipes Lionel Landwerlin
2016-03-10 12:47 ` [PATCH i-g-t 3/6] lib: fb: add igt_paint_color_gradient_range Lionel Landwerlin
2016-03-10 12:47 ` [PATCH i-g-t 4/6] lib: add crc comparison function without an assert Lionel Landwerlin
2016-03-10 12:47 ` [PATCH i-g-t 5/6] tests/kms_color: New test for pipe level color management Lionel Landwerlin
2016-03-10 12:47 ` [PATCH i-g-t 6/6] test/kms_pipe_color: add test to verify legacy ioctl resets GAMMA_LUT Lionel Landwerlin
2016-03-10 23:56 ` Matt Roper [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-03-11 12:32 [PATCH i-g-t 0/6] New pipe level color management tests Lionel Landwerlin
2016-03-11 12:32 ` [PATCH i-g-t 6/6] test/kms_pipe_color: add test to verify legacy ioctl resets GAMMA_LUT Lionel Landwerlin
2016-03-18 17:32 [PATCH i-g-t 0/6] New pipe level color management tests Lionel Landwerlin
2016-03-18 17:33 ` [PATCH i-g-t 6/6] test/kms_pipe_color: add test to verify legacy ioctl resets GAMMA_LUT Lionel Landwerlin
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=20160310235639.GA8050@intel.com \
--to=matthew.d.roper@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=lionel.g.landwerlin@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