anv: Reduce accesses of isl_mod_info->aux_usage

This field will be replaced in an upcoming patch.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24120>
This commit is contained in:
Nanley Chery 2023-06-21 12:53:08 -04:00 committed by Marge Bot
parent f2dab434d8
commit 569f80f2df
3 changed files with 12 additions and 10 deletions

View file

@ -775,17 +775,17 @@ anv_get_image_format_features2(const struct anv_physical_device *physical_device
* planes and aux planes due to the lack of defined ABI for external * planes and aux planes due to the lack of defined ABI for external
* multi-planar images. * multi-planar images.
*/ */
if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { if (isl_drm_modifier_has_aux(isl_mod_info->modifier)) {
return 0; return 0;
} }
} }
if (isl_aux_usage_has_ccs_e(isl_mod_info->aux_usage) && if (isl_drm_modifier_has_aux(isl_mod_info->modifier) &&
!isl_format_supports_ccs_e(devinfo, plane_format.isl_format)) { !isl_format_supports_ccs_e(devinfo, plane_format.isl_format)) {
return 0; return 0;
} }
if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { if (isl_drm_modifier_has_aux(isl_mod_info->modifier)) {
/* Rejection DISJOINT for consistency with the GL driver. In /* Rejection DISJOINT for consistency with the GL driver. In
* eglCreateImage, we require that the dma_buf for the primary surface * eglCreateImage, we require that the dma_buf for the primary surface
* and the dma_buf for its aux surface refer to the same bo. * and the dma_buf for its aux surface refer to the same bo.
@ -1340,7 +1340,7 @@ anv_get_image_format_properties(
maxMipLevels = 1; maxMipLevels = 1;
sampleCounts = VK_SAMPLE_COUNT_1_BIT; sampleCounts = VK_SAMPLE_COUNT_1_BIT;
if (isl_mod_info->aux_usage == ISL_AUX_USAGE_CCS_E && if (isl_drm_modifier_has_aux(isl_mod_info->modifier) &&
!anv_formats_ccs_e_compatible(devinfo, info->flags, info->format, !anv_formats_ccs_e_compatible(devinfo, info->flags, info->format,
info->tiling, info->usage, info->tiling, info->usage,
format_list_info)) { format_list_info)) {
@ -1405,7 +1405,7 @@ anv_get_image_format_properties(
} }
if (info->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT && if (info->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { isl_drm_modifier_has_aux(isl_mod_info->modifier)) {
/* Rejection DISJOINT for consistency with the GL driver. In /* Rejection DISJOINT for consistency with the GL driver. In
* eglCreateImage, we require that the dma_buf for the primary surface * eglCreateImage, we require that the dma_buf for the primary surface
* and the dma_buf for its aux surface refer to the same bo. * and the dma_buf for its aux surface refer to the same bo.

View file

@ -1099,7 +1099,7 @@ check_drm_format_mod(const struct anv_device *device,
assert(isl_layout->colorspace == ISL_COLORSPACE_LINEAR || assert(isl_layout->colorspace == ISL_COLORSPACE_LINEAR ||
isl_layout->colorspace == ISL_COLORSPACE_SRGB); isl_layout->colorspace == ISL_COLORSPACE_SRGB);
if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) { if (isl_drm_modifier_has_aux(isl_mod_info->modifier)) {
/* Reject DISJOINT for consistency with the GL driver. */ /* Reject DISJOINT for consistency with the GL driver. */
assert(!image->disjoint); assert(!image->disjoint);

View file

@ -971,11 +971,13 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
* of acquire/release direction. * of acquire/release direction.
*/ */
if (private_binding_acquire) { if (private_binding_acquire) {
initial_aux_usage = isl_mod_info->aux_usage; initial_aux_usage = isl_drm_modifier_has_aux(isl_mod_info->modifier) ?
image->planes[plane].aux_usage : ISL_AUX_USAGE_NONE;
initial_fast_clear = isl_mod_info->supports_clear_color ? initial_fast_clear = isl_mod_info->supports_clear_color ?
initial_fast_clear : ANV_FAST_CLEAR_NONE; initial_fast_clear : ANV_FAST_CLEAR_NONE;
} else if (private_binding_release) { } else if (private_binding_release) {
final_aux_usage = isl_mod_info->aux_usage; final_aux_usage = isl_drm_modifier_has_aux(isl_mod_info->modifier) ?
image->planes[plane].aux_usage : ISL_AUX_USAGE_NONE;
final_fast_clear = isl_mod_info->supports_clear_color ? final_fast_clear = isl_mod_info->supports_clear_color ?
final_fast_clear : ANV_FAST_CLEAR_NONE; final_fast_clear : ANV_FAST_CLEAR_NONE;
} }
@ -1050,7 +1052,7 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
if (image->planes[plane].aux_surface.memory_range.binding == if (image->planes[plane].aux_surface.memory_range.binding ==
ANV_IMAGE_MEMORY_BINDING_PRIVATE) { ANV_IMAGE_MEMORY_BINDING_PRIVATE) {
assert(isl_mod_info->aux_usage == ISL_AUX_USAGE_NONE); assert(!isl_drm_modifier_has_aux(isl_mod_info->modifier));
/* The aux surface, like the fast clear state, lives in /* The aux surface, like the fast clear state, lives in
* a driver-private bo. We must initialize the aux surface for the * a driver-private bo. We must initialize the aux surface for the
@ -1058,7 +1060,7 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
*/ */
must_init_aux_surface = true; must_init_aux_surface = true;
} else { } else {
assert(isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE); assert(isl_drm_modifier_has_aux(isl_mod_info->modifier));
/* The aux surface, unlike the fast clear state, lives in /* The aux surface, unlike the fast clear state, lives in
* application-visible VkDeviceMemory and is shared with the * application-visible VkDeviceMemory and is shared with the