Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/asahi/lib/agx_bg_eot.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ agx_compile_background_shader(const struct agx_device *dev,
continue;
}

if (agx_chip_g17_m5(dev->chip) && key->op[rt] == AGX_BG_CLEAR &&
if (agx_chip_native_or_m5(dev->chip) && key->op[rt] == AGX_BG_CLEAR &&
(key->packed_clear_mask & BITFIELD_BIT(rt)) &&
agx_m5_packed_clear_rt_ok(&key->tib, rt)) {
enum pipe_format fmt = key->tib.logical_format[rt];
Expand All @@ -487,7 +487,7 @@ agx_compile_background_shader(const struct agx_device *dev,
continue;
}

if (agx_chip_g17_m5(dev->chip) && key->op[rt] == AGX_BG_LOAD &&
if (agx_chip_native_or_m5(dev->chip) && key->op[rt] == AGX_BG_LOAD &&
(key->raw32_load_mask & BITFIELD_BIT(rt)) && !msaa &&
!key->tib.spilled[rt] && !key->preserve_resolve_outside &&
(agx_tilebuffer_offset_B(&key->tib, rt) & 3) == 0) {
Expand All @@ -505,14 +505,18 @@ agx_compile_background_shader(const struct agx_device *dev,

enum pipe_format phys = agx_tilebuffer_physical_format(&key->tib, rt);
/* Keep multisample reloads on W32: W16 on 8x MSAA MRT reloads can
* overflow the AGX3c tile-store payload bank. */
* overflow the AGX3c tile-store payload bank. On native AGX3 (AGX3b),
* fltnorm has no f16 register source operand, so restrict W16 reloads to
* F16 tile formats (which store directly without fltnorm) and keep 8-bit
* normalized W16 reloads M5 (AGX3c)-only. */
const bool load_f16 =
agx_chip_g17_m5(dev->chip) && key->op[rt] == AGX_BG_LOAD &&
!msaa && !key->tib.spilled[rt] &&
agx_chip_native_or_m5(dev->chip) && key->op[rt] == AGX_BG_LOAD &&
!msaa && !key->tib.spilled[rt] && !key->preserve_resolve_outside &&
(phys == PIPE_FORMAT_R16_FLOAT ||
phys == (enum pipe_format)AIL_ISA_FORMAT_U8NORM ||
phys == (enum pipe_format)AIL_ISA_FORMAT_S8NORM ||
phys == (enum pipe_format)AIL_ISA_FORMAT_SRGBA8);
(agx_chip_g17_m5(dev->chip) &&
(phys == (enum pipe_format)AIL_ISA_FORMAT_U8NORM ||
phys == (enum pipe_format)AIL_ISA_FORMAT_S8NORM ||
phys == (enum pipe_format)AIL_ISA_FORMAT_SRGBA8)));
const nir_alu_type op_type =
load_f16 ? nir_type_float16 : nir_type_uint32;

Expand Down
11 changes: 6 additions & 5 deletions src/asahi/lib/agx_bg_eot.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct agx_bg_eot_key {
* floats with two FLTNORMs per pixel. Only agx_g17p_packed_clear_ok()
* layouts set it. */
bool packed_clear;
/* Per-RT bitmasks for M5 background shaders:
/* Per-RT bitmasks for native AGX3 and M5 background shaders:
* - packed_clear_mask: clear values arrive pre-packed in each RT's clear
* uniform slot (see agx_m5_packed_clear_format_ok()).
* - raw32_load_mask: uncompressed 32-bit targets (R11G11B10_FLOAT) bound
Expand All @@ -112,10 +112,11 @@ agx_m5_packed_clear_format_ok(enum pipe_format fmt)
}
}

/* Whether RT @rt may use an M5 pre-packed background clear. R16_FLOAT stores a
* 16-bit lane (2-byte aligned); every other packed-clear format stores one or
* two raw 32-bit R32_UINT words, which require a 4-byte-aligned tilebuffer
* offset so hardware word alignment does not overwrite a neighbouring target. */
/* Whether RT @rt may use a native AGX3 / M5 pre-packed background clear.
* R16_FLOAT stores a 16-bit lane (2-byte aligned); every other packed-clear
* format stores one or two raw 32-bit R32_UINT words, which require a
* 4-byte-aligned tilebuffer offset so hardware word alignment does not
* overwrite a neighbouring target. */
static inline bool
agx_m5_packed_clear_rt_ok(const struct agx_tilebuffer_layout *tib, unsigned rt)
{
Expand Down
10 changes: 8 additions & 2 deletions src/asahi/lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,14 @@ if with_tests
executable(
'asahi-g17p-mrt-mixed',
files('tests/test-agx-g17p-mrt-mixed.c'),
include_directories : [inc_include, inc_src, inc_asahi],
dependencies : [idep_nir, idep_mesautil],
include_directories : [
inc_include, inc_src, inc_asahi, libasahi_lib_includes,
include_directories('../libagx'),
],
dependencies : [
idep_nir, idep_mesautil, idep_agx_opcodes_h, idep_libagx_shaders_h,
idep_agx_pack,
],
link_with : [libasahi_lib, libasahi_compiler, libasahi_layout],
),
suite : ['asahi'],
Expand Down
Loading