#ifndef Debug_hpp
#define Debug_hpp
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "DebugAndroid.hpp"
#else
// limitations under the License.
#include "GrallocAndroid.hpp"
+#include "Debug.hpp"
-#include <cutils/log.h>
+#ifdef HAVE_GRALLOC1
+#include <sync/sync.h>
+#endif
GrallocModule *GrallocModule::getInstance()
{
break;
#endif
default:
- ALOGE("unknown gralloc major version (%d)", m_major_version);
+ TRACE("unknown gralloc major version (%d)", m_major_version);
break;
}
}
+
+int GrallocModule::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:
+ {
+ TRACE("no gralloc module to lock");
+ return -1;
+ }
+ }
+}
+
+int GrallocModule::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:
+ {
+ TRACE("no gralloc module to unlock");
+ return -1;
+ }
+ }
+}
#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()
{
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();
#include <string.h>
#include <time.h>
-#ifdef __ANDROID__
-#include <cutils/properties.h>
-#endif
-
#define ASYNCHRONOUS_BLIT false // FIXME: Currently leads to rare race conditions
namespace sw
#include "Common/GrallocAndroid.hpp"
#include <system/window.h>
-#include <cutils/log.h>
namespace sw
{
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
0, 0, buffer->width, buffer->height, &framebuffer) != 0)
{
- ALOGE("%s failed to lock buffer %p", __FUNCTION__, buffer);
+ TRACE("%s failed to lock buffer %p", __FUNCTION__, buffer);
return nullptr;
}
if((buffer->width < width) || (buffer->height < height))
{
- ALOGI("lock failed: buffer of %dx%d too small for window of %dx%d",
- buffer->width, buffer->height, width, height);
+ TRACE("lock failed: buffer of %dx%d too small for window of %dx%d",
+ buffer->width, buffer->height, width, height);
return nullptr;
}
case HAL_PIXEL_FORMAT_BGRA_8888: format = FORMAT_A8R8G8B8; break;
case HAL_PIXEL_FORMAT_RGB_888:
// Frame buffers are expected to have 16-bit or 32-bit colors, not 24-bit.
- ALOGE("Unsupported frame buffer format RGB_888"); ASSERT(false);
+ TRACE("Unsupported frame buffer format RGB_888"); ASSERT(false);
format = FORMAT_R8G8B8; // Wrong component order.
break;
default:
- ALOGE("Unsupported frame buffer format %d", buffer->format); ASSERT(false);
+ TRACE("Unsupported frame buffer format %d", buffer->format); ASSERT(false);
format = FORMAT_NULL;
break;
}
{
if(!buffer)
{
- ALOGE("%s: badness unlock with no active buffer", __FUNCTION__);
+ TRACE("%s: badness unlock with no active buffer", __FUNCTION__);
return;
}
if(GrallocModule::getInstance()->unlock(buffer->handle) != 0)
{
- ALOGE("%s: badness unlock failed", __FUNCTION__);
+ TRACE("%s: badness unlock failed", __FUNCTION__);
}
}
}
#if defined(__ANDROID__)
#include <system/window.h>
#include "../../Common/GrallocAndroid.hpp"
+#endif
+
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
-#define LOGLOCK(fmt, ...) // ALOGI(fmt " tid=%d", ##__VA_ARGS__, gettid())
+#define LOGLOCK(fmt, ...) // TRACE(fmt " tid=%d", ##__VA_ARGS__, gettid())
#else
#include <assert.h>
#define LOGLOCK(...)
#endif
case HAL_PIXEL_FORMAT_RGB_888: // Unsupported.
default:
- ALOGE("Unsupported EGL image format %d", halFormat); ASSERT(false);
+ ERR("Unsupported EGL image format %d", halFormat); ASSERT(false);
return GL_NONE;
}
}
{
if(x != 0 || y != 0 || z != 0)
{
- ALOGI("badness: %s called with unsupported parms: image=%p x=%d y=%d z=%d", __FUNCTION__, this, x, y, z);
+ TRACE("badness: %s called with unsupported parms: image=%p x=%d y=%d z=%d", __FUNCTION__, this, x, y, z);
}
LOGLOCK("image=%p op=%s.ani lock=%d", this, __FUNCTION__, lock);
namespace es
{
-#ifdef __ANDROID__
- void output(const char *format, va_list vararg)
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
+ static void output(const char *format, va_list vararg)
{
ALOGI("%s", android::String8::formatV(format, vararg).string());
}
#ifndef COMMON_DEBUG_H_
#define COMMON_DEBUG_H_
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
#else
#include <stdio.h>
#ifndef _CONSTANT_UNION_INCLUDED_
#define _CONSTANT_UNION_INCLUDED_
-#ifndef __ANDROID__
-#include <assert.h>
-#else
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
+#else
+#include <assert.h>
#endif
class ConstantUnion {
// are tracked in the intermediate representation, not the symbol table.
//
-#ifndef __ANDROID__
-#include <assert.h>
-#else
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
+#else
+#include <assert.h>
#endif
#include "InfoSink.h"
#ifndef COMPILER_DEBUG_H_
#define COMPILER_DEBUG_H_
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
#define Trace(...) ((void)0)
#elif defined(__ANDROID__)
if(!window)
{
- ALOGE("%s called with window==NULL %s:%d", __FUNCTION__, __FILE__, __LINE__);
+ ERR("%s called with window==NULL %s:%d", __FUNCTION__, __FILE__, __LINE__);
return false;
}
if(static_cast<ANativeWindow*>(window)->common.magic != ANDROID_NATIVE_WINDOW_MAGIC)
{
- ALOGE("%s called with window==%p bad magic %s:%d", __FUNCTION__, window, __FILE__, __LINE__);
+ ERR("%s called with window==%p bad magic %s:%d", __FUNCTION__, window, __FILE__, __LINE__);
return false;
}
return true;
if(!nativeBuffer || GLPixelFormatFromAndroid(nativeBuffer->format) == GL_NONE)
{
- ALOGW("%s badness unsupported HAL format=%x", __FUNCTION__, nativeBuffer ? nativeBuffer->format : 0);
+ ERR("%s badness unsupported HAL format=%x", __FUNCTION__, nativeBuffer ? nativeBuffer->format : 0);
return error(EGL_BAD_ATTRIBUTE, EGL_NO_IMAGE_KHR);
}
#include <algorithm>
#include <limits>
-#ifdef __ANDROID__
-#include <cutils/log.h>
-#endif
-
namespace es2
{
if(!context)
{
// Not strictly an error, but probably unintended or attempting to rely on non-compliant behavior
- #ifdef __ANDROID__
- ALOGI("expected_badness glGetIntegerv() called without current context.");
- #else
- ERR("glGetIntegerv() called without current context.");
- #endif
+ ERR("glGetIntegerv() called without current context.");
// This is not spec compliant! When there is no current GL context, functions should
// have no side effects. Google Maps queries these values before creating a context,