[vulkan] host coherent: Integrate VK_GOOGLE_address_space
bug: 111137294
bug: 121377497
This CL replaces the aligned_buf_alloc mechanism with a call to
vkMapMemoryIntoAddressSpaceGOOGLE, which is implemented as follows:
- Use GoldfishAddressSpaceBlock to obtain a reservation of guest physical memory
- Through the encoder, we obtain a host-side gpu pointer
- mmap() method of GoldfishAddressSpaceBlock is used to get a guest
userspace pointer
Change-Id: I643351e2c8cd8528c4f0aa1e9b10166b736aea51
diff --git a/system/vulkan_enc/ResourceTracker.h b/system/vulkan_enc/ResourceTracker.h
index c385e19..4789ac2 100644
--- a/system/vulkan_enc/ResourceTracker.h
+++ b/system/vulkan_enc/ResourceTracker.h
@@ -93,6 +93,19 @@
VkImageCreateInfo* local_pCreateInfo);
void unwrap_vkAcquireImageANDROID_nativeFenceFd(int fd, int* fd_out);
+ VkResult on_vkMapMemoryIntoAddressSpaceGOOGLE_pre(
+ void* context,
+ VkResult input_result,
+ VkDevice device,
+ VkDeviceMemory memory,
+ uint64_t* pAddress);
+ VkResult on_vkMapMemoryIntoAddressSpaceGOOGLE(
+ void* context,
+ VkResult input_result,
+ VkDevice device,
+ VkDeviceMemory memory,
+ uint64_t* pAddress);
+
void setDeviceInfo(VkDevice device, VkPhysicalDevice physdev, VkPhysicalDeviceProperties props, VkPhysicalDeviceMemoryProperties memProps);
bool isMemoryTypeHostVisible(VkDevice device, uint32_t typeIndex) const;
uint8_t* getMappedPointer(VkDeviceMemory memory);
@@ -100,6 +113,7 @@
VkDeviceSize getNonCoherentExtendedSize(VkDevice device, VkDeviceSize basicSize) const;
bool isValidMemoryRange(const VkMappedMemoryRange& range) const;
void setupFeatures(const EmulatorFeatureInfo* features);
+ bool usingDirectMapping() const;
private:
class Impl;