Snap for 10214594 from 5e0871763c6ee8763d06d302c409f15e4f2411cc to sdk-release

Change-Id: I422e0776ff79acdb90463bb68a9df2bdaef200f3
diff --git a/BUILD.gn b/BUILD.gn
index 50961ab..30f65b3 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -126,7 +126,6 @@
   defines = [
     "LOG_TAG=\"goldfish_vulkan\"",
     "GFXSTREAM",
-    "ENABLE_ANDROID_HEALTHMONITOR=1",
     "GOLDFISH_NO_GL",
     "VK_GFXSTREAM_STRUCTURE_TYPE_EXT",
     "VK_USE_PLATFORM_FUCHSIA",
diff --git a/android-emu/Android.bp b/android-emu/Android.bp
index 35c440e..cec615d 100644
--- a/android-emu/Android.bp
+++ b/android-emu/Android.bp
@@ -39,7 +39,6 @@
         ".",
     ],
     cflags: [
-        "-DENABLE_ANDROID_HEALTH_MONITOR",
         "-DLOG_TAG=\"androidemu\"",
         "-Wno-missing-field-initializers",
         "-fvisibility=default",
diff --git a/host/include/libOpenglRender/IOStream.h b/host/include/libOpenglRender/IOStream.h
index 824b510..8b1f052 100644
--- a/host/include/libOpenglRender/IOStream.h
+++ b/host/include/libOpenglRender/IOStream.h
@@ -22,6 +22,8 @@
 
 #include "ErrorLog.h"
 
+namespace gfxstream {
+
 class IOStream {
 public:
 
@@ -133,6 +135,7 @@
     uint32_t m_refcount;
 };
 
+}  // namespace gfxstream
 //
 // When a client opens a connection to the renderer, it should
 // send unsigned int value indicating the "clientFlags".
diff --git a/platform/include/util.h b/platform/include/util.h
new file mode 100644
index 0000000..a0f5459
--- /dev/null
+++ b/platform/include/util.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef UTIL_H
+#define UTIL_H
+
+#define ALIGN(A, B) (((A) + (B)-1) & ~((B)-1))
+
+#endif
diff --git a/platform/include/virtgpu_gfxstream_protocol.h b/platform/include/virtgpu_gfxstream_protocol.h
index 1eb5d35..b5efd2e 100644
--- a/platform/include/virtgpu_gfxstream_protocol.h
+++ b/platform/include/virtgpu_gfxstream_protocol.h
@@ -31,8 +31,10 @@
 #define GFXSTREAM_CREATE_IMPORT_SYNC_VK         0xa001
 #define GFXSTREAM_CREATE_QSRI_EXPORT_VK         0xa002
 
+// clang-format off
 // A placeholder command to ensure virtio-gpu completes
-#define GFXSTREAM_PLACEHOLDER_COMMAND_VK 0xf002
+#define GFXSTREAM_PLACEHOLDER_COMMAND_VK        0xf002
+// clang-format on
 
 struct gfxstreamHeader {
     uint32_t opCode;
@@ -82,8 +84,9 @@
     uint32_t bufferSize;
 
     uint32_t colorBufferMemoryIndex;
-    uint32_t padding[16];
     uint32_t deferredMapping;
+    uint32_t blobAlignment;
+    uint32_t padding[15];
 };
 
 #endif
diff --git a/platform/linux/VirtGpuDevice.cpp b/platform/linux/VirtGpuDevice.cpp
index 5f25d91..9882f87 100644
--- a/platform/linux/VirtGpuDevice.cpp
+++ b/platform/linux/VirtGpuDevice.cpp
@@ -88,6 +88,10 @@
         ALOGE("DRM_IOCTL_VIRTGPU_GET_CAPS failed with %s", strerror(errno));
     }
 
+    // We always need an ASG blob in some cases, so always define blobAlignment
+    if (!mCaps.gfxstreamCapset.blobAlignment) {
+        mCaps.gfxstreamCapset.blobAlignment = 4096;
+    }
 
     ctx_set_params[0].param = VIRTGPU_CONTEXT_PARAM_NUM_RINGS;
     ctx_set_params[0].value = 2;
diff --git a/shared/OpenglCodecCommon/SocketStream.h b/shared/OpenglCodecCommon/SocketStream.h
index 3d8f5f5..3a51c8f 100644
--- a/shared/OpenglCodecCommon/SocketStream.h
+++ b/shared/OpenglCodecCommon/SocketStream.h
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include "IOStream.h"
 
-class SocketStream : public IOStream {
+class SocketStream : public gfxstream::IOStream {
 public:
     typedef enum { ERR_INVALID_SOCKET = -1000 } SocketStreamError;
 
diff --git a/shared/OpenglCodecCommon/glUtils.cpp b/shared/OpenglCodecCommon/glUtils.cpp
index 36eba6a..52d8f1a 100644
--- a/shared/OpenglCodecCommon/glUtils.cpp
+++ b/shared/OpenglCodecCommon/glUtils.cpp
@@ -20,6 +20,8 @@
 
 #include <GLES3/gl31.h>
 
+using gfxstream::IOStream;
+
 bool isSamplerType(GLenum type) {
     switch (type) {
         case GL_SAMPLER_2D:
diff --git a/system/GLESv1_enc/GLEncoder.cpp b/system/GLESv1_enc/GLEncoder.cpp
index 1ab13e3..6a6b361 100644
--- a/system/GLESv1_enc/GLEncoder.cpp
+++ b/system/GLESv1_enc/GLEncoder.cpp
@@ -19,6 +19,8 @@
 #include <assert.h>
 #include <vector>
 
+using gfxstream::IOStream;
+
 #ifndef MIN
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
diff --git a/system/GLESv1_enc/GLEncoder.h b/system/GLESv1_enc/GLEncoder.h
index 7837838..1d3378a 100644
--- a/system/GLESv1_enc/GLEncoder.h
+++ b/system/GLESv1_enc/GLEncoder.h
@@ -26,7 +26,7 @@
 class GLEncoder : public gl_encoder_context_t {
 
 public:
-    GLEncoder(IOStream *stream, ChecksumCalculator* protocol);
+    GLEncoder(gfxstream::IOStream *stream, ChecksumCalculator* protocol);
     virtual ~GLEncoder();
     void setClientState(GLClientState *state) {
         m_state = state;
diff --git a/system/GLESv1_enc/gl_enc.cpp b/system/GLESv1_enc/gl_enc.cpp
index ffa01a8..df1d7f9 100644
--- a/system/GLESv1_enc/gl_enc.cpp
+++ b/system/GLESv1_enc/gl_enc.cpp
@@ -16,6 +16,8 @@
 
 #include "EncoderDebug.h"
 
+using gfxstream::IOStream;
+
 namespace {
 
 void enc_unsupported()
diff --git a/system/GLESv1_enc/gl_enc.h b/system/GLESv1_enc/gl_enc.h
index d71964f..8d272b3 100644
--- a/system/GLESv1_enc/gl_enc.h
+++ b/system/GLESv1_enc/gl_enc.h
@@ -14,10 +14,10 @@
 
 struct gl_encoder_context_t : public gl_client_context_t {
 
-	IOStream *m_stream;
+	gfxstream::IOStream *m_stream;
 	ChecksumCalculator *m_checksumCalculator;
 
-	gl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
+	gl_encoder_context_t(gfxstream::IOStream *stream, ChecksumCalculator *checksumCalculator);
 	virtual uint64_t lockAndWriteDma(void*, uint32_t) { return 0; }
 };
 
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 162a4be..2c0321d 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -31,6 +31,8 @@
 #include <GLES3/gl3.h>
 #include <GLES3/gl31.h>
 
+using gfxstream::IOStream;
+
 #ifndef MIN
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
diff --git a/system/GLESv2_enc/GL2Encoder.h b/system/GLESv2_enc/GL2Encoder.h
index 29fe37f..e36538b 100644
--- a/system/GLESv2_enc/GL2Encoder.h
+++ b/system/GLESv2_enc/GL2Encoder.h
@@ -43,7 +43,7 @@
 
 class GL2Encoder : public gl2_encoder_context_t {
 public:
-    GL2Encoder(IOStream *stream, ChecksumCalculator* protocol);
+    GL2Encoder(gfxstream::IOStream *stream, ChecksumCalculator* protocol);
     virtual ~GL2Encoder();
     const Extensions& getExtensions() const { return m_extensions; }
     void setDrawCallFlushInterval(uint32_t interval) {
diff --git a/system/GLESv2_enc/IOStream2.cpp b/system/GLESv2_enc/IOStream2.cpp
index 2a704b7..445472c 100644
--- a/system/GLESv2_enc/IOStream2.cpp
+++ b/system/GLESv2_enc/IOStream2.cpp
@@ -8,6 +8,8 @@
 
 #include <assert.h>
 
+namespace gfxstream {
+
 void IOStream::readbackPixels(void* context, int width, int height, unsigned int format, unsigned int type, void* pixels) {
     GL2Encoder *ctx = (GL2Encoder *)context;
     assert (ctx->state() != NULL);
@@ -200,3 +202,5 @@
         }
     }
 }
+
+}  // namespace gfxstream
\ No newline at end of file
diff --git a/system/GLESv2_enc/gl2_enc.cpp b/system/GLESv2_enc/gl2_enc.cpp
index 3bc0162..2b0dc33 100644
--- a/system/GLESv2_enc/gl2_enc.cpp
+++ b/system/GLESv2_enc/gl2_enc.cpp
@@ -16,6 +16,8 @@
 
 #include "EncoderDebug.h"
 
+using gfxstream::IOStream;
+
 namespace {
 
 void enc_unsupported()
diff --git a/system/GLESv2_enc/gl2_enc.h b/system/GLESv2_enc/gl2_enc.h
index 3b175cd..501a339 100644
--- a/system/GLESv2_enc/gl2_enc.h
+++ b/system/GLESv2_enc/gl2_enc.h
@@ -15,10 +15,10 @@
 
 struct gl2_encoder_context_t : public gl2_client_context_t {
 
-	IOStream *m_stream;
+	gfxstream::IOStream *m_stream;
 	ChecksumCalculator *m_checksumCalculator;
 
-	gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
+	gl2_encoder_context_t(gfxstream::IOStream *stream, ChecksumCalculator *checksumCalculator);
 	virtual uint64_t lockAndWriteDma(void*, uint32_t) { return 0; }
 };
 
diff --git a/system/OpenglSystemCommon/AddressSpaceStream.cpp b/system/OpenglSystemCommon/AddressSpaceStream.cpp
index 23c6d7f..cb0d58a 100644
--- a/system/OpenglSystemCommon/AddressSpaceStream.cpp
+++ b/system/OpenglSystemCommon/AddressSpaceStream.cpp
@@ -17,6 +17,7 @@
 
 #include "VirtGpu.h"
 #include "aemu/base/Tracing.h"
+#include "util.h"
 #include "virtgpu_gfxstream_protocol.h"
 
 #if PLATFORM_SDK_VERSION < 26
@@ -185,17 +186,14 @@
     char* blobAddr, *bufferPtr;
     int ret;
 
-    // HACK: constants that are currently used.
-    // Ideal solution would use virtio-gpu capabilities to report both ringSize and bufferSize
-    uint32_t ringSize = 12288;
-    uint32_t bufferSize = 1048576;
-
     VirtGpuDevice& instance = VirtGpuDevice::getInstance();
+    VirtGpuCaps caps = instance.getCaps();
 
     blobCreate.blobId = 0;
     blobCreate.blobMem = kBlobMemHost3d;
     blobCreate.flags = kBlobFlagMappable;
-    blobCreate.size = ringSize + bufferSize;
+    blobCreate.size = ALIGN(caps.gfxstreamCapset.ringSize + caps.gfxstreamCapset.bufferSize,
+                            caps.gfxstreamCapset.blobAlignment);
     blob = instance.createBlob(blobCreate);
     if (!blob)
         return nullptr;
@@ -224,7 +222,7 @@
 
     bufferPtr = blobAddr + sizeof(struct asg_ring_storage);
     struct asg_context context =
-        asg_context_create(blobAddr, bufferPtr, bufferSize);
+        asg_context_create(blobAddr, bufferPtr, caps.gfxstreamCapset.bufferSize);
 
     context.ring_config->transfer_mode = 1;
     context.ring_config->host_consumed_pos = 0;
diff --git a/system/OpenglSystemCommon/AddressSpaceStream.h b/system/OpenglSystemCommon/AddressSpaceStream.h
index d2886b2..1884c2d 100644
--- a/system/OpenglSystemCommon/AddressSpaceStream.h
+++ b/system/OpenglSystemCommon/AddressSpaceStream.h
@@ -23,6 +23,7 @@
 #include "goldfish_address_space.h"
 
 using android::base::guest::HealthMonitor;
+using gfxstream::IOStream;
 
 class AddressSpaceStream;
 
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index f52e84e..9c69732 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -37,6 +37,7 @@
 using android::base::guest::CreateHealthMonitor;
 using android::base::guest::HealthMonitor;
 using android::base::guest::HealthMonitorConsumerBasic;
+using gfxstream::IOStream;
 
 #ifdef GOLDFISH_NO_GL
 struct gl_client_context_t {
@@ -556,7 +557,8 @@
             break;
         }
         case HOST_CONNECTION_VIRTIO_GPU_ADDRESS_SPACE: {
-            VirtGpuDevice& instance = VirtGpuDevice::getInstance((enum VirtGpuCapset)capset_id);
+            VirtGpuDevice& instance =
+                VirtGpuDevice::getInstance((enum VirtGpuCapset)kCapsetGfxStream);
             auto deviceHandle = instance.getDeviceHandle();
             auto stream = createVirtioGpuAddressSpaceStream(getGlobalHealthMonitor());
             if (!stream) {
diff --git a/system/OpenglSystemCommon/HostConnection.h b/system/OpenglSystemCommon/HostConnection.h
index 64f0137..0df5887 100644
--- a/system/OpenglSystemCommon/HostConnection.h
+++ b/system/OpenglSystemCommon/HostConnection.h
@@ -53,7 +53,7 @@
 // that will be used to track available emulator features.
 class ExtendedRCEncoderContext : public renderControl_encoder_context_t {
 public:
-    ExtendedRCEncoderContext(IOStream *stream, ChecksumCalculator *checksumCalculator)
+    ExtendedRCEncoderContext(gfxstream::IOStream *stream, ChecksumCalculator *checksumCalculator)
         : renderControl_encoder_context_t(stream, checksumCalculator),
           m_dmaCxt(NULL), m_dmaPtr(NULL), m_dmaPhysAddr(0) { }
     void setSyncImpl(SyncImpl syncImpl) { m_featureInfo.syncImpl = syncImpl; }
@@ -268,7 +268,7 @@
     GrallocType m_grallocType;
 
     // intrusively refcounted
-    IOStream* m_stream = nullptr;
+    gfxstream::IOStream* m_stream = nullptr;
 
     std::unique_ptr<GLEncoder> m_glEnc;
     std::unique_ptr<GL2Encoder> m_gl2Enc;
diff --git a/system/OpenglSystemCommon/QemuPipeStream.h b/system/OpenglSystemCommon/QemuPipeStream.h
index 57c85a4..b70621d 100644
--- a/system/OpenglSystemCommon/QemuPipeStream.h
+++ b/system/OpenglSystemCommon/QemuPipeStream.h
@@ -32,7 +32,7 @@
 #include <lib/zx/vmo.h>
 #endif
 
-class QemuPipeStream : public IOStream {
+class QemuPipeStream : public gfxstream::IOStream {
 public:
     typedef enum { ERR_INVALID_SOCKET = -1000 } QemuPipeStreamError;
 
diff --git a/system/OpenglSystemCommon/VirtioGpuPipeStream.h b/system/OpenglSystemCommon/VirtioGpuPipeStream.h
index 1d99c12..e446494 100644
--- a/system/OpenglSystemCommon/VirtioGpuPipeStream.h
+++ b/system/OpenglSystemCommon/VirtioGpuPipeStream.h
@@ -26,7 +26,7 @@
  * service on the host side.
  */
 
-class VirtioGpuPipeStream : public IOStream {
+class VirtioGpuPipeStream : public gfxstream::IOStream {
 public:
     typedef enum { ERR_INVALID_SOCKET = -1000 } QemuPipeStreamError;
 
diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp
index cbc7069..544225b 100644
--- a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp
+++ b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp
@@ -615,6 +615,9 @@
     mSignalledOutputEos = false;
     gettimeofday(&mTimeStart, nullptr);
     gettimeofday(&mTimeEnd, nullptr);
+    if (mOutBlock) {
+        mOutBlock.reset();
+    }
 }
 
 void C2GoldfishAvcDec::deleteContext() {
@@ -745,8 +748,8 @@
 void C2GoldfishAvcDec::checkMode(const std::shared_ptr<C2BlockPool> &pool) {
     mWidth = mIntf->width();
     mHeight = mIntf->height();
-    const bool isGraphic = (pool->getAllocatorId() & C2Allocator::GRAPHIC);
-    DDD("buffer id %d", (int)(pool->getAllocatorId()));
+    const bool isGraphic = (pool->getLocalId() == C2PlatformAllocatorStore::GRALLOC);
+    DDD("buffer pool id %x",  (int)(pool->getLocalId()));
     if (isGraphic) {
         DDD("decoding to host color buffer");
         mEnableAndroidNativeBuffers = true;
diff --git a/system/codecs/c2/decoders/avcdec/GoldfishH264Helper.cpp b/system/codecs/c2/decoders/avcdec/GoldfishH264Helper.cpp
index 077ef15..c656b90 100644
--- a/system/codecs/c2/decoders/avcdec/GoldfishH264Helper.cpp
+++ b/system/codecs/c2/decoders/avcdec/GoldfishH264Helper.cpp
@@ -19,10 +19,9 @@
 #define LOG_TAG "GoldfishH264Helper"
 #include <log/log.h>
 
-
 #define DEBUG 0
 #if DEBUG
-#define DDD(...) ALOGD(__VA_ARGS__)
+#define DDD(fmt, ...) ALOGD("%s %d:" fmt, __func__, __LINE__, ##__VA_ARGS__)
 #else
 #define DDD(...) ((void)0)
 #endif
@@ -187,10 +186,12 @@
 }
 
 bool GoldfishH264Helper::decodeHeader(const uint8_t *frame, int inSize) {
+    DDD("entering");
     // should we check the header for vps/sps/pps frame ? otherwise
     // there is no point calling decoder
     if (!isSpsFrame(frame, inSize)) {
         DDD("could not find valid vps frame");
+        DDD("leaving with false");
         return false;
     } else {
         DDD("found valid vps frame");
@@ -211,12 +212,7 @@
     setParams(mStride, IVD_DECODE_HEADER);
 
     // now kick off the decoding
-    IV_API_CALL_STATUS_T status = ivdec_api_function(mDecHandle, ps_decode_ip, ps_decode_op);
-    if (status != IV_SUCCESS) {
-        ALOGE("failed to call decoder function for header\n");
-        ALOGE("error in %s: 0x%x", __func__,
-              ps_decode_op->u4_error_code);
-    }
+    ivdec_api_function(mDecHandle, ps_decode_ip, ps_decode_op);
 
     if (IVD_RES_CHANGED == (ps_decode_op->u4_error_code & IVD_ERROR_MASK)) {
         DDD("resolution changed, reset decoder");
@@ -232,12 +228,11 @@
         if (ps_decode_op->u4_pic_wd != mWidth ||  ps_decode_op->u4_pic_ht != mHeight) {
             mWidth = ps_decode_op->u4_pic_wd;
             mHeight = ps_decode_op->u4_pic_ht;
+            DDD("leaving with true");
             return true;
         } else {
             DDD("success decode w/h, but they are the same %d %d", ps_decode_op->u4_pic_wd , ps_decode_op->u4_pic_ht);
         }
-    } else {
-        ALOGE("could not decode w/h");
     }
 
     // get output delay
@@ -250,6 +245,7 @@
         }
     }
 
+    DDD("leaving with false");
     return false;
 }
 
diff --git a/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp b/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp
index 13e9515..9c6014b 100644
--- a/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp
+++ b/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp
@@ -563,6 +563,9 @@
     mSignalledOutputEos = false;
     gettimeofday(&mTimeStart, nullptr);
     gettimeofday(&mTimeEnd, nullptr);
+    if (mOutBlock) {
+        mOutBlock.reset();
+    }
 }
 
 void C2GoldfishHevcDec::deleteContext() {
@@ -693,8 +696,8 @@
 void C2GoldfishHevcDec::checkMode(const std::shared_ptr<C2BlockPool> &pool) {
     mWidth = mIntf->width();
     mHeight = mIntf->height();
-    const bool isGraphic = (pool->getAllocatorId() & C2Allocator::GRAPHIC);
-    DDD("buffer id %d", (int)(pool->getAllocatorId()));
+    const bool isGraphic = (pool->getLocalId() == C2PlatformAllocatorStore::GRALLOC);
+    DDD("buffer pool id %x",  (int)(pool->getLocalId()));
     if (isGraphic) {
         DDD("decoding to host color buffer");
         mEnableAndroidNativeBuffers = true;
diff --git a/system/codecs/c2/decoders/vpxdec/C2GoldfishVpxDec.cpp b/system/codecs/c2/decoders/vpxdec/C2GoldfishVpxDec.cpp
index be6428e..ed2189d 100644
--- a/system/codecs/c2/decoders/vpxdec/C2GoldfishVpxDec.cpp
+++ b/system/codecs/c2/decoders/vpxdec/C2GoldfishVpxDec.cpp
@@ -495,8 +495,8 @@
     mCtx = new vpx_codec_ctx_t;
     mCtx->vpversion = mMode == MODE_VP8 ? 8 : 9;
 
-    const bool isGraphic = (pool->getAllocatorId() & C2Allocator::GRAPHIC);
-    DDD("buffer id %d", (int)(pool->getAllocatorId()));
+    const bool isGraphic = (pool->getLocalId() == C2PlatformAllocatorStore::GRALLOC);
+    DDD("buffer pool id %x",  (int)(pool->getLocalId()));
     if (isGraphic) {
         DDD("decoding to host color buffer");
         mEnableAndroidNativeBuffers = true;
diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp
index 7e34b7d..d52d627 100644
--- a/system/egl/egl.cpp
+++ b/system/egl/egl.cpp
@@ -2222,6 +2222,9 @@
         if (native_buffer->common.version != sizeof(android_native_buffer_t))
             setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
 
+        if (native_buffer->handle == NULL)
+            setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
+
         DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
         int format = grallocHelper->getFormat(native_buffer->handle);
         switch (format) {
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index 8a05abd..3ff8c84 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -27,6 +27,7 @@
 #include "debug.h"
 
 const int kOMX_COLOR_FormatYUV420Planar = 19;
+const int kC2_COLOR_FormatYCBCR_420_888 = 0x23;
 
 using ::android::hardware::hidl_handle;
 using ::android::hardware::hidl_vec;
@@ -101,7 +102,7 @@
         if (!descriptor.height) { RETURN_ERROR(Error3::UNSUPPORTED); }
         if (descriptor.layerCount != 1) { RETURN_ERROR(Error3::UNSUPPORTED); }
 
-        const uint32_t usage = descriptor.usage;
+        uint32_t usage = descriptor.usage;
 
         int bpp = 1;
         int glFormat = 0;
@@ -112,7 +113,7 @@
             EmulatorFrameworkFormat::GL_COMPATIBLE;
 
         PixelFormat format;
-        Error3 e = getBufferFormat(descriptor.format, usage, &format);
+        Error3 e = getBufferFormat(descriptor.format, &usage, &format);
         if (e != Error3::NONE) {
             ALOGE("%s:%d Unsupported format: frameworkFormat=%d, usage=%x",
                   __func__, __LINE__, descriptor.format, usage);
@@ -290,19 +291,22 @@
         }
     }
 
-    static Error3 getBufferFormat(const PixelFormat frameworkFormat,
-                                  const uint32_t usage,
+    static Error3 getBufferFormat(const PixelFormat frameworkFormat, uint32_t* pusage,
                                   PixelFormat* format) {
+        uint32_t& usage = *pusage;
         if (frameworkFormat == PixelFormat::IMPLEMENTATION_DEFINED) {
             RETURN_ERROR(Error3::UNSUPPORTED);
-        } else if (static_cast<int>(frameworkFormat) == kOMX_COLOR_FormatYUV420Planar &&
-               (usage & BufferUsage::VIDEO_DECODER)) {
+        } else if ((static_cast<int>(frameworkFormat) == kOMX_COLOR_FormatYUV420Planar ||
+                    static_cast<int>(frameworkFormat) == kC2_COLOR_FormatYCBCR_420_888) &&
+                   (usage & BufferUsage::VIDEO_DECODER)) {
             ALOGW("gralloc_alloc: Requested OMX_COLOR_FormatYUV420Planar, given "
               "YCbCr_420_888, taking experimental path. "
               "usage=%x", usage);
             *format = PixelFormat::YCBCR_420_888;
+            usage = static_cast<typeof(usage)>(usage | BufferUsage::CPU_READ_OFTEN);
+            usage = static_cast<typeof(usage)>(usage | BufferUsage::CPU_WRITE_OFTEN);
             RETURN(Error3::NONE);
-        } else  {
+        } else {
             *format = frameworkFormat;
             RETURN(Error3::NONE);
         }
diff --git a/system/hwc3/HostFrameComposer.cpp b/system/hwc3/HostFrameComposer.cpp
index 76ecf43..91590ee 100644
--- a/system/hwc3/HostFrameComposer.cpp
+++ b/system/hwc3/HostFrameComposer.cpp
@@ -487,13 +487,13 @@
       switch (layerCompositionType) {
         case Composition::CLIENT:
         case Composition::SIDEBAND:
-          ALOGI("%s: layer %" PRIu32 " CompositionType %d, fallback to client",
+          ALOGV("%s: layer %" PRIu32 " CompositionType %d, fallback to client",
                 __FUNCTION__, static_cast<uint32_t>(layer->getId()),
                 layerCompositionType);
           layerFallBackTo = Composition::CLIENT;
           break;
         case Composition::CURSOR:
-          ALOGI("%s: layer %" PRIu32 " CompositionType %d, fallback to device",
+          ALOGV("%s: layer %" PRIu32 " CompositionType %d, fallback to device",
                 __FUNCTION__, static_cast<uint32_t>(layer->getId()),
                 layerCompositionType);
           layerFallBackTo = Composition::DEVICE;
diff --git a/system/magma/magma_enc/magma_client_context.cpp b/system/magma/magma_enc/magma_client_context.cpp
index 2101949..298c11f 100644
--- a/system/magma/magma_enc/magma_client_context.cpp
+++ b/system/magma/magma_enc/magma_client_context.cpp
@@ -28,7 +28,9 @@
 	magma_connection_map_buffer = (magma_connection_map_buffer_client_proc_t) getProc("magma_connection_map_buffer", userData);
 	magma_connection_unmap_buffer = (magma_connection_unmap_buffer_client_proc_t) getProc("magma_connection_unmap_buffer", userData);
 	magma_connection_execute_command = (magma_connection_execute_command_client_proc_t) getProc("magma_connection_execute_command", userData);
+	magma_connection_execute_command_fudge = (magma_connection_execute_command_fudge_client_proc_t) getProc("magma_connection_execute_command_fudge", userData);
 	magma_connection_execute_immediate_commands = (magma_connection_execute_immediate_commands_client_proc_t) getProc("magma_connection_execute_immediate_commands", userData);
+	magma_connection_execute_immediate_commands_fudge = (magma_connection_execute_immediate_commands_fudge_client_proc_t) getProc("magma_connection_execute_immediate_commands_fudge", userData);
 	magma_connection_flush = (magma_connection_flush_client_proc_t) getProc("magma_connection_flush", userData);
 	magma_connection_get_notification_channel_handle = (magma_connection_get_notification_channel_handle_client_proc_t) getProc("magma_connection_get_notification_channel_handle", userData);
 	magma_connection_read_notification_channel = (magma_connection_read_notification_channel_client_proc_t) getProc("magma_connection_read_notification_channel", userData);
@@ -36,6 +38,7 @@
 	magma_buffer_set_cache_policy = (magma_buffer_set_cache_policy_client_proc_t) getProc("magma_buffer_set_cache_policy", userData);
 	magma_buffer_get_cache_policy = (magma_buffer_get_cache_policy_client_proc_t) getProc("magma_buffer_get_cache_policy", userData);
 	magma_buffer_set_name = (magma_buffer_set_name_client_proc_t) getProc("magma_buffer_set_name", userData);
+	magma_buffer_set_name_fudge = (magma_buffer_set_name_fudge_client_proc_t) getProc("magma_buffer_set_name_fudge", userData);
 	magma_buffer_get_info = (magma_buffer_get_info_client_proc_t) getProc("magma_buffer_get_info", userData);
 	magma_buffer_get_handle = (magma_buffer_get_handle_client_proc_t) getProc("magma_buffer_get_handle", userData);
 	magma_buffer_export = (magma_buffer_export_client_proc_t) getProc("magma_buffer_export", userData);
diff --git a/system/magma/magma_enc/magma_client_context.h b/system/magma/magma_enc/magma_client_context.h
index 3b140a4..7502894 100644
--- a/system/magma/magma_enc/magma_client_context.h
+++ b/system/magma/magma_enc/magma_client_context.h
@@ -28,7 +28,9 @@
 	magma_connection_map_buffer_client_proc_t magma_connection_map_buffer;
 	magma_connection_unmap_buffer_client_proc_t magma_connection_unmap_buffer;
 	magma_connection_execute_command_client_proc_t magma_connection_execute_command;
+	magma_connection_execute_command_fudge_client_proc_t magma_connection_execute_command_fudge;
 	magma_connection_execute_immediate_commands_client_proc_t magma_connection_execute_immediate_commands;
+	magma_connection_execute_immediate_commands_fudge_client_proc_t magma_connection_execute_immediate_commands_fudge;
 	magma_connection_flush_client_proc_t magma_connection_flush;
 	magma_connection_get_notification_channel_handle_client_proc_t magma_connection_get_notification_channel_handle;
 	magma_connection_read_notification_channel_client_proc_t magma_connection_read_notification_channel;
@@ -36,6 +38,7 @@
 	magma_buffer_set_cache_policy_client_proc_t magma_buffer_set_cache_policy;
 	magma_buffer_get_cache_policy_client_proc_t magma_buffer_get_cache_policy;
 	magma_buffer_set_name_client_proc_t magma_buffer_set_name;
+	magma_buffer_set_name_fudge_client_proc_t magma_buffer_set_name_fudge;
 	magma_buffer_get_info_client_proc_t magma_buffer_get_info;
 	magma_buffer_get_handle_client_proc_t magma_buffer_get_handle;
 	magma_buffer_export_client_proc_t magma_buffer_export;
diff --git a/system/magma/magma_enc/magma_client_proc.h b/system/magma/magma_enc/magma_client_proc.h
index 85711a1..8d68f36 100644
--- a/system/magma/magma_enc/magma_client_proc.h
+++ b/system/magma/magma_enc/magma_client_proc.h
@@ -29,16 +29,19 @@
 typedef magma_status_t (magma_APIENTRY *magma_connection_perform_buffer_op_client_proc_t) (void * ctx, magma_connection_t, magma_buffer_t, uint32_t, uint64_t, uint64_t);
 typedef magma_status_t (magma_APIENTRY *magma_connection_map_buffer_client_proc_t) (void * ctx, magma_connection_t, uint64_t, magma_buffer_t, uint64_t, uint64_t, uint64_t);
 typedef void (magma_APIENTRY *magma_connection_unmap_buffer_client_proc_t) (void * ctx, magma_connection_t, uint64_t, magma_buffer_t);
-typedef magma_status_t (magma_APIENTRY *magma_connection_execute_command_client_proc_t) (void * ctx, uint64_t*, uint64_t);
-typedef magma_status_t (magma_APIENTRY *magma_connection_execute_immediate_commands_client_proc_t) (void * ctx, uint64_t*, uint64_t);
+typedef magma_status_t (magma_APIENTRY *magma_connection_execute_command_client_proc_t) (void * ctx, magma_connection_t, uint32_t, magma_command_descriptor_t*);
+typedef magma_status_t (magma_APIENTRY *magma_connection_execute_command_fudge_client_proc_t) (void * ctx, magma_connection_t, uint32_t, void*, uint64_t);
+typedef magma_status_t (magma_APIENTRY *magma_connection_execute_immediate_commands_client_proc_t) (void * ctx, magma_connection_t, uint32_t, uint64_t, magma_inline_command_buffer_t*);
+typedef magma_status_t (magma_APIENTRY *magma_connection_execute_immediate_commands_fudge_client_proc_t) (void * ctx, magma_connection_t, uint32_t, uint64_t, void*, uint64_t, uint64_t*);
 typedef magma_status_t (magma_APIENTRY *magma_connection_flush_client_proc_t) (void * ctx, magma_connection_t);
 typedef magma_handle_t (magma_APIENTRY *magma_connection_get_notification_channel_handle_client_proc_t) (void * ctx, magma_connection_t);
 typedef magma_status_t (magma_APIENTRY *magma_connection_read_notification_channel_client_proc_t) (void * ctx, magma_connection_t, void*, uint64_t, uint64_t*, magma_bool_t*);
 typedef magma_status_t (magma_APIENTRY *magma_buffer_clean_cache_client_proc_t) (void * ctx, magma_buffer_t, uint64_t, uint64_t, magma_cache_operation_t);
 typedef magma_status_t (magma_APIENTRY *magma_buffer_set_cache_policy_client_proc_t) (void * ctx, magma_buffer_t, magma_cache_policy_t);
 typedef magma_status_t (magma_APIENTRY *magma_buffer_get_cache_policy_client_proc_t) (void * ctx, magma_buffer_t, magma_cache_policy_t*);
-typedef magma_status_t (magma_APIENTRY *magma_buffer_set_name_client_proc_t) (void * ctx, magma_buffer_t, void*, uint64_t);
-typedef magma_status_t (magma_APIENTRY *magma_buffer_get_info_client_proc_t) (void * ctx, uint64_t*, uint64_t);
+typedef magma_status_t (magma_APIENTRY *magma_buffer_set_name_client_proc_t) (void * ctx, magma_buffer_t, const char*);
+typedef magma_status_t (magma_APIENTRY *magma_buffer_set_name_fudge_client_proc_t) (void * ctx, magma_buffer_t, void*, uint64_t);
+typedef magma_status_t (magma_APIENTRY *magma_buffer_get_info_client_proc_t) (void * ctx, magma_buffer_t, magma_buffer_info_t*);
 typedef magma_status_t (magma_APIENTRY *magma_buffer_get_handle_client_proc_t) (void * ctx, magma_buffer_t, magma_handle_t*);
 typedef magma_status_t (magma_APIENTRY *magma_buffer_export_client_proc_t) (void * ctx, magma_buffer_t, magma_handle_t*);
 typedef void (magma_APIENTRY *magma_semaphore_signal_client_proc_t) (void * ctx, magma_semaphore_t);
@@ -51,13 +54,13 @@
 typedef magma_status_t (magma_APIENTRY *magma_connection_enable_performance_counters_client_proc_t) (void * ctx, magma_connection_t, uint64_t*, uint64_t);
 typedef magma_status_t (magma_APIENTRY *magma_connection_create_performance_counter_buffer_pool_client_proc_t) (void * ctx, magma_connection_t, magma_perf_count_pool_t*, magma_handle_t*);
 typedef magma_status_t (magma_APIENTRY *magma_connection_release_performance_counter_buffer_pool_client_proc_t) (void * ctx, magma_connection_t, magma_perf_count_pool_t);
-typedef magma_status_t (magma_APIENTRY *magma_connection_add_performance_counter_buffer_offsets_to_pool_client_proc_t) (void * ctx, uint64_t*, uint64_t);
+typedef magma_status_t (magma_APIENTRY *magma_connection_add_performance_counter_buffer_offsets_to_pool_client_proc_t) (void * ctx, magma_connection_t, magma_perf_count_pool_t, const magma_buffer_offset_t*, uint64_t);
 typedef magma_status_t (magma_APIENTRY *magma_connection_remove_performance_counter_buffer_from_pool_client_proc_t) (void * ctx, magma_connection_t, magma_perf_count_pool_t, magma_buffer_t);
 typedef magma_status_t (magma_APIENTRY *magma_connection_dump_performance_counters_client_proc_t) (void * ctx, magma_connection_t, magma_perf_count_pool_t, uint32_t);
 typedef magma_status_t (magma_APIENTRY *magma_connection_clear_performance_counters_client_proc_t) (void * ctx, magma_connection_t, uint64_t*, uint64_t);
 typedef magma_status_t (magma_APIENTRY *magma_connection_read_performance_counter_completion_client_proc_t) (void * ctx, magma_connection_t, magma_perf_count_pool_t, uint32_t*, uint64_t*, uint32_t*, uint64_t*, uint32_t*);
-typedef magma_status_t (magma_APIENTRY *magma_virt_connection_create_image_client_proc_t) (void * ctx, uint64_t*, uint64_t);
-typedef magma_status_t (magma_APIENTRY *magma_virt_connection_get_image_info_client_proc_t) (void * ctx, uint64_t*, uint64_t);
+typedef magma_status_t (magma_APIENTRY *magma_virt_connection_create_image_client_proc_t) (void * ctx, magma_connection_t, magma_image_create_info_t*, uint64_t*, magma_buffer_t*, magma_buffer_id_t*);
+typedef magma_status_t (magma_APIENTRY *magma_virt_connection_get_image_info_client_proc_t) (void * ctx, magma_connection_t, magma_buffer_t, magma_image_info_t*);
 
 
 #endif
diff --git a/system/magma/magma_enc/magma_enc.cpp b/system/magma/magma_enc/magma_enc.cpp
index a8e807f..4b41c12 100644
--- a/system/magma/magma_enc/magma_enc.cpp
+++ b/system/magma/magma_enc/magma_enc.cpp
@@ -18,6 +18,8 @@
 
 #include "EncoderDebug.h"
 
+using gfxstream::IOStream;
+
 namespace {
 
 void enc_unsupported()
@@ -27,7 +29,7 @@
 
 magma_status_t magma_device_import_enc(void *self , magma_handle_t device_channel, magma_device_t* device_out)
 {
-	ENCODER_DEBUG_LOG("magma_device_import(device_channel:0x%x, device_out:%p)", device_channel, device_out);
+	ENCODER_DEBUG_LOG("magma_device_import(device_channel:%u, device_out:%p)", device_channel, device_out);
 	AEMU_SCOPED_TRACE("magma_device_import encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -423,7 +425,7 @@
 
 magma_status_t magma_connection_import_buffer_enc(void *self , magma_connection_t connection, magma_handle_t buffer_handle, uint64_t* size_out, magma_buffer_t* buffer_out, magma_buffer_id_t* id_out)
 {
-	ENCODER_DEBUG_LOG("magma_connection_import_buffer(connection:%lu, buffer_handle:0x%x, size_out:%p, buffer_out:%p, id_out:%p)", connection, buffer_handle, size_out, buffer_out, id_out);
+	ENCODER_DEBUG_LOG("magma_connection_import_buffer(connection:%lu, buffer_handle:%u, size_out:%p, buffer_out:%p, id_out:%p)", connection, buffer_handle, size_out, buffer_out, id_out);
 	AEMU_SCOPED_TRACE("magma_connection_import_buffer encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -556,7 +558,7 @@
 
 magma_status_t magma_connection_import_semaphore_enc(void *self , magma_connection_t connection, magma_handle_t semaphore_handle, magma_semaphore_t* semaphore_out, magma_semaphore_id_t* id_out)
 {
-	ENCODER_DEBUG_LOG("magma_connection_import_semaphore(connection:%lu, semaphore_handle:0x%x, semaphore_out:%p, id_out:%p)", connection, semaphore_handle, semaphore_out, id_out);
+	ENCODER_DEBUG_LOG("magma_connection_import_semaphore(connection:%lu, semaphore_handle:%u, semaphore_out:%p, id_out:%p)", connection, semaphore_handle, semaphore_out, id_out);
 	AEMU_SCOPED_TRACE("magma_connection_import_semaphore encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -727,9 +729,9 @@
 
 }
 
-magma_status_t magma_connection_execute_command_enc(void *self , uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_connection_execute_command_enc(void *self , magma_connection_t connection, uint32_t context_id, magma_command_descriptor_t* descriptor)
 {
-	ENCODER_DEBUG_LOG("magma_connection_execute_command(parameters:%p, parameter_count:%lu)", parameters, parameter_count);
+	ENCODER_DEBUG_LOG("magma_connection_execute_command(connection:%lu, context_id:%u, descriptor:%p)", connection, context_id, descriptor);
 	AEMU_SCOPED_TRACE("magma_connection_execute_command encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -737,10 +739,10 @@
 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
 	bool useChecksum = checksumCalculator->getVersion() > 0;
 
-	const unsigned int __size_parameters =  parameter_count * sizeof(uint64_t);
+	const unsigned int __size_descriptor =  sizeof(magma_command_descriptor_t);
 	 unsigned char *ptr;
 	 unsigned char *buf;
-	 const size_t sizeWithoutChecksum = 8 + __size_parameters + 8 + 1*4;
+	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + __size_descriptor + 1*4;
 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
 	buf = stream->alloc(totalSize);
@@ -748,15 +750,14 @@
 	int tmp = OP_magma_connection_execute_command;memcpy(ptr, &tmp, 4); ptr += 4;
 	memcpy(ptr, &totalSize, 4);  ptr += 4;
 
-	memcpy(ptr, &__size_parameters, 4); ptr += 4;
-	memcpy(ptr, parameters, __size_parameters);ptr += __size_parameters;
-		memcpy(ptr, &parameter_count, 8); ptr += 8;
+		memcpy(ptr, &connection, 8); ptr += 8;
+		memcpy(ptr, &context_id, 4); ptr += 4;
+	memcpy(ptr, &__size_descriptor, 4); ptr += 4;
+	memcpy(ptr, descriptor, __size_descriptor);ptr += __size_descriptor;
 
 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
 
-	stream->readback(parameters, __size_parameters);
-	if (useChecksum) checksumCalculator->addBuffer(parameters, __size_parameters);
 
 	magma_status_t retval;
 	stream->readback(&retval, 4);
@@ -774,9 +775,56 @@
 	return retval;
 }
 
-magma_status_t magma_connection_execute_immediate_commands_enc(void *self , uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_connection_execute_command_fudge_enc(void *self , magma_connection_t connection, uint32_t context_id, void* descriptor, uint64_t descriptor_size)
 {
-	ENCODER_DEBUG_LOG("magma_connection_execute_immediate_commands(parameters:%p, parameter_count:%lu)", parameters, parameter_count);
+	ENCODER_DEBUG_LOG("magma_connection_execute_command_fudge(connection:%lu, context_id:%u, descriptor:%p, descriptor_size:%lu)", connection, context_id, descriptor, descriptor_size);
+	AEMU_SCOPED_TRACE("magma_connection_execute_command_fudge encode");
+
+	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
+	IOStream *stream = ctx->m_stream;
+	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+	bool useChecksum = checksumCalculator->getVersion() > 0;
+
+	const unsigned int __size_descriptor =  descriptor_size;
+	 unsigned char *ptr;
+	 unsigned char *buf;
+	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + __size_descriptor + 8 + 1*4;
+	 const size_t checksumSize = checksumCalculator->checksumByteSize();
+	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
+	buf = stream->alloc(totalSize);
+	ptr = buf;
+	int tmp = OP_magma_connection_execute_command_fudge;memcpy(ptr, &tmp, 4); ptr += 4;
+	memcpy(ptr, &totalSize, 4);  ptr += 4;
+
+		memcpy(ptr, &connection, 8); ptr += 8;
+		memcpy(ptr, &context_id, 4); ptr += 4;
+	memcpy(ptr, &__size_descriptor, 4); ptr += 4;
+	memcpy(ptr, descriptor, __size_descriptor);ptr += __size_descriptor;
+		memcpy(ptr, &descriptor_size, 8); ptr += 8;
+
+	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+
+	magma_status_t retval;
+	stream->readback(&retval, 4);
+	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
+	if (useChecksum) {
+		unsigned char *checksumBufPtr = NULL;
+		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
+		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
+		stream->readback(checksumBufPtr, checksumSize);
+		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
+			ALOGE("magma_connection_execute_command_fudge: GL communication error, please report this issue to b.android.com.\n");
+			abort();
+		}
+	}
+	return retval;
+}
+
+magma_status_t magma_connection_execute_immediate_commands_enc(void *self , magma_connection_t connection, uint32_t context_id, uint64_t command_count, magma_inline_command_buffer_t* command_buffers)
+{
+	ENCODER_DEBUG_LOG("magma_connection_execute_immediate_commands(connection:%lu, context_id:%u, command_count:%lu, command_buffers:%p)", connection, context_id, command_count, command_buffers);
 	AEMU_SCOPED_TRACE("magma_connection_execute_immediate_commands encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -784,10 +832,10 @@
 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
 	bool useChecksum = checksumCalculator->getVersion() > 0;
 
-	const unsigned int __size_parameters =  parameter_count * sizeof(uint64_t);
+	const unsigned int __size_command_buffers =  command_count * sizeof(magma_inline_command_buffer_t);
 	 unsigned char *ptr;
 	 unsigned char *buf;
-	 const size_t sizeWithoutChecksum = 8 + __size_parameters + 8 + 1*4;
+	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8 + __size_command_buffers + 1*4;
 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
 	buf = stream->alloc(totalSize);
@@ -795,15 +843,15 @@
 	int tmp = OP_magma_connection_execute_immediate_commands;memcpy(ptr, &tmp, 4); ptr += 4;
 	memcpy(ptr, &totalSize, 4);  ptr += 4;
 
-	memcpy(ptr, &__size_parameters, 4); ptr += 4;
-	memcpy(ptr, parameters, __size_parameters);ptr += __size_parameters;
-		memcpy(ptr, &parameter_count, 8); ptr += 8;
+		memcpy(ptr, &connection, 8); ptr += 8;
+		memcpy(ptr, &context_id, 4); ptr += 4;
+		memcpy(ptr, &command_count, 8); ptr += 8;
+	memcpy(ptr, &__size_command_buffers, 4); ptr += 4;
+	memcpy(ptr, command_buffers, __size_command_buffers);ptr += __size_command_buffers;
 
 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
 
-	stream->readback(parameters, __size_parameters);
-	if (useChecksum) checksumCalculator->addBuffer(parameters, __size_parameters);
 
 	magma_status_t retval;
 	stream->readback(&retval, 4);
@@ -821,6 +869,57 @@
 	return retval;
 }
 
+magma_status_t magma_connection_execute_immediate_commands_fudge_enc(void *self , magma_connection_t connection, uint32_t context_id, uint64_t command_count, void* command_buffers, uint64_t command_buffers_size, uint64_t* command_buffer_offsets)
+{
+	ENCODER_DEBUG_LOG("magma_connection_execute_immediate_commands_fudge(connection:%lu, context_id:%u, command_count:%lu, command_buffers:%p, command_buffers_size:%lu, command_buffer_offsets:%p)", connection, context_id, command_count, command_buffers, command_buffers_size, command_buffer_offsets);
+	AEMU_SCOPED_TRACE("magma_connection_execute_immediate_commands_fudge encode");
+
+	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
+	IOStream *stream = ctx->m_stream;
+	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+	bool useChecksum = checksumCalculator->getVersion() > 0;
+
+	const unsigned int __size_command_buffers =  command_buffers_size;
+	const unsigned int __size_command_buffer_offsets =  command_count * sizeof(uint64_t);
+	 unsigned char *ptr;
+	 unsigned char *buf;
+	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8 + __size_command_buffers + 8 + __size_command_buffer_offsets + 2*4;
+	 const size_t checksumSize = checksumCalculator->checksumByteSize();
+	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
+	buf = stream->alloc(totalSize);
+	ptr = buf;
+	int tmp = OP_magma_connection_execute_immediate_commands_fudge;memcpy(ptr, &tmp, 4); ptr += 4;
+	memcpy(ptr, &totalSize, 4);  ptr += 4;
+
+		memcpy(ptr, &connection, 8); ptr += 8;
+		memcpy(ptr, &context_id, 4); ptr += 4;
+		memcpy(ptr, &command_count, 8); ptr += 8;
+	memcpy(ptr, &__size_command_buffers, 4); ptr += 4;
+	memcpy(ptr, command_buffers, __size_command_buffers);ptr += __size_command_buffers;
+		memcpy(ptr, &command_buffers_size, 8); ptr += 8;
+	memcpy(ptr, &__size_command_buffer_offsets, 4); ptr += 4;
+	memcpy(ptr, command_buffer_offsets, __size_command_buffer_offsets);ptr += __size_command_buffer_offsets;
+
+	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+
+	magma_status_t retval;
+	stream->readback(&retval, 4);
+	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
+	if (useChecksum) {
+		unsigned char *checksumBufPtr = NULL;
+		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
+		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
+		stream->readback(checksumBufPtr, checksumSize);
+		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
+			ALOGE("magma_connection_execute_immediate_commands_fudge: GL communication error, please report this issue to b.android.com.\n");
+			abort();
+		}
+	}
+	return retval;
+}
+
 magma_status_t magma_connection_flush_enc(void *self , magma_connection_t connection)
 {
 	ENCODER_DEBUG_LOG("magma_connection_flush(connection:%lu)", connection);
@@ -962,7 +1061,7 @@
 
 magma_status_t magma_buffer_clean_cache_enc(void *self , magma_buffer_t buffer, uint64_t offset, uint64_t size, magma_cache_operation_t operation)
 {
-	ENCODER_DEBUG_LOG("magma_buffer_clean_cache(buffer:%lu, offset:%lu, size:%lu, operation:%d)", buffer, offset, size, operation);
+	ENCODER_DEBUG_LOG("magma_buffer_clean_cache(buffer:%lu, offset:%lu, size:%lu, operation:%u)", buffer, offset, size, operation);
 	AEMU_SCOPED_TRACE("magma_buffer_clean_cache encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1007,7 +1106,7 @@
 
 magma_status_t magma_buffer_set_cache_policy_enc(void *self , magma_buffer_t buffer, magma_cache_policy_t policy)
 {
-	ENCODER_DEBUG_LOG("magma_buffer_set_cache_policy(buffer:%lu, policy:%d)", buffer, policy);
+	ENCODER_DEBUG_LOG("magma_buffer_set_cache_policy(buffer:%lu, policy:%u)", buffer, policy);
 	AEMU_SCOPED_TRACE("magma_buffer_set_cache_policy encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1094,9 +1193,9 @@
 	return retval;
 }
 
-magma_status_t magma_buffer_set_name_enc(void *self , magma_buffer_t buffer, void* name, uint64_t name_size)
+magma_status_t magma_buffer_set_name_enc(void *self , magma_buffer_t buffer, const char* name)
 {
-	ENCODER_DEBUG_LOG("magma_buffer_set_name(buffer:%lu, name:%p, name_size:%lu)", buffer, name, name_size);
+	ENCODER_DEBUG_LOG("magma_buffer_set_name(buffer:%lu, name:%p)", buffer, name);
 	AEMU_SCOPED_TRACE("magma_buffer_set_name encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1104,10 +1203,10 @@
 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
 	bool useChecksum = checksumCalculator->getVersion() > 0;
 
-	const unsigned int __size_name =  name_size;
+	const unsigned int __size_name =  1;
 	 unsigned char *ptr;
 	 unsigned char *buf;
-	 const size_t sizeWithoutChecksum = 8 + 8 + __size_name + 8 + 1*4;
+	 const size_t sizeWithoutChecksum = 8 + 8 + __size_name + 1*4;
 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
 	buf = stream->alloc(totalSize);
@@ -1118,7 +1217,6 @@
 		memcpy(ptr, &buffer, 8); ptr += 8;
 	memcpy(ptr, &__size_name, 4); ptr += 4;
 	memcpy(ptr, name, __size_name);ptr += __size_name;
-		memcpy(ptr, &name_size, 8); ptr += 8;
 
 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
@@ -1140,9 +1238,55 @@
 	return retval;
 }
 
-magma_status_t magma_buffer_get_info_enc(void *self , uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_buffer_set_name_fudge_enc(void *self , magma_buffer_t buffer, void* name, uint64_t name_size)
 {
-	ENCODER_DEBUG_LOG("magma_buffer_get_info(parameters:%p, parameter_count:%lu)", parameters, parameter_count);
+	ENCODER_DEBUG_LOG("magma_buffer_set_name_fudge(buffer:%lu, name:%p, name_size:%lu)", buffer, name, name_size);
+	AEMU_SCOPED_TRACE("magma_buffer_set_name_fudge encode");
+
+	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
+	IOStream *stream = ctx->m_stream;
+	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+	bool useChecksum = checksumCalculator->getVersion() > 0;
+
+	const unsigned int __size_name =  name_size;
+	 unsigned char *ptr;
+	 unsigned char *buf;
+	 const size_t sizeWithoutChecksum = 8 + 8 + __size_name + 8 + 1*4;
+	 const size_t checksumSize = checksumCalculator->checksumByteSize();
+	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
+	buf = stream->alloc(totalSize);
+	ptr = buf;
+	int tmp = OP_magma_buffer_set_name_fudge;memcpy(ptr, &tmp, 4); ptr += 4;
+	memcpy(ptr, &totalSize, 4);  ptr += 4;
+
+		memcpy(ptr, &buffer, 8); ptr += 8;
+	memcpy(ptr, &__size_name, 4); ptr += 4;
+	memcpy(ptr, name, __size_name);ptr += __size_name;
+		memcpy(ptr, &name_size, 8); ptr += 8;
+
+	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+
+	magma_status_t retval;
+	stream->readback(&retval, 4);
+	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
+	if (useChecksum) {
+		unsigned char *checksumBufPtr = NULL;
+		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
+		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
+		stream->readback(checksumBufPtr, checksumSize);
+		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
+			ALOGE("magma_buffer_set_name_fudge: GL communication error, please report this issue to b.android.com.\n");
+			abort();
+		}
+	}
+	return retval;
+}
+
+magma_status_t magma_buffer_get_info_enc(void *self , magma_buffer_t buffer, magma_buffer_info_t* info_out)
+{
+	ENCODER_DEBUG_LOG("magma_buffer_get_info(buffer:%lu, info_out:%p)", buffer, info_out);
 	AEMU_SCOPED_TRACE("magma_buffer_get_info encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1150,10 +1294,10 @@
 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
 	bool useChecksum = checksumCalculator->getVersion() > 0;
 
-	const unsigned int __size_parameters =  parameter_count * sizeof(uint64_t);
+	const unsigned int __size_info_out =  sizeof(magma_buffer_info);
 	 unsigned char *ptr;
 	 unsigned char *buf;
-	 const size_t sizeWithoutChecksum = 8 + __size_parameters + 8 + 1*4;
+	 const size_t sizeWithoutChecksum = 8 + 8 + 0 + 1*4;
 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
 	buf = stream->alloc(totalSize);
@@ -1161,15 +1305,14 @@
 	int tmp = OP_magma_buffer_get_info;memcpy(ptr, &tmp, 4); ptr += 4;
 	memcpy(ptr, &totalSize, 4);  ptr += 4;
 
-	memcpy(ptr, &__size_parameters, 4); ptr += 4;
-	memcpy(ptr, parameters, __size_parameters);ptr += __size_parameters;
-		memcpy(ptr, &parameter_count, 8); ptr += 8;
+		memcpy(ptr, &buffer, 8); ptr += 8;
+	memcpy(ptr, &__size_info_out, 4); ptr += 4;
 
 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
 
-	stream->readback(parameters, __size_parameters);
-	if (useChecksum) checksumCalculator->addBuffer(parameters, __size_parameters);
+	stream->readback(info_out, __size_info_out);
+	if (useChecksum) checksumCalculator->addBuffer(info_out, __size_info_out);
 
 	magma_status_t retval;
 	stream->readback(&retval, 4);
@@ -1429,7 +1572,7 @@
 
 magma_status_t magma_initialize_tracing_enc(void *self , magma_handle_t channel)
 {
-	ENCODER_DEBUG_LOG("magma_initialize_tracing(channel:0x%x)", channel);
+	ENCODER_DEBUG_LOG("magma_initialize_tracing(channel:%u)", channel);
 	AEMU_SCOPED_TRACE("magma_initialize_tracing encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1471,7 +1614,7 @@
 
 magma_status_t magma_initialize_logging_enc(void *self , magma_handle_t channel)
 {
-	ENCODER_DEBUG_LOG("magma_initialize_logging(channel:0x%x)", channel);
+	ENCODER_DEBUG_LOG("magma_initialize_logging(channel:%u)", channel);
 	AEMU_SCOPED_TRACE("magma_initialize_logging encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1513,7 +1656,7 @@
 
 magma_status_t magma_connection_enable_performance_counter_access_enc(void *self , magma_connection_t connection, magma_handle_t channel)
 {
-	ENCODER_DEBUG_LOG("magma_connection_enable_performance_counter_access(connection:%lu, channel:0x%x)", connection, channel);
+	ENCODER_DEBUG_LOG("magma_connection_enable_performance_counter_access(connection:%lu, channel:%u)", connection, channel);
 	AEMU_SCOPED_TRACE("magma_connection_enable_performance_counter_access encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1693,9 +1836,9 @@
 	return retval;
 }
 
-magma_status_t magma_connection_add_performance_counter_buffer_offsets_to_pool_enc(void *self , uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_connection_add_performance_counter_buffer_offsets_to_pool_enc(void *self , magma_connection_t connection, magma_perf_count_pool_t pool_id, const magma_buffer_offset_t* offsets, uint64_t offsets_count)
 {
-	ENCODER_DEBUG_LOG("magma_connection_add_performance_counter_buffer_offsets_to_pool(parameters:%p, parameter_count:%lu)", parameters, parameter_count);
+	ENCODER_DEBUG_LOG("magma_connection_add_performance_counter_buffer_offsets_to_pool(connection:%lu, pool_id:%lu, offsets:%p, offsets_count:%lu)", connection, pool_id, offsets, offsets_count);
 	AEMU_SCOPED_TRACE("magma_connection_add_performance_counter_buffer_offsets_to_pool encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1703,10 +1846,10 @@
 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
 	bool useChecksum = checksumCalculator->getVersion() > 0;
 
-	const unsigned int __size_parameters =  parameter_count * sizeof(uint64_t);
+	const unsigned int __size_offsets =  offsets_count * sizeof(magma_buffer_offset_t);
 	 unsigned char *ptr;
 	 unsigned char *buf;
-	 const size_t sizeWithoutChecksum = 8 + __size_parameters + 8 + 1*4;
+	 const size_t sizeWithoutChecksum = 8 + 8 + 8 + __size_offsets + 8 + 1*4;
 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
 	buf = stream->alloc(totalSize);
@@ -1714,15 +1857,15 @@
 	int tmp = OP_magma_connection_add_performance_counter_buffer_offsets_to_pool;memcpy(ptr, &tmp, 4); ptr += 4;
 	memcpy(ptr, &totalSize, 4);  ptr += 4;
 
-	memcpy(ptr, &__size_parameters, 4); ptr += 4;
-	memcpy(ptr, parameters, __size_parameters);ptr += __size_parameters;
-		memcpy(ptr, &parameter_count, 8); ptr += 8;
+		memcpy(ptr, &connection, 8); ptr += 8;
+		memcpy(ptr, &pool_id, 8); ptr += 8;
+	memcpy(ptr, &__size_offsets, 4); ptr += 4;
+	memcpy(ptr, offsets, __size_offsets);ptr += __size_offsets;
+		memcpy(ptr, &offsets_count, 8); ptr += 8;
 
 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
 
-	stream->readback(parameters, __size_parameters);
-	if (useChecksum) checksumCalculator->addBuffer(parameters, __size_parameters);
 
 	magma_status_t retval;
 	stream->readback(&retval, 4);
@@ -1937,9 +2080,9 @@
 	return retval;
 }
 
-magma_status_t magma_virt_connection_create_image_enc(void *self , uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_virt_connection_create_image_enc(void *self , magma_connection_t connection, magma_image_create_info_t* create_info, uint64_t* size_out, magma_buffer_t* image_out, magma_buffer_id_t* buffer_id_out)
 {
-	ENCODER_DEBUG_LOG("magma_virt_connection_create_image(parameters:%p, parameter_count:%lu)", parameters, parameter_count);
+	ENCODER_DEBUG_LOG("magma_virt_connection_create_image(connection:%lu, create_info:%p, size_out:%p, image_out:%p, buffer_id_out:%p)", connection, create_info, size_out, image_out, buffer_id_out);
 	AEMU_SCOPED_TRACE("magma_virt_connection_create_image encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1947,10 +2090,13 @@
 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
 	bool useChecksum = checksumCalculator->getVersion() > 0;
 
-	const unsigned int __size_parameters =  parameter_count * sizeof(uint64_t);
+	const unsigned int __size_create_info =  sizeof(magma_image_create_info_t);
+	const unsigned int __size_size_out =  sizeof(uint64_t);
+	const unsigned int __size_image_out =  sizeof(magma_buffer_t);
+	const unsigned int __size_buffer_id_out =  sizeof(magma_buffer_id_t);
 	 unsigned char *ptr;
 	 unsigned char *buf;
-	 const size_t sizeWithoutChecksum = 8 + __size_parameters + 8 + 1*4;
+	 const size_t sizeWithoutChecksum = 8 + 8 + __size_create_info + 0 + 0 + 0 + 4*4;
 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
 	buf = stream->alloc(totalSize);
@@ -1958,15 +2104,22 @@
 	int tmp = OP_magma_virt_connection_create_image;memcpy(ptr, &tmp, 4); ptr += 4;
 	memcpy(ptr, &totalSize, 4);  ptr += 4;
 
-	memcpy(ptr, &__size_parameters, 4); ptr += 4;
-	memcpy(ptr, parameters, __size_parameters);ptr += __size_parameters;
-		memcpy(ptr, &parameter_count, 8); ptr += 8;
+		memcpy(ptr, &connection, 8); ptr += 8;
+	memcpy(ptr, &__size_create_info, 4); ptr += 4;
+	memcpy(ptr, create_info, __size_create_info);ptr += __size_create_info;
+	memcpy(ptr, &__size_size_out, 4); ptr += 4;
+	memcpy(ptr, &__size_image_out, 4); ptr += 4;
+	memcpy(ptr, &__size_buffer_id_out, 4); ptr += 4;
 
 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
 
-	stream->readback(parameters, __size_parameters);
-	if (useChecksum) checksumCalculator->addBuffer(parameters, __size_parameters);
+	stream->readback(size_out, __size_size_out);
+	if (useChecksum) checksumCalculator->addBuffer(size_out, __size_size_out);
+	stream->readback(image_out, __size_image_out);
+	if (useChecksum) checksumCalculator->addBuffer(image_out, __size_image_out);
+	stream->readback(buffer_id_out, __size_buffer_id_out);
+	if (useChecksum) checksumCalculator->addBuffer(buffer_id_out, __size_buffer_id_out);
 
 	magma_status_t retval;
 	stream->readback(&retval, 4);
@@ -1984,9 +2137,9 @@
 	return retval;
 }
 
-magma_status_t magma_virt_connection_get_image_info_enc(void *self , uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_virt_connection_get_image_info_enc(void *self , magma_connection_t connection, magma_buffer_t image, magma_image_info_t* image_info_out)
 {
-	ENCODER_DEBUG_LOG("magma_virt_connection_get_image_info(parameters:%p, parameter_count:%lu)", parameters, parameter_count);
+	ENCODER_DEBUG_LOG("magma_virt_connection_get_image_info(connection:%lu, image:%lu, image_info_out:%p)", connection, image, image_info_out);
 	AEMU_SCOPED_TRACE("magma_virt_connection_get_image_info encode");
 
 	magma_encoder_context_t *ctx = (magma_encoder_context_t *)self;
@@ -1994,10 +2147,10 @@
 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
 	bool useChecksum = checksumCalculator->getVersion() > 0;
 
-	const unsigned int __size_parameters =  parameter_count * sizeof(uint64_t);
+	const unsigned int __size_image_info_out =  sizeof(magma_image_info_t);
 	 unsigned char *ptr;
 	 unsigned char *buf;
-	 const size_t sizeWithoutChecksum = 8 + __size_parameters + 8 + 1*4;
+	 const size_t sizeWithoutChecksum = 8 + 8 + 8 + 0 + 1*4;
 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
 	buf = stream->alloc(totalSize);
@@ -2005,15 +2158,15 @@
 	int tmp = OP_magma_virt_connection_get_image_info;memcpy(ptr, &tmp, 4); ptr += 4;
 	memcpy(ptr, &totalSize, 4);  ptr += 4;
 
-	memcpy(ptr, &__size_parameters, 4); ptr += 4;
-	memcpy(ptr, parameters, __size_parameters);ptr += __size_parameters;
-		memcpy(ptr, &parameter_count, 8); ptr += 8;
+		memcpy(ptr, &connection, 8); ptr += 8;
+		memcpy(ptr, &image, 8); ptr += 8;
+	memcpy(ptr, &__size_image_info_out, 4); ptr += 4;
 
 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
 
-	stream->readback(parameters, __size_parameters);
-	if (useChecksum) checksumCalculator->addBuffer(parameters, __size_parameters);
+	stream->readback(image_info_out, __size_image_info_out);
+	if (useChecksum) checksumCalculator->addBuffer(image_info_out, __size_image_info_out);
 
 	magma_status_t retval;
 	stream->readback(&retval, 4);
@@ -2056,7 +2209,9 @@
 	this->magma_connection_map_buffer = &magma_connection_map_buffer_enc;
 	this->magma_connection_unmap_buffer = &magma_connection_unmap_buffer_enc;
 	this->magma_connection_execute_command = &magma_connection_execute_command_enc;
+	this->magma_connection_execute_command_fudge = &magma_connection_execute_command_fudge_enc;
 	this->magma_connection_execute_immediate_commands = &magma_connection_execute_immediate_commands_enc;
+	this->magma_connection_execute_immediate_commands_fudge = &magma_connection_execute_immediate_commands_fudge_enc;
 	this->magma_connection_flush = &magma_connection_flush_enc;
 	this->magma_connection_get_notification_channel_handle = &magma_connection_get_notification_channel_handle_enc;
 	this->magma_connection_read_notification_channel = &magma_connection_read_notification_channel_enc;
@@ -2064,6 +2219,7 @@
 	this->magma_buffer_set_cache_policy = &magma_buffer_set_cache_policy_enc;
 	this->magma_buffer_get_cache_policy = &magma_buffer_get_cache_policy_enc;
 	this->magma_buffer_set_name = &magma_buffer_set_name_enc;
+	this->magma_buffer_set_name_fudge = &magma_buffer_set_name_fudge_enc;
 	this->magma_buffer_get_info = &magma_buffer_get_info_enc;
 	this->magma_buffer_get_handle = &magma_buffer_get_handle_enc;
 	this->magma_buffer_export = &magma_buffer_export_enc;
diff --git a/system/magma/magma_enc/magma_enc.h b/system/magma/magma_enc/magma_enc.h
index c4a6df5..4c270ad 100644
--- a/system/magma/magma_enc/magma_enc.h
+++ b/system/magma/magma_enc/magma_enc.h
@@ -13,10 +13,10 @@
 
 struct magma_encoder_context_t : public magma_client_context_t {
 
-	IOStream *m_stream;
+	gfxstream::IOStream *m_stream;
 	ChecksumCalculator *m_checksumCalculator;
 
-	magma_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
+	magma_encoder_context_t(gfxstream::IOStream *stream, ChecksumCalculator *checksumCalculator);
 	virtual uint64_t lockAndWriteDma(void*, uint32_t) { return 0; }
 };
 
diff --git a/system/magma/magma_enc/magma_entry.cpp b/system/magma/magma_enc/magma_entry.cpp
index acff129..f34c10e 100644
--- a/system/magma/magma_enc/magma_entry.cpp
+++ b/system/magma/magma_enc/magma_entry.cpp
@@ -22,16 +22,19 @@
 	magma_status_t magma_connection_perform_buffer_op(magma_connection_t connection, magma_buffer_t buffer, uint32_t options, uint64_t start_offset, uint64_t length);
 	magma_status_t magma_connection_map_buffer(magma_connection_t connection, uint64_t hw_va, magma_buffer_t buffer, uint64_t offset, uint64_t length, uint64_t map_flags);
 	void magma_connection_unmap_buffer(magma_connection_t connection, uint64_t hw_va, magma_buffer_t buffer);
-	magma_status_t magma_connection_execute_command(uint64_t* parameters, uint64_t parameter_count);
-	magma_status_t magma_connection_execute_immediate_commands(uint64_t* parameters, uint64_t parameter_count);
+	magma_status_t magma_connection_execute_command(magma_connection_t connection, uint32_t context_id, magma_command_descriptor_t* descriptor);
+	magma_status_t magma_connection_execute_command_fudge(magma_connection_t connection, uint32_t context_id, void* descriptor, uint64_t descriptor_size);
+	magma_status_t magma_connection_execute_immediate_commands(magma_connection_t connection, uint32_t context_id, uint64_t command_count, magma_inline_command_buffer_t* command_buffers);
+	magma_status_t magma_connection_execute_immediate_commands_fudge(magma_connection_t connection, uint32_t context_id, uint64_t command_count, void* command_buffers, uint64_t command_buffers_size, uint64_t* command_buffer_offsets);
 	magma_status_t magma_connection_flush(magma_connection_t connection);
 	magma_handle_t magma_connection_get_notification_channel_handle(magma_connection_t connection);
 	magma_status_t magma_connection_read_notification_channel(magma_connection_t connection, void* buffer, uint64_t buffer_size, uint64_t* buffer_size_out, magma_bool_t* more_data_out);
 	magma_status_t magma_buffer_clean_cache(magma_buffer_t buffer, uint64_t offset, uint64_t size, magma_cache_operation_t operation);
 	magma_status_t magma_buffer_set_cache_policy(magma_buffer_t buffer, magma_cache_policy_t policy);
 	magma_status_t magma_buffer_get_cache_policy(magma_buffer_t buffer, magma_cache_policy_t* cache_policy_out);
-	magma_status_t magma_buffer_set_name(magma_buffer_t buffer, void* name, uint64_t name_size);
-	magma_status_t magma_buffer_get_info(uint64_t* parameters, uint64_t parameter_count);
+	magma_status_t magma_buffer_set_name(magma_buffer_t buffer, const char* name);
+	magma_status_t magma_buffer_set_name_fudge(magma_buffer_t buffer, void* name, uint64_t name_size);
+	magma_status_t magma_buffer_get_info(magma_buffer_t buffer, magma_buffer_info_t* info_out);
 	magma_status_t magma_buffer_get_handle(magma_buffer_t buffer, magma_handle_t* handle_out);
 	magma_status_t magma_buffer_export(magma_buffer_t buffer, magma_handle_t* buffer_handle_out);
 	void magma_semaphore_signal(magma_semaphore_t semaphore);
@@ -44,13 +47,13 @@
 	magma_status_t magma_connection_enable_performance_counters(magma_connection_t connection, uint64_t* counters, uint64_t counters_count);
 	magma_status_t magma_connection_create_performance_counter_buffer_pool(magma_connection_t connection, magma_perf_count_pool_t* pool_id_out, magma_handle_t* notification_handle_out);
 	magma_status_t magma_connection_release_performance_counter_buffer_pool(magma_connection_t connection, magma_perf_count_pool_t pool_id);
-	magma_status_t magma_connection_add_performance_counter_buffer_offsets_to_pool(uint64_t* parameters, uint64_t parameter_count);
+	magma_status_t magma_connection_add_performance_counter_buffer_offsets_to_pool(magma_connection_t connection, magma_perf_count_pool_t pool_id, const magma_buffer_offset_t* offsets, uint64_t offsets_count);
 	magma_status_t magma_connection_remove_performance_counter_buffer_from_pool(magma_connection_t connection, magma_perf_count_pool_t pool_id, magma_buffer_t buffer);
 	magma_status_t magma_connection_dump_performance_counters(magma_connection_t connection, magma_perf_count_pool_t pool_id, uint32_t trigger_id);
 	magma_status_t magma_connection_clear_performance_counters(magma_connection_t connection, uint64_t* counters, uint64_t counters_count);
 	magma_status_t magma_connection_read_performance_counter_completion(magma_connection_t connection, magma_perf_count_pool_t pool_id, uint32_t* trigger_id_out, uint64_t* buffer_id_out, uint32_t* buffer_offset_out, uint64_t* time_out, uint32_t* result_flags_out);
-	magma_status_t magma_virt_connection_create_image(uint64_t* parameters, uint64_t parameter_count);
-	magma_status_t magma_virt_connection_get_image_info(uint64_t* parameters, uint64_t parameter_count);
+	magma_status_t magma_virt_connection_create_image(magma_connection_t connection, magma_image_create_info_t* create_info, uint64_t* size_out, magma_buffer_t* image_out, magma_buffer_id_t* buffer_id_out);
+	magma_status_t magma_virt_connection_get_image_info(magma_connection_t connection, magma_buffer_t image, magma_image_info_t* image_info_out);
 };
 
 #ifndef GET_CONTEXT
@@ -161,16 +164,28 @@
 	ctx->magma_connection_unmap_buffer(ctx, connection, hw_va, buffer);
 }
 
-magma_status_t magma_connection_execute_command(uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_connection_execute_command(magma_connection_t connection, uint32_t context_id, magma_command_descriptor_t* descriptor)
 {
 	GET_CONTEXT;
-	return ctx->magma_connection_execute_command(ctx, parameters, parameter_count);
+	return ctx->magma_connection_execute_command(ctx, connection, context_id, descriptor);
 }
 
-magma_status_t magma_connection_execute_immediate_commands(uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_connection_execute_command_fudge(magma_connection_t connection, uint32_t context_id, void* descriptor, uint64_t descriptor_size)
 {
 	GET_CONTEXT;
-	return ctx->magma_connection_execute_immediate_commands(ctx, parameters, parameter_count);
+	return ctx->magma_connection_execute_command_fudge(ctx, connection, context_id, descriptor, descriptor_size);
+}
+
+magma_status_t magma_connection_execute_immediate_commands(magma_connection_t connection, uint32_t context_id, uint64_t command_count, magma_inline_command_buffer_t* command_buffers)
+{
+	GET_CONTEXT;
+	return ctx->magma_connection_execute_immediate_commands(ctx, connection, context_id, command_count, command_buffers);
+}
+
+magma_status_t magma_connection_execute_immediate_commands_fudge(magma_connection_t connection, uint32_t context_id, uint64_t command_count, void* command_buffers, uint64_t command_buffers_size, uint64_t* command_buffer_offsets)
+{
+	GET_CONTEXT;
+	return ctx->magma_connection_execute_immediate_commands_fudge(ctx, connection, context_id, command_count, command_buffers, command_buffers_size, command_buffer_offsets);
 }
 
 magma_status_t magma_connection_flush(magma_connection_t connection)
@@ -209,16 +224,22 @@
 	return ctx->magma_buffer_get_cache_policy(ctx, buffer, cache_policy_out);
 }
 
-magma_status_t magma_buffer_set_name(magma_buffer_t buffer, void* name, uint64_t name_size)
+magma_status_t magma_buffer_set_name(magma_buffer_t buffer, const char* name)
 {
 	GET_CONTEXT;
-	return ctx->magma_buffer_set_name(ctx, buffer, name, name_size);
+	return ctx->magma_buffer_set_name(ctx, buffer, name);
 }
 
-magma_status_t magma_buffer_get_info(uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_buffer_set_name_fudge(magma_buffer_t buffer, void* name, uint64_t name_size)
 {
 	GET_CONTEXT;
-	return ctx->magma_buffer_get_info(ctx, parameters, parameter_count);
+	return ctx->magma_buffer_set_name_fudge(ctx, buffer, name, name_size);
+}
+
+magma_status_t magma_buffer_get_info(magma_buffer_t buffer, magma_buffer_info_t* info_out)
+{
+	GET_CONTEXT;
+	return ctx->magma_buffer_get_info(ctx, buffer, info_out);
 }
 
 magma_status_t magma_buffer_get_handle(magma_buffer_t buffer, magma_handle_t* handle_out)
@@ -293,10 +314,10 @@
 	return ctx->magma_connection_release_performance_counter_buffer_pool(ctx, connection, pool_id);
 }
 
-magma_status_t magma_connection_add_performance_counter_buffer_offsets_to_pool(uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_connection_add_performance_counter_buffer_offsets_to_pool(magma_connection_t connection, magma_perf_count_pool_t pool_id, const magma_buffer_offset_t* offsets, uint64_t offsets_count)
 {
 	GET_CONTEXT;
-	return ctx->magma_connection_add_performance_counter_buffer_offsets_to_pool(ctx, parameters, parameter_count);
+	return ctx->magma_connection_add_performance_counter_buffer_offsets_to_pool(ctx, connection, pool_id, offsets, offsets_count);
 }
 
 magma_status_t magma_connection_remove_performance_counter_buffer_from_pool(magma_connection_t connection, magma_perf_count_pool_t pool_id, magma_buffer_t buffer)
@@ -323,15 +344,15 @@
 	return ctx->magma_connection_read_performance_counter_completion(ctx, connection, pool_id, trigger_id_out, buffer_id_out, buffer_offset_out, time_out, result_flags_out);
 }
 
-magma_status_t magma_virt_connection_create_image(uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_virt_connection_create_image(magma_connection_t connection, magma_image_create_info_t* create_info, uint64_t* size_out, magma_buffer_t* image_out, magma_buffer_id_t* buffer_id_out)
 {
 	GET_CONTEXT;
-	return ctx->magma_virt_connection_create_image(ctx, parameters, parameter_count);
+	return ctx->magma_virt_connection_create_image(ctx, connection, create_info, size_out, image_out, buffer_id_out);
 }
 
-magma_status_t magma_virt_connection_get_image_info(uint64_t* parameters, uint64_t parameter_count)
+magma_status_t magma_virt_connection_get_image_info(magma_connection_t connection, magma_buffer_t image, magma_image_info_t* image_info_out)
 {
 	GET_CONTEXT;
-	return ctx->magma_virt_connection_get_image_info(ctx, parameters, parameter_count);
+	return ctx->magma_virt_connection_get_image_info(ctx, connection, image, image_info_out);
 }
 
diff --git a/system/magma/magma_enc/magma_ftable.h b/system/magma/magma_enc/magma_ftable.h
index be0d18e..03bc1b5 100644
--- a/system/magma/magma_enc/magma_ftable.h
+++ b/system/magma/magma_enc/magma_ftable.h
@@ -26,7 +26,9 @@
 	{"magma_connection_map_buffer", (void*)magma_connection_map_buffer},
 	{"magma_connection_unmap_buffer", (void*)magma_connection_unmap_buffer},
 	{"magma_connection_execute_command", (void*)magma_connection_execute_command},
+	{"magma_connection_execute_command_fudge", (void*)magma_connection_execute_command_fudge},
 	{"magma_connection_execute_immediate_commands", (void*)magma_connection_execute_immediate_commands},
+	{"magma_connection_execute_immediate_commands_fudge", (void*)magma_connection_execute_immediate_commands_fudge},
 	{"magma_connection_flush", (void*)magma_connection_flush},
 	{"magma_connection_get_notification_channel_handle", (void*)magma_connection_get_notification_channel_handle},
 	{"magma_connection_read_notification_channel", (void*)magma_connection_read_notification_channel},
@@ -34,6 +36,7 @@
 	{"magma_buffer_set_cache_policy", (void*)magma_buffer_set_cache_policy},
 	{"magma_buffer_get_cache_policy", (void*)magma_buffer_get_cache_policy},
 	{"magma_buffer_set_name", (void*)magma_buffer_set_name},
+	{"magma_buffer_set_name_fudge", (void*)magma_buffer_set_name_fudge},
 	{"magma_buffer_get_info", (void*)magma_buffer_get_info},
 	{"magma_buffer_get_handle", (void*)magma_buffer_get_handle},
 	{"magma_buffer_export", (void*)magma_buffer_export},
diff --git a/system/magma/magma_enc/magma_opcodes.h b/system/magma/magma_enc/magma_opcodes.h
index aaa3451..f1b6a10 100644
--- a/system/magma/magma_enc/magma_opcodes.h
+++ b/system/magma/magma_enc/magma_opcodes.h
@@ -21,35 +21,38 @@
 #define OP_magma_connection_map_buffer 					100015
 #define OP_magma_connection_unmap_buffer 					100016
 #define OP_magma_connection_execute_command 					100017
-#define OP_magma_connection_execute_immediate_commands 					100018
-#define OP_magma_connection_flush 					100019
-#define OP_magma_connection_get_notification_channel_handle 					100020
-#define OP_magma_connection_read_notification_channel 					100021
-#define OP_magma_buffer_clean_cache 					100022
-#define OP_magma_buffer_set_cache_policy 					100023
-#define OP_magma_buffer_get_cache_policy 					100024
-#define OP_magma_buffer_set_name 					100025
-#define OP_magma_buffer_get_info 					100026
-#define OP_magma_buffer_get_handle 					100027
-#define OP_magma_buffer_export 					100028
-#define OP_magma_semaphore_signal 					100029
-#define OP_magma_semaphore_reset 					100030
-#define OP_magma_semaphore_export 					100031
-#define OP_magma_poll 					100032
-#define OP_magma_initialize_tracing 					100033
-#define OP_magma_initialize_logging 					100034
-#define OP_magma_connection_enable_performance_counter_access 					100035
-#define OP_magma_connection_enable_performance_counters 					100036
-#define OP_magma_connection_create_performance_counter_buffer_pool 					100037
-#define OP_magma_connection_release_performance_counter_buffer_pool 					100038
-#define OP_magma_connection_add_performance_counter_buffer_offsets_to_pool 					100039
-#define OP_magma_connection_remove_performance_counter_buffer_from_pool 					100040
-#define OP_magma_connection_dump_performance_counters 					100041
-#define OP_magma_connection_clear_performance_counters 					100042
-#define OP_magma_connection_read_performance_counter_completion 					100043
-#define OP_magma_virt_connection_create_image 					100044
-#define OP_magma_virt_connection_get_image_info 					100045
-#define OP_last 					100046
+#define OP_magma_connection_execute_command_fudge 					100018
+#define OP_magma_connection_execute_immediate_commands 					100019
+#define OP_magma_connection_execute_immediate_commands_fudge 					100020
+#define OP_magma_connection_flush 					100021
+#define OP_magma_connection_get_notification_channel_handle 					100022
+#define OP_magma_connection_read_notification_channel 					100023
+#define OP_magma_buffer_clean_cache 					100024
+#define OP_magma_buffer_set_cache_policy 					100025
+#define OP_magma_buffer_get_cache_policy 					100026
+#define OP_magma_buffer_set_name 					100027
+#define OP_magma_buffer_set_name_fudge 					100028
+#define OP_magma_buffer_get_info 					100029
+#define OP_magma_buffer_get_handle 					100030
+#define OP_magma_buffer_export 					100031
+#define OP_magma_semaphore_signal 					100032
+#define OP_magma_semaphore_reset 					100033
+#define OP_magma_semaphore_export 					100034
+#define OP_magma_poll 					100035
+#define OP_magma_initialize_tracing 					100036
+#define OP_magma_initialize_logging 					100037
+#define OP_magma_connection_enable_performance_counter_access 					100038
+#define OP_magma_connection_enable_performance_counters 					100039
+#define OP_magma_connection_create_performance_counter_buffer_pool 					100040
+#define OP_magma_connection_release_performance_counter_buffer_pool 					100041
+#define OP_magma_connection_add_performance_counter_buffer_offsets_to_pool 					100042
+#define OP_magma_connection_remove_performance_counter_buffer_from_pool 					100043
+#define OP_magma_connection_dump_performance_counters 					100044
+#define OP_magma_connection_clear_performance_counters 					100045
+#define OP_magma_connection_read_performance_counter_completion 					100046
+#define OP_magma_virt_connection_create_image 					100047
+#define OP_magma_virt_connection_get_image_info 					100048
+#define OP_last 					100049
 
 
 #endif
diff --git a/system/renderControl_enc/renderControl_enc.cpp b/system/renderControl_enc/renderControl_enc.cpp
index 04fe484..409eb00 100644
--- a/system/renderControl_enc/renderControl_enc.cpp
+++ b/system/renderControl_enc/renderControl_enc.cpp
@@ -16,6 +16,8 @@
 
 #include "EncoderDebug.h"
 
+using gfxstream::IOStream;
+
 namespace {
 
 void enc_unsupported()
diff --git a/system/renderControl_enc/renderControl_enc.h b/system/renderControl_enc/renderControl_enc.h
index ec1cf32..08340e9 100644
--- a/system/renderControl_enc/renderControl_enc.h
+++ b/system/renderControl_enc/renderControl_enc.h
@@ -15,10 +15,10 @@
 
 struct renderControl_encoder_context_t : public renderControl_client_context_t {
 
-	IOStream *m_stream;
+	gfxstream::IOStream *m_stream;
 	ChecksumCalculator *m_checksumCalculator;
 
-	renderControl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
+	renderControl_encoder_context_t(gfxstream::IOStream *stream, ChecksumCalculator *checksumCalculator);
 	virtual uint64_t lockAndWriteDma(void*, uint32_t) { return 0; }
 };
 
diff --git a/system/vulkan/Android.mk b/system/vulkan/Android.mk
index 4f71cbb..beb7d46 100644
--- a/system/vulkan/Android.mk
+++ b/system/vulkan/Android.mk
@@ -9,7 +9,7 @@
 # Vulkan include dir
 ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
 
-LOCAL_C_INCLUDES += $(GFXSTREAM_PROTOCOLS_PATH)/include/vulkan/include
+LOCAL_C_INCLUDES += $(GFXSTREAM_PROTOCOLS_PATH)/common/vulkan/include
 
 endif
 
diff --git a/system/vulkan/CMakeLists.txt b/system/vulkan/CMakeLists.txt
index 8501697..6ffd4aa 100644
--- a/system/vulkan/CMakeLists.txt
+++ b/system/vulkan/CMakeLists.txt
@@ -1,10 +1,10 @@
 # This is an autogenerated file! Do not edit!
 # instead run make from .../device/generic/goldfish-opengl
 # which will re-generate this file.
-android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/vulkan/Android.mk" "b02756b89a6ae61787d3f13657ab459dd74fb3856394dac0e9c8f9106fd2b1e7")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/vulkan/Android.mk" "2b78d60122b99e5ba57e1066fed62df201a75f8a327829277fa6d50d52227539")
 set(vulkan.ranchu_src goldfish_vulkan.cpp)
 android_add_library(TARGET vulkan.ranchu SHARED LICENSE Apache-2.0 SRC goldfish_vulkan.cpp)
-target_include_directories(vulkan.ranchu PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/bionic-include ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon ${GOLDFISH_DEVICE_ROOT}/bionic/libc/private ${GOLDFISH_DEVICE_ROOT}/bionic/libc/platform ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/shared/gralloc_cb/include ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/platform/include ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/vulkan ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/../../../gfxstream-protocols/include/vulkan/include)
+target_include_directories(vulkan.ranchu PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/bionic-include ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon ${GOLDFISH_DEVICE_ROOT}/bionic/libc/private ${GOLDFISH_DEVICE_ROOT}/bionic/libc/platform ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/shared/gralloc_cb/include ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/platform/include ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/vulkan ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/../../../gfxstream-protocols/common/vulkan/include)
 target_compile_definitions(vulkan.ranchu PRIVATE "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGFXSTREAM" "-DENABLE_ANDROID_HEALTH_MONITOR" "-DLOG_TAG=\"goldfish_vulkan\"" "-DVK_USE_PLATFORM_ANDROID_KHR" "-DVK_NO_PROTOTYPES")
 target_compile_options(vulkan.ranchu PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-fvisibility=hidden" "-fstrict-aliasing" "-Wno-unused-function")
 target_link_libraries(vulkan.ranchu PRIVATE OpenglSystemCommon android-emu-shared vulkan_enc gui log _renderControl_enc GLESv2_enc GLESv1_enc OpenglCodecCommon_host cutils utils androidemu GoldfishProfiler PRIVATE gralloc_cb_host GoldfishAddressSpace_host platform_host qemupipe_host)
\ No newline at end of file
diff --git a/system/vulkan_enc/Android.mk b/system/vulkan_enc/Android.mk
index 5f0bb0f..e085a51 100644
--- a/system/vulkan_enc/Android.mk
+++ b/system/vulkan_enc/Android.mk
@@ -17,7 +17,7 @@
 ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
 LOCAL_C_INCLUDES += \
     $(LOCAL_PATH) \
-    $(GFXSTREAM_PROTOCOLS_PATH)/include/vulkan/include
+    $(GFXSTREAM_PROTOCOLS_PATH)/common/vulkan/include
 endif
 
 ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
diff --git a/system/vulkan_enc/CMakeLists.txt b/system/vulkan_enc/CMakeLists.txt
index 408b1e1..275a6c7 100644
--- a/system/vulkan_enc/CMakeLists.txt
+++ b/system/vulkan_enc/CMakeLists.txt
@@ -1,10 +1,10 @@
 # This is an autogenerated file! Do not edit!
 # instead run make from .../device/generic/goldfish-opengl
 # which will re-generate this file.
-android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc/Android.mk" "0b1505a39a4dfd4379a4a274e2388293823f9152bf0b1b6b629d86a427c3ce4f")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc/Android.mk" "a38a9cb4212af60da21bc4f42d5c09644a1940afcccb766bf88266e70340f779")
 set(vulkan_enc_src AndroidHardwareBuffer.cpp CommandBufferStagingStream.cpp DescriptorSetVirtualization.cpp HostVisibleMemoryVirtualization.cpp Resources.cpp Validation.cpp VulkanStreamGuest.cpp VulkanHandleMapping.cpp ResourceTracker.cpp VkEncoder.cpp goldfish_vk_extension_structs_guest.cpp goldfish_vk_marshaling_guest.cpp goldfish_vk_reserved_marshaling_guest.cpp goldfish_vk_deepcopy_guest.cpp goldfish_vk_counting_guest.cpp goldfish_vk_handlemap_guest.cpp goldfish_vk_transform_guest.cpp func_table.cpp)
 android_add_library(TARGET vulkan_enc SHARED LICENSE Apache-2.0 SRC AndroidHardwareBuffer.cpp CommandBufferStagingStream.cpp DescriptorSetVirtualization.cpp HostVisibleMemoryVirtualization.cpp Resources.cpp Validation.cpp VulkanStreamGuest.cpp VulkanHandleMapping.cpp ResourceTracker.cpp VkEncoder.cpp goldfish_vk_extension_structs_guest.cpp goldfish_vk_marshaling_guest.cpp goldfish_vk_reserved_marshaling_guest.cpp goldfish_vk_deepcopy_guest.cpp goldfish_vk_counting_guest.cpp goldfish_vk_handlemap_guest.cpp goldfish_vk_transform_guest.cpp func_table.cpp)
-target_include_directories(vulkan_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/platform/include ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/../../../gfxstream-protocols/include/vulkan/include)
+target_include_directories(vulkan_enc PRIVATE ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/platform/include ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/../../../gfxstream-protocols/common/vulkan/include)
 target_compile_definitions(vulkan_enc PRIVATE "-DPLATFORM_SDK_VERSION=29" "-DGOLDFISH_HIDL_GRALLOC" "-DHOST_BUILD" "-DANDROID" "-DGL_GLEXT_PROTOTYPES" "-DPAGE_SIZE=4096" "-DGFXSTREAM" "-DENABLE_ANDROID_HEALTH_MONITOR" "-DLOG_TAG=\"goldfish_vulkan\"" "-DVK_ANDROID_native_buffer" "-DVK_EXT_device_memory_report" "-DVK_GOOGLE_gfxstream" "-DVK_USE_PLATFORM_ANDROID_KHR" "-DVK_NO_PROTOTYPES" "-DVIRTIO_GPU" "-D__ANDROID_API__=28")
 target_compile_options(vulkan_enc PRIVATE "-fvisibility=default" "-Wno-unused-parameter" "-Wno-missing-field-initializers" "-Werror" "-fstrict-aliasing")
 target_link_libraries(vulkan_enc PRIVATE gui log android-emu-shared _renderControl_enc OpenglCodecCommon_host cutils utils androidemu PRIVATE GoldfishAddressSpace_host platform_host qemupipe_host)
\ No newline at end of file
diff --git a/system/vulkan_enc/HostVisibleMemoryVirtualization.h b/system/vulkan_enc/HostVisibleMemoryVirtualization.h
index 3c99bc5..bd62386 100644
--- a/system/vulkan_enc/HostVisibleMemoryVirtualization.h
+++ b/system/vulkan_enc/HostVisibleMemoryVirtualization.h
@@ -20,8 +20,6 @@
 #include "aemu/base/AndroidSubAllocator.h"
 #include "goldfish_address_space.h"
 
-#define ALIGN(A, B) (((A) + (B)-1) & ~((B)-1))
-
 constexpr uint64_t kMegaByte = 1048576;
 
 // This needs to be a power of 2 that is at least the min alignment needed
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index e74392f..f6dec28 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -80,13 +80,12 @@
 #include "HostVisibleMemoryVirtualization.h"
 #include "Resources.h"
 #include "VkEncoder.h"
-
 #include "aemu/base/AlignedBuf.h"
 #include "aemu/base/synchronization/AndroidLock.h"
-#include "virtgpu_gfxstream_protocol.h"
-
 #include "goldfish_address_space.h"
 #include "goldfish_vk_private_defs.h"
+#include "util.h"
+#include "virtgpu_gfxstream_protocol.h"
 #ifdef VK_USE_PLATFORM_ANDROID_KHR
 #include "vk_format_info.h"
 #endif
@@ -3000,7 +2999,8 @@
         vk_struct_chain_iterator structChainIter = vk_make_chain_iterator(&hostAllocationInfo);
 
         if (mCaps.gfxstreamCapset.deferredMapping || mCaps.params[kParamCreateGuestHandle]) {
-            hostAllocationInfo.allocationSize = ALIGN(pAllocateInfo->allocationSize, 4096);
+            hostAllocationInfo.allocationSize =
+                ALIGN(pAllocateInfo->allocationSize, mCaps.gfxstreamCapset.blobAlignment);
         } else if (dedicated) {
             // Over-aligning to kLargestSize to some Windows drivers (b:152769369).  Can likely
             // have host report the desired alignment.
diff --git a/system/vulkan_enc/Resources.h b/system/vulkan_enc/Resources.h
index 4b47300..6270f9a 100644
--- a/system/vulkan_enc/Resources.h
+++ b/system/vulkan_enc/Resources.h
@@ -23,6 +23,7 @@
 #include <functional>
 
 namespace gfxstream {
+class IOStream;
 namespace vk {
 class VkEncoder;
 struct DescriptorPoolAllocationInfo;
@@ -31,7 +32,6 @@
 }  // namespace vk
 }  // namespace gfxstream
 
-class IOStream;
 
 extern "C" {
 
@@ -47,7 +47,7 @@
         gfxstream::vk::VkEncoder* lastUsedEncoder; \
         uint32_t sequenceNumber; \
         gfxstream::vk::VkEncoder* privateEncoder; \
-        IOStream* privateStream; \
+        gfxstream::IOStream* privateStream; \
         uint32_t flags; \
         struct goldfish_vk_object_list* poolObjects; \
         struct goldfish_vk_object_list* subObjects; \
@@ -124,7 +124,7 @@
     gfxstream::vk::VkEncoder* lastUsedEncoder;
     uint32_t sequenceNumber;
     gfxstream::vk::VkEncoder* privateEncoder;
-    IOStream* privateStream;
+    gfxstream::IOStream* privateStream;
     uint32_t flags;
     struct goldfish_vk_object_list* poolObjects;
     struct goldfish_vk_object_list* subObjects;
diff --git a/system/vulkan_enc/VkEncoder.cpp b/system/vulkan_enc/VkEncoder.cpp
index 068f779..56d4362 100644
--- a/system/vulkan_enc/VkEncoder.cpp
+++ b/system/vulkan_enc/VkEncoder.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module VkEncoder
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/VkEncoder.h b/system/vulkan_enc/VkEncoder.h
index ab50adc..1c00764 100644
--- a/system/vulkan_enc/VkEncoder.h
+++ b/system/vulkan_enc/VkEncoder.h
@@ -16,7 +16,7 @@
 // Autogenerated module VkEncoder
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
@@ -36,7 +36,10 @@
 #include "aemu/base/AndroidHealthMonitor.h"
 #include "goldfish_vk_private_defs.h"
 #include "vulkan_gfxstream.h"
+
+namespace gfxstream {
 class IOStream;
+}
 
 namespace gfxstream {
 namespace vk {
diff --git a/system/vulkan_enc/func_table.cpp b/system/vulkan_enc/func_table.cpp
index 83bf6f4..fdbd8b1 100644
--- a/system/vulkan_enc/func_table.cpp
+++ b/system/vulkan_enc/func_table.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module func_table
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
@@ -4463,7 +4463,7 @@
                                                        true /* do lock */);
 }
 #endif
-#ifdef VK_ANDROID_native_buffer
+#if defined(VK_USE_PLATFORM_ANDROID_KHR) && defined(VK_ANDROID_native_buffer)
 static VkResult entry_vkGetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format,
                                                         VkImageUsageFlags imageUsage,
                                                         int* grallocUsage) {
@@ -10138,7 +10138,7 @@
         return nullptr;
     }
 #endif
-#ifdef VK_ANDROID_native_buffer
+#if defined(VK_USE_PLATFORM_ANDROID_KHR) && defined(VK_ANDROID_native_buffer)
     if (!strcmp(name, "vkGetSwapchainGrallocUsageANDROID")) {
         return nullptr;
     }
@@ -12147,7 +12147,7 @@
         return (void*)dynCheck_entry_vkGetDeviceImageSparseMemoryRequirementsKHR;
     }
 #endif
-#ifdef VK_ANDROID_native_buffer
+#if defined(VK_USE_PLATFORM_ANDROID_KHR) && defined(VK_ANDROID_native_buffer)
     if (!strcmp(name, "vkGetSwapchainGrallocUsageANDROID")) {
         // TODO(b/236246382): Check support for device extension;
         return (void*)dynCheck_entry_vkGetSwapchainGrallocUsageANDROID;
@@ -14394,7 +14394,7 @@
         return hasExt ? (void*)entry_vkGetDeviceImageSparseMemoryRequirementsKHR : nullptr;
     }
 #endif
-#ifdef VK_ANDROID_native_buffer
+#if defined(VK_USE_PLATFORM_ANDROID_KHR) && defined(VK_ANDROID_native_buffer)
     if (!strcmp(name, "vkGetSwapchainGrallocUsageANDROID")) {
         bool hasExt = resources->hasDeviceExtension(device, "VK_ANDROID_native_buffer");
         return hasExt ? (void*)entry_vkGetSwapchainGrallocUsageANDROID : nullptr;
diff --git a/system/vulkan_enc/func_table.h b/system/vulkan_enc/func_table.h
index 6a04926..4c08334 100644
--- a/system/vulkan_enc/func_table.h
+++ b/system/vulkan_enc/func_table.h
@@ -16,7 +16,7 @@
 // Autogenerated module func_table
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_counting_guest.cpp b/system/vulkan_enc/goldfish_vk_counting_guest.cpp
index 120e18c..5725ffd 100644
--- a/system/vulkan_enc/goldfish_vk_counting_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_counting_guest.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_counting_guest
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_counting_guest.h b/system/vulkan_enc/goldfish_vk_counting_guest.h
index 00d5eda..a7fd19b 100644
--- a/system/vulkan_enc/goldfish_vk_counting_guest.h
+++ b/system/vulkan_enc/goldfish_vk_counting_guest.h
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_counting_guest
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp b/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp
index 655a4d2..908da96 100644
--- a/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_deepcopy_guest
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_deepcopy_guest.h b/system/vulkan_enc/goldfish_vk_deepcopy_guest.h
index c23eb8c..2987088 100644
--- a/system/vulkan_enc/goldfish_vk_deepcopy_guest.h
+++ b/system/vulkan_enc/goldfish_vk_deepcopy_guest.h
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_deepcopy_guest
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp b/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp
index ade32c2..bce4339 100644
--- a/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_extension_structs_guest
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_extension_structs_guest.h b/system/vulkan_enc/goldfish_vk_extension_structs_guest.h
index 8a84de5..ec179a6 100644
--- a/system/vulkan_enc/goldfish_vk_extension_structs_guest.h
+++ b/system/vulkan_enc/goldfish_vk_extension_structs_guest.h
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_extension_structs_guest
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp b/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp
index c1b9fcc..60766fa 100644
--- a/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_handlemap_guest
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_handlemap_guest.h b/system/vulkan_enc/goldfish_vk_handlemap_guest.h
index 49cb457..2b7e7a5 100644
--- a/system/vulkan_enc/goldfish_vk_handlemap_guest.h
+++ b/system/vulkan_enc/goldfish_vk_handlemap_guest.h
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_handlemap_guest
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp b/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
index 3b4cdb7..42aeaa6 100644
--- a/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_marshaling_guest
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_marshaling_guest.h b/system/vulkan_enc/goldfish_vk_marshaling_guest.h
index 0fd4111..9bedfbe 100644
--- a/system/vulkan_enc/goldfish_vk_marshaling_guest.h
+++ b/system/vulkan_enc/goldfish_vk_marshaling_guest.h
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_marshaling_guest
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp b/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp
index 24c249f..96050ee 100644
--- a/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_reserved_marshaling_guest
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.h b/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.h
index 54b3555..8016c09 100644
--- a/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.h
+++ b/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.h
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_reserved_marshaling_guest
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_transform_guest.cpp b/system/vulkan_enc/goldfish_vk_transform_guest.cpp
index 2683ea9..3b22723 100644
--- a/system/vulkan_enc/goldfish_vk_transform_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_transform_guest.cpp
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_transform_guest
 //
 // (impl) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml cereal
-// -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/goldfish_vk_transform_guest.h b/system/vulkan_enc/goldfish_vk_transform_guest.h
index 8552ee6..4ee8c4b 100644
--- a/system/vulkan_enc/goldfish_vk_transform_guest.h
+++ b/system/vulkan_enc/goldfish_vk_transform_guest.h
@@ -16,7 +16,7 @@
 // Autogenerated module goldfish_vk_transform_guest
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc/vulkan_gfxstream_structure_type.h b/system/vulkan_enc/vulkan_gfxstream_structure_type.h
index c8df42f..e8958aa 100644
--- a/system/vulkan_enc/vulkan_gfxstream_structure_type.h
+++ b/system/vulkan_enc/vulkan_gfxstream_structure_type.h
@@ -16,7 +16,7 @@
 // Autogenerated module vulkan_gfxstream_structure_type
 //
 // (header) generated by registry/vulkan/scripts/genvk.py -registry registry/vulkan/xml/vk.xml
-// cereal -o ../vulkan-cereal/stream-servers/vulkan/cereal
+// cereal -o ../../device/generic/vulkan-cereal/host/vulkan/cereal
 //
 // Please do not modify directly;
 // re-run gfxstream-protocols/scripts/generate-vulkan-sources.sh,
diff --git a/system/vulkan_enc_unit_tests/Android.mk b/system/vulkan_enc_unit_tests/Android.mk
index e506bc9..564cf20 100644
--- a/system/vulkan_enc_unit_tests/Android.mk
+++ b/system/vulkan_enc_unit_tests/Android.mk
@@ -6,7 +6,7 @@
 
 LOCAL_C_INCLUDES += \
     device/generic/goldfish-opengl/host/include/libOpenglRender \
-    external/gfxstream-protocols/include/vulkan/include/
+    external/gfxstream-protocols/common/vulkan/include/
 
 LOCAL_SRC_FILES:= \
     CommandBufferStagingStream_test.cpp \