From 779981a3f1f22dd9676298432ffdb557deccbd5a Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 9 Apr 2026 14:01:49 +0200 Subject: [PATCH] panfrost: use perf-trilinear when doing anisotropic sampling This should be faster, and matches what the DDK does. Reviewed-by: Marc Alcala Prieto Reviewed-by: Eric R. Smith Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 6e2a36c5b27..58b044c5295 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -146,13 +146,14 @@ panfrost_sampler_compare_func(const struct pipe_sampler_state *cso) } static enum mali_mipmap_mode -pan_pipe_to_mipmode(enum pipe_tex_mipfilter f) +pan_pipe_to_mipmode(enum pipe_tex_mipfilter f, bool use_perf_trilinear) { switch (f) { case PIPE_TEX_MIPFILTER_NEAREST: return MALI_MIPMAP_MODE_NEAREST; case PIPE_TEX_MIPFILTER_LINEAR: - return MALI_MIPMAP_MODE_TRILINEAR; + return use_perf_trilinear ? MALI_MIPMAP_MODE_PERFORMANCE_TRILINEAR : + MALI_MIPMAP_MODE_TRILINEAR; #if PAN_ARCH >= 6 case PIPE_TEX_MIPFILTER_NONE: return MALI_MIPMAP_MODE_NONE; @@ -220,7 +221,9 @@ panfrost_create_sampler_state(struct pipe_context *pctx, cfg.wrap_mode_t = translate_tex_wrap(cso->wrap_t, using_nearest); cfg.wrap_mode_r = translate_tex_wrap(cso->wrap_r, using_nearest); - cfg.mipmap_mode = pan_pipe_to_mipmode(cso->min_mip_filter); + cfg.mipmap_mode = pan_pipe_to_mipmode(cso->min_mip_filter, + cso->max_anisotropy > 1); + cfg.compare_function = panfrost_sampler_compare_func(cso); cfg.seamless_cube_map = cso->seamless_cube_map;