[vulkan] initialize hostconnection
bug: 111137294
+ Add vulkan headers to OpenglSystemCommon if we
are doing a Vulkan driver build.
Change-Id: Id2d8ab6a1f045a5268229c3ee214ccbdfb7be8e5
diff --git a/system/OpenglSystemCommon/Android.mk b/system/OpenglSystemCommon/Android.mk
index 5cdfc4b..e25e97d 100644
--- a/system/OpenglSystemCommon/Android.mk
+++ b/system/OpenglSystemCommon/Android.mk
@@ -20,6 +20,12 @@
else
+ifeq (true,$(BUILD_EMULATOR_VULKAN))
+
+LOCAL_HEADER_LIBRARIES += vulkan_headers
+
+endif
+
LOCAL_SRC_FILES += \
ThreadInfo.cpp \
diff --git a/system/vulkan/goldfish_vulkan.cpp b/system/vulkan/goldfish_vulkan.cpp
index 98dd890..3f84aaa 100644
--- a/system/vulkan/goldfish_vulkan.cpp
+++ b/system/vulkan/goldfish_vulkan.cpp
@@ -18,6 +18,8 @@
#include <errno.h>
#include <string.h>
+#include "HostConnection.h"
+
namespace {
int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device);
@@ -43,12 +45,27 @@
return 0;
}
+#define VK_HOST_CONNECTION \
+ HostConnection *hostCon = HostConnection::get(); \
+ if (!hostCon) { \
+ ALOGE("vulkan: Failed to get host connection\n"); \
+ return VK_ERROR_DEVICE_LOST; \
+ } \
+ ExtendedRCEncoderContext *rcEnc = hostCon->rcEncoder(); \
+ if (!rcEnc) { \
+ ALOGE("vulkan: Failed to get renderControl encoder context\n"); \
+ return VK_ERROR_DEVICE_LOST; \
+ }
+
VKAPI_ATTR
VkResult EnumerateInstanceExtensionProperties(
const char* layer_name,
uint32_t* count,
VkExtensionProperties* properties) {
+ ALOGD("%s: call from goldfish_vulkan\n", __func__);
+ VK_HOST_CONNECTION;
+
if (layer_name) {
ALOGW(
"Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
@@ -65,6 +82,7 @@
const VkAllocationCallbacks* allocator,
VkInstance* out_instance) {
ALOGD("%s: goldfish vkCreateInstance\n", __func__);
+ VK_HOST_CONNECTION;
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
diff --git a/system/vulkan_enc/VkEncoder.cpp b/system/vulkan_enc/VkEncoder.cpp
index 1d7c9c2..d3b1fb2 100644
--- a/system/vulkan_enc/VkEncoder.cpp
+++ b/system/vulkan_enc/VkEncoder.cpp
@@ -16,11 +16,16 @@
#include "IOStream.h"
#include "VulkanStream.h"
+#include "goldfish_vk_marshaling_guest.h"
+
class VkEncoder::Impl {
public:
Impl(IOStream* stream) : m_stream(stream) {
}
+
+ // do the api calls here
+
private:
goldfish_vk::VulkanStream m_stream;
};