From 51ed940bb83607586d5cf4d3d6ab738257cc05a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= Date: Thu, 13 Nov 2025 10:02:43 +0100 Subject: [PATCH] panfrost: Fix clean_pixel_write_enable forced check for AFBC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clean tiles must actually be written back for AFBC buffers (color, z/s) when either one of the effective tile size dimension is smaller than the superblock dimension. This commit fixes the current check which compares the effective tile size to the superblock size. Fixes: 762a0f41336 ("panfrost: Add the concept of render block") Signed-off-by: Loïc Molinari Reviewed-by: Boris Brezillon Part-of: (cherry picked from commit 098b69a05c70804a29f12cb1f97e62aac7412bb1) --- .pick_status.json | 2 +- src/panfrost/ci/panfrost-g925-fails.txt | 1 - src/panfrost/genxml/v10.xml | 8 ++++++-- src/panfrost/genxml/v12.xml | 8 ++++++-- src/panfrost/genxml/v13.xml | 8 ++++++-- src/panfrost/genxml/v6.xml | 4 ++++ src/panfrost/genxml/v7.xml | 4 ++++ src/panfrost/genxml/v9.xml | 8 ++++++-- src/panfrost/lib/pan_desc.c | 18 ++++++++++-------- src/panfrost/lib/pan_desc.h | 12 ++++++++++++ 10 files changed, 55 insertions(+), 18 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index fd56816da28..648c6224ade 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -204,7 +204,7 @@ "description": "panfrost: Fix clean_pixel_write_enable forced check for AFBC", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "762a0f413369ecbbeb94810b133e66963b69208b", "notes": null diff --git a/src/panfrost/ci/panfrost-g925-fails.txt b/src/panfrost/ci/panfrost-g925-fails.txt index 3566bd31d31..94645a08fba 100644 --- a/src/panfrost/ci/panfrost-g925-fails.txt +++ b/src/panfrost/ci/panfrost-g925-fails.txt @@ -3,7 +3,6 @@ dEQP-VK.wsi.wayland.swapchain.create.image_extent,Crash dEQP-VK.wsi.wayland.swapchain.simulate_oom.image_extent,Crash -angle-KHR-GLES3.framebuffer_blit.scissor_blit,Fail angle-KHR-GLES3.packed_depth_stencil.verify_read_pixels.depth24_stencil8,Fail angle-KHR-GLES3.packed_depth_stencil.verify_read_pixels.depth32f_stencil8,Fail angle-KHR-GLES31.core.shader_atomic_counters.advanced-usage-multi-stage,Fail diff --git a/src/panfrost/genxml/v10.xml b/src/panfrost/genxml/v10.xml index ffb448afdad..2303aa8f7b8 100644 --- a/src/panfrost/genxml/v10.xml +++ b/src/panfrost/genxml/v10.xml @@ -1723,7 +1723,8 @@ - + @@ -1749,7 +1750,8 @@ - + @@ -1849,6 +1851,8 @@ + diff --git a/src/panfrost/genxml/v12.xml b/src/panfrost/genxml/v12.xml index 5526f24baa0..ad4d8f9f41e 100644 --- a/src/panfrost/genxml/v12.xml +++ b/src/panfrost/genxml/v12.xml @@ -2010,7 +2010,8 @@ - + @@ -2037,7 +2038,8 @@ - + @@ -2137,6 +2139,8 @@ + diff --git a/src/panfrost/genxml/v13.xml b/src/panfrost/genxml/v13.xml index 4e7f7038556..7e94a8209f0 100644 --- a/src/panfrost/genxml/v13.xml +++ b/src/panfrost/genxml/v13.xml @@ -2316,7 +2316,8 @@ - + @@ -2343,7 +2344,8 @@ - + @@ -2443,6 +2445,8 @@ + diff --git a/src/panfrost/genxml/v6.xml b/src/panfrost/genxml/v6.xml index 69fd18ef61d..ff06bd54349 100644 --- a/src/panfrost/genxml/v6.xml +++ b/src/panfrost/genxml/v6.xml @@ -1009,6 +1009,8 @@ + @@ -1121,6 +1123,8 @@ + diff --git a/src/panfrost/genxml/v7.xml b/src/panfrost/genxml/v7.xml index 9bf1190899b..a0a8477b384 100644 --- a/src/panfrost/genxml/v7.xml +++ b/src/panfrost/genxml/v7.xml @@ -1101,6 +1101,8 @@ + @@ -1203,6 +1205,8 @@ + diff --git a/src/panfrost/genxml/v9.xml b/src/panfrost/genxml/v9.xml index f0b82108859..57ecc2a07bc 100644 --- a/src/panfrost/genxml/v9.xml +++ b/src/panfrost/genxml/v9.xml @@ -1147,7 +1147,8 @@ - + @@ -1173,7 +1174,8 @@ - + @@ -1270,6 +1272,8 @@ + diff --git a/src/panfrost/lib/pan_desc.c b/src/panfrost/lib/pan_desc.c index 7803b1e5029..9e3532849bc 100644 --- a/src/panfrost/lib/pan_desc.c +++ b/src/panfrost/lib/pan_desc.c @@ -940,9 +940,9 @@ pan_fix_frame_shader_mode(enum mali_pre_post_frame_shader_mode mode, return mode; } -/* Regardless of clean_tile_write_enable, the hardware writes clean tiles if - * the effective tile size differs from the superblock size of any enabled AFBC - * render target. Check this condition. */ +/* Clean tiles must be written back for AFBC buffers (color, z/s) when either + * one of the effective tile size dimension is smaller than the superblock + * dimension. */ static bool pan_force_clean_write_on(const struct pan_image *image, unsigned tile_size) @@ -953,13 +953,15 @@ pan_force_clean_write_on(const struct pan_image *image, unsigned tile_size) if (!drm_is_afbc(image->props.modifier)) return false; - struct pan_image_block_size renderblk_sz = - pan_afbc_renderblock_size(image->props.modifier); - - assert(renderblk_sz.width >= 16 && renderblk_sz.height >= 16); assert(tile_size <= pan_max_effective_tile_size(PAN_ARCH)); - return tile_size != renderblk_sz.width * renderblk_sz.height; + struct pan_image_block_size tileblk_sz = + pan_effective_tile_block_size(tile_size); + struct pan_image_block_size superblk_sz = + pan_afbc_superblock_size(image->props.modifier); + + return tileblk_sz.width < superblk_sz.width || + tileblk_sz.height < superblk_sz.height; } static bool diff --git a/src/panfrost/lib/pan_desc.h b/src/panfrost/lib/pan_desc.h index 5adcdb128d9..f657038125b 100644 --- a/src/panfrost/lib/pan_desc.h +++ b/src/panfrost/lib/pan_desc.h @@ -247,6 +247,18 @@ pan_sample_pattern(unsigned samples) } } +static inline struct pan_image_block_size +pan_effective_tile_block_size(unsigned tile_size) +{ + /* Tile is either a square or a rect whose width is twice the height. */ + unsigned shift_h = util_logbase2(tile_size); + unsigned shift_w = shift_h + 1; + unsigned h = 1 << (shift_h >> 1); + unsigned w = 1 << (shift_w >> 1); + + return (struct pan_image_block_size){w, h}; +} + void GENX(pan_select_tile_size)(struct pan_fb_info *fb); void GENX(pan_emit_tls)(const struct pan_tls_info *info,