Use Android log system in helpers.c.

This code might be loaded by a daemonized process now, so the existing
logging to stderr goes nowhere. It's better to use the Android logger.

Change-Id: I19f088b8f049f07c9c6839038d2971fad1a0e852
Reviewed-on: https://chromium-review.googlesource.com/971360
Commit-Ready: Alistair Strachan <astrachan@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/cros_gralloc/gralloc0/gralloc0.cc b/cros_gralloc/gralloc0/gralloc0.cc
index 50cd1af..86c3a4e 100644
--- a/cros_gralloc/gralloc0/gralloc0.cc
+++ b/cros_gralloc/gralloc0/gralloc0.cc
@@ -113,10 +113,10 @@
 	}
 
 	if (!supported) {
-		cros_gralloc_error("Unsupported combination -- HAL format: %u, HAL usage: %u, "
-				   "drv_format: %4.4s, use_flags: %llu",
-				   format, usage, reinterpret_cast<char *>(&descriptor.drm_format),
-				   static_cast<unsigned long long>(descriptor.use_flags));
+		drv_log("Unsupported combination -- HAL format: %u, HAL usage: %u, "
+			"drv_format: %4.4s, use_flags: %llu\n",
+			format, usage, reinterpret_cast<char *>(&descriptor.drm_format),
+			static_cast<unsigned long long>(descriptor.use_flags));
 		return -EINVAL;
 	}
 
@@ -151,7 +151,7 @@
 
 	mod->driver = std::make_unique<cros_gralloc_driver>();
 	if (mod->driver->init()) {
-		cros_gralloc_error("Failed to initialize driver.");
+		drv_log("Failed to initialize driver.\n");
 		return -ENODEV;
 	}
 
@@ -179,7 +179,7 @@
 	}
 
 	if (strcmp(name, GRALLOC_HARDWARE_GPU0)) {
-		cros_gralloc_error("Incorrect device name - %s.", name);
+		drv_log("Incorrect device name - %s.\n", name);
 		return -EINVAL;
 	}
 
@@ -253,7 +253,7 @@
 	handle = va_arg(args, buffer_handle_t);
 	auto hnd = cros_gralloc_convert_handle(handle);
 	if (!hnd) {
-		cros_gralloc_error("Invalid handle.");
+		drv_log("Invalid handle.\n");
 		return -EINVAL;
 	}
 
@@ -305,12 +305,12 @@
 
 	auto hnd = cros_gralloc_convert_handle(handle);
 	if (!hnd) {
-		cros_gralloc_error("Invalid handle.");
+		drv_log("Invalid handle.\n");
 		return -EINVAL;
 	}
 
 	if (hnd->droid_format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
-		cros_gralloc_error("HAL_PIXEL_FORMAT_YCbCr_*_888 format not compatible.");
+		drv_log("HAL_PIXEL_FORMAT_YCbCr_*_888 format not compatible.\n");
 		return -EINVAL;
 	}
 
@@ -347,14 +347,14 @@
 
 	auto hnd = cros_gralloc_convert_handle(handle);
 	if (!hnd) {
-		cros_gralloc_error("Invalid handle.");
+		drv_log("Invalid handle.\n");
 		return -EINVAL;
 	}
 
 	if ((hnd->droid_format != HAL_PIXEL_FORMAT_YCbCr_420_888) &&
 	    (hnd->droid_format != HAL_PIXEL_FORMAT_YV12) &&
 	    (hnd->droid_format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED)) {
-		cros_gralloc_error("Non-YUV format not compatible.");
+		drv_log("Non-YUV format not compatible.\n");
 		return -EINVAL;
 	}