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.hpp b/src/Common/GrallocAndroid.hpp
new file mode 100644
index 0000000..4714d36
--- /dev/null
+++ b/src/Common/GrallocAndroid.hpp
@@ -0,0 +1,27 @@
+#ifndef GRALLOC_ANDROID
+#define GRALLOC_ANDROID
+
+#include <hardware/gralloc.h>
+
+class GrallocModule
+{
+public:
+ static GrallocModule* getInstance();
+ bool supportsConversion() const { return m_supportsConversion; }
+ int lock(
+ buffer_handle_t handle, int usage,
+ int left, int top, int width, int height, void**vaddr) {
+ return m_module->lock(m_module, handle, 0, left, top, width, height, vaddr);
+ }
+
+ int unlock(buffer_handle_t handle) {
+ return m_module->unlock(m_module, handle);
+ }
+
+private:
+ GrallocModule();
+ bool m_supportsConversion;
+ const gralloc_module_t* m_module;
+};
+
+#endif // GRALLOC_ANDROID