pan/lib: prepare for pixel local storage support

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37110>
This commit is contained in:
Ryan Mckeever 2025-10-03 17:08:58 -07:00 committed by Marge Bot
parent dfddcae916
commit c15a43cce0
2 changed files with 13 additions and 4 deletions

View file

@ -490,6 +490,11 @@ pan_cbuf_bytes_per_pixel(const struct pan_fb_info *fb)
sum += rt_size; sum += rt_size;
} }
if (fb->pls_enabled) {
/* need at least 16 bytes per pixel for pixel local storage */
sum = MAX2(sum, 16);
}
return sum; return sum;
} }
@ -639,7 +644,7 @@ static bool pan_force_clean_write_on(const struct pan_image *img, unsigned tile_
static struct MALI_RT_CLEAR static struct MALI_RT_CLEAR
rt_clear(const struct pan_fb_color_attachment *rt) rt_clear(const struct pan_fb_color_attachment *rt)
{ {
if (!rt->clear) if (!rt || !rt->clear)
return (struct MALI_RT_CLEAR){0}; return (struct MALI_RT_CLEAR){0};
return (struct MALI_RT_CLEAR){ return (struct MALI_RT_CLEAR){
@ -927,10 +932,8 @@ pan_emit_rt(const struct pan_fb_info *fb, unsigned layer_idx, unsigned idx,
cfg.clear = rt_clear(&fb->rts[idx]); cfg.clear = rt_clear(&fb->rts[idx]);
cfg.dithering_enable = true; cfg.dithering_enable = true;
cfg.internal_format = MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8; cfg.internal_format = MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8;
cfg.internal_buffer_offset = cbuf_offset;
#if PAN_ARCH >= 7 #if PAN_ARCH >= 7
cfg.writeback_block_format = MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED; cfg.writeback_block_format = MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED;
cfg.dithering_enable = true;
#endif #endif
} }
@ -1121,7 +1124,10 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx,
* This can be used to read SYSTEM_VALUE_SAMPLE_MASK_IN from the * This can be used to read SYSTEM_VALUE_SAMPLE_MASK_IN from the
* fragment shader, even when performing single-sampled rendering. * fragment shader, even when performing single-sampled rendering.
*/ */
if (!fb->force_samples) { if (fb->pls_enabled) {
cfg.sample_count = 4;
cfg.sample_pattern = pan_sample_pattern(1);
} else if (!fb->force_samples) {
cfg.sample_count = fb->nr_samples; cfg.sample_count = fb->nr_samples;
cfg.sample_pattern = pan_sample_pattern(fb->nr_samples); cfg.sample_pattern = pan_sample_pattern(fb->nr_samples);
} else if (fb->force_samples == 1) { } else if (fb->force_samples == 1) {

View file

@ -170,6 +170,9 @@ struct pan_fb_info {
/* Only used on Valhall */ /* Only used on Valhall */
bool sprite_coord_origin; bool sprite_coord_origin;
bool first_provoking_vertex; bool first_provoking_vertex;
/* indicates whether pixel local storage is enabled */
bool pls_enabled;
}; };
static inline unsigned static inline unsigned