amd/common: add ac_gpu_info::has_etc_support

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29301>
This commit is contained in:
Samuel Pitoiset
2024-05-21 10:02:40 +02:00
parent ae9331694b
commit 7785a63fc0
6 changed files with 9 additions and 16 deletions

View File

@@ -1223,6 +1223,9 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,
info->has_dcc_constant_encode =
info->family == CHIP_RAVEN2 || info->family == CHIP_RENOIR || info->gfx_level >= GFX10;
info->has_etc_support = info->family == CHIP_STONEY || info->family == CHIP_VEGA10 ||
info->family == CHIP_RAVEN || info->family == CHIP_RAVEN2;
info->has_rbplus = info->family == CHIP_STONEY || info->gfx_level >= GFX9;
/* Some chips have RB+ registers, but don't support RB+. Those must

View File

@@ -85,6 +85,7 @@ struct radeon_info {
bool has_clear_state;
bool has_distributed_tess;
bool has_dcc_constant_encode;
bool has_etc_support;
bool has_rbplus; /* if RB+ registers exist */
bool rbplus_allowed; /* if RB+ is allowed */
bool has_load_ctx_reg_pkt;

View File

@@ -578,7 +578,7 @@ radv_physical_device_get_format_properties(struct radv_physical_device *pdev, Vk
return;
}
if ((desc->layout == UTIL_FORMAT_LAYOUT_ETC && !radv_device_supports_etc(pdev)) ||
if ((desc->layout == UTIL_FORMAT_LAYOUT_ETC && !pdev->info.has_etc_support) ||
desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
if (radv_is_format_emulated(pdev, format)) {
/* required features for compressed formats */

View File

@@ -124,13 +124,6 @@ radv_is_conformant(const struct radv_physical_device *pdev)
return pdev->info.gfx_level >= GFX8;
}
bool
radv_device_supports_etc(const struct radv_physical_device *pdev)
{
return pdev->info.family == CHIP_VEGA10 || pdev->info.family == CHIP_RAVEN || pdev->info.family == CHIP_RAVEN2 ||
pdev->info.family == CHIP_STONEY;
}
static void
parse_hex(char *out, const char *in, unsigned length)
{
@@ -748,7 +741,7 @@ radv_physical_device_get_features(const struct radv_physical_device *pdev, struc
.alphaToOne = true,
.multiViewport = true,
.samplerAnisotropy = true,
.textureCompressionETC2 = radv_device_supports_etc(pdev) || pdev->emulate_etc2,
.textureCompressionETC2 = pdev->info.has_etc_support || pdev->emulate_etc2,
.textureCompressionASTC_LDR = pdev->emulate_astc,
.textureCompressionBC = true,
.occlusionQueryPrecise = true,
@@ -2038,10 +2031,10 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
#endif
#if DETECT_OS_ANDROID
pdev->emulate_etc2 = !radv_device_supports_etc(pdev);
pdev->emulate_etc2 = !pdev->info.has_etc_support;
pdev->emulate_astc = true;
#else
pdev->emulate_etc2 = !radv_device_supports_etc(pdev) && instance->drirc.vk_require_etc2;
pdev->emulate_etc2 = !pdev->info.has_etc_support && instance->drirc.vk_require_etc2;
pdev->emulate_astc = instance->drirc.vk_require_astc;
#endif

View File

@@ -255,8 +255,6 @@ bool radv_enable_rt(const struct radv_physical_device *pdev, bool rt_pipelines);
bool radv_emulate_rt(const struct radv_physical_device *pdev);
bool radv_device_supports_etc(const struct radv_physical_device *pdev);
uint32_t radv_find_memory_index(const struct radv_physical_device *pdev, VkMemoryPropertyFlags flags);
VkResult create_null_physical_device(struct vk_instance *vk_instance);

View File

@@ -2042,9 +2042,7 @@ static uint32_t si_translate_texformat(struct pipe_screen *screen, enum pipe_for
}
}
if (desc->layout == UTIL_FORMAT_LAYOUT_ETC &&
(sscreen->info.family == CHIP_STONEY || sscreen->info.family == CHIP_VEGA10 ||
sscreen->info.family == CHIP_RAVEN || sscreen->info.family == CHIP_RAVEN2)) {
if (desc->layout == UTIL_FORMAT_LAYOUT_ETC && sscreen->info.has_etc_support) {
switch (format) {
case PIPE_FORMAT_ETC1_RGB8:
case PIPE_FORMAT_ETC2_RGB8: