Merge "[vulkan] deferred command buffers (guest)"
diff --git a/shared/OpenglCodecCommon/gralloc_cb.h b/shared/OpenglCodecCommon/gralloc_cb.h
index f874c12..979d8e5 100644
--- a/shared/OpenglCodecCommon/gralloc_cb.h
+++ b/shared/OpenglCodecCommon/gralloc_cb.h
@@ -21,7 +21,6 @@
 #include <hardware/gralloc.h>
 #include <cutils/native_handle.h>
 
-#include "goldfish_dma.h"
 #include "qemu_pipe.h"
 
 #define BUFFER_HANDLE_MAGIC ((int)0xabfabfab)
@@ -64,7 +63,6 @@
         hostHandle(0),
         emuFrameworkFormat(p_emuFrameworkFormat)
     {
-        goldfish_dma.fd = -1;
         refcount_pipe_fd = QEMU_PIPE_INVALID_HANDLE;
         version = sizeof(native_handle);
         numFds = 0;
@@ -134,7 +132,6 @@
     int lockedHeight;
     uint32_t hostHandle;
 
-    goldfish_dma_context goldfish_dma;
     uint32_t goldfish_dma_buf_size;
     EmulatorFrameworkFormat emuFrameworkFormat;
 };
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index 812ee04..57a9e9e 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -709,19 +709,6 @@
         }
 
         cb->setFd(fd);
-
-        hostCon->lock();
-
-        if (rcEnc->getDmaVersion() > 0) {
-            D("%s: creating goldfish dma region of size %lu (cb fd %d)\n", __FUNCTION__, ashmem_size, cb->fd);
-            init_gralloc_dmaregion();
-            get_gralloc_dmaregion();
-        } else {
-            cb->goldfish_dma.fd = -1;
-        }
-        hostCon->unlock();
-    } else {
-        cb->goldfish_dma.fd = -1;
     }
 
     if (needHostCb) {
@@ -780,6 +767,14 @@
         *pStride = stride;
         break;
     }
+
+    hostCon->lock();
+    if (rcEnc->getDmaVersion() > 0) {
+        init_gralloc_dmaregion();
+        get_gralloc_dmaregion();
+    }
+    hostCon->unlock();
+
     return 0;
 }