summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>2018-12-05 16:14:59 +0100
committerPaul Kocialkowski <paul.kocialkowski@bootlin.com>2019-02-26 09:45:54 +0100
commit34a21dfb6a02c3becd0639b30ec43ad42bb493dd (patch)
treee8c83c09cb4c07b1828279aece7aaeee823baa0c /lib/igt_fb.c
parent6e227181ab57e43f058edd76368b17d8c235aeb0 (diff)
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 <paul.kocialkowski@bootlin.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c16
1 files changed, 16 insertions, 0 deletions
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];
+}