Mesa (master): lavapipe: fix 3d compressed texture copies.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 3 21:46:13 UTC 2020
Module: Mesa
Branch: master
Commit: c871ac04a158401f36c0cc4f9b030509f3cab6d8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c871ac04a158401f36c0cc4f9b030509f3cab6d8
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Nov 2 09:42:59 2020 +1000
lavapipe: fix 3d compressed texture copies.
The img stride was being calculated incorrectly.
Fixes crashes in:
dEQP-VK.api.copy_and_blit.core.image_to_image.all_formats.color.3d.bc1_rgb_srgb_block.bc1_rgb_srgb_block.general_general
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>
---
src/gallium/frontends/lavapipe/lvp_execute.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index 30fe031c06b..3441df6c71a 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -1566,9 +1566,10 @@ static void handle_copy_image_to_buffer(struct lvp_cmd_buffer_entry *cmd,
if (buffer_image_height == 0)
buffer_image_height = copycmd->regions[i].imageExtent.height;
+ unsigned img_stride = util_format_get_2d_size(dst_format, buffer_row_len, buffer_image_height);
if (src_format != dst_format) {
copy_depth_box(dst_data, dst_format,
- buffer_row_len, buffer_row_len * buffer_image_height,
+ buffer_row_len, img_stride,
0, 0, 0,
copycmd->regions[i].imageExtent.width,
copycmd->regions[i].imageExtent.height,
@@ -1576,7 +1577,7 @@ static void handle_copy_image_to_buffer(struct lvp_cmd_buffer_entry *cmd,
src_data, src_format, src_t->stride, src_t->layer_stride, 0, 0, 0);
} else {
util_copy_box((ubyte *)dst_data, src_format,
- buffer_row_len, buffer_row_len * buffer_image_height,
+ buffer_row_len, img_stride,
0, 0, 0,
copycmd->regions[i].imageExtent.width,
copycmd->regions[i].imageExtent.height,
@@ -1646,6 +1647,7 @@ static void handle_copy_buffer_to_image(struct lvp_cmd_buffer_entry *cmd,
if (buffer_image_height == 0)
buffer_image_height = copycmd->regions[i].imageExtent.height;
+ unsigned img_stride = util_format_get_2d_size(src_format, buffer_row_len, buffer_image_height);
if (src_format != dst_format) {
copy_depth_box(dst_data, dst_format,
dst_t->stride, dst_t->layer_stride,
@@ -1654,7 +1656,7 @@ static void handle_copy_buffer_to_image(struct lvp_cmd_buffer_entry *cmd,
copycmd->regions[i].imageExtent.height,
box.depth,
src_data, src_format,
- buffer_row_len, buffer_row_len * buffer_image_height, 0, 0, 0);
+ buffer_row_len, img_stride, 0, 0, 0);
} else {
util_copy_box(dst_data, dst_format,
dst_t->stride, dst_t->layer_stride,
@@ -1663,7 +1665,7 @@ static void handle_copy_buffer_to_image(struct lvp_cmd_buffer_entry *cmd,
copycmd->regions[i].imageExtent.height,
box.depth,
src_data,
- buffer_row_len, buffer_row_len * buffer_image_height, 0, 0, 0);
+ buffer_row_len, img_stride, 0, 0, 0);
}
state->pctx->transfer_unmap(state->pctx, src_t);
state->pctx->transfer_unmap(state->pctx, dst_t);
More information about the mesa-commit
mailing list