anv: Enable implicit CCS for external images

AUX and clear state is stored in the VkDevice private binding

Signed-off-by: Renato Pereyra <renatopereyra@google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14416>
This commit is contained in:
Renato Pereyra
2022-01-05 18:27:23 -08:00
parent a4c9276de2
commit b664349973
4 changed files with 36 additions and 25 deletions

View File

@@ -536,8 +536,14 @@ add_aux_state_tracking_buffer(struct anv_device *device,
enum anv_image_memory_binding binding =
ANV_IMAGE_MEMORY_BINDING_PLANE_0 + plane;
if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID)
/* Ensure that AUX state is stored outside the buffer memory for any images
* externally sharable. This prevents corruptions arising due to disjoint
* processes working with the same image.
*/
if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID ||
image->vk.external_handle_types != 0) {
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
}
/* We believe that 256B alignment may be sufficient, but we choose 4K due to
* lack of testing. And MI_LOAD/STORE operations require dword-alignment.
@@ -944,9 +950,15 @@ check_memory_bindings(const struct anv_device *device,
if (anv_surface_is_valid(&plane->aux_surface)) {
enum anv_image_memory_binding binding = primary_binding;
if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID &&
!isl_drm_modifier_has_aux(image->vk.drm_format_mod))
/* Ensure that AUX state is stored outside the buffer memory for any
* images externally sharable. This prevents corruptions arising due
* to disjoint processes working with the same image.
*/
if ((image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID &&
!isl_drm_modifier_has_aux(image->vk.drm_format_mod)) ||
(image->vk.external_handle_types != 0)) {
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
}
/* Display hardware requires that the aux surface start at
* a higher address than the primary surface. The 3D hardware
@@ -962,8 +974,14 @@ check_memory_bindings(const struct anv_device *device,
if (plane->fast_clear_memory_range.size > 0) {
enum anv_image_memory_binding binding = primary_binding;
if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID)
/* Ensure that clear state is stored outside the buffer memory for any
* images externally sharable. This prevents corruptions arising due
* to disjoint processes working with the same image.
*/
if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID ||
image->vk.external_handle_types != 0) {
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
}
/* We believe that 256B alignment may be sufficient, but we choose 4K
* due to lack of testing. And MI_LOAD/STORE operations require