Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 9 additions & 0 deletions src/asahi/lib/agx_chip.h
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,15 @@ agx_chip_has_depth_clip_control(enum agx_chip chip)
return !agx_chip_hal300_path(chip) || agx_chip_g17_m5(chip);
}

/* Whether hardware ASTC HDR decode is qualified on this chip: AGX2, native
* AGX3, and M5 (AGX3C/HAL300: G17G/G17S/G17C). Other HAL300 encodings such as
* AGX3D (G18G) stay off until qualified on their hardware. */
static inline bool
agx_chip_has_astc_hdr(enum agx_chip chip)
{
return !agx_chip_hal300_path(chip) || agx_chip_g17_m5(chip);
}

/* Number of helper-table slots in the USC code-container lead block. G15
* and G16 parts have ten; with six their fragment programs of 256x256 and
* larger walk past the lead into the guard page. On G17P the state loader's
Expand Down
7 changes: 4 additions & 3 deletions src/asahi/vulkan/hk_physical_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,10 @@ hk_get_device_extensions(const struct agx_device *dev,
.EXT_swapchain_maintenance1 = true,
#endif
.EXT_texel_buffer_alignment = true,
/* Hardware ASTC HDR decode is supported across AGX2 and native AGX3
* (G13-G17P); keep HAL300 off until qualified on M5 hardware. */
.EXT_texture_compression_astc_hdr = !agx_chip_hal300_path(dev->chip),
/* Hardware ASTC HDR decode is supported across AGX2, native AGX3, and
* AGX3C/HAL300 (M5: G17G/G17S/G17C). Other HAL300 encodings such as
* AGX3D (G18G) stay off until qualified on their hardware. */
.EXT_texture_compression_astc_hdr = agx_chip_has_astc_hdr(dev->chip),
.EXT_tooling_info = true,
.EXT_transform_feedback = true,

Expand Down
58 changes: 58 additions & 0 deletions src/asahi/vulkan/tests/test-hk-native-descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,63 @@ check_gen9_astc_4x4_texture(void)
assert(memcmp(&packed, expected, sizeof(expected)) == 0);
}

static void
check_gen10_astc_hdr_textures(void)
{
static const enum agx_channels astc_channels[] = {
AGX_CHANNELS_ASTC_4X4, AGX_CHANNELS_ASTC_5X4,
AGX_CHANNELS_ASTC_5X5, AGX_CHANNELS_ASTC_6X5,
AGX_CHANNELS_ASTC_6X6, AGX_CHANNELS_ASTC_8X5,
AGX_CHANNELS_ASTC_8X6, AGX_CHANNELS_ASTC_8X8,
AGX_CHANNELS_ASTC_10X5, AGX_CHANNELS_ASTC_10X6,
AGX_CHANNELS_ASTC_10X8, AGX_CHANNELS_ASTC_10X10,
AGX_CHANNELS_ASTC_12X10, AGX_CHANNELS_ASTC_12X12,
};

for (unsigned i = 0; i < ARRAY_SIZE(astc_channels); ++i) {
const struct AGX_TEXTURE semantic = {
AGX_TEXTURE_header,
.dimension = AGX_TEXTURE_DIMENSION_2D,
.layout = AGX_LAYOUT_GPU,
.channels = astc_channels[i],
.type = AGX_TEXTURE_TYPE_FLOAT,
.swizzle_r = AGX_CHANNEL_R,
.swizzle_g = AGX_CHANNEL_G,
.swizzle_b = AGX_CHANNEL_B,
.swizzle_a = AGX_CHANNEL_A,
.width = 32,
.height = 32,
.depth = 1,
.address = UINT64_C(0x1000001c500),
};
struct hk_native_texture_descriptor packed;
assert(hk_pack_native_texture(10, &packed, &semantic));

char *log = NULL;
size_t log_size = 0;
FILE *fp = open_memstream(&log, &log_size);
assert(fp);
struct AGX_TEXTURE_GEN10 gen10;
const bool valid =
AGX_TEXTURE_GEN10_unpack(fp, (const uint8_t *)packed.opaque, &gen10);
fclose(fp);
assert(valid && log_size == 0);
free(log);

assert(gen10.dimension == AGX_TEXTURE_DIMENSION_2D);
assert(gen10.layout == AGX_LAYOUT_GPU);
assert(gen10.channels == astc_channels[i]);
assert(gen10.type == AGX_TEXTURE_TYPE_FLOAT);
assert(!gen10.srgb);
assert(gen10.width == 32 && gen10.height == 32);
assert(gen10.address == semantic.address);

uint32_t repacked[8];
AGX_TEXTURE_GEN10_pack(repacked, &gen10);
assert(memcmp(repacked, packed.opaque, sizeof(repacked)) == 0);
}
}

static void
check_gen9_cube_textures(void)
{
Expand Down Expand Up @@ -1014,6 +1071,7 @@ main(void)
check_gen9_bc1_rgba_texture();
check_gen9_etc2_rgba8_texture();
check_gen9_astc_4x4_texture();
check_gen10_astc_hdr_textures();
check_gen9_cube_textures();
check_gen9_cube_array_texture();
check_gen9_bc_textures();
Expand Down
8 changes: 8 additions & 0 deletions src/asahi/vulkan/tests/test-native-feature-defaults.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ main(void)
assert(agx_chip_has_depth_clip_control(elide_chips[i]));
assert(!agx_chip_has_depth_clip_control(AGX_CHIP_G18G));

/* Hardware ASTC HDR decode stays on across AGX2, native AGX3, and
* AGX3C/HAL300 (M5), and fails closed on AGX3D (G18G). */
assert(agx_chip_has_astc_hdr(AGX_CHIP_G13G));
assert(agx_chip_has_astc_hdr(AGX_CHIP_G14X));
for (unsigned i = 0; i < ARRAY_SIZE(elide_chips); ++i)
assert(agx_chip_has_astc_hdr(elide_chips[i]));
assert(!agx_chip_has_astc_hdr(AGX_CHIP_G18G));

/* Kernel-feature-gated cumulative signals and sibling compute queues apply
* uniformly across G16G, G17P, and M5 (G17G/G17S/G17C) without chip forks. */
const uint64_t sib_features = DRM_ASAHI_FEATURE_INDEPENDENT_QUEUES |
Expand Down