[vulkan] Integrate with HostConnection

bug: 111137294

This pushes vulkan components downward so that we can reuse
HostConnection and the general infrastructure around it (incl. DMA) when
running Vulkan.

This has benefits, like being able to interoperate easily with
renderControl and gralloc, and not having to create qemu pipe (or some
other transport) ourselves.

- Move VulkanStream to vulkan_enc
- Move cereal as a dependency of vulkan_enc

Note that this makes VulkanStream into a class that doesnt do any real
writing or reading, but that's fine since this is an intermediate state
and we'll hook it up to IOStream later on.

Change-Id: I7dce6798f1490f7a5874da3a4213d7b5bdf71f06
diff --git a/Android.mk b/Android.mk
index 6c4986f..b14ab81 100644
--- a/Android.mk
+++ b/Android.mk
@@ -34,12 +34,17 @@
 # See the definition of emugl-begin-module in common.mk
 EMUGL_COMMON_CFLAGS := -DWITH_GLES2
 
+# Whether or not to build the Vulkan library.
+BUILD_EMULATOR_VULKAN := false
+
 # Host build
 ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
 
 GOLDFISH_OPENGL_SHOULD_BUILD := true
 GOLDFISH_OPENGL_LIB_SUFFIX := _host
 
+BUILD_EMULATOR_VULKAN := true
+
 # Set modern defaults for the codename, version, etc.
 PLATFORM_VERSION_CODENAME:=Q
 PLATFORM_SDK_VERSION:=29
@@ -58,6 +63,7 @@
     -DGL_GLEXT_PROTOTYPES \
     -fvisibility=default \
     -DPAGE_SIZE=4096 \
+    -DGOLDFISH_VULKAN \
 
 endif # GOLDFISH_OPENGL_BUILD_FOR_HOST
 
@@ -92,6 +98,11 @@
     EMUGL_COMMON_CFLAGS += -DALOGV=LOGV
 endif
 
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23 && echo isApi24OrHigher),isApi24OrHigher)
+    BUILD_EMULATOR_VULKAN := true
+    EMUGL_COMMON_CFLAGS += -DGOLDFISH_VULKAN
+endif
+
 # Include common definitions used by all the modules included later
 # in this build file. This contains the definition of all useful
 # emugl-xxxx functions.
@@ -125,6 +136,12 @@
 include $(GOLDFISH_OPENGL_PATH)/system/GLESv2_enc/Android.mk
 include $(GOLDFISH_OPENGL_PATH)/system/renderControl_enc/Android.mk
 
+ifeq (true,$(BUILD_EMULATOR_VULKAN)) # Vulkan libs
+    include $(GOLDFISH_OPENGL_PATH)/android-emu/Android.mk
+    include $(GOLDFISH_OPENGL_PATH)/system/vulkan_cereal/Android.mk
+    include $(GOLDFISH_OPENGL_PATH)/system/vulkan_enc/Android.mk
+endif
+
 include $(GOLDFISH_OPENGL_PATH)/system/OpenglSystemCommon/Android.mk
 
 # System shared libraries
@@ -135,9 +152,7 @@
 
 include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk
 
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23 && echo isApi24OrHigher),isApi24OrHigher)
-    include $(GOLDFISH_OPENGL_PATH)/android-emu/Android.mk
-    include $(GOLDFISH_OPENGL_PATH)/system/vulkan/cereal/Android.mk
+ifeq (true,$(BUILD_EMULATOR_VULKAN)) # Vulkan libs
     include $(GOLDFISH_OPENGL_PATH)/system/vulkan/Android.mk
 endif