[igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Add support for Y410/Y416 formats, v5.
Ville Syrjälä
ville.syrjala at linux.intel.com
Thu Mar 28 19:16:19 UTC 2019
On Thu, Mar 28, 2019 at 07:08:44PM +0100, Maarten Lankhorst wrote:
> Y410 is packed with compressed a channel and only 32 bpp, like
> 10 bits RGB formats. Y416 is a packed 16 bits per component format.
>
> Changes since v1:
> - Rebase on top of upstream YUV changes.
> Changes since v2:
> - Discard alpha channel, not used upstream.
> Changes since v3:
> - Handle the XVYU formats and Y41x formats correctly.
> Changes since v4:
> - Fix YUV conversion routines. (Ville)
> - Use memset64 to clear initial fb. (Ville)
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
> lib/igt_color_encoding.c | 6 +
> lib/igt_fb.c | 257 +++++++++++++++++++++++++++++++++++----
> 2 files changed, 238 insertions(+), 25 deletions(-)
>
> diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
> index 9f9dc1439ee4..7de6d5abd690 100644
> --- a/lib/igt_color_encoding.c
> +++ b/lib/igt_color_encoding.c
> @@ -154,6 +154,12 @@ static const struct color_encoding_format {
> { DRM_FORMAT_Y210, 65472.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
> { DRM_FORMAT_Y212, 65520.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
> { DRM_FORMAT_Y216, 65535.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
> + { DRM_FORMAT_Y410, 1023.f, 64.f, 940.f, 64.f, 512.f, 960.f },
> + { DRM_FORMAT_Y412, 65520.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
> + { DRM_FORMAT_Y416, 65535.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
> + { DRM_FORMAT_XVYU2101010, 1023.f, 64.f, 940.f, 64.f, 512.f, 960.f },
> + { DRM_FORMAT_XVYU12_16161616, 65520.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
> + { DRM_FORMAT_XVYU16161616, 65535.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
> };
>
> static const struct color_encoding_format *lookup_fourcc(uint32_t fourcc)
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index c5b1e169a5ff..600d9c246e30 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -221,6 +221,36 @@ static const struct format_desc_struct {
> .num_planes = 3, .plane_bpp = { 8, 8, 8, },
> .hsub = 2, .vsub = 1,
> },
> + { .name = "Y410", .depth = -1, .drm_id = DRM_FORMAT_Y410,
> + .cairo_id = CAIRO_FORMAT_RGBA128F,
> + .num_planes = 1, .plane_bpp = { 32, },
> + .hsub = 1, .vsub = 1,
> + },
> + { .name = "Y412", .depth = -1, .drm_id = DRM_FORMAT_Y412,
> + .cairo_id = CAIRO_FORMAT_RGBA128F,
> + .num_planes = 1, .plane_bpp = { 64, },
> + .hsub = 1, .vsub = 1,
> + },
> + { .name = "Y416", .depth = -1, .drm_id = DRM_FORMAT_Y416,
> + .cairo_id = CAIRO_FORMAT_RGBA128F,
> + .num_planes = 1, .plane_bpp = { 64, },
> + .hsub = 1, .vsub = 1,
> + },
> + { .name = "XV30", .depth = -1, .drm_id = DRM_FORMAT_XVYU2101010,
> + .cairo_id = CAIRO_FORMAT_RGB96F,
> + .num_planes = 1, .plane_bpp = { 32, },
> + .hsub = 1, .vsub = 1,
> + },
> + { .name = "XV36", .depth = -1, .drm_id = DRM_FORMAT_XVYU12_16161616,
> + .cairo_id = CAIRO_FORMAT_RGB96F,
> + .num_planes = 1, .plane_bpp = { 64, },
> + .hsub = 1, .vsub = 1,
> + },
> + { .name = "XV48", .depth = -1, .drm_id = DRM_FORMAT_XVYU16161616,
> + .cairo_id = CAIRO_FORMAT_RGB96F,
> + .num_planes = 1, .plane_bpp = { 64, },
> + .hsub = 1, .vsub = 1,
> + },
> { .name = "P010", .depth = -1, .drm_id = DRM_FORMAT_P010,
> .cairo_id = CAIRO_FORMAT_RGB96F,
> .num_planes = 2, .plane_bpp = { 16, 32 },
> @@ -638,6 +668,12 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
> }
> }
>
> +static void memset64(uint64_t *s, uint64_t c, size_t n)
> +{
> + for (int i = 0; i < n; i++)
> + s[i] = c;
> +}
> +
> static void clear_yuv_buffer(struct igt_fb *fb)
> {
> bool full_range = fb->color_range == IGT_COLOR_YCBCR_FULL_RANGE;
> @@ -690,6 +726,21 @@ static void clear_yuv_buffer(struct igt_fb *fb)
> fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
> break;
>
> + case DRM_FORMAT_XVYU2101010:
> + case DRM_FORMAT_Y410:
> + wmemset(ptr + fb->offsets[0],
> + full_range ? 0x20000200 : 0x20010200,
> + fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
Indentation fail.
> + break;
> +
> + case DRM_FORMAT_XVYU12_16161616:
> + case DRM_FORMAT_XVYU16161616:
> + case DRM_FORMAT_Y412:
> + case DRM_FORMAT_Y416:
> + memset64(ptr + fb->offsets[0],
> + full_range ? 0x800000008000 : 0x800010008000ULL,
Missing ULL?
Apart from that this looks good to me.
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
--
Ville Syrjälä
Intel
More information about the igt-dev
mailing list