[igt-dev] [PATCH i-g-t 2/3] lib/igt_kms: Add igt_reduce_format()

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 30 15:38:16 UTC 2020


Quoting Ville Syrjala (2020-01-30 15:12:28)
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Add a helper to reduce a pixel format to a "base" format.
> Ie. group all formats to some idea of classes based on the
> bits per pixel + component sizes etc. ignoring any component ordering.
> Let's us skip potentially redundant tests when all we might care
> about is testing each format "class" the once.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  lib/igt_kms.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_kms.h |  1 +
>  2 files changed, 80 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index d20daaad7764..2b075c435291 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -4474,3 +4474,82 @@ void igt_parse_connector_tile_blob(drmModePropertyBlobPtr blob,
>         tile->tile_h_size = atoi(strtok(NULL, ":"));
>         tile->tile_v_size = atoi(strtok(NULL, ":"));
>  }
> +
> +uint32_t igt_reduce_format(uint32_t format)
> +{

/*
 * Any words of wisdom on how/why these are reduced to a representative
 * format for each class? Just in case a new format is introduced and we
 * want to decide if it's a new class or should be aliased to an older
 * one.
 */
> +       switch (format) {
> +       case DRM_FORMAT_RGB332:
> +       case DRM_FORMAT_BGR233:
> +               return DRM_FORMAT_RGB332;


More information about the igt-dev mailing list