From: Nanley Chery Date: Thu, 6 Jul 2023 20:20:00 +0000 (-0400) Subject: hasvk: Delete modifier with aux code X-Git-Tag: upstream/23.3.3~5270 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f5f61c5bb70dd509cb31fd727b17a844428b70df;p=platform%2Fupstream%2Fmesa.git hasvk: Delete modifier with aux code Modifiers with compression are not supported. Reviewed-by: Lionel Landwerlin Part-of: --- diff --git a/src/intel/vulkan_hasvk/anv_formats.c b/src/intel/vulkan_hasvk/anv_formats.c index ba9ed47..bdd0000 100644 --- a/src/intel/vulkan_hasvk/anv_formats.c +++ b/src/intel/vulkan_hasvk/anv_formats.c @@ -725,6 +725,9 @@ anv_get_image_format_features2(const struct intel_device_info *devinfo, if (!isl_drm_modifier_get_score(devinfo, isl_mod_info->modifier)) return 0; + /* No modifiers have compression on platforms supported by hasvk. */ + assert(!isl_drm_modifier_has_aux(isl_mod_info->modifier)); + /* Try to restrict the supported formats to those in drm_fourcc.h. The * VK_EXT_image_drm_format_modifier does not require this (after all, two * Vulkan apps could share an image by exchanging its VkFormat instead of @@ -780,29 +783,6 @@ anv_get_image_format_features2(const struct intel_device_info *devinfo, anv_finishme("support more multi-planar formats with DRM modifiers"); return 0; } - - /* Currently there is no way to properly map memory planes to format - * planes and aux planes due to the lack of defined ABI for external - * multi-planar images. - */ - if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { - return 0; - } - } - - if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { - /* Rejection DISJOINT for consistency with the GL driver. In - * eglCreateImage, we require that the dma_buf for the primary surface - * and the dma_buf for its aux surface refer to the same bo. - */ - flags &= ~VK_FORMAT_FEATURE_2_DISJOINT_BIT; - - /* When the hardware accesses a storage image, it bypasses the aux - * surface. We could support storage access on images with aux - * modifiers by resolving the aux surface prior to the storage access. - */ - flags &= ~VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT; - flags &= ~VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT; } } @@ -875,14 +855,10 @@ get_drm_format_modifier_properties_list(const struct anv_physical_device *physic if (!features) continue; - uint32_t planes = anv_format->n_planes; - if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) - ++planes; - vk_outarray_append_typed(VkDrmFormatModifierPropertiesEXT, &out, out_props) { *out_props = (VkDrmFormatModifierPropertiesEXT) { .drmFormatModifier = isl_mod_info->modifier, - .drmFormatModifierPlaneCount = planes, + .drmFormatModifierPlaneCount = anv_format->n_planes, .drmFormatModifierTilingFeatures = features, }; }; @@ -909,14 +885,10 @@ get_drm_format_modifier_properties_list_2(const struct anv_physical_device *phys if (!features2) continue; - uint32_t planes = anv_format->n_planes; - if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) - ++planes; - vk_outarray_append_typed(VkDrmFormatModifierProperties2EXT, &out, out_props) { *out_props = (VkDrmFormatModifierProperties2EXT) { .drmFormatModifier = isl_mod_info->modifier, - .drmFormatModifierPlaneCount = planes, + .drmFormatModifierPlaneCount = anv_format->n_planes, .drmFormatModifierTilingFeatures = features2, }; }; @@ -1201,15 +1173,6 @@ anv_get_image_format_properties( !(info->flags & VK_IMAGE_CREATE_ALIAS_BIT)) { goto unsupported; } - - if (info->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT && - isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { - /* Rejection DISJOINT for consistency with the GL driver. In - * eglCreateImage, we require that the dma_buf for the primary surface - * and the dma_buf for its aux surface refer to the same bo. - */ - goto unsupported; - } } if (info->flags & VK_IMAGE_CREATE_ALIAS_BIT && !from_wsi) { diff --git a/src/intel/vulkan_hasvk/anv_image.c b/src/intel/vulkan_hasvk/anv_image.c index 780e2e7..0d81339 100644 --- a/src/intel/vulkan_hasvk/anv_image.c +++ b/src/intel/vulkan_hasvk/anv_image.c @@ -945,10 +945,7 @@ check_memory_bindings(const struct anv_device *device, * Ideally, if vkGetPhysicalDeviceImageFormatProperties2() succeeds with a given * modifier, then vkCreateImage() produces an image that is compatible with the * modifier. However, it is difficult to reconcile the two functions to agree - * due to their complexity. For example, isl_surf_get_ccs_surf() may - * unexpectedly fail in vkCreateImage(), eliminating the image's aux surface - * even when the modifier requires one. (Maybe we should reconcile the two - * functions despite the difficulty). + * due to their complexity. */ static VkResult MUST_CHECK check_drm_format_mod(const struct anv_device *device, @@ -985,21 +982,7 @@ check_drm_format_mod(const struct anv_device *device, assert(isl_layout->colorspace == ISL_COLORSPACE_LINEAR || isl_layout->colorspace == ISL_COLORSPACE_SRGB); assert(!anv_surface_is_valid(&plane->shadow_surface)); - - if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { - /* Reject DISJOINT for consistency with the GL driver. */ - assert(!image->disjoint); - - /* The modifier's required aux usage mandates the image's aux usage. - * The inverse, however, does not hold; if the modifier has no aux - * usage, then we may enable a private aux surface. - */ - if (plane->aux_usage != isl_mod_info->aux_usage) { - return vk_errorf(device, VK_ERROR_UNKNOWN, - "image with modifier unexpectedly has wrong aux " - "usage"); - } - } + assert(!isl_drm_modifier_has_aux(isl_mod_info->modifier)); } return VK_SUCCESS; diff --git a/src/intel/vulkan_hasvk/genX_cmd_buffer.c b/src/intel/vulkan_hasvk/genX_cmd_buffer.c index f790e25..9d002b6 100644 --- a/src/intel/vulkan_hasvk/genX_cmd_buffer.c +++ b/src/intel/vulkan_hasvk/genX_cmd_buffer.c @@ -986,26 +986,13 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer, ANV_IMAGE_MEMORY_BINDING_PRIVATE); must_init_fast_clear_state = true; - if (image->planes[plane].aux_surface.memory_range.binding == - ANV_IMAGE_MEMORY_BINDING_PRIVATE) { - assert(isl_mod_info->aux_usage == ISL_AUX_USAGE_NONE); - - /* The aux surface, like the fast clear state, lives in - * a driver-private bo. We must initialize the aux surface for the - * same reasons we must initialize the fast clear state. - */ - must_init_aux_surface = true; - } else { - assert(isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE); - - /* The aux surface, unlike the fast clear state, lives in - * application-visible VkDeviceMemory and is shared with the - * external/foreign queue. Therefore, when we acquire ownership of the - * image with a defined VkImageLayout, the aux surface is valid and has - * the aux state required by the modifier. - */ - must_init_aux_surface = false; - } + /* The aux surface, like the fast clear state, lives in + * a driver-private bo. We must initialize the aux surface for the + * same reasons we must initialize the fast clear state. + */ + assert(image->planes[plane].aux_surface.memory_range.binding == + ANV_IMAGE_MEMORY_BINDING_PRIVATE); + must_init_aux_surface = true; } if (must_init_fast_clear_state) { @@ -1112,13 +1099,13 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer, * acquire/release direction. */ if (private_binding_acquire) { - initial_aux_usage = isl_mod_info->aux_usage; - initial_fast_clear = isl_mod_info->supports_clear_color ? - initial_fast_clear : ANV_FAST_CLEAR_NONE; + assert(!isl_drm_modifier_has_aux(isl_mod_info->modifier)); + initial_aux_usage = ISL_AUX_USAGE_NONE; + initial_fast_clear = ANV_FAST_CLEAR_NONE; } else if (private_binding_release) { - final_aux_usage = isl_mod_info->aux_usage; - final_fast_clear = isl_mod_info->supports_clear_color ? - final_fast_clear : ANV_FAST_CLEAR_NONE; + assert(!isl_drm_modifier_has_aux(isl_mod_info->modifier)); + final_aux_usage = ISL_AUX_USAGE_NONE; + final_fast_clear = ANV_FAST_CLEAR_NONE; } /* The current code assumes that there is no mixing of CCS_E and CCS_D.