[PATCH i-g-t 23/37] lib/igt_fb: Fix planar block copy
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Tue Aug 27 16:55:45 UTC 2024
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
On 3.7.2024 2.28, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> The block copy code tries to handle planar formats by blitting
> each color plane separately. But it incorrectly picks some of
> the parameters (size, bpp, etc.) from the first color plane
> instead of the one it's actually copying. Pick the parameters
> from the correct color plane.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> lib/igt_fb.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index c0b157ee44fa..64be4bffdea8 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -2802,7 +2802,8 @@ static struct blt_copy_object *allocate_and_initialize_blt(const struct igt_fb *
> igt_fb_is_ccs_modifier(fb->modifier) ? COMPRESSION_ENABLED : COMPRESSION_DISABLED,
> igt_fb_is_gen12_mc_ccs_modifier(fb->modifier) ? COMPRESSION_TYPE_MEDIA : COMPRESSION_TYPE_3D);
>
> - blt_set_geom(blt, stride, 0, 0, fb->width, fb->plane_height[plane], 0, 0);
> + blt_set_geom(blt, stride, 0, 0,
> + fb->plane_width[plane], fb->plane_height[plane], 0, 0);
> blt->plane_offset = fb->offsets[plane];
>
> return blt;
> @@ -2848,9 +2849,10 @@ static struct blt_copy_object *blt_fb_init(const struct igt_fb *fb,
> return blt;
> }
>
> -static enum blt_color_depth blt_get_bpp(const struct igt_fb *fb)
> +static enum blt_color_depth blt_get_bpp(const struct igt_fb *fb,
> + int color_plane)
> {
> - switch (fb->plane_bpp[0]) {
> + switch (fb->plane_bpp[color_plane]) {
> case 8:
> return CD_8bit;
> case 16:
> @@ -2995,19 +2997,19 @@ static void do_block_copy(const struct igt_fb *src_fb,
> igt_assert(src && dst);
>
> blt_copy_init(src_fb->fd, &blt);
> - blt.color_depth = blt_get_bpp(src_fb);
> + blt.color_depth = blt_get_bpp(src_fb, i);
> blt_set_copy_object(&blt.src, src);
> blt_set_copy_object(&blt.dst, dst);
>
> if (blt_uses_extended_block_copy(src_fb->fd)) {
> blt_set_object_ext(&ext.src,
> blt_compression_format(&blt, src_fb),
> - src_fb->width, src_fb->height,
> + src_fb->plane_width[i], src_fb->plane_height[i],
> SURFACE_TYPE_2D);
>
> blt_set_object_ext(&ext.dst,
> blt_compression_format(&blt, dst_fb),
> - dst_fb->width, dst_fb->height,
> + dst_fb->plane_width[i], dst_fb->plane_height[i],
> SURFACE_TYPE_2D);
> pext = &ext;
> }
More information about the igt-dev
mailing list