Increment the DMA counter if gralloc_alloc completes successfully
am: 047d270064
Change-Id: I433b84197dcd6714bef94d7357a6bc1d5ca05d39
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index ff2c744..57a9e9e 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -709,15 +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();
- }
- hostCon->unlock();
}
if (needHostCb) {
@@ -776,6 +767,14 @@
*pStride = stride;
break;
}
+
+ hostCon->lock();
+ if (rcEnc->getDmaVersion() > 0) {
+ init_gralloc_dmaregion();
+ get_gralloc_dmaregion();
+ }
+ hostCon->unlock();
+
return 0;
}