Initial work to connect gralloc to egl::Image
Change-Id: Ia11a9520bb6525dc367e0b2956850574b29e4796
Reviewed-on: https://swiftshader-review.googlesource.com/2900
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Common/GrallocAndroid.cpp b/src/Common/GrallocAndroid.cpp
new file mode 100644
index 0000000..307a16f
--- /dev/null
+++ b/src/Common/GrallocAndroid.cpp
@@ -0,0 +1,31 @@
+#include "GrallocAndroid.hpp"
+
+#include <cutils/log.h>
+
+GrallocModule* GrallocModule::getInstance()
+{
+ static GrallocModule instance;
+ return &instance;
+}
+
+GrallocModule::GrallocModule()
+{
+ const hw_module_t* module;
+ hw_get_module("converting_gralloc", &module);
+ if (module)
+ {
+ m_supportsConversion = true;
+ ALOGI("Loaded converting gralloc");
+ }
+ else
+ {
+ m_supportsConversion = false;
+ ALOGE("Falling back to standard gralloc with reduced format support");
+ hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
+ }
+ if (!module)
+ {
+ ALOGE("Failed to load standard gralloc");
+ }
+ m_module = reinterpret_cast<const gralloc_module_t*>(module);
+}