From 34a21dfb6a02c3becd0639b30ec43ad42bb493dd Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Wed, 5 Dec 2018 16:14:59 +0100 Subject: lib/igt_fb: Add a helper to retreive the plane bpp for a given format The format bpp for a given plane is stored in the static format_desc structure and is not accessible to tests, which is inconvenient to get the minimum stride for a format when testing various strides. Add a simple helper to expose the information. Signed-off-by: Paul Kocialkowski Reviewed-by: Lyude Paul Reviewed-by: Maxime Ripard --- lib/igt_fb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/igt_fb.c') diff --git a/lib/igt_fb.c b/lib/igt_fb.c index f1989249..48f7921e 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -2727,3 +2727,19 @@ bool igt_format_is_yuv(uint32_t drm_format) return false; } } + +/** + * igt_format_plane_bpp: + * @drm_format: drm fourcc + * @plane: format plane index + * + * This functions returns the number of bits per pixel for the given @plane + * index of the @drm_format. + */ +int igt_format_plane_bpp(uint32_t drm_format, int plane) +{ + const struct format_desc_struct *format = + lookup_drm_format(drm_format); + + return format->plane_bpp[plane]; +} -- cgit v1.2.3