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->has_dcc_constant_encode =
info->family == CHIP_RAVEN2 || info->family == CHIP_RENOIR || info->gfx_level >= GFX10; 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; info->has_rbplus = info->family == CHIP_STONEY || info->gfx_level >= GFX9;
/* Some chips have RB+ registers, but don't support RB+. Those must /* 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_clear_state;
bool has_distributed_tess; bool has_distributed_tess;
bool has_dcc_constant_encode; bool has_dcc_constant_encode;
bool has_etc_support;
bool has_rbplus; /* if RB+ registers exist */ bool has_rbplus; /* if RB+ registers exist */
bool rbplus_allowed; /* if RB+ is allowed */ bool rbplus_allowed; /* if RB+ is allowed */
bool has_load_ctx_reg_pkt; 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; 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) { desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
if (radv_is_format_emulated(pdev, format)) { if (radv_is_format_emulated(pdev, format)) {
/* required features for compressed formats */ /* 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; 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 static void
parse_hex(char *out, const char *in, unsigned length) 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, .alphaToOne = true,
.multiViewport = true, .multiViewport = true,
.samplerAnisotropy = 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, .textureCompressionASTC_LDR = pdev->emulate_astc,
.textureCompressionBC = true, .textureCompressionBC = true,
.occlusionQueryPrecise = true, .occlusionQueryPrecise = true,
@@ -2038,10 +2031,10 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
#endif #endif
#if DETECT_OS_ANDROID #if DETECT_OS_ANDROID
pdev->emulate_etc2 = !radv_device_supports_etc(pdev); pdev->emulate_etc2 = !pdev->info.has_etc_support;
pdev->emulate_astc = true; pdev->emulate_astc = true;
#else #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; pdev->emulate_astc = instance->drirc.vk_require_astc;
#endif #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_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); uint32_t radv_find_memory_index(const struct radv_physical_device *pdev, VkMemoryPropertyFlags flags);
VkResult create_null_physical_device(struct vk_instance *vk_instance); 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 && if (desc->layout == UTIL_FORMAT_LAYOUT_ETC && sscreen->info.has_etc_support) {
(sscreen->info.family == CHIP_STONEY || sscreen->info.family == CHIP_VEGA10 ||
sscreen->info.family == CHIP_RAVEN || sscreen->info.family == CHIP_RAVEN2)) {
switch (format) { switch (format) {
case PIPE_FORMAT_ETC1_RGB8: case PIPE_FORMAT_ETC1_RGB8:
case PIPE_FORMAT_ETC2_RGB8: case PIPE_FORMAT_ETC2_RGB8: