[igt-dev] [PATCH i-g-t 12/25] lib/igt_fb: Add fb_num_planes()
Paulo Zanoni
paulo.r.zanoni at intel.com
Fri Sep 21 22:05:52 UTC 2018
Em Qui, 2018-07-19 às 18:04 +0300, Ville Syrjala escreveu:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Add a helper to return the number of color planes. We'll need this
> for ccs support later.
Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> lib/igt_fb.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index df43d9c66ded..0319afa9749f 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -221,6 +221,11 @@ static unsigned fb_plane_height(struct
> format_desc_struct *format,
> return height;
> }
>
> +static int fb_num_planes(struct format_desc_struct *format)
> +{
> + return format->num_planes;
> +}
> +
> static void calc_fb_size_planar(int fd, int width, int height,
> struct format_desc_struct *format,
> uint64_t tiling, unsigned stride,
> @@ -232,7 +237,7 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
>
> *size_ret = 0;
>
> - for (plane = 0; plane < format->num_planes; plane++) {
> + for (plane = 0; plane < fb_num_planes(format); plane++) {
> unsigned plane_stride;
>
> igt_get_fb_tile_size(fd, tiling,
> fb_plane_bpp(format, plane),
> @@ -246,7 +251,7 @@ static void calc_fb_size_planar(int fd, int
> width, int height,
> if (!stride)
> stride = max_stride;
>
> - for (plane = 0; plane < format->num_planes; plane++) {
> + for (plane = 0; plane < fb_num_planes(format); plane++) {
> if (offsets)
> offsets[plane] = *size_ret;
>
> @@ -323,7 +328,7 @@ void igt_calc_fb_size(int fd, int width, int
> height, uint32_t drm_format, uint64
> struct format_desc_struct *format =
> lookup_drm_format(drm_format);
> igt_assert(format);
>
> - if (format->num_planes > 1)
> + if (fb_num_planes(format) > 1)
> calc_fb_size_planar(fd, width, height, format,
> tiling, 0, size_ret, stride_ret, NULL);
> else
> calc_fb_size_packed(fd, width, height, format,
> tiling, 0, size_ret, stride_ret);
> @@ -400,7 +405,7 @@ static int create_bo_for_fb(int fd, int width,
> int height,
> if (tiling || size || stride || igt_format_is_yuv(format-
> >drm_id)) {
> unsigned calculated_size, calculated_stride;
>
> - if (format->num_planes > 1)
> + if (fb_num_planes(format) > 1)
> calc_fb_size_planar(fd, width, height,
> format, tiling, stride,
> &calculated_size,
> &calculated_stride, offsets);
> else
> @@ -874,7 +879,7 @@ igt_create_fb_with_bo_size(int fd, int width, int
> height,
>
> handles[0] = fb->gem_handle;
> pitches[0] = fb->stride;
> - for (i = 0; i < f->num_planes; i++) {
> + for (i = 0; i < fb_num_planes(f); i++) {
> handles[i] = fb->gem_handle;
> pitches[i] = fb->stride;
> }
> @@ -890,11 +895,11 @@ igt_create_fb_with_bo_size(int fd, int width,
> int height,
> fb->drm_format = format;
> fb->fb_id = fb_id;
> fb->fd = fd;
> - fb->num_planes = f->num_planes;
> + fb->num_planes = fb_num_planes(f);
> fb->color_encoding = color_encoding;
> fb->color_range = color_range;
>
> - for (i = 0; i < f->num_planes; i++) {
> + for (i = 0; i < fb_num_planes(f); i++) {
> fb->plane_bpp[i] = fb_plane_bpp(f, i);
> fb->plane_height[i] = fb_plane_height(f, height, i);
> fb->plane_width[i] = fb_plane_width(f, width, i);
More information about the igt-dev
mailing list