lima: make fp16 render-targets opt-in with driconf

Lima can't do *both* FP16 *and* 4x MSAA at the same time. And because
GLES2 requires MAX_SAMPLES to be valid for *all* supported formats,
this means we can't support MSAA at all unless we disable support for
the FP16 formats when used as render-targets.

To allow applications that needs FP16 render-targets to still support
it, we introduce a driconf that makes the opposite trade; support FP16,
but not 4x MSAA. Unfortunately, we can't support both, and still be
following the spec.

Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35207>
This commit is contained in:
Erik Faye-Lund 2025-05-28 15:23:48 +02:00 committed by Marge Bot
parent 939d3a96fb
commit 1617778c38
5 changed files with 23 additions and 4 deletions

View file

@ -57,6 +57,14 @@ These are some display drivers that have been tested with Lima:
- Tiny DRM: ``tinydrm``
- Xilinx ZynqMP: ``zynqmp-dpsub``
DRIconf variables
-----------------
``lima_allow_fp16_rts``
Expose support for FP16 render-targets. This has the side-effect of
dropping support for 4xMSAA, which unfortunately can't be supported
at the same time due to API and hardware restrictions.
Environment variables
---------------------

View file

@ -44,7 +44,6 @@ dEQP-GLES2.functional.texture.mipmap.cube.projected.linear_nearest,Fail
wayland-dEQP-EGL.functional.create_context.no_config,Fail
wayland-dEQP-EGL.functional.image.modify.renderbuffer_depth16_renderbuffer_clear_depth,Fail
wayland-dEQP-EGL.functional.wide_color.window_fp16_default_colorspace,Fail
wayland-dEQP-EGL.functional.wide_color.window_8888_colorspace_srgb,Fail
wayland-dEQP-EGL.functional.wide_color.window_888_colorspace_srgb,Fail

View file

@ -1 +1,4 @@
/* lima specific driconf options */
DRI_CONF_SECTION_MISCELLANEOUS
DRI_CONF_OPT_B(lima_allow_fp16_rts, false, "Allow using FP16 render-targets")
DRI_CONF_SECTION_END

View file

@ -246,9 +246,14 @@ lima_screen_is_format_supported(struct pipe_screen *pscreen,
if (!lima_format_pixel_supported(format))
return false;
/* multisample unsupported with half float target */
if (sample_count > 1 && util_format_is_float(format))
return false;
if (util_format_is_float(format)) {
if (!lima_screen(pscreen)->allow_fp16_rts)
return false;
/* multisample unsupported with half float target */
if (sample_count > 1)
return false;
}
}
if (usage & PIPE_BIND_DEPTH_STENCIL) {
@ -589,6 +594,9 @@ lima_screen_create(int fd, const struct pipe_screen_config *config,
driParseConfigFiles(config->options, config->options_info, 0,
"lima", NULL, NULL, NULL, 0, NULL, 0);
screen->allow_fp16_rts = driQueryOptionb(config->options,
"lima_allow_fp16_rts");
if (!lima_screen_query_info(screen))
goto err_out0;

View file

@ -95,6 +95,7 @@ struct lima_screen {
#define pp_buffer_size 0x1000
bool has_growable_heap_buffer;
bool allow_fp16_rts;
struct disk_cache *disk_cache;
};