summaryrefslogtreecommitdiff
path: root/vulkan/libvulkan/driver.cpp
diff options
context:
space:
mode:
author Jesse Hall <jessehall@google.com> 2017-02-10 22:22:09 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-02-10 22:22:10 +0000
commitd08aec40b48e4bbfd841a42dbd67fe362a3697b3 (patch)
treec71a1278b2a65559c1f01aff0d82c13e89ac34c0 /vulkan/libvulkan/driver.cpp
parent748a163bf020d9eb53ce610fad90241fc52940af (diff)
parent85bb0c5a57be2b456079c14448127fa9bb8cff66 (diff)
Merge changes I5a8bb16f,I4555ba9d,Id1e3dd5e
* changes: vulkan: Temporarily hack around loader/driver mismatch vulkan: Add gralloc1 usage to VK_ANDROID_native_buffer vulkan: Tolerate missing GetSwapchainGrallocUsageANDROID function
Diffstat (limited to 'vulkan/libvulkan/driver.cpp')
-rw-r--r--vulkan/libvulkan/driver.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 991c3edef4..32f777dc87 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -899,7 +899,29 @@ VkResult CreateDevice(VkPhysicalDevice physicalDevice,
return VK_ERROR_INCOMPATIBLE_DRIVER;
}
+
+ // sanity check ANDROID_native_buffer implementation, whose set of
+ // entrypoints varies according to the spec version.
+ if ((wrapper.GetHalExtensions()[ProcHook::ANDROID_native_buffer]) &&
+ !data->driver.GetSwapchainGrallocUsageANDROID &&
+ !data->driver.GetSwapchainGrallocUsage2ANDROID) {
+ ALOGE("Driver's implementation of ANDROID_native_buffer is broken;"
+ " must expose at least one of "
+ "vkGetSwapchainGrallocUsageANDROID or "
+ "vkGetSwapchainGrallocUsage2ANDROID");
+
+ data->driver.DestroyDevice(dev, pAllocator);
+ FreeDeviceData(data, data_allocator);
+
+ return VK_ERROR_INCOMPATIBLE_DRIVER;
+ }
+
+ VkPhysicalDeviceProperties properties;
+ instance_data.driver.GetPhysicalDeviceProperties(physicalDevice,
+ &properties);
+
data->driver_device = dev;
+ data->driver_version = properties.driverVersion;
*pDevice = dev;