anv: fake VK_EXT_image_compression_control on Xe2+
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

We're required to support this extension for Android VP17.

We've tried supporting it through the use of
CMF_DISABLE_WRITE_COMPRESSION but some regressions are measures
(-0.5~-1.0%).

We're not aware using CMF_DISABLE_WRITE_COMPRESSION would prevent any
application bug so it doesn't feel useful to implement.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41187>
This commit is contained in:
Lionel Landwerlin 2026-05-14 17:51:24 +03:00
parent 2218581c95
commit e24dc5bd1e
5 changed files with 38 additions and 20 deletions

View file

@ -243,6 +243,9 @@ def declare_options(android_version):
B("anv_enable_fully_covered", False,
"Enable fullyCoveredFragmentShaderInputVariable (Alchemist and newer only).",
c_name="fully_covered"),
B("anv_fake_image_compression_control_xe2_plus", android_version >= 37,
"Enable VK_EXT_image_compression_control with no actual effect",
c_name= "fake_image_compression_control_xe2_plus"),
B("compression_control_enabled", android_version >= 37,
"Enable VK_EXT_image_compression_control support",
c_name="compression_control_enabled"),

View file

@ -331,7 +331,9 @@ anv_image_choose_isl_surf_usage(struct anv_physical_device *device,
isl_usage |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
}
if (comp_flags & VK_IMAGE_COMPRESSION_DISABLED_EXT) {
if (device->has_compression_control &&
device->expose_compression_control &&
(comp_flags & VK_IMAGE_COMPRESSION_DISABLED_EXT)) {
anv_perf_warn(VK_LOG_OBJS(&device->vk.base),
"Disabling aux: "
"image compression disabled via create flags");
@ -3467,7 +3469,7 @@ anv_get_image_subresource_layout(struct anv_device *device,
VkImageCompressionPropertiesEXT *comp_props =
vk_find_struct(layout->pNext, IMAGE_COMPRESSION_PROPERTIES_EXT);
if (comp_props) {
if (comp_props && device->physical->expose_compression_control) {
comp_props->imageCompressionFixedRateFlags =
VK_IMAGE_COMPRESSION_FIXED_RATE_NONE_EXT;
comp_props->imageCompressionFlags = VK_IMAGE_COMPRESSION_DISABLED_EXT;

View file

@ -134,6 +134,7 @@ static void
get_device_extensions(const struct anv_physical_device *device,
struct vk_device_extension_table *ext)
{
const struct anv_instance *instance = device->instance;
const bool rt_enabled = ANV_SUPPORT_RT && device->info.has_ray_tracing &&
!intel_use_jay_any_stage(&device->info);
const bool hw_video_encode_supported = device->info.verx10 < 125;
@ -143,7 +144,7 @@ get_device_extensions(const struct anv_physical_device *device,
*ext = (struct vk_device_extension_table) {
.KHR_8bit_storage = true,
.KHR_16bit_storage = !device->instance->drirc.debug.no_16bit,
.KHR_16bit_storage = !instance->drirc.debug.no_16bit,
.KHR_acceleration_structure = rt_enabled,
.KHR_bind_memory2 = true,
.KHR_buffer_device_address = true,
@ -228,7 +229,7 @@ get_device_extensions(const struct anv_physical_device *device,
.KHR_shader_constant_data = true,
.KHR_shader_draw_parameters = true,
.KHR_shader_expect_assume = true,
.KHR_shader_float16_int8 = !device->instance->drirc.debug.no_16bit,
.KHR_shader_float16_int8 = !instance->drirc.debug.no_16bit,
.KHR_shader_float_controls = true,
.KHR_shader_float_controls2 = true,
.KHR_shader_integer_dot_product = true,
@ -329,7 +330,7 @@ get_device_extensions(const struct anv_physical_device *device,
.EXT_host_image_copy = true,
.EXT_host_query_reset = true,
.EXT_image_2d_view_of_3d = true,
.EXT_image_compression_control = device->has_compression_control,
.EXT_image_compression_control = device->expose_compression_control,
.EXT_image_drm_format_modifier = true,
.EXT_image_robustness = true,
.EXT_image_sliced_view_of_3d = true,
@ -388,7 +389,7 @@ get_device_extensions(const struct anv_physical_device *device,
.EXT_shader_uniform_buffer_unsized_array = true,
.EXT_subgroup_size_control = !device->brw_disable_subgroup_size_control,
#ifdef ANV_USE_WSI_PLATFORM
.EXT_image_compression_control_swapchain = device->has_compression_control,
.EXT_image_compression_control_swapchain = device->expose_compression_control,
.EXT_swapchain_maintenance1 = true,
#endif
.EXT_texel_buffer_alignment = true,
@ -423,7 +424,8 @@ static void
get_features(const struct anv_physical_device *pdevice,
struct vk_features *features)
{
struct vk_app_info *app_info = &pdevice->instance->vk.app_info;
const struct anv_instance *instance = pdevice->instance;
const struct vk_app_info *app_info = &instance->vk.app_info;
const bool rt_enabled = ANV_SUPPORT_RT && pdevice->info.has_ray_tracing;
@ -470,7 +472,7 @@ get_features(const struct anv_physical_device *pdevice,
* read/writes, on Gfx11 & Gfx12.0 we emulate for 3 formats.
*/
.shaderStorageImageReadWithoutFormat = pdevice->info.verx10 >= 125 ||
pdevice->instance->drirc.debug.read_without_format_emu,
instance->drirc.debug.read_without_format_emu,
.shaderStorageImageWriteWithoutFormat = true,
.shaderUniformBufferArrayDynamicIndexing = true,
.shaderSampledImageArrayDynamicIndexing = true,
@ -479,7 +481,7 @@ get_features(const struct anv_physical_device *pdevice,
.shaderClipDistance = true,
.shaderCullDistance = true,
.shaderFloat64 = pdevice->info.has_64bit_float ||
pdevice->instance->drirc.debug.fp64_emu,
instance->drirc.debug.fp64_emu,
.shaderInt64 = true,
.shaderInt16 = true,
.shaderResourceMinLod = true,
@ -500,8 +502,8 @@ get_features(const struct anv_physical_device *pdevice,
.inheritedQueries = true,
/* Vulkan 1.1 */
.storageBuffer16BitAccess = !pdevice->instance->drirc.debug.no_16bit,
.uniformAndStorageBuffer16BitAccess = !pdevice->instance->drirc.debug.no_16bit,
.storageBuffer16BitAccess = !instance->drirc.debug.no_16bit,
.uniformAndStorageBuffer16BitAccess = !instance->drirc.debug.no_16bit,
.storagePushConstant16 = true,
.storageInputOutput16 = true,
.multiview = true,
@ -521,8 +523,8 @@ get_features(const struct anv_physical_device *pdevice,
.storagePushConstant8 = true,
.shaderBufferInt64Atomics = true,
.shaderSharedInt64Atomics = false,
.shaderFloat16 = !pdevice->instance->drirc.debug.no_16bit,
.shaderInt8 = !pdevice->instance->drirc.debug.no_16bit,
.shaderFloat16 = !instance->drirc.debug.no_16bit,
.shaderInt8 = !instance->drirc.debug.no_16bit,
.descriptorIndexing = true,
.shaderInputAttachmentArrayDynamicIndexing = false,
@ -620,7 +622,7 @@ get_features(const struct anv_physical_device *pdevice,
/* VK_EXT_custom_border_color */
.customBorderColors = true,
.customBorderColorWithoutFormat =
pdevice->instance->drirc.debug.custom_border_colors_without_format,
instance->drirc.debug.custom_border_colors_without_format,
/* VK_KHR_depth_clamp_zero_one */
.depthClampZeroOne = true,
@ -948,7 +950,7 @@ get_features(const struct anv_physical_device *pdevice,
.videoDecodeVP9 = true,
/* VK_EXT_image_compression_control */
.imageCompressionControl = pdevice->has_compression_control,
.imageCompressionControl = pdevice->expose_compression_control,
/* VK_KHR_shader_float_controls2 */
.shaderFloatControls2 = true,
@ -1058,7 +1060,7 @@ get_features(const struct anv_physical_device *pdevice,
.deviceAddressCommands = true,
/* VK_EXT_swapchain_compression_control */
.imageCompressionControlSwapchain = pdevice->has_compression_control,
.imageCompressionControlSwapchain = pdevice->expose_compression_control,
};
/* The new DOOM and Wolfenstein games require depthBounds without
@ -2903,9 +2905,17 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
* to always return the same memory types for Images with same properties
* we can't support EXT_image_compression_control on Xe2+.
*/
device->has_compression_control =
instance->drirc.features.compression_control_enabled &&
device->info.ver < 20;
device->has_compression_control = device->info.ver < 20;
/* Whether we want to expose the extension depends on DRIRC (for platforms
* that support this or fake on Xe2+ due to Android VP17 profile
* requirement).
*/
device->expose_compression_control =
(instance->drirc.features.fake_image_compression_control_xe2_plus &&
device->info.ver >= 20) ||
(instance->drirc.features.compression_control_enabled &&
device->has_compression_control);
if (is_virtio) {
struct util_sync_provider *sync = intel_virtio_sync_provider(fd);

View file

@ -1554,8 +1554,10 @@ struct anv_physical_device {
bool has_scratch_page;
/** Whether we allow the application to control compression */
/** Whether the device can support compression control */
bool has_compression_control;
/** Whether the device expose support for compression control */
bool expose_compression_control;
struct {
uint32_t family_count;

View file

@ -80,6 +80,7 @@
<engine engine_name_match="vkd3d|DXVK">
<option name="anv_force_filter_addr_rounding" value="true" />
<option name="anv_promote_cbv_to_push_buffers" value="true" />
<option name="anv_fake_image_compression_control_xe2_plus" value="false" />
</engine>
<!-- Needed to avoid XeSS code paths. -->
<application name="Marvel's Spider-Man Remastered" executable="Spider-Man.exe">