Modifiers with compression are not supported.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24120>
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
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;
}
}
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,
};
};
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,
};
};
!(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) {
* 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,
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;
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) {
* 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.