}
default:
- if (ext->sType != VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA)
- /* this isn't a real enum value,
- * so use conditional to avoid compiler warn
+ /* VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA isn't a real
+ * enum value, so use conditional to avoid compiler warn
+ */
+ if (ext->sType == VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA) {
+ /* TODO: Android, ChromeOS and other applications may need another
+ * way to allocate buffers that can be scanout to display but it
+ * should pretty easy to catch those as Xe KMD driver will print
+ * warnings in dmesg when scanning buffers allocated without
+ * proper flag set.
*/
+ alloc_flags |= ANV_BO_ALLOC_SCANOUT;
+ } else {
anv_debug_ignored_stype(ext->sType);
+ }
break;
}
}
* Should be faster for bo pools, which write but do not read
*/
ANV_BO_ALLOC_WRITE_COMBINE = (1 << 12),
+
+ /** This buffer will be scanout to display */
+ ANV_BO_ALLOC_SCANOUT = (1 << 13),
};
struct anv_bo {
struct drm_xe_gem_create gem_create = {
.vm_id = device->vm_id,
.size = size,
+ .flags = alloc_flags & ANV_BO_ALLOC_SCANOUT ? XE_GEM_CREATE_FLAG_SCANOUT : 0,
};
for (uint16_t i = 0; i < regions_count; i++)
gem_create.flags |= BITFIELD_BIT(regions[i]->instance);