diff --git a/src/asahi/layout/layout.h b/src/asahi/layout/layout.h index 05959557439..ea8843b571a 100644 --- a/src/asahi/layout/layout.h +++ b/src/asahi/layout/layout.h @@ -445,9 +445,6 @@ ail_can_compress(enum pipe_format format, unsigned w_px, unsigned h_px, ail_effective_height_sa(h_px, sample_count_sa) >= 16; } -/* AGX compression mode for a solid colour for the subtile */ -#define AIL_COMP_SOLID 0x3 - /* AGX compression mode for an uncompessed subtile. Frustratingly, this seems to * depend on the format. It is possible that modes are actual 8-bit structures * with multiple fields rather than plain enumerations. @@ -457,6 +454,12 @@ ail_can_compress(enum pipe_format format, unsigned w_px, unsigned h_px, #define AIL_COMP_UNCOMPRESSED_4 0x7f #define AIL_COMP_UNCOMPRESSED_8_16 0xff +/* AGX compression mode for a solid colour for the subtile. */ +#define AIL_COMP_SOLID_1 0x60 +#define AIL_COMP_SOLID_2 0x01 +#define AIL_COMP_SOLID_4 0x03 +#define AIL_COMP_SOLID_8_16 0x07 + static inline uint8_t ail_subtile_uncompressed_mode(enum pipe_format format) { @@ -472,6 +475,21 @@ ail_subtile_uncompressed_mode(enum pipe_format format) /* clang-format on */ } +static inline uint8_t +ail_subtile_solid_mode(enum pipe_format format) +{ + /* clang-format off */ + switch (util_format_get_blocksize(format)) { + case 1: return AIL_COMP_SOLID_1; + case 2: return AIL_COMP_SOLID_2; + case 4: return AIL_COMP_SOLID_4; + case 8: + case 16: return AIL_COMP_SOLID_8_16; + default: unreachable("invalid block size"); + } + /* clang-format on */ +} + /* * Compression modes are 8-bit per 8x4 subtile, but grouped into 64-bit for all * modes in a 16x16 tile. This helper replicates a subtile mode to a tile mode @@ -492,6 +510,12 @@ ail_tile_mode_uncompressed(enum pipe_format format) return ail_tile_mode_replicated(ail_subtile_uncompressed_mode(format)); } +static inline uint64_t +ail_tile_mode_solid(enum pipe_format format) +{ + return ail_tile_mode_replicated(ail_subtile_solid_mode(format)); +} + /* * For compression, compatible formats must have the same number/size/order of * channels, but may differ in data type. For example, R32_SINT is compatible