mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
panfrost, panvk: fix G31 use of SHADER_MODE_EARLY_ZS_ALWAYS
PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS was introduced in
architecture version 7.2, not 7.0 as we assumed. Using it on
G31 (a 7.0 device) caused some CTS failures.
Cc: mesa-stable
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34744>
(cherry picked from commit 13b35a3c9c)
This commit is contained in:
parent
6eb10b69a4
commit
54caa53302
3 changed files with 45 additions and 11 deletions
|
|
@ -1834,7 +1834,7 @@
|
|||
"description": "panfrost, panvk: fix G31 use of SHADER_MODE_EARLY_ZS_ALWAYS",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1271,7 +1271,15 @@ 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;
|
||||
UNUSED bool always = false;
|
||||
/* On some GPUs (e.g. G31), we must use SHADER_MODE_ALWAYS rather than
|
||||
* SHADER_MODE_INTERSECT for full screen operations. Since the full
|
||||
* screen rectangle will always intersect, this won't affect
|
||||
* performance. The UNUSED tag is because some PAN_ARCH variants do not
|
||||
* need this test.
|
||||
*/
|
||||
UNUSED bool always = !fb->extent.minx && !fb->extent.miny &&
|
||||
fb->extent.maxx == (fb->width - 1) &&
|
||||
fb->extent.maxy == (fb->height - 1);
|
||||
|
||||
/* If we're dealing with a combined ZS resource and only one
|
||||
* component is cleared, we need to reload the whole surface
|
||||
|
|
@ -1297,13 +1305,22 @@ pan_preload_emit_pre_frame_dcd(struct pan_fb_preload_cache *cache,
|
|||
fb->bifrost.pre_post.modes[dcd_idx] =
|
||||
always ? MALI_PRE_POST_FRAME_SHADER_MODE_PREPASS_ALWAYS
|
||||
: MALI_PRE_POST_FRAME_SHADER_MODE_PREPASS_INTERSECT;
|
||||
#elif PAN_ARCH >= 7 && PAN_ARCH <= 12
|
||||
#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;
|
||||
/* EARLY_ZS_ALWAYS was introduced in 7.2, so we have to check the
|
||||
* GPU id to find if it's supported, not just PAN_ARCH.
|
||||
* The PAN_ARCH check is redundant but allows the compiler to optimize
|
||||
* when PAN_ARCH < 7.
|
||||
*/
|
||||
if (PAN_ARCH >= 7 && cache->gpu_id >= 0x7200)
|
||||
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] =
|
||||
|
|
|
|||
|
|
@ -492,7 +492,14 @@ cmd_emit_dcd(struct panvk_cmd_buffer *cmdbuf, struct pan_fb_info *fbinfo,
|
|||
fbinfo->zs.view.zs ? pan_image_view_get_zs_plane(fbinfo->zs.view.zs)
|
||||
: pan_image_view_get_s_plane(fbinfo->zs.view.s);
|
||||
enum pipe_format fmt = plane->layout.format;
|
||||
bool always = false;
|
||||
/* On some GPUs (e.g. G31), we must use SHADER_MODE_ALWAYS rather than
|
||||
* SHADER_MODE_INTERSECT for full screen operations. Since the full
|
||||
* screen rectangle will always intersect, this won't affect
|
||||
* performance.
|
||||
*/
|
||||
bool always = !fbinfo->extent.minx && !fbinfo->extent.miny &&
|
||||
fbinfo->extent.maxx == (fbinfo->width - 1) &&
|
||||
fbinfo->extent.maxy == (fbinfo->height - 1);
|
||||
|
||||
/* If we're dealing with a combined ZS resource and only one
|
||||
* component is cleared, we need to reload the whole surface
|
||||
|
|
@ -510,11 +517,21 @@ cmd_emit_dcd(struct panvk_cmd_buffer *cmdbuf, struct pan_fb_info *fbinfo,
|
|||
* 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.
|
||||
* HOWEVER, EARLY_ZS_ALWAYS doesn't exist on 7.0, only on
|
||||
* 7.2 and later, so check for that!
|
||||
*/
|
||||
fbinfo->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
|
||||
struct panvk_physical_device *pdev =
|
||||
to_panvk_physical_device(dev->vk.physical);
|
||||
unsigned gpu_id = pdev->kmod.props.gpu_prod_id;
|
||||
|
||||
/* the PAN_ARCH check is redundant but allows compiler optimization
|
||||
when PAN_ARCH <= 6 */
|
||||
if (PAN_ARCH > 6 && gpu_id >= 0x7200)
|
||||
fbinfo->bifrost.pre_post.modes[dcd_idx] =
|
||||
MALI_PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS;
|
||||
else
|
||||
fbinfo->bifrost.pre_post.modes[dcd_idx] = always
|
||||
? MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS
|
||||
: MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue