radeonsi: Fix plane size in si_copy_multi_plane_texture
Size was wrong and also need to scale sbox xy.
Fixes: 4f047c9583 ("radeonsi: Copy all planes with multi-plane staging textures")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25737>
This commit is contained in:
@@ -71,11 +71,10 @@ static bool si_copy_multi_plane_texture(struct pipe_context *ctx, struct pipe_re
|
||||
struct pipe_resource *src, unsigned src_level,
|
||||
const struct pipe_box *src_box)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned i, dx, dy;
|
||||
struct si_texture *src_tex = (struct si_texture *)src;
|
||||
struct si_texture *dst_tex = (struct si_texture *)dst;
|
||||
struct pipe_box sbox;
|
||||
const struct util_format_description *desc;
|
||||
|
||||
if (src_tex->multi_plane_format == PIPE_FORMAT_NONE || src_tex->plane_index != 0)
|
||||
return false;
|
||||
@@ -84,20 +83,19 @@ static bool si_copy_multi_plane_texture(struct pipe_context *ctx, struct pipe_re
|
||||
assert(dst_tex->plane_index == 0 && src_tex->num_planes == dst_tex->num_planes);
|
||||
|
||||
sbox = *src_box;
|
||||
desc = util_format_description(src_tex->multi_plane_format);
|
||||
|
||||
for (i = 0; i < src_tex->num_planes; ++i) {
|
||||
if (!src || !dst)
|
||||
break;
|
||||
si_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz, src, src_level, &sbox);
|
||||
for (i = 0; i < src_tex->num_planes && src && dst; ++i) {
|
||||
dx = util_format_get_plane_width(src_tex->multi_plane_format, i, dstx);
|
||||
dy = util_format_get_plane_height(src_tex->multi_plane_format, i, dsty);
|
||||
sbox.x = util_format_get_plane_width(src_tex->multi_plane_format, i, src_box->x);
|
||||
sbox.y = util_format_get_plane_height(src_tex->multi_plane_format, i, src_box->y);
|
||||
sbox.width = util_format_get_plane_width(src_tex->multi_plane_format, i, src_box->width);
|
||||
sbox.height = util_format_get_plane_height(src_tex->multi_plane_format, i, src_box->height);
|
||||
|
||||
si_resource_copy_region(ctx, dst, dst_level, dx, dy, dstz, src, src_level, &sbox);
|
||||
|
||||
src = src->next;
|
||||
dst = dst->next;
|
||||
if (i == 0) {
|
||||
dstx /= desc->block.width;
|
||||
dsty /= desc->block.height;
|
||||
sbox.width /= desc->block.width;
|
||||
sbox.height /= desc->block.height;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user