From 13448fd3aaa75dec15fed8a5d9eb798a0bed533f Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Fri, 23 Jan 2026 11:47:26 -0500 Subject: [PATCH] pan/desc: Pass image views directly to attachment helpers Now that we're doing a merge to fill out the various enable bits, we don't actually need the pan_fb_info in the attachment helpers. Reviewed-by: Lars-Ivar Hesselberg Simonsen Acked-by: Boris Brezillon Acked-by: Eric R. Smith Part-of: --- src/panfrost/lib/pan_desc.c | 61 ++++++++++++------------------------- src/panfrost/lib/pan_desc.h | 31 ++++++++----------- src/panfrost/lib/pan_mod.h | 6 ++-- 3 files changed, 36 insertions(+), 62 deletions(-) diff --git a/src/panfrost/lib/pan_desc.c b/src/panfrost/lib/pan_desc.c index 3e7ee10aaa7..ba9753e87d8 100644 --- a/src/panfrost/lib/pan_desc.c +++ b/src/panfrost/lib/pan_desc.c @@ -221,10 +221,9 @@ get_afbc_att_mem_props(struct pan_image_plane_ref pref, unsigned mip_level, #endif void -GENX(pan_emit_linear_s_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_linear_s_attachment)(const struct pan_image_view *s, unsigned layer_or_z_slice, void *payload) { - const struct pan_image_view *s = fb->zs.view.s; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_s_plane(s), @@ -241,13 +240,12 @@ GENX(pan_emit_linear_s_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_afbc_s_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_afbc_s_attachment)(const struct pan_image_view *s, unsigned layer_or_z_slice, void *payload) { assert(PAN_ARCH >= 9); #if PAN_ARCH >= 9 - const struct pan_image_view *s = fb->zs.view.s; const struct pan_image_plane_ref pref = pan_image_view_get_s_plane(s); uint64_t header, body_offset, hdr_row_stride; @@ -265,10 +263,9 @@ GENX(pan_emit_afbc_s_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_u_tiled_s_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_u_tiled_s_attachment)(const struct pan_image_view *s, unsigned layer_or_z_slice, void *payload) { - const struct pan_image_view *s = fb->zs.view.s; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_s_plane(s), @@ -285,10 +282,9 @@ GENX(pan_emit_u_tiled_s_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_linear_zs_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_linear_zs_attachment)(const struct pan_image_view *zs, unsigned layer_or_z_slice, void *payload) { - const struct pan_image_view *zs = fb->zs.view.zs; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_zs_plane(zs), @@ -305,10 +301,9 @@ GENX(pan_emit_linear_zs_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_u_tiled_zs_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_u_tiled_zs_attachment)(const struct pan_image_view *zs, unsigned layer_or_z_slice, void *payload) { - const struct pan_image_view *zs = fb->zs.view.zs; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_zs_plane(zs), @@ -325,10 +320,9 @@ GENX(pan_emit_u_tiled_zs_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_afbc_zs_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_afbc_zs_attachment)(const struct pan_image_view *zs, unsigned layer_or_z_slice, void *payload) { - const struct pan_image_view *zs = fb->zs.view.zs; const struct pan_image_plane_ref pref = pan_image_view_get_zs_plane(zs); uint64_t header, body_offset, hdr_row_stride; @@ -363,10 +357,9 @@ GENX(pan_emit_afbc_zs_attachment)(const struct pan_fb_info *fb, #if PAN_ARCH >= 10 void -GENX(pan_emit_interleaved_64k_s_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_interleaved_64k_s_attachment)(const struct pan_image_view *s, unsigned layer_or_z_slice, void *payload) { - const struct pan_image_view *s = fb->zs.view.s; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_s_plane(s), @@ -383,10 +376,9 @@ GENX(pan_emit_interleaved_64k_s_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_interleaved_64k_zs_attachment)(const struct pan_fb_info *fb, +GENX(pan_emit_interleaved_64k_zs_attachment)(const struct pan_image_view *zs, unsigned layer_or_z_slice, void *payload) { - const struct pan_image_view *zs = fb->zs.view.zs; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_zs_plane(zs), @@ -458,8 +450,8 @@ pan_emit_zs_crc_ext(const struct pan_fb_info *fb, unsigned layer_idx, const struct pan_mod_handler *mod_handler = pref.image->mod_handler; struct mali_zs_crc_extension_packed zs_part; - mod_handler->emit_zs_attachment( - fb, layer_idx + fb->zs.view.zs->first_layer, &zs_part); + mod_handler->emit_zs_attachment(fb->zs.view.zs, + layer_idx + fb->zs.view.zs->first_layer, &zs_part); pan_merge(&desc, &zs_part, ZS_CRC_EXTENSION); } @@ -469,8 +461,8 @@ pan_emit_zs_crc_ext(const struct pan_fb_info *fb, unsigned layer_idx, const struct pan_mod_handler *mod_handler = pref.image->mod_handler; struct mali_zs_crc_extension_packed s_part; - mod_handler->emit_s_attachment(fb, layer_idx + fb->zs.view.s->first_layer, - &s_part); + mod_handler->emit_s_attachment(fb->zs.view.s, + layer_idx + fb->zs.view.s->first_layer, &s_part); pan_merge(&desc, &s_part, ZS_CRC_EXTENSION); } @@ -655,13 +647,10 @@ get_rt_formats(enum pipe_format pfmt, uint32_t *writeback, uint32_t *internal, } void -GENX(pan_emit_afbc_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +GENX(pan_emit_afbc_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload) { - const struct pan_fb_color_attachment *rt = &fb->rts[rt_idx]; - const struct pan_image_view *iview = rt->view; const struct pan_image_plane_ref pref = pan_image_view_get_color_plane(iview); const struct pan_image *image = pref.image; uint64_t header, body_offset, hdr_row_stride; @@ -720,13 +709,10 @@ GENX(pan_emit_afbc_color_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_u_tiled_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +GENX(pan_emit_u_tiled_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload) { - const struct pan_fb_color_attachment *rt = &fb->rts[rt_idx]; - const struct pan_image_view *iview = rt->view; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_color_plane(iview), @@ -748,13 +734,10 @@ GENX(pan_emit_u_tiled_color_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_linear_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +GENX(pan_emit_linear_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload) { - const struct pan_fb_color_attachment *rt = &fb->rts[rt_idx]; - const struct pan_image_view *iview = rt->view; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_color_plane(iview), @@ -777,13 +760,10 @@ GENX(pan_emit_linear_color_attachment)(const struct pan_fb_info *fb, #if PAN_ARCH >= 10 void -GENX(pan_emit_interleaved_64k_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +GENX(pan_emit_interleaved_64k_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload) { - const struct pan_fb_color_attachment *rt = &fb->rts[rt_idx]; - const struct pan_image_view *iview = rt->view; uint64_t base, row_stride, surf_stride; get_tiled_or_linear_att_mem_props(pan_image_view_get_color_plane(iview), @@ -805,12 +785,10 @@ GENX(pan_emit_interleaved_64k_color_attachment)(const struct pan_fb_info *fb, } void -GENX(pan_emit_afrc_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, unsigned layer_or_z_slice, +GENX(pan_emit_afrc_color_attachment)(const struct pan_image_view *iview, + unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload) { - const struct pan_fb_color_attachment *rt = &fb->rts[rt_idx]; - const struct pan_image_view *iview = rt->view; const struct pan_image_plane_ref pref = pan_image_view_get_color_plane(iview); const struct pan_image *image = pref.image; struct pan_afrc_format_info finfo = @@ -984,7 +962,8 @@ pan_emit_rt(const struct pan_fb_info *fb, unsigned layer_idx, unsigned idx, assert(layer_idx < layer_count); struct mali_render_target_packed desc; - mod_handler->emit_color_attachment(fb, idx, layer_idx + rt->first_layer, + mod_handler->emit_color_attachment(fb->rts[idx].view, + layer_idx + rt->first_layer, cbuf_offset, &desc); /* Avoid mixing loads and stores on write-combined memory. */ diff --git a/src/panfrost/lib/pan_desc.h b/src/panfrost/lib/pan_desc.h index 642ef3299a1..d2e0e9fcc0a 100644 --- a/src/panfrost/lib/pan_desc.h +++ b/src/panfrost/lib/pan_desc.h @@ -295,55 +295,50 @@ void GENX(pan_emit_tls)(const struct pan_tls_info *info, int GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size); #if PAN_ARCH >= 5 -void GENX(pan_emit_linear_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +void GENX(pan_emit_linear_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload); -void GENX(pan_emit_linear_s_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_linear_s_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); -void GENX(pan_emit_linear_zs_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_linear_zs_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); -void GENX(pan_emit_u_tiled_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +void GENX(pan_emit_u_tiled_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload); -void GENX(pan_emit_u_tiled_s_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_u_tiled_s_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); -void GENX(pan_emit_u_tiled_zs_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_u_tiled_zs_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); -void GENX(pan_emit_afbc_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +void GENX(pan_emit_afbc_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload); -void GENX(pan_emit_afbc_zs_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_afbc_zs_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); -void GENX(pan_emit_afbc_s_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_afbc_s_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); #endif #if PAN_ARCH >= 10 void -GENX(pan_emit_interleaved_64k_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +GENX(pan_emit_interleaved_64k_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload); -void GENX(pan_emit_interleaved_64k_zs_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_interleaved_64k_zs_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); -void GENX(pan_emit_interleaved_64k_s_attachment)(const struct pan_fb_info *fb, +void GENX(pan_emit_interleaved_64k_s_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); -void GENX(pan_emit_afrc_color_attachment)(const struct pan_fb_info *fb, - unsigned rt_idx, +void GENX(pan_emit_afrc_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload); #endif diff --git a/src/panfrost/lib/pan_mod.h b/src/panfrost/lib/pan_mod.h index 4038a3681fa..a75be8b7a84 100644 --- a/src/panfrost/lib/pan_mod.h +++ b/src/panfrost/lib/pan_mod.h @@ -58,12 +58,12 @@ struct pan_mod_handler { unsigned mip_level, unsigned layer_or_z_slice, unsigned sample, void **payload); - void (*emit_color_attachment)(const struct pan_fb_info *fb, unsigned rt_idx, + void (*emit_color_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, unsigned cbuf_offset, void *payload); - void (*emit_zs_attachment)(const struct pan_fb_info *fb, + void (*emit_zs_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); - void (*emit_s_attachment)(const struct pan_fb_info *fb, + void (*emit_s_attachment)(const struct pan_image_view *iview, unsigned layer_or_z_slice, void *payload); };