Commit 34a21dfb authored by Paul Kocialkowski's avatar Paul Kocialkowski

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's avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
parent 6e227181
......@@ -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];
}
......@@ -181,6 +181,7 @@ uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
const char *igt_format_str(uint32_t drm_format);
bool igt_fb_supported_format(uint32_t drm_format);
bool igt_format_is_yuv(uint32_t drm_format);
int igt_format_plane_bpp(uint32_t drm_format, int plane);
#endif /* __IGT_FB_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment