gbm_gralloc: Sync with upstream project

This syncs the gralloc dir with the upstream gbm_gralloc project
here:
  https://github.com/robherring/gbm_gralloc

As of commit cecd1a2c8504 ("gralloc_gbm: Quiet logcat verbosity")
with the exception of Android.mk to which necessary local AOSP changes
have been made.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: If845e8cbe144db6df90a2c5eb3e844f361ece7ec
diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp
index c71e901..1cc9f55 100644
--- a/gralloc/gralloc.cpp
+++ b/gralloc/gralloc.cpp
@@ -24,7 +24,7 @@
 
 #define LOG_TAG "GRALLOC-GBM"
 
-#include <cutils/log.h>
+#include <log/log.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/gralloc/gralloc_gbm.cpp b/gralloc/gralloc_gbm.cpp
index bdb41b8..29d11cd 100644
--- a/gralloc/gralloc_gbm.cpp
+++ b/gralloc/gralloc_gbm.cpp
@@ -24,11 +24,12 @@
 
 #define LOG_TAG "GRALLOC-GBM"
 
-#include <cutils/log.h>
+#include <log/log.h>
 #include <cutils/atomic.h>
 #include <cutils/properties.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -382,8 +383,7 @@
 	gbm_bo_handle_map.emplace(handle, bo);
 
 	/* in pixels */
-	struct gralloc_handle_t *ghandle = gralloc_handle(handle);
-	*stride = ghandle->stride / gralloc_gbm_get_bpp(format);
+	*stride = gralloc_handle(handle)->stride / gralloc_gbm_get_bpp(format);
 
 	return handle;
 }
@@ -420,7 +420,7 @@
 		gbm_bo_set_user_data(bo, bo_data, gralloc_gbm_destroy_user_data);
 	}
 
-	ALOGI("lock bo %p, cnt=%d, usage=%x", bo, bo_data->lock_count, usage);
+	ALOGV("lock bo %p, cnt=%d, usage=%x", bo, bo_data->lock_count, usage);
 
 	/* allow multiple locks with compatible usages */
 	if (bo_data->lock_count && (bo_data->locked_for & usage) != usage)
@@ -491,10 +491,10 @@
 {
 	struct gralloc_handle_t *hnd = gralloc_handle(handle);
 	int ystride, cstride;
-	void *addr;
+	void *addr = 0;
 	int err;
 
-	ALOGD("handle %p, hnd %p, usage 0x%x", handle, hnd, usage);
+	ALOGV("handle %p, hnd %p, usage 0x%x", handle, hnd, usage);
 
 	err = gralloc_gbm_bo_lock(handle, usage, x, y, w, h, &addr);
 	if (err)