panfrost: Add v13 support to the Gallium driver

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34032>
This commit is contained in:
Mary Guillemard
2025-03-12 14:10:42 +01:00
parent 1f1c36094b
commit 1eef84aaab
7 changed files with 36 additions and 9 deletions

View File

@@ -41,7 +41,7 @@ compile_args_panfrost = [
'-Wno-pointer-arith'
]
panfrost_versions = ['4', '5', '6', '7', '9', '10', '12']
panfrost_versions = ['4', '5', '6', '7', '9', '10', '12', '13']
libpanfrost_versions = []
foreach ver : panfrost_versions
@@ -53,7 +53,7 @@ foreach ver : panfrost_versions
]
if ver in ['4', '5', '6', '7', '9']
files_panfrost_vx += ['pan_jm.c']
elif ver in ['10', '12']
elif ver in ['10', '12', '13']
files_panfrost_vx += ['pan_csf.c']
endif
libpanfrost_versions += static_library(

View File

@@ -64,7 +64,7 @@
* functions. */
#if PAN_ARCH <= 9
#define JOBX(__suffix) GENX(jm_##__suffix)
#elif PAN_ARCH <= 12
#elif PAN_ARCH <= 13
#define JOBX(__suffix) GENX(csf_##__suffix)
#else
#error "Unsupported arch"

View File

@@ -157,6 +157,7 @@ panfrost_overdraw_alpha(const struct panfrost_context *ctx, bool zero)
}
#endif
#if PAN_ARCH < 13
static inline void
panfrost_emit_primitive_size(struct panfrost_context *ctx, bool points,
uint64_t size_array,
@@ -172,6 +173,7 @@ panfrost_emit_primitive_size(struct panfrost_context *ctx, bool points,
}
}
}
#endif
static inline uint8_t
pan_draw_mode(enum mesa_prim mode)

View File

@@ -1172,8 +1172,10 @@ csf_emit_draw_state(struct panfrost_batch *batch,
struct mali_primitive_flags_packed primitive_flags;
pan_pack(&primitive_flags, PRIMITIVE_FLAGS, cfg) {
#if PAN_ARCH < 13
if (panfrost_writes_point_size(ctx))
cfg.point_size_array_format = MALI_POINT_SIZE_ARRAY_FORMAT_FP16;
#endif
cfg.allow_rotating_primitives = allow_rotating_primitives(fs, info);
@@ -1302,12 +1304,17 @@ csf_emit_draw_state(struct panfrost_batch *batch,
cs_move32_to(b, cs_sr_reg32(b, IDVS, DCD0), dcd_flags0.opaque[0]);
cs_move32_to(b, cs_sr_reg32(b, IDVS, DCD1), dcd_flags1.opaque[0]);
#if PAN_ARCH >= 13
cs_move32_to(b, cs_reg32(b, MALI_IDVS_SR_LINE_WIDTH),
fui(ctx->rasterizer->base.line_width));
#else
struct mali_primitive_size_packed primsize;
panfrost_emit_primitive_size(ctx, info->mode == MESA_PRIM_POINTS, 0,
&primsize);
struct mali_primitive_size_packed *primsize_ptr = &primsize;
cs_move64_to(b, cs_sr_reg64(b, IDVS, PRIMITIVE_SIZE),
*((uint64_t *)primsize_ptr));
#endif
struct mali_primitive_flags_packed flags_override;
/* Pack with nodefaults so only explicitly set override fields affect the

View File

@@ -1271,7 +1271,7 @@ pan_preload_emit_pre_frame_dcd(struct pan_fb_preload_cache *cache,
enum pipe_format fmt = fb->zs.view.zs
? fb->zs.view.zs->planes[0]->layout.format
: fb->zs.view.s->planes[0]->layout.format;
bool always = false;
UNUSED bool always = false;
/* If we're dealing with a combined ZS resource and only one
* component is cleared, we need to reload the whole surface
@@ -1282,19 +1282,29 @@ pan_preload_emit_pre_frame_dcd(struct pan_fb_preload_cache *cache,
fb->zs.clear.z != fb->zs.clear.s)
always = true;
/* We could use INTERSECT on Bifrost v7 too, but
/* We could use INTERSECT on Bifrost v7-v12 too, but
* EARLY_ZS_ALWAYS has the advantage of reloading the ZS tile
* buffer one or more tiles ahead, making ZS data immediately
* available for any ZS tests taking place in other shaders.
* Thing's haven't been benchmarked to determine what's
* preferable (saving bandwidth vs having ZS preloaded
* earlier), so let's leave it like that for now.
*
* On v13+, we don't have EARLY_ZS_ALWAYS instead we use
* PREPASS_ALWAYS / PREPASS_INTERSECT.
*/
#if PAN_ARCH >= 13
fb->bifrost.pre_post.modes[dcd_idx] =
PAN_ARCH > 6
? MALI_PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS
: always ? MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS
: MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
always ? MALI_PRE_POST_FRAME_SHADER_MODE_PREPASS_ALWAYS
: MALI_PRE_POST_FRAME_SHADER_MODE_PREPASS_INTERSECT;
#elif PAN_ARCH >= 7 && PAN_ARCH <= 12
fb->bifrost.pre_post.modes[dcd_idx] =
MALI_PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS;
#else
fb->bifrost.pre_post.modes[dcd_idx] =
always ? MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS
: MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
#endif
} else {
fb->bifrost.pre_post.modes[dcd_idx] =
always_write ? MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS

View File

@@ -498,6 +498,10 @@ panfrost_init_screen_caps(struct panfrost_screen *screen)
/* Removed in v9 (Valhall) */
caps->depth_clip_disable_separate = dev->arch < 9;
/* On v13+, point size cannot be set in the command stream anymore. */
caps->point_size_fixed = dev->arch >= 13 ? PIPE_POINT_SIZE_LOWER_USER_ONLY
: PIPE_POINT_SIZE_LOWER_NEVER;
caps->max_render_targets =
caps->fbfetch = has_mrt ? 8 : 1;
caps->fbfetch_coherent = true;
@@ -942,6 +946,9 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config,
case 12:
panfrost_cmdstream_screen_init_v12(screen);
break;
case 13:
panfrost_cmdstream_screen_init_v13(screen);
break;
default:
debug_printf("panfrost: Unhandled architecture major %d", dev->arch);
panfrost_destroy_screen(&(screen->base));

View File

@@ -161,6 +161,7 @@ void panfrost_cmdstream_screen_init_v7(struct panfrost_screen *screen);
void panfrost_cmdstream_screen_init_v9(struct panfrost_screen *screen);
void panfrost_cmdstream_screen_init_v10(struct panfrost_screen *screen);
void panfrost_cmdstream_screen_init_v12(struct panfrost_screen *screen);
void panfrost_cmdstream_screen_init_v13(struct panfrost_screen *screen);
#define perf_debug(ctx, ...) \
do { \