minigbm: cros_gralloc: refactor for future HALs

We want the ability to support gralloc0, gralloc1 and HIDL
gralloc in this repo. This commit moves gralloc0 specific code
to the gralloc0 subdirectory, and refactors the rest of the code
so it can be eventually used by whichever APIs we choose to
implement.

In addition, all of the data by the module is now handled by
managed pointers instead of process data, since we get a number
of crash reports when we try to access data in gralloc_close().

BUG=b:62069164, b:62221166
TEST=gralloctest all, Android boots, Youtube videos, 5-10
     CTS tests

Change-Id: Ic29a777573936216d99498d0b814ea50015fd435
Reviewed-on: https://chromium-review.googlesource.com/521794
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
diff --git a/cros_gralloc/cros_gralloc_types.h b/cros_gralloc/cros_gralloc_types.h
new file mode 100644
index 0000000..b1938c8
--- /dev/null
+++ b/cros_gralloc/cros_gralloc_types.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef CROS_GRALLOC_TYPES_H
+#define CROS_GRALLOC_TYPES_H
+
+typedef enum {
+	CROS_GRALLOC_ERROR_NONE = 0,
+	CROS_GRALLOC_ERROR_BAD_DESCRIPTOR = 1,
+	CROS_GRALLOC_ERROR_BAD_HANDLE = 2,
+	CROS_GRALLOC_ERROR_BAD_VALUE = 3,
+	CROS_GRALLOC_ERROR_NOT_SHARED = 4,
+	CROS_GRALLOC_ERROR_NO_RESOURCES = 5,
+	CROS_GRALLOC_ERROR_UNDEFINED = 6,
+	CROS_GRALLOC_ERROR_UNSUPPORTED = 7,
+} cros_gralloc_error_t;
+
+struct cros_gralloc_buffer_descriptor {
+	uint32_t width;
+	uint32_t height;
+	uint32_t consumer_usage;
+	uint32_t producer_usage;
+	uint32_t droid_format;
+	uint32_t drm_format;
+	uint64_t drv_usage;
+};
+
+#endif