ANV_BO_ALLOC_SNOOPED |
ANV_BO_ALLOC_FIXED_ADDRESS)));
- /* We can't do implicit CCS with an aux table on shared memory */
- if (!device->physical->has_implicit_ccs || device->info.has_aux_map)
- assert(!(alloc_flags & ANV_BO_ALLOC_IMPLICIT_CCS));
+ assert(!(alloc_flags & ANV_BO_ALLOC_IMPLICIT_CCS) ||
+ (device->physical->has_implicit_ccs && device->info.has_aux_map));
struct anv_bo_cache *cache = &device->bo_cache;
const uint32_t bo_flags =
ANV_BO_ALLOC_SNOOPED |
ANV_BO_ALLOC_FIXED_ADDRESS)));
- /* We can't do implicit CCS with an aux table on shared memory */
- if (!device->physical->has_implicit_ccs || device->info.has_aux_map)
- assert(!(alloc_flags & ANV_BO_ALLOC_IMPLICIT_CCS));
+ assert(!(alloc_flags & ANV_BO_ALLOC_IMPLICIT_CCS) ||
+ (device->physical->has_implicit_ccs && device->info.has_aux_map));
struct anv_bo_cache *cache = &device->bo_cache;
const uint32_t bo_flags =
(host_ptr_info && host_ptr_info->handleType)) {
/* Anything imported or exported is EXTERNAL */
alloc_flags |= ANV_BO_ALLOC_EXTERNAL;
-
- /* We can't have implicit CCS on external memory with an AUX-table.
- * Doing so would require us to sync the aux tables across processes
- * which is impractical.
- */
- if (device->info.has_aux_map)
- alloc_flags &= ~ANV_BO_ALLOC_IMPLICIT_CCS;
}
/* Check if we need to support Android HW buffer export. If so,
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.
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
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
* image has a DRM format modifier because we store image data in
* a driver-private bo which is inaccessible to the external queue.
*/
- const bool mod_acquire =
+ const bool private_binding_acquire =
src_queue_external &&
- image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
+ (image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT ||
+ image->vk.external_handle_types != 0);
- const bool mod_release =
+ const bool private_binding_release =
dst_queue_external &&
- image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
+ (image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT ||
+ image->vk.external_handle_types != 0);
if (initial_layout == final_layout &&
- !mod_acquire && !mod_release) {
+ !private_binding_acquire && !private_binding_release) {
/* No work is needed. */
return;
}
*/
must_init_fast_clear_state = true;
must_init_aux_surface = true;
- } else if (mod_acquire) {
+ } else if (private_binding_acquire) {
/* The fast clear state lives in a driver-private bo, and therefore the
* external/foreign queue is unaware of it.
*
/* We must override the anv_layout_to_* functions because they are unaware of
* acquire/release direction.
*/
- if (mod_acquire) {
+ if (private_binding_acquire) {
initial_aux_usage = isl_mod_info->aux_usage;
- } else if (mod_release) {
+ } else if (private_binding_release) {
final_aux_usage = isl_mod_info->aux_usage;
}