summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-01-18 17:12:57 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-02-01 13:18:31 +0100
commite9277a3b6c44ae81c2e6f403e75e7612ce750c1f (patch)
treef362e0066871d62ba8223efa2d09ad23e3a7568f /lib/igt_fb.c
parentbe2f6fc1cba25372837daed6cec19107d44d3eb5 (diff)
lib/igt_fb: Pass format to igt_calc_fb_size
bpp is only sufficient to calculate dimensions for packed formats, in case of planar formats we need to pass the drm format fourcc, which will give us better information. This is required for supporting planar framebuffers. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 39a83bae..da07d1a9 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -147,7 +147,7 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
* @fd: the DRM file descriptor
* @width: width of the framebuffer in pixels
* @height: height of the framebuffer in pixels
- * @bpp: bytes per pixel of the framebuffer
+ * @format: drm fourcc pixel format code
* @tiling: tiling layout of the framebuffer (as framebuffer modifier)
* @size_ret: returned size for the framebuffer
* @stride_ret: returned stride for the framebuffer
@@ -155,10 +155,11 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
* This function returns valid stride and size values for a framebuffer with the
* specified parameters.
*/
-void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
+void igt_calc_fb_size(int fd, int width, int height, uint32_t format, uint64_t tiling,
unsigned *size_ret, unsigned *stride_ret)
{
unsigned int tile_width, tile_height, stride, size;
+ int bpp = igt_drm_format_to_bpp(format);
int byte_width = width * (bpp / 8);
igt_get_fb_tile_size(fd, tiling, bpp, &tile_width, &tile_height);
@@ -249,13 +250,12 @@ static int create_bo_for_fb(int fd, int width, int height, uint32_t format,
unsigned *size_ret, unsigned *stride_ret,
bool *is_dumb)
{
- int bpp = igt_drm_format_to_bpp(format);
int bo;
if (tiling || size || stride) {
unsigned calculated_size, calculated_stride;
- igt_calc_fb_size(fd, width, height, bpp, tiling,
+ igt_calc_fb_size(fd, width, height, format, tiling,
&calculated_size, &calculated_stride);
if (stride == 0)
stride = calculated_stride;
@@ -290,6 +290,8 @@ static int create_bo_for_fb(int fd, int width, int height, uint32_t format,
return -EINVAL;
}
} else {
+ int bpp = igt_drm_format_to_bpp(format);
+
if (is_dumb)
*is_dumb = true;