asahi: Handle reloads of specific cube/mipfaces

The texture descriptor we construct for reloading needs to respect the
surface's texture/layer selection. Fix exactly the same bug as
b8c31ac06d ("lima: fix glCopyTexSubImage2D").

Fixes:

    dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.2d_rgb
    dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.2d_rgba
    dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.cube_rgb
    dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.cube_rgba

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14903>
This commit is contained in:
Alyssa Rosenzweig
2022-01-18 19:01:19 -05:00
committed by Marge Bot
parent 062ca49ca7
commit 11072cfd21
+13 -5
View File
@@ -1224,24 +1224,32 @@ agx_build_reload_pipeline(struct agx_context *ctx, uint32_t code, struct pipe_su
agx_pack(texture.cpu, TEXTURE, cfg) {
struct agx_resource *rsrc = agx_resource(surf->texture);
unsigned level = surf->u.tex.level;
unsigned layer = surf->u.tex.first_layer;
const struct util_format_description *desc =
util_format_description(surf->format);
/* To reduce shader variants, we always use a non-mipmapped 2D texture.
* For reloads of arrays, cube maps, etc -- we only logically reload a
* single 2D image. This does mean we need to be careful about
* width/height and address.
*/
cfg.dimension = AGX_TEXTURE_DIMENSION_2D;
cfg.layout = agx_translate_layout(rsrc->modifier);
cfg.format = agx_pixel_format[surf->format].hw;
cfg.swizzle_r = agx_channel_from_pipe(desc->swizzle[0]);
cfg.swizzle_g = agx_channel_from_pipe(desc->swizzle[1]);
cfg.swizzle_b = agx_channel_from_pipe(desc->swizzle[2]);
cfg.swizzle_a = agx_channel_from_pipe(desc->swizzle[3]);
cfg.width = surf->width;
cfg.height = surf->height;
cfg.width = u_minify(surf->width, level);
cfg.height = u_minify(surf->height, level);
cfg.levels = 1;
cfg.srgb = (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB);
cfg.address = rsrc->bo->ptr.gpu;
cfg.unk_2 = false;
cfg.address = agx_map_texture_gpu(rsrc, level, layer);
cfg.stride = (rsrc->modifier == DRM_FORMAT_MOD_LINEAR) ?
(rsrc->slices[0].line_stride - 16) :
(rsrc->slices[level].line_stride - 16) :
AGX_RT_STRIDE_TILED;
}