Android: Introduce ANDROID_HOST_BUILD and rework logging.
Avoid using the Android logger directly. Instead, use the Common/Debug
and OpenGL/common/debug paths instead, which abstracts away use of the
logger.
Add ANDRIOD_HOST_BUILD to tell the build we are building an Android
swiftshader, but minimizing the use of platform features such as the
logger.
Change-Id: Ic6c70843d947c568d0e29fe66c55af74b8559a59
Reviewed-on: https://swiftshader-review.googlesource.com/18028
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Common/GrallocAndroid.hpp b/src/Common/GrallocAndroid.hpp
index 3ebb5d7..fe0b15a 100644
--- a/src/Common/GrallocAndroid.hpp
+++ b/src/Common/GrallocAndroid.hpp
@@ -16,11 +16,9 @@
#define GRALLOC_ANDROID
#include <hardware/gralloc.h>
-#include <cutils/log.h>
#ifdef HAVE_GRALLOC1
#include <hardware/gralloc1.h>
-#include <sync/sync.h>
#endif
#include <unistd.h> // for close()
@@ -29,61 +27,8 @@
{
public:
static GrallocModule *getInstance();
- int lock(buffer_handle_t handle, int usage, int left, int top, int width, int height, void **vaddr)
- {
- switch(m_major_version)
- {
- case 0:
- {
- return m_module->lock(m_module, handle, usage, left, top, width, height, vaddr);
- }
- case 1:
-#ifdef HAVE_GRALLOC1
- {
- gralloc1_rect_t outRect{};
- outRect.left = left;
- outRect.top = top;
- outRect.width = width;
- outRect.height = height;
- return m_gralloc1_lock(m_gralloc1_device, handle, usage, usage, &outRect, vaddr, -1);
- }
-#endif
- default:
- {
- ALOGE("no gralloc module to lock");
- return -1;
- }
- }
- }
-
- int unlock(buffer_handle_t handle)
- {
- switch(m_major_version)
- {
- case 0:
- {
- return m_module->unlock(m_module, handle);
- }
- case 1:
-#ifdef HAVE_GRALLOC1
- {
- int32_t fenceFd = -1;
- int error = m_gralloc1_unlock(m_gralloc1_device, handle, &fenceFd);
- if (!error)
- {
- sync_wait(fenceFd, -1);
- close(fenceFd);
- }
- return error;
- }
-#endif
- default:
- {
- ALOGE("no gralloc module to unlock");
- return -1;
- }
- }
- }
+ int lock(buffer_handle_t handle, int usage, int left, int top, int width, int height, void **vaddr);
+ int unlock(buffer_handle_t handle);
private:
GrallocModule();