mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-20 17:30:24 +01:00
anv: fix image-to-image copies of TileW images
The intermediate buffer between the 2 images is linear, its stride should be a function of the tile's logical width. Normally this should map to the values reported by ISL except for TileW where for some reason it was decided to report 128 for TileW instead of the actual 64 size (see isl_tiling_get_info() ISL_TILING_W case) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: mesa-stable Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37902>
This commit is contained in:
parent
75604ff945
commit
77fb8fb062
1 changed files with 10 additions and 6 deletions
|
|
@ -480,6 +480,9 @@ anv_CopyImageToMemory(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* This functions copies from one image to another through an intermediate
|
||||
* linear buffer.
|
||||
*/
|
||||
static void
|
||||
copy_image_to_image(struct anv_device *device,
|
||||
struct anv_image *src_image,
|
||||
|
|
@ -505,14 +508,11 @@ copy_image_to_image(struct anv_device *device,
|
|||
isl_surf_get_tile_info(src_surf, &src_tile);
|
||||
isl_surf_get_tile_info(dst_surf, &dst_tile);
|
||||
|
||||
uint32_t tile_width_B;
|
||||
uint32_t tile_width_el, tile_height_el;
|
||||
if (src_tile.phys_extent_B.w > dst_tile.phys_extent_B.w) {
|
||||
tile_width_B = src_tile.phys_extent_B.w;
|
||||
tile_width_el = src_tile.logical_extent_el.w;
|
||||
tile_height_el = src_tile.logical_extent_el.h;
|
||||
} else {
|
||||
tile_width_B = dst_tile.phys_extent_B.w;
|
||||
tile_width_el = dst_tile.logical_extent_el.w;
|
||||
tile_height_el = dst_tile.logical_extent_el.h;
|
||||
}
|
||||
|
|
@ -527,14 +527,18 @@ copy_image_to_image(struct anv_device *device,
|
|||
VkExtent3D extent_el =
|
||||
vk_extent3d_to_el(src_surf->format, region->extent);
|
||||
|
||||
uint32_t linear_stride_B;
|
||||
/* linear-to-linear case */
|
||||
if (tile_width_el == 1 && tile_height_el == 1) {
|
||||
tile_width_el = MIN2(4096 / (src_tile.format_bpb / 8),
|
||||
extent_el.width);
|
||||
tile_height_el = 4096 / (tile_width_el * (src_tile.format_bpb / 8));
|
||||
tile_width_B = tile_width_el * src_tile.format_bpb / 8;
|
||||
linear_stride_B = tile_width_el * src_tile.format_bpb / 8;
|
||||
} else {
|
||||
linear_stride_B = src_tile.logical_extent_el.w * src_tile.format_bpb / 8;
|
||||
}
|
||||
|
||||
|
||||
uint32_t layer_count =
|
||||
vk_image_subresource_layer_count(&src_image->vk, ®ion->srcSubresource);
|
||||
for (uint32_t a = 0; a < layer_count; a++) {
|
||||
|
|
@ -559,7 +563,7 @@ copy_image_to_image(struct anv_device *device,
|
|||
src_binding,
|
||||
src_anv_surf->memory_range.offset,
|
||||
tmp_map,
|
||||
tile_width_B,
|
||||
linear_stride_B,
|
||||
&src_offset, &extent,
|
||||
region->srcSubresource.mipLevel,
|
||||
region->srcSubresource.baseArrayLayer,
|
||||
|
|
@ -570,7 +574,7 @@ copy_image_to_image(struct anv_device *device,
|
|||
dst_binding,
|
||||
dst_anv_surf->memory_range.offset,
|
||||
tmp_map,
|
||||
tile_width_B,
|
||||
linear_stride_B,
|
||||
&dst_offset, &extent,
|
||||
region->dstSubresource.mipLevel,
|
||||
region->dstSubresource.baseArrayLayer,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue