summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-07-17 18:09:06 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-09-25 16:07:44 +0300
commitb0d2056c451721893cf3002a50d7e5e49c755458 (patch)
tree9d8d410c5b130083fe9300645afa93094f377591 /lib/igt_fb.c
parent74261fd915efdcb8ff4bea1d648a607931ec7c1c (diff)
lib/igt_fb: s/planar_foo/fb_plane_foo/
Rename the planar_foo() functions to fb_plane_foo(). Makes it clear they're perfectly usable with non-planar formats too. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index df966c92..7073b7de 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -190,7 +190,8 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
}
}
-static unsigned planar_width(struct format_desc_struct *format, unsigned width, int plane)
+static unsigned fb_plane_width(struct format_desc_struct *format,
+ unsigned width, int plane)
{
if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
return DIV_ROUND_UP(width, 2);
@@ -198,14 +199,16 @@ static unsigned planar_width(struct format_desc_struct *format, unsigned width,
return width;
}
-static unsigned planar_stride(struct format_desc_struct *format, unsigned width, int plane)
+static unsigned fb_plane_min_stride(struct format_desc_struct *format,
+ unsigned width, int plane)
{
unsigned cpp = format->plane_bpp[plane] / 8;
- return planar_width(format, width, plane) * cpp;
+ return fb_plane_width(format, width, plane) * cpp;
}
-static unsigned planar_height(struct format_desc_struct *format, unsigned height, int plane)
+static unsigned fb_plane_height(struct format_desc_struct *format,
+ unsigned height, int plane)
{
if (format->drm_id == DRM_FORMAT_NV12 && plane == 1)
return DIV_ROUND_UP(height, 2);
@@ -229,7 +232,7 @@ static void calc_fb_size_planar(int fd, int width, int height,
igt_get_fb_tile_size(fd, tiling, format->plane_bpp[plane], &tile_width, &tile_height);
- plane_stride = ALIGN(planar_stride(format, width, plane), tile_width);
+ plane_stride = ALIGN(fb_plane_min_stride(format, width, plane), tile_width);
if (max_stride < plane_stride)
max_stride = plane_stride;
}
@@ -243,7 +246,7 @@ static void calc_fb_size_planar(int fd, int width, int height,
igt_get_fb_tile_size(fd, tiling, format->plane_bpp[plane], &tile_width, &tile_height);
- *size_ret += stride * ALIGN(planar_height(format, height, plane), tile_height);
+ *size_ret += stride * ALIGN(fb_plane_height(format, height, plane), tile_height);
}
if (offsets)
@@ -259,7 +262,7 @@ static void calc_fb_size_packed(int fd, int width, int height,
{
unsigned int tile_width, tile_height;
uint64_t size;
- int byte_width = width * (format->plane_bpp[0] / 8);
+ unsigned int byte_width = fb_plane_min_stride(format, width, 0);
igt_get_fb_tile_size(fd, tiling, format->plane_bpp[0], &tile_width, &tile_height);
@@ -887,8 +890,8 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
for (i = 0; i < f->num_planes; i++) {
fb->plane_bpp[i] = f->plane_bpp[i];
- fb->plane_height[i] = planar_height(f, height, i);
- fb->plane_width[i] = planar_width(f, width, i);
+ fb->plane_height[i] = fb_plane_height(f, height, i);
+ fb->plane_width[i] = fb_plane_width(f, width, i);
}
return fb_id;