[igt-dev] [PATCH i-g-t 3/3] tests/kms_plane: Test C8 pixel format

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Tue May 28 10:59:22 UTC 2019


Op 16-05-2019 om 18:59 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Now that igt_fb has rudimentary C8 support let's test it.
> We have to generate a custom palette for it of course.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  tests/kms_plane.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 43 insertions(+), 2 deletions(-)
>
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 471bcbeb8f77..6f30a95efc7a 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -389,6 +389,39 @@ static void set_legacy_lut(data_t *data, enum pipe pipe,
>  	free(lut);
>  }
>  
> +static bool set_c8_legacy_lut(data_t *data, enum pipe pipe,
> +			      uint16_t mask)
> +{
> +	igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
> +	drmModeCrtc *crtc;
> +	uint16_t *r, *g, *b;
> +	int i, lut_size;
> +
> +	crtc = drmModeGetCrtc(data->drm_fd, pipe_obj->crtc_id);
> +	lut_size = crtc->gamma_size;
> +	drmModeFreeCrtc(crtc);
> +
> +	if (lut_size != 256)
> +		return false;
> +
> +	r = malloc(sizeof(uint16_t) * 3 * lut_size);
> +	g = r + lut_size;
> +	b = g + lut_size;
> +
> +	/* igt_fb uses RGB332 for C8 */
> +	for (i = 0; i < lut_size; i++) {
> +		r[i] = (((i & 0xe0) >> 5) * 0xffff / 0x7) & mask;
> +		g[i] = (((i & 0x1c) >> 2) * 0xffff / 0x7) & mask;
> +		b[i] = (((i & 0x03) >> 0) * 0xffff / 0x3) & mask;
> +	}
> +
> +	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, pipe_obj->crtc_id,
> +					  lut_size, r, g, b), 0);
> +
> +	free(r);
> +
> +	return true;
> +}
>  
>  static void test_format_plane_color(data_t *data, enum pipe pipe,
>  				    igt_plane_t *plane,
> @@ -532,8 +565,13 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
>  		    modifier == ref_modifier)
>  			continue;
>  
> -		if (!igt_fb_supported_format(format))
> -			continue;
> +		if (format == DRM_FORMAT_C8) {
> +			if (!set_c8_legacy_lut(data, pipe, 0xfc00))
> +				continue;
> +		} else {
> +			if (!igt_fb_supported_format(format))
> +				continue;
> +		}
>  
>  		igt_info("Testing format " IGT_FORMAT_FMT " / modifier 0x%" PRIx64 " on %s.%u\n",
>  			 IGT_FORMAT_ARGS(format), modifier,
> @@ -552,6 +590,9 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
>  			}
>  		}
>  
> +		if (format == DRM_FORMAT_C8)
> +			set_legacy_lut(data, pipe, 0xfc00);

I guess this has to run on pre-gen5 as well, so we can't use our awesome atomic path for setting the prop blob.

For the series

Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>

>  		if (crc_mismatch_count)
>  			igt_warn("CRC mismatches with format " IGT_FORMAT_FMT " on %s.%u with %d/%d solid colors tested (0x%X)\n",
>  				 IGT_FORMAT_ARGS(format), kmstest_pipe_name(pipe),




More information about the igt-dev mailing list