Mesa (main): iris: fix mapping compressed textures
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 30 10:26:46 UTC 2021
Module: Mesa
Branch: main
Commit: 80c2b274387ba6372c493cae036887a5cc13e15a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=80c2b274387ba6372c493cae036887a5cc13e15a
Author: Filip Gawin <filip.gawin at zoho.com>
Date: Wed Aug 18 09:57:09 2021 +0200
iris: fix mapping compressed textures
This code was originally made for crocus by Dave Airlie.
Iris is also affected, so this commit ports the fix.
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12993>
---
src/gallium/drivers/iris/iris_resource.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 3b5e95bfab7..bf8d7bc8fbb 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -2153,12 +2153,17 @@ iris_map_direct(struct iris_transfer *map)
const unsigned cpp = fmtl->bpb / 8;
unsigned x0_el, y0_el;
+ assert(box->x % fmtl->bw == 0);
+ assert(box->y % fmtl->bh == 0);
get_image_offset_el(surf, xfer->level, box->z, &x0_el, &y0_el);
+ x0_el += box->x / fmtl->bw;
+ y0_el += box->y / fmtl->bh;
+
xfer->stride = isl_surf_get_row_pitch_B(surf);
xfer->layer_stride = isl_surf_get_array_pitch(surf);
- map->ptr = ptr + (y0_el + box->y) * xfer->stride + (x0_el + box->x) * cpp;
+ map->ptr = ptr + y0_el * xfer->stride + x0_el * cpp;
}
}
More information about the mesa-commit
mailing list