From 714e9a02d1d9a4c48d9e479d4628a5710fcf4ed8 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 29 Jan 2021 14:31:18 -0500 Subject: [PATCH] panfrost: Add panfrost_sample_pattern helper We always use rotated grids to preserve current behaviour. Cc stable as it is required for the next commit. If deemed too invasive, a simpler fix could be backported. Signed-off-by: Alyssa Rosenzweig Cc: 21.0 Part-of: (cherry picked from commit b08100fb96e1568aabc9b9512b9a509c56bb5c8b) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_cmdstream.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 27cc486bcdf..c8b87c241fd 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2974,7 +2974,7 @@ "description": "panfrost: Add panfrost_sample_pattern helper", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h index a1c5aea2537..3d729065915 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.h +++ b/src/gallium/drivers/panfrost/pan_cmdstream.h @@ -104,4 +104,16 @@ panfrost_translate_compare_func(enum pipe_compare_func in) } } +static inline enum mali_sample_pattern +panfrost_sample_pattern(unsigned samples) +{ + switch (samples) { + case 1: return MALI_SAMPLE_PATTERN_SINGLE_SAMPLED; + case 4: return MALI_SAMPLE_PATTERN_ROTATED_4X_GRID; + case 8: return MALI_SAMPLE_PATTERN_D3D_8X_GRID; + case 16: return MALI_SAMPLE_PATTERN_D3D_16X_GRID; + default: unreachable("Unsupported sample count"); + } +} + #endif /* __PAN_CMDSTREAM_H__ */