panvk: Support VK_EXT_legacy_dithering
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Wire up the existing Panfrost dithering infrastructure to the Vulkan
extension. The library already supports dithered formats via
pan_dithered_format_from_pipe_format(), so this plumbs the
VK_RENDERING_ENABLE_LEGACY_DITHERING_BIT_EXT flag through to the blend
descriptor emission and color attachment internal conversion paths.

Dithering is only applied to color attachments, not depth or framebuffer
preloads.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39781>
This commit is contained in:
Christian Gmeiner 2026-02-09 12:55:22 +01:00 committed by Marge Bot
parent 755cb6cb75
commit 8dc8a2eec4
5 changed files with 17 additions and 5 deletions

View file

@ -727,7 +727,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_INTEL_shader_integer_functions2 DONE (anv, hasvk, radv)
VK_EXT_map_memory_placed DONE (anv, hk, nvk, pvr, radv, tu, vn)
VK_MESA_image_alignment_control DONE (anv, nvk, radv)
VK_EXT_legacy_dithering DONE (anv, tu, vn)
VK_EXT_legacy_dithering DONE (anv, panvk, tu, vn)
VK_QCOM_fragment_density_map_offset DONE (tu)
VK_QCOM_image_processing DONE (tu)
VK_QCOM_multiview_per_view_render_areas DONE (tu)

View file

@ -19,3 +19,4 @@ VK_EXT_color_write_enable on panvk
VK_EXT_image_view_min_lod on panvk
VK_EXT_depth_clamp_control on panvk
VK_VALVE_shader_mixed_float_dot_product on RADV (Vega20, Navi14, RDNA2+)
VK_EXT_legacy_dithering on panvk

View file

@ -117,7 +117,7 @@ static void
emit_blend_desc(const struct pan_blend_state *state, uint8_t rt_idx,
const struct pan_shader_info *fs_info, uint8_t loc,
uint64_t fs_code, uint64_t blend_shader, uint16_t constant,
struct mali_blend_packed *bd)
bool dithered, struct mali_blend_packed *bd)
{
const struct pan_blend_rt_state *rt = &state->rts[rt_idx];
@ -168,7 +168,7 @@ emit_blend_desc(const struct pan_blend_state *state, uint8_t rt_idx,
*/
cfg.internal.fixed_function.num_comps = 4;
cfg.internal.fixed_function.conversion.memory_format =
GENX(pan_dithered_format_from_pipe_format)(rt->format, false);
GENX(pan_dithered_format_from_pipe_format)(rt->format, dithered);
#if PAN_ARCH >= 7
if (cfg.internal.mode == MALI_BLEND_MODE_FIXED_FUNCTION &&
@ -380,8 +380,12 @@ panvk_per_arch(blend_emit_descs)(struct panvk_cmd_buffer *cmdbuf,
struct mali_blend_packed packed[MAX_RTS];
for (uint8_t rt = 0; rt < bs.rt_count; rt++) {
bool dithered = render->flags &
VK_RENDERING_ENABLE_LEGACY_DITHERING_BIT_EXT;
emit_blend_desc(&bs, rt, fs_info, rt_loc[rt], fs_code,
blend_shaders[rt], ff_blend_constant, &packed[rt]);
blend_shaders[rt], ff_blend_constant, dithered,
&packed[rt]);
}
/* Copy into the GPU descriptor array */

View file

@ -718,9 +718,12 @@ prepare_iam_sysvals(struct panvk_cmd_buffer *cmdbuf, BITSET_WORD *dirty_sysvals)
iam[ia_idx].target = PANVK_COLOR_ATTACHMENT(i);
bool dithered = cmdbuf->state.gfx.render.flags &
VK_RENDERING_ENABLE_LEGACY_DITHERING_BIT_EXT;
pan_pack(&conv, INTERNAL_CONVERSION, cfg) {
cfg.memory_format =
GENX(pan_dithered_format_from_pipe_format)(pfmt, false);
GENX(pan_dithered_format_from_pipe_format)(pfmt, dithered);
#if PAN_ARCH < 9
cfg.register_format =
vk_format_is_uint(fmt) ? MALI_REGISTER_FILE_FORMAT_U32

View file

@ -161,6 +161,7 @@ panvk_per_arch(get_physical_device_extensions)(
.EXT_image_robustness = true,
.EXT_image_view_min_lod = true,
.EXT_index_type_uint8 = true,
.EXT_legacy_dithering = true,
.EXT_line_rasterization = true,
.EXT_load_store_op_none = true,
.EXT_non_seamless_cube_map = true,
@ -553,6 +554,9 @@ panvk_per_arch(get_physical_device_features)(
/* VK_EXT_ycbcr_image_arrays */
.ycbcrImageArrays = PAN_ARCH >= 10,
/* VK_EXT_legacy_dithering */
.legacyDithering = true,
/* VK_EXT_non_seamless_cube_map */
.nonSeamlessCubeMap = true,