mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-09 14:10:33 +01:00
gfxstream: Check host allocation mode for external memory
New host feature allows usage of external_memory_host extension for external memory support, mainly for software renderers which don't implement platform specific extensions. Also moves enablement of queue_family_foreign outside of android, to allow it also on linux guests (ref: github PR#74), and removes the check for VK_MVK_moltenvk extension in favor of metal mode. Test: -gpu lavapipe -feature VulkanNativeSwapchain on windows Reviewed-by: David Gilhooley <djgilhooley.gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38153>
This commit is contained in:
parent
deb48556dc
commit
7bc14977a8
1 changed files with 15 additions and 5 deletions
|
|
@ -1972,27 +1972,37 @@ VkResult ResourceTracker::on_vkEnumerateDeviceExtensionProperties(
|
|||
}
|
||||
#endif
|
||||
|
||||
// TODO: query ExternalMemoryMode from vkEmulation directly to compansate for the host platform
|
||||
// correctly, instead of host extension checks, or make this support mandatory for Android.
|
||||
bool win32ExtMemAvailable = getHostDeviceExtensionIndex("VK_KHR_external_memory_win32") != -1;
|
||||
bool posixExtMemAvailable = getHostDeviceExtensionIndex("VK_KHR_external_memory_fd") != -1;
|
||||
bool metalExtMemAvailable = getHostDeviceExtensionIndex("VK_EXT_external_memory_metal") != -1 ||
|
||||
getHostDeviceExtensionIndex("VK_MVK_moltenvk") != -1;
|
||||
bool metalExtMemAvailable = getHostDeviceExtensionIndex("VK_EXT_external_memory_metal") != -1;
|
||||
bool hostAllocationExtMemAvailable =
|
||||
getHostDeviceExtensionIndex("VK_EXT_external_memory_host") != -1;
|
||||
bool qnxExtMemAvailable =
|
||||
getHostDeviceExtensionIndex("VK_QNX_external_memory_screen_buffer") != -1;
|
||||
|
||||
bool hostHasExternalMemorySupport =
|
||||
win32ExtMemAvailable || posixExtMemAvailable || metalExtMemAvailable || qnxExtMemAvailable;
|
||||
bool hostHasExternalMemorySupport = win32ExtMemAvailable || posixExtMemAvailable ||
|
||||
metalExtMemAvailable || hostAllocationExtMemAvailable ||
|
||||
qnxExtMemAvailable;
|
||||
|
||||
if (hostHasExternalMemorySupport) {
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
filteredExts.push_back(
|
||||
VkExtensionProperties{"VK_ANDROID_external_memory_android_hardware_buffer", 7});
|
||||
filteredExts.push_back(VkExtensionProperties{"VK_EXT_queue_family_foreign", 1});
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||
filteredExts.push_back(VkExtensionProperties{"VK_FUCHSIA_external_memory", 1});
|
||||
filteredExts.push_back(VkExtensionProperties{"VK_FUCHSIA_buffer_collection", 1});
|
||||
#endif
|
||||
filteredExts.push_back(VkExtensionProperties{"VK_EXT_queue_family_foreign", 1});
|
||||
} else {
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
mesa_loge(
|
||||
"%s: Did not recognize any form of external memory support on the host device/driver. "
|
||||
"Guest won't support VK_ANDROID_external_memory_android_hardware_buffer!",
|
||||
__func__);
|
||||
#endif
|
||||
#ifdef LINUX_GUEST_BUILD
|
||||
// Note: Linux gfxstream-vulkan driver automatically assumes some form of external memory
|
||||
// support on the host, and advertises VK_KHR_external_memory_fd and
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue