panfrost: Do not evaluate_per_sample for non-MSAA

Enabling evaluate_per_sample in non-MSAA cases might cause issues and
hangs for subsequent ZS cases.

Therefore, only enable the flag when MSAA is active.

Fixes: 26d339ef8a ("panfrost: Generate Valhall Malloc IDVS jobs")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Benjamin Lee <benjamin.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33300>
(cherry picked from commit 46256f3e39)
This commit is contained in:
Lars-Ivar Hesselberg Simonsen 2025-01-30 11:34:52 +01:00 committed by Eric Engestrom
parent cd4ffc319f
commit 8379aef572
5 changed files with 10 additions and 6 deletions

View file

@ -1204,7 +1204,7 @@
"description": "panfrost: Do not evaluate_per_sample for non-MSAA",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "26d339ef8ac7338a39aa5908d2dd38950933a474",
"notes": null

View file

@ -1196,7 +1196,8 @@ csf_emit_draw_state(struct panfrost_batch *batch,
/* Also use per-sample shading if required by the shader
*/
cfg.evaluate_per_sample |= fs->info.fs.sample_shading;
cfg.evaluate_per_sample |=
(fs->info.fs.sample_shading && rast->multisample);
/* Unlike Bifrost, alpha-to-coverage must be included in
* this identically-named flag. Confusing, isn't it?

View file

@ -593,7 +593,8 @@ jm_emit_tiler_draw(struct mali_draw_packed *out, struct panfrost_batch *batch,
/* Also use per-sample shading if required by the shader
*/
cfg.evaluate_per_sample |= fs->info.fs.sample_shading;
cfg.evaluate_per_sample |=
(fs->info.fs.sample_shading && rast->multisample);
/* Unlike Bifrost, alpha-to-coverage must be included in
* this identically-named flag. Confusing, isn't it?

View file

@ -1526,7 +1526,8 @@ prepare_dcd(struct panvk_cmd_buffer *cmdbuf)
cfg.pixel_kill_operation = earlyzs.kill;
cfg.zs_update_operation = earlyzs.update;
cfg.evaluate_per_sample = fs->info.fs.sample_shading;
cfg.evaluate_per_sample = fs->info.fs.sample_shading &&
(dyns->ms.rasterization_samples > 1);
} else {
cfg.allow_forward_pixel_to_kill = true;
cfg.allow_forward_pixel_to_be_killed = true;

View file

@ -251,6 +251,7 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf,
pan_pack(rsd, RENDERER_STATE, cfg) {
bool alpha_to_coverage = dyns->ms.alpha_to_coverage_enable;
bool msaa = dyns->ms.rasterization_samples > 1;
if (fs) {
pan_shader_prepare_rsd(fs_info, fs_code, &cfg);
@ -282,7 +283,8 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf,
cfg.properties.pixel_kill_operation = earlyzs.kill;
cfg.properties.zs_update_operation = earlyzs.update;
cfg.multisample_misc.evaluate_per_sample = fs->info.fs.sample_shading;
cfg.multisample_misc.evaluate_per_sample =
(fs->info.fs.sample_shading && msaa);
} else {
cfg.properties.depth_source = MALI_DEPTH_SOURCE_FIXED_FUNCTION;
cfg.properties.allow_forward_pixel_to_kill = true;
@ -290,7 +292,6 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf,
cfg.properties.zs_update_operation = MALI_PIXEL_KILL_FORCE_EARLY;
}
bool msaa = dyns->ms.rasterization_samples > 1;
cfg.multisample_misc.multisample_enable = msaa;
cfg.multisample_misc.sample_mask =
msaa ? dyns->ms.sample_mask : UINT16_MAX;