summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camera/ANativeWindowDisplayAdapter.cpp5
-rw-r--r--camera/Android.mk26
-rw-r--r--camera/AppCallbackNotifier.cpp10
-rw-r--r--camera/BaseCameraAdapter.cpp8
-rw-r--r--camera/CameraHal.cpp10
-rw-r--r--camera/CameraHalUtilClasses.cpp3
-rw-r--r--camera/CameraHal_Module.cpp2
-rw-r--r--camera/Encoder_libjpeg.cpp2
-rw-r--r--camera/MemoryManager.cpp5
-rw-r--r--camera/NV12_resize.c4
-rw-r--r--camera/OMXCameraAdapter/OMX3A.cpp4
-rw-r--r--camera/OMXCameraAdapter/OMXAlgo.cpp4
-rw-r--r--camera/OMXCameraAdapter/OMXCameraAdapter.cpp16
-rw-r--r--camera/OMXCameraAdapter/OMXCapabilities.cpp51
-rw-r--r--camera/OMXCameraAdapter/OMXCapture.cpp4
-rw-r--r--camera/OMXCameraAdapter/OMXDefaults.cpp3
-rw-r--r--camera/OMXCameraAdapter/OMXExif.cpp4
-rw-r--r--camera/OMXCameraAdapter/OMXFD.cpp6
-rw-r--r--camera/OMXCameraAdapter/OMXFocus.cpp6
-rw-r--r--camera/OMXCameraAdapter/OMXZoom.cpp4
-rw-r--r--camera/SensorListener.cpp2
-rw-r--r--camera/TICameraParameters.cpp4
-rw-r--r--camera/V4LCameraAdapter/V4LCameraAdapter.cpp4
-rw-r--r--camera/inc/BaseCameraAdapter.h2
-rw-r--r--camera/inc/CameraHal.h54
-rw-r--r--libtiutils/Android.mk11
-rw-r--r--libtiutils/DebugUtils.cpp96
-rw-r--r--libtiutils/DebugUtils.h380
-rw-r--r--libtiutils/MessageQueue.h24
29 files changed, 576 insertions, 178 deletions
diff --git a/camera/ANativeWindowDisplayAdapter.cpp b/camera/ANativeWindowDisplayAdapter.cpp
index fa4e1d1..a2e7329 100644
--- a/camera/ANativeWindowDisplayAdapter.cpp
+++ b/camera/ANativeWindowDisplayAdapter.cpp
@@ -14,11 +14,6 @@
* limitations under the License.
*/
-
-
-
-#define LOG_TAG "CameraHAL"
-
#include "ANativeWindowDisplayAdapter.h"
#include <OMX_IVCommon.h>
#include <ui/GraphicBuffer.h>
diff --git a/camera/Android.mk b/camera/Android.mk
index 4a76cd1..649d528 100644
--- a/camera/Android.mk
+++ b/camera/Android.mk
@@ -5,6 +5,28 @@ LOCAL_PATH:= $(call my-dir)
OMAP4_CAMERA_HAL_USES:= OMX
# OMAP4_CAMERA_HAL_USES:= USB
+ifdef TI_CAMERAHAL_DEBUG_ENABLED
+ # Enable CameraHAL debug logs
+ CAMERAHAL_CFLAGS += -DCAMERAHAL_DEBUG
+endif
+
+ifdef TI_CAMERAHAL_VERBOSE_DEBUG_ENABLED
+ # Enable CameraHAL verbose debug logs
+ CAMERAHAL_CFLAGS += -DCAMERAHAL_DEBUG_VERBOSE
+endif
+
+ifdef TI_CAMERAHAL_DEBUG_FUNCTION_NAMES
+ # Enable CameraHAL function enter/exit logging
+ CAMERAHAL_CFLAGS += -DTI_UTILS_FUNCTION_LOGGER_ENABLE
+endif
+
+ifdef TI_CAMERAHAL_DEBUG_TIMESTAMPS
+ # Enable timestamp logging
+ CAMERAHAL_CFLAGS += -DTI_UTILS_DEBUG_USE_TIMESTAMPS
+endif
+
+CAMERAHAL_CFLAGS += -DLOG_TAG=\"CameraHal\"
+
OMAP4_CAMERA_HAL_SRC := \
CameraHal_Module.cpp \
CameraHal.cpp \
@@ -84,7 +106,7 @@ LOCAL_SHARED_LIBRARIES:= \
libjpeg \
libexif
-LOCAL_CFLAGS := -fno-short-enums -DCOPY_IMAGE_BUFFER
+LOCAL_CFLAGS := -fno-short-enums -DCOPY_IMAGE_BUFFER $(CAMERAHAL_CFLAGS)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE:= camera.$(TARGET_BOARD_PLATFORM)
@@ -127,7 +149,7 @@ LOCAL_SHARED_LIBRARIES:= \
libcamera_client \
libion \
-LOCAL_CFLAGS := -fno-short-enums -DCOPY_IMAGE_BUFFER
+LOCAL_CFLAGS := -fno-short-enums -DCOPY_IMAGE_BUFFER $(CAMERAHAL_CFLAGS)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE:= camera.$(TARGET_BOARD_PLATFORM)
diff --git a/camera/AppCallbackNotifier.cpp b/camera/AppCallbackNotifier.cpp
index df8a8de..bec2e68 100644
--- a/camera/AppCallbackNotifier.cpp
+++ b/camera/AppCallbackNotifier.cpp
@@ -14,12 +14,6 @@
* limitations under the License.
*/
-
-
-
-#define LOG_TAG "CameraHAL"
-
-
#include "CameraHal.h"
#include "VideoMetadata.h"
#include "Encoder_libjpeg.h"
@@ -1128,6 +1122,8 @@ void AppCallbackNotifier::frameCallback(CameraFrame* caFrame)
void AppCallbackNotifier::flushAndReturnFrames()
{
+ LOG_FUNCTION_NAME;
+
TIUTILS::Message msg;
CameraFrame *frame;
@@ -1443,7 +1439,7 @@ status_t AppCallbackNotifier::startPreviewCallbacks(CameraParameters &params, vo
mPreviewing = true;
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return NO_ERROR;
}
diff --git a/camera/BaseCameraAdapter.cpp b/camera/BaseCameraAdapter.cpp
index df287c5..b844a30 100644
--- a/camera/BaseCameraAdapter.cpp
+++ b/camera/BaseCameraAdapter.cpp
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-
-
-#define LOG_TAG "CameraHAL"
-
#include "BaseCameraAdapter.h"
namespace android {
@@ -311,7 +307,7 @@ void BaseCameraAdapter::returnFrame(void* frameBuf, CameraFrame::FrameType frame
//check if someone is holding this buffer
if ( 0 == refCount )
{
-#ifdef DEBUG_LOG
+#ifdef CAMERAHAL_DEBUG
if(mBuffersWithDucati.indexOfKey((int)frameBuf)>=0)
{
LOGE("Buffer already with Ducati!! 0x%x", frameBuf);
@@ -1080,7 +1076,7 @@ status_t BaseCameraAdapter::notifyShutterSubscribers()
shutterEvent.mEventData.clear();
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index 2170b15..2ce7499 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -21,8 +21,6 @@
*
*/
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "ANativeWindowDisplayAdapter.h"
#include "TICameraParameters.h"
@@ -1163,7 +1161,7 @@ status_t CameraHal::allocPreviewDataBufs(size_t size, size_t bufferCount)
mPreviewDataOffsets = NULL;
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -1236,7 +1234,7 @@ status_t CameraHal::allocImageBufs(unsigned int width, unsigned int height, size
mImageOffsets = NULL;
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -1284,7 +1282,7 @@ status_t CameraHal::allocVideoBufs(uint32_t width, uint32_t height, uint32_t buf
}
exit:
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -1324,7 +1322,7 @@ status_t CameraHal::allocRawBufs(int width, int height, const char* previewForma
mVideoOffsets = NULL;
}
- LOG_FUNCTION_NAME
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
diff --git a/camera/CameraHalUtilClasses.cpp b/camera/CameraHalUtilClasses.cpp
index 073c2b8..0cb5c35 100644
--- a/camera/CameraHalUtilClasses.cpp
+++ b/camera/CameraHalUtilClasses.cpp
@@ -21,9 +21,6 @@
*
*/
-#define LOG_TAG "CameraHAL"
-
-
#include "CameraHal.h"
namespace android {
diff --git a/camera/CameraHal_Module.cpp b/camera/CameraHal_Module.cpp
index 511cbc2..9f94bb8 100644
--- a/camera/CameraHal_Module.cpp
+++ b/camera/CameraHal_Module.cpp
@@ -21,8 +21,6 @@
*
*/
-#define LOG_TAG "CameraHAL"
-
#include <utils/threads.h>
#include "CameraHal.h"
diff --git a/camera/Encoder_libjpeg.cpp b/camera/Encoder_libjpeg.cpp
index 7a6054f..deed61a 100644
--- a/camera/Encoder_libjpeg.cpp
+++ b/camera/Encoder_libjpeg.cpp
@@ -23,8 +23,6 @@
*
*/
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "Encoder_libjpeg.h"
#include "NV12_resize.h"
diff --git a/camera/MemoryManager.cpp b/camera/MemoryManager.cpp
index a817518..b6a1390 100644
--- a/camera/MemoryManager.cpp
+++ b/camera/MemoryManager.cpp
@@ -14,11 +14,6 @@
* limitations under the License.
*/
-
-
-#define LOG_TAG "CameraHAL"
-
-
#include "CameraHal.h"
#include "TICameraParameters.h"
diff --git a/camera/NV12_resize.c b/camera/NV12_resize.c
index 03c049e..9191d16 100644
--- a/camera/NV12_resize.c
+++ b/camera/NV12_resize.c
@@ -4,7 +4,11 @@
#define LOG_NIDEBUG 0
#define LOG_NDDEBUG 0
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
#define LOG_TAG "NV12_resize"
+
#define STRIDE 4096
#include <utils/Log.h>
diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp
index 06571d2..8ccacf4 100644
--- a/camera/OMXCameraAdapter/OMX3A.cpp
+++ b/camera/OMXCameraAdapter/OMX3A.cpp
@@ -21,10 +21,6 @@
*
*/
-#undef LOG_TAG
-
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
#include "ErrorUtils.h"
diff --git a/camera/OMXCameraAdapter/OMXAlgo.cpp b/camera/OMXCameraAdapter/OMXAlgo.cpp
index b3fad0f..71274d8 100644
--- a/camera/OMXCameraAdapter/OMXAlgo.cpp
+++ b/camera/OMXCameraAdapter/OMXAlgo.cpp
@@ -21,10 +21,6 @@
*
*/
-#undef LOG_TAG
-
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
#include "ErrorUtils.h"
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index e207803..ea896bb 100644
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -38,10 +38,6 @@ static int mDebugFcs = 0;
namespace android {
-#undef LOG_TAG
-///Maintain a separate tag for OMXCameraAdapter logs to isolate issues OMX specific
-#define LOG_TAG "CameraHAL"
-
//frames skipped before recalculating the framerate
#define FPS_PERIOD 30
@@ -346,6 +342,8 @@ OMXCameraAdapter::OMXCameraPortParameters *OMXCameraAdapter::getPortParams(Camer
status_t OMXCameraAdapter::fillThisBuffer(void* frameBuf, CameraFrame::FrameType frameType)
{
+ LOG_FUNCTION_NAME;
+
status_t ret = NO_ERROR;
OMXCameraPortParameters *port = NULL;
OMX_ERRORTYPE eError = OMX_ErrorNone;
@@ -914,6 +912,8 @@ status_t OMXCameraAdapter::setFormat(OMX_U32 port, OMXCameraPortParameters &port
status_t OMXCameraAdapter::flushBuffers()
{
+ LOG_FUNCTION_NAME;
+
status_t ret = NO_ERROR;
OMX_ERRORTYPE eError = OMX_ErrorNone;
@@ -924,8 +924,6 @@ status_t OMXCameraAdapter::flushBuffers()
return NO_INIT;
}
- LOG_FUNCTION_NAME;
-
OMXCameraPortParameters * mPreviewData = NULL;
mPreviewData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mPrevPortIndex];
@@ -1160,7 +1158,7 @@ status_t OMXCameraAdapter::switchToExecuting()
msg.arg1 = mErrorNotifier;
ret = mCommandHandler->put(&msg);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -2273,7 +2271,7 @@ status_t OMXCameraAdapter::autoFocus()
EXIT:
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -3005,7 +3003,7 @@ OMX_ERRORTYPE OMXCameraAdapter::OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLE
mFramesWithDucati--;
-#ifdef DEBUG_LOG
+#ifdef CAMERAHAL_DEBUG
if(mBuffersWithDucati.indexOfKey((int)pBuffHeader->pBuffer)<0)
{
LOGE("Buffer was never with Ducati!! 0x%x", pBuffHeader->pBuffer);
diff --git a/camera/OMXCameraAdapter/OMXCapabilities.cpp b/camera/OMXCameraAdapter/OMXCapabilities.cpp
index 30977ec..ada6491 100644
--- a/camera/OMXCameraAdapter/OMXCapabilities.cpp
+++ b/camera/OMXCameraAdapter/OMXCapabilities.cpp
@@ -28,11 +28,6 @@
namespace android {
-#undef LOG_TAG
-
-// Maintain a separate tag for OMXCameraAdapter logs to isolate issues OMX specific
-#define LOG_TAG "CameraHAL"
-
/************************************
* global constants and variables
*************************************/
@@ -485,7 +480,7 @@ status_t OMXCameraAdapter::insertImageSizes(CameraProperties::Properties* params
params->set(CameraProperties::SUPPORTED_PICTURE_SIZES, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -523,7 +518,7 @@ status_t OMXCameraAdapter::insertPreviewSizes(CameraProperties::Properties* para
params->set(CameraProperties::SUPPORTED_PREVIEW_SIZES, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -549,7 +544,7 @@ status_t OMXCameraAdapter::insertVideoSizes(CameraProperties::Properties* params
params->set(CameraProperties::SUPPORTED_VIDEO_SIZES, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -576,7 +571,7 @@ status_t OMXCameraAdapter::insertThumbSizes(CameraProperties::Properties* params
params->set(CameraProperties::SUPPORTED_THUMBNAIL_SIZES, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -608,7 +603,7 @@ status_t OMXCameraAdapter::insertZoomStages(CameraProperties::Properties* params
params->set(CameraProperties::SMOOTH_ZOOM_SUPPORTED, TICameraParameters::ZOOM_SUPPORTED);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -641,7 +636,7 @@ status_t OMXCameraAdapter::insertImageFormats(CameraProperties::Properties* para
params->set(CameraProperties::SUPPORTED_PICTURE_FORMATS, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -673,7 +668,7 @@ status_t OMXCameraAdapter::insertPreviewFormats(CameraProperties::Properties* pa
params->set(CameraProperties::SUPPORTED_PREVIEW_FORMATS, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -699,7 +694,7 @@ status_t OMXCameraAdapter::insertFramerates(CameraProperties::Properties* params
params->set(CameraProperties::SUPPORTED_PREVIEW_FRAME_RATES, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -731,7 +726,7 @@ status_t OMXCameraAdapter::insertVFramerates(CameraProperties::Properties* param
CAMHAL_LOGDB("Default framerate range: [%s]", DEFAULT_FRAMERATE_RANGE_IMAGE);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -750,7 +745,7 @@ status_t OMXCameraAdapter::insertEVs(CameraProperties::Properties* params, OMX_T
snprintf(supported, MAX_PROP_VALUE_LENGTH, "%d", ( int ) ( caps.xEVCompensationMax * 10 ));
params->set(CameraProperties::SUPPORTED_EV_MAX, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -774,7 +769,7 @@ status_t OMXCameraAdapter::insertISOModes(CameraProperties::Properties* params,
params->set(CameraProperties::SUPPORTED_ISO_VALUES, supported);
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -809,7 +804,7 @@ status_t OMXCameraAdapter::insertIPPModes(CameraProperties::Properties* params,
remove_last_sep(supported);
params->set(CameraProperties::SUPPORTED_IPP_MODES, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -833,7 +828,7 @@ status_t OMXCameraAdapter::insertWBModes(CameraProperties::Properties* params, O
params->set(CameraProperties::SUPPORTED_WHITE_BALANCE, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -857,7 +852,7 @@ status_t OMXCameraAdapter::insertEffects(CameraProperties::Properties* params, O
remove_last_sep(supported);
params->set(CameraProperties::SUPPORTED_EFFECTS, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -881,7 +876,7 @@ status_t OMXCameraAdapter::insertExpModes(CameraProperties::Properties* params,
params->set(CameraProperties::SUPPORTED_EXPOSURE_MODES, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -911,7 +906,7 @@ status_t OMXCameraAdapter::insertFlashModes(CameraProperties::Properties* params
remove_last_sep(supported);
params->set(CameraProperties::SUPPORTED_FLASH_MODES, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -936,7 +931,7 @@ status_t OMXCameraAdapter::insertSceneModes(CameraProperties::Properties* params
remove_last_sep(supported);
params->set(CameraProperties::SUPPORTED_SCENE_MODES, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -972,7 +967,7 @@ status_t OMXCameraAdapter::insertFocusModes(CameraProperties::Properties* params
params->set(CameraProperties::SUPPORTED_FOCUS_MODES, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -996,7 +991,7 @@ status_t OMXCameraAdapter::insertFlickerModes(CameraProperties::Properties* para
remove_last_sep(supported);
params->set(CameraProperties::SUPPORTED_ANTIBANDING, supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -1019,7 +1014,7 @@ status_t OMXCameraAdapter::insertAreas(CameraProperties::Properties* params, OMX
params->set(CameraProperties::MAX_NUM_METERING_AREAS, supported);
CAMHAL_LOGDB("Maximum supported exposure areas %s", supported);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -1032,7 +1027,7 @@ status_t OMXCameraAdapter::insertLocks(CameraProperties::Properties* params, OMX
params->set(CameraProperties::AUTO_EXPOSURE_LOCK_SUPPORTED, DEFAULT_LOCK_SUPPORTED);
params->set(CameraProperties::AUTO_WHITEBALANCE_LOCK_SUPPORTED, DEFAULT_LOCK_SUPPORTED);
- LOG_FUNCTION_NAME
+ LOG_FUNCTION_NAME_EXIT
return ret;
}
@@ -1097,7 +1092,7 @@ status_t OMXCameraAdapter::insertDefaults(CameraProperties::Properties* params,
params->set(CameraProperties::PREFERRED_PREVIEW_SIZE_FOR_VIDEO, DEFAULT_PREFERRED_PREVIEW_SIZE_FOR_VIDEO);
params->set(CameraProperties::SENSOR_ORIENTATION, DEFAULT_SENSOR_ORIENTATION);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
@@ -1130,7 +1125,7 @@ status_t OMXCameraAdapter::insertSenMount(CameraProperties::Properties* params,
// 2) Assign mounting rotation
params->set(CameraProperties::ORIENTATION_INDEX, caps.tSenMounting.nRotation);
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp
index 5e102c5..32c0666 100644
--- a/camera/OMXCameraAdapter/OMXCapture.cpp
+++ b/camera/OMXCameraAdapter/OMXCapture.cpp
@@ -21,10 +21,6 @@
*
*/
-#undef LOG_TAG
-
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
#include "ErrorUtils.h"
diff --git a/camera/OMXCameraAdapter/OMXDefaults.cpp b/camera/OMXCameraAdapter/OMXDefaults.cpp
index 9099bb5..891e595 100644
--- a/camera/OMXCameraAdapter/OMXDefaults.cpp
+++ b/camera/OMXCameraAdapter/OMXDefaults.cpp
@@ -26,9 +26,6 @@
namespace android {
-#undef LOG_TAG
-#define LOG_TAG "CameraHAL"
-
#define __STRINGIFY(s) __STRING(s)
// OMX Camera defaults
diff --git a/camera/OMXCameraAdapter/OMXExif.cpp b/camera/OMXCameraAdapter/OMXExif.cpp
index 4c5e555..f931510 100644
--- a/camera/OMXCameraAdapter/OMXExif.cpp
+++ b/camera/OMXCameraAdapter/OMXExif.cpp
@@ -21,10 +21,6 @@
*
*/
-#undef LOG_TAG
-
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
#include <math.h>
diff --git a/camera/OMXCameraAdapter/OMXFD.cpp b/camera/OMXCameraAdapter/OMXFD.cpp
index 73d07ae..49d202b 100644
--- a/camera/OMXCameraAdapter/OMXFD.cpp
+++ b/camera/OMXCameraAdapter/OMXFD.cpp
@@ -21,10 +21,6 @@
*
*/
-#undef LOG_TAG
-
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
@@ -331,8 +327,6 @@ status_t OMXCameraAdapter::encodeFaceCoordinates(const OMX_FACEDETECTIONTYPE *fa
return EINVAL;
}
- LOG_FUNCTION_NAME
-
hRange = CameraFDResult::RIGHT - CameraFDResult::LEFT;
vRange = CameraFDResult::BOTTOM - CameraFDResult::TOP;
diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp
index 3a882f4..014e8f5 100644
--- a/camera/OMXCameraAdapter/OMXFocus.cpp
+++ b/camera/OMXCameraAdapter/OMXFocus.cpp
@@ -22,10 +22,6 @@
*
*/
-#undef LOG_TAG
-
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
#include "ErrorUtils.h"
@@ -72,7 +68,7 @@ status_t OMXCameraAdapter::setParametersFocus(const CameraParameters &params,
}
}
- LOG_FUNCTION_NAME;
+ LOG_FUNCTION_NAME_EXIT;
return ret;
}
diff --git a/camera/OMXCameraAdapter/OMXZoom.cpp b/camera/OMXCameraAdapter/OMXZoom.cpp
index eec7691..478fd81 100644
--- a/camera/OMXCameraAdapter/OMXZoom.cpp
+++ b/camera/OMXCameraAdapter/OMXZoom.cpp
@@ -21,10 +21,6 @@
*
*/
-#undef LOG_TAG
-
-#define LOG_TAG "CameraHAL"
-
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
diff --git a/camera/SensorListener.cpp b/camera/SensorListener.cpp
index bb6f577..00835b3 100644
--- a/camera/SensorListener.cpp
+++ b/camera/SensorListener.cpp
@@ -21,8 +21,6 @@
*
*/
-#define LOG_TAG "CameraHAL"
-
#include "SensorListener.h"
#include "CameraHal.h"
diff --git a/camera/TICameraParameters.cpp b/camera/TICameraParameters.cpp
index e3f2645..a2c9f26 100644
--- a/camera/TICameraParameters.cpp
+++ b/camera/TICameraParameters.cpp
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-
-
-
-#define LOG_TAG "CameraHAL"
#include <utils/Log.h>
#include <string.h>
diff --git a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
index 3fb3380..44904f3 100644
--- a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -48,10 +48,6 @@ static int mDebugFps = 0;
namespace android {
-#undef LOG_TAG
-///Maintain a separate tag for V4LCameraAdapter logs to isolate issues OMX specific
-#define LOG_TAG "CameraHAL"
-
//frames skipped before recalculating the framerate
#define FPS_PERIOD 30
diff --git a/camera/inc/BaseCameraAdapter.h b/camera/inc/BaseCameraAdapter.h
index d778491..b358427 100644
--- a/camera/inc/BaseCameraAdapter.h
+++ b/camera/inc/BaseCameraAdapter.h
@@ -258,7 +258,7 @@ protected:
uint32_t mFramesWithDisplay;
uint32_t mFramesWithEncoder;
-#ifdef DEBUG_LOG
+#ifdef CAMERAHAL_DEBUG
KeyedVector<int, bool> mBuffersWithDucati;
#endif
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index 9f3230b..fd3080e 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -79,43 +79,45 @@
#define CAMHAL_LOGI LOGI
-//Uncomment to enable more verbose/debug logs
-//#define DEBUG_LOG
-
-///Camera HAL Logging Functions
-#ifndef DEBUG_LOG
-
-#define CAMHAL_LOGDA(str)
-#define CAMHAL_LOGDB(str, ...)
-#define CAMHAL_LOGVA(str)
-#define CAMHAL_LOGVB(str, ...)
-
-#define CAMHAL_LOGEA LOGE
-#define CAMHAL_LOGEB LOGE
-
-#undef LOG_FUNCTION_NAME
-#undef LOG_FUNCTION_NAME_EXIT
-#define LOG_FUNCTION_NAME
-#define LOG_FUNCTION_NAME_EXIT
-
+// logging functions
+#ifdef CAMERAHAL_DEBUG
+# define CAMHAL_LOGD DBGUTILS_LOGD
+# define CAMHAL_LOGDA DBGUTILS_LOGDA
+# define CAMHAL_LOGDB DBGUTILS_LOGDB
+# ifdef CAMERAHAL_DEBUG_VERBOSE
+# define CAMHAL_LOGV DBGUTILS_LOGV
+# define CAMHAL_LOGVA DBGUTILS_LOGVA
+# define CAMHAL_LOGVB DBGUTILS_LOGVB
+# else
+# define CAMHAL_LOGV(...)
+# define CAMHAL_LOGVA(str)
+# define CAMHAL_LOGVB(str, ...)
+# endif
#else
+# define CAMHAL_LOGD(...)
+# define CAMHAL_LOGDA(str)
+# define CAMHAL_LOGDB(str, ...)
+# define CAMHAL_LOGV(...)
+# define CAMHAL_LOGVA(str)
+# define CAMHAL_LOGVB(str, ...)
+#endif
-#define CAMHAL_LOGDA DBGUTILS_LOGDA
-#define CAMHAL_LOGDB DBGUTILS_LOGDB
-#define CAMHAL_LOGVA DBGUTILS_LOGVA
-#define CAMHAL_LOGVB DBGUTILS_LOGVB
-
+#define CAMHAL_LOGE DBGUTILS_LOGE
#define CAMHAL_LOGEA DBGUTILS_LOGEA
#define CAMHAL_LOGEB DBGUTILS_LOGEB
+#define CAMHAL_LOGF DBGUTILS_LOGF
-#endif
-
+#define CAMHAL_ASSERT DBGUTILS_ASSERT
+#define CAMHAL_ASSERT_X DBGUTILS_ASSERT_X
+#define CAMHAL_UNUSED(x) (void)x
#define NONNEG_ASSIGN(x,y) \
if(x > -1) \
y = x
+#define CAMHAL_SIZE_OF_ARRAY(x) static_cast<int>(sizeof(x)/sizeof(x[0]))
+
namespace android {
#define PARAM_BUFFER 6000
diff --git a/libtiutils/Android.mk b/libtiutils/Android.mk
index 50168d1..8e45913 100644
--- a/libtiutils/Android.mk
+++ b/libtiutils/Android.mk
@@ -7,6 +7,7 @@ include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_SRC_FILES:= \
+ DebugUtils.cpp \
MessageQueue.cpp \
Semaphore.cpp \
ErrorUtils.cpp
@@ -26,7 +27,15 @@ LOCAL_C_INCLUDES += \
LOCAL_CFLAGS += -fno-short-enums
-# LOCAL_CFLAGS +=
+ifdef TI_UTILS_MESSAGE_QUEUE_DEBUG_ENABLED
+ # Enable debug logs
+ LOCAL_CFLAGS += -DMSGQ_DEBUG
+endif
+
+ifdef TI_UTILS_MESSAGE_QUEUE_DEBUG_FUNCTION_NAMES
+ # Enable function enter/exit logging
+ LOCAL_CFLAGS += -DTI_UTILS_FUNCTION_LOGGER_ENABLE
+endif
LOCAL_MODULE:= libtiutils
LOCAL_MODULE_TAGS:= optional
diff --git a/libtiutils/DebugUtils.cpp b/libtiutils/DebugUtils.cpp
new file mode 100644
index 0000000..0165118
--- /dev/null
+++ b/libtiutils/DebugUtils.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) Texas Instruments - http://www.ti.com/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "DebugUtils.h"
+
+#include "utils/Debug.h"
+
+
+
+
+namespace Ti {
+
+
+
+
+// shared const buffer with spaces for indentation string
+extern const char sIndentStringBuffer[] =
+ " "
+ " ";
+template class android::CompileTimeAssert<sizeof(sIndentStringBuffer) - 1 == kIndentStringMaxLength>;
+
+
+
+
+static const int kDebugThreadInfoGrowSize = 16;
+
+
+
+
+Debug Debug::sInstance;
+
+
+
+
+Debug::Debug()
+{
+ grow();
+}
+
+
+void Debug::grow()
+{
+ android::Mutex::Autolock locker(mMutex);
+ (void)locker;
+
+ const int size = kDebugThreadInfoGrowSize;
+
+ const int newSize = (mData.get() ? mData->threads.size() : 0) + size;
+
+ Data * const newData = new Data;
+ newData->threads.setCapacity(newSize);
+
+ // insert previous thread info pointers
+ if ( mData.get() )
+ newData->threads.insertVectorAt(mData->threads, 0);
+
+ // populate data with new thread infos
+ for ( int i = 0; i < size; ++i )
+ newData->threads.add(new ThreadInfo);
+
+ // replace old data with new one
+ mData = newData;
+}
+
+
+Debug::ThreadInfo * Debug::registerThread(Data * const data, const int32_t threadId)
+{
+ const int size = data->threads.size();
+ for ( int i = 0; i < size; ++i )
+ {
+ ThreadInfo * const threadInfo = data->threads.itemAt(i);
+ if ( android_atomic_acquire_cas(0, threadId, &threadInfo->threadId) == 0 )
+ return threadInfo;
+ }
+
+ // failed to find empty slot for thread
+ return 0;
+}
+
+
+
+
+} // namespace Ti
diff --git a/libtiutils/DebugUtils.h b/libtiutils/DebugUtils.h
index 54edfc7..9f12a9c 100644
--- a/libtiutils/DebugUtils.h
+++ b/libtiutils/DebugUtils.h
@@ -14,23 +14,379 @@
* limitations under the License.
*/
-
-
#ifndef DEBUG_UTILS_H
#define DEBUG_UTILS_H
-///Defines for debug statements - Macro LOG_TAG needs to be defined in the respective files
-#define DBGUTILS_LOGVA(str) LOGV("%s:%d %s - " str,__FILE__, __LINE__,__FUNCTION__);
-#define DBGUTILS_LOGVB(str,...) LOGV("%s:%d %s - " str,__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__);
-#define DBGUTILS_LOGDA(str) LOGD("%s:%d %s - " str,__FILE__, __LINE__,__FUNCTION__);
-#define DBGUTILS_LOGDB(str, ...) LOGD("%s:%d %s - " str,__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__);
-#define DBGUTILS_LOGEA(str) LOGE("%s:%d %s - " str,__FILE__, __LINE__, __FUNCTION__);
-#define DBGUTILS_LOGEB(str, ...) LOGE("%s:%d %s - " str,__FILE__, __LINE__,__FUNCTION__, __VA_ARGS__);
-#define LOG_FUNCTION_NAME LOGV("%d: %s() ENTER", __LINE__, __FUNCTION__);
-#define LOG_FUNCTION_NAME_EXIT LOGV("%d: %s() EXIT", __LINE__, __FUNCTION__);
+#include <android/log.h>
+#include <utils/threads.h>
+#include <utils/Vector.h>
-#endif //DEBUG_UTILS_H
+namespace Ti {
+
+
+
+
+// use 2 space characters for call stack indent
+static const int kFunctionLoggerIndentSize = 2;
+
+
+
+
+template <int Size = kFunctionLoggerIndentSize>
+class IndentString
+{
+public:
+ IndentString(int length);
+
+ const char * string() const;
+
+private:
+ int calculateOffset(int length) const;
+
+private:
+ const int mOffset;
+};
+
+
+
+
+class Debug
+{
+public:
+ static Debug * instance();
+
+ int offsetForCurrentThread();
+ void log(int priority, const char * format, ...);
+
+private:
+ class ThreadInfo
+ {
+ public:
+ ThreadInfo() :
+ threadId(0), callOffset(0)
+ {}
+
+ volatile int32_t threadId;
+ int callOffset;
+ };
+
+ class Data : public android::RefBase
+ {
+ public:
+ android::Vector<ThreadInfo*> threads;
+ };
+
+private:
+ // called from FunctionLogger
+ void increaseOffsetForCurrentThread();
+ void decreaseOffsetForCurrentThread();
+
+private:
+ Debug();
+
+ void grow();
+ ThreadInfo * registerThread(Data * data, int32_t threadId);
+ ThreadInfo * findCurrentThreadInfo();
+ void addOffsetForCurrentThread(int offset);
+
+private:
+ static Debug sInstance;
+
+ mutable android::Mutex mMutex;
+ android::sp<Data> mData;
+
+ friend class FunctionLogger;
+};
+
+
+
+
+class FunctionLogger
+{
+public:
+ FunctionLogger(const char * file, int line, const char * function);
+ ~FunctionLogger();
+
+ void setExitLine(int line);
+
+private:
+ const char * const mFile;
+ const int mLine;
+ const char * const mFunction;
+ const void * const mThreadId;
+ int mExitLine;
+};
+
+
+
+
+#ifdef TI_UTILS_FUNCTION_LOGGER_ENABLE
+# define LOG_FUNCTION_NAME Ti::FunctionLogger __function_logger_instance(__FILE__, __LINE__, __FUNCTION__);
+# define LOG_FUNCTION_NAME_EXIT __function_logger_instance.setExitLine(__LINE__);
+#else
+# define LOG_FUNCTION_NAME
+# define LOG_FUNCTION_NAME_EXIT
+#endif
+
+#ifdef TI_UTILS_DEBUG_USE_TIMESTAMPS
+ // truncate timestamp to 1000 seconds to fit into 6 characters
+# define TI_UTILS_DEBUG_TIMESTAMP_TOKEN "[%06d] "
+# define TI_UTILS_DEBUG_TIMESTAMP_VARIABLE static_cast<int>(nanoseconds_to_milliseconds(systemTime()) % 1000000),
+#else
+# define TI_UTILS_DEBUG_TIMESTAMP_TOKEN
+# define TI_UTILS_DEBUG_TIMESTAMP_VARIABLE
+#endif
+
+
+
+
+#define DBGUTILS_LOGV_FULL(priority, file, line, function, format, ...) \
+ do \
+ { \
+ Ti::Debug * const debug = Ti::Debug::instance(); \
+ debug->log(priority, format, \
+ TI_UTILS_DEBUG_TIMESTAMP_VARIABLE \
+ reinterpret_cast<int>(androidGetThreadId()), \
+ Ti::IndentString<>(debug->offsetForCurrentThread()).string(), \
+ file, line, function, __VA_ARGS__); \
+ } while (0)
+
+#define DBGUTILS_LOGV(...) DBGUTILS_LOGV_FULL(ANDROID_LOG_VERBOSE, __FILE__, __LINE__, __FUNCTION__, TI_UTILS_DEBUG_TIMESTAMP_TOKEN "(%x) %s %s:%d %s - " __VA_ARGS__, "")
+#define DBGUTILS_LOGD(...) DBGUTILS_LOGV_FULL(ANDROID_LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, TI_UTILS_DEBUG_TIMESTAMP_TOKEN "(%x) %s %s:%d %s - " __VA_ARGS__, "")
+#define DBGUTILS_LOGE(...) DBGUTILS_LOGV_FULL(ANDROID_LOG_ERROR, __FILE__, __LINE__, __FUNCTION__, TI_UTILS_DEBUG_TIMESTAMP_TOKEN "(%x) %s %s:%d %s - " __VA_ARGS__, "")
+#define DBGUTILS_LOGF(...) DBGUTILS_LOGV_FULL(ANDROID_LOG_FATAL, __FILE__, __LINE__, __FUNCTION__, TI_UTILS_DEBUG_TIMESTAMP_TOKEN "(%x) %s %s:%d %s - " __VA_ARGS__, "")
+
+#define DBGUTILS_LOGVA DBGUTILS_LOGV
+#define DBGUTILS_LOGVB DBGUTILS_LOGV
+
+#define DBGUTILS_LOGDA DBGUTILS_LOGD
+#define DBGUTILS_LOGDB DBGUTILS_LOGD
+
+#define DBGUTILS_LOGEA DBGUTILS_LOGE
+#define DBGUTILS_LOGEB DBGUTILS_LOGE
+
+// asserts
+#define _DBGUTILS_PLAIN_ASSERT(condition) \
+ do \
+ { \
+ if ( !(condition) ) \
+ { \
+ __android_log_print(ANDROID_LOG_FATAL, "Ti::Debug", \
+ "Condition failed: " #condition); \
+ __android_log_print(ANDROID_LOG_FATAL, "Ti::Debug", \
+ "Aborting process..."); \
+ abort(); \
+ } \
+ } while (0)
+
+#define _DBGUTILS_PLAIN_ASSERT_X(condition, ...) \
+ do \
+ { \
+ if ( !(condition) ) \
+ { \
+ __android_log_print(ANDROID_LOG_FATAL, "Ti::Debug", \
+ "Condition failed: " #condition ": " __VA_ARGS__); \
+ __android_log_print(ANDROID_LOG_FATAL, "Ti::Debug", \
+ "Aborting process..."); \
+ abort(); \
+ } \
+ } while (0)
+
+#define DBGUTILS_ASSERT(condition) \
+ do \
+ { \
+ if ( !(condition) ) \
+ { \
+ DBGUTILS_LOGF("Condition failed: " #condition); \
+ DBGUTILS_LOGF("Aborting process..."); \
+ abort(); \
+ } \
+ } while (0)
+#define DBGUTILS_ASSERT_X(condition, ...) \
+ do \
+ { \
+ if ( !(condition) ) \
+ { \
+ DBGUTILS_LOGF("Condition failed: " #condition ": " __VA_ARGS__); \
+ DBGUTILS_LOGF("Aborting process..."); \
+ abort(); \
+ } \
+ } while (0)
+
+
+
+
+static const int kIndentStringMaxLength = 128;
+
+template <int Size>
+inline int IndentString<Size>::calculateOffset(const int length) const
+{
+ const int offset = kIndentStringMaxLength - length*Size;
+ return offset < 0 ? 0 : offset;
+}
+
+template <int Size>
+inline IndentString<Size>::IndentString(const int length) :
+ mOffset(calculateOffset(length))
+{}
+
+template <int Size>
+inline const char * IndentString<Size>::string() const
+{
+ extern const char sIndentStringBuffer[];
+ return sIndentStringBuffer + mOffset;
+}
+
+
+
+
+inline Debug * Debug::instance()
+{ return &sInstance; }
+
+
+inline Debug::ThreadInfo * Debug::findCurrentThreadInfo()
+{
+ // retain reference to threads data
+ android::sp<Data> data = mData;
+
+ // iterate over threads to locate thread id,
+ // this is safe from race conditions because each thread
+ // is able to modify only his own ThreadInfo structure
+ const int32_t threadId = reinterpret_cast<int32_t>(androidGetThreadId());
+ const int size = int(data->threads.size());
+ for ( int i = 0; i < size; ++i )
+ {
+ ThreadInfo * const threadInfo = data->threads.itemAt(i);
+ if ( threadInfo->threadId == threadId )
+ return threadInfo;
+ }
+
+ // this thread has not been registered yet,
+ // try to fing empty thread info slot
+ while ( true )
+ {
+ ThreadInfo * const threadInfo = registerThread(data.get(), threadId);
+ if ( threadInfo )
+ return threadInfo;
+
+ // failed registering thread, because all slots are occupied
+ // grow the data and try again
+ grow();
+
+ data = mData;
+ }
+
+ // should never reach here
+ _DBGUTILS_PLAIN_ASSERT(false);
+ return 0;
+}
+
+
+inline void Debug::addOffsetForCurrentThread(const int offset)
+{
+ if ( offset == 0 )
+ return;
+
+ ThreadInfo * const threadInfo = findCurrentThreadInfo();
+ _DBGUTILS_PLAIN_ASSERT(threadInfo);
+
+ threadInfo->callOffset += offset;
+
+ if ( threadInfo->callOffset == 0 )
+ {
+ // thread call stack has dropped to zero, unregister it
+ android_atomic_acquire_store(0, &threadInfo->threadId);
+ }
+}
+
+
+inline int Debug::offsetForCurrentThread()
+{
+#ifdef TI_UTILS_FUNCTION_LOGGER_ENABLE
+ ThreadInfo * const threadInfo = findCurrentThreadInfo();
+ _DBGUTILS_PLAIN_ASSERT(threadInfo);
+
+ return threadInfo->callOffset;
+#else
+ return 0;
+#endif
+}
+
+
+inline void Debug::increaseOffsetForCurrentThread()
+{
+#ifdef TI_UTILS_FUNCTION_LOGGER_ENABLE
+ addOffsetForCurrentThread(1);
+#endif
+}
+
+
+inline void Debug::decreaseOffsetForCurrentThread()
+{
+#ifdef TI_UTILS_FUNCTION_LOGGER_ENABLE
+ addOffsetForCurrentThread(-1);
+#endif
+}
+
+
+inline void Debug::log(const int priority, const char * const format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ __android_log_vprint(priority, LOG_TAG, format, args);
+ va_end(args);
+}
+
+
+
+
+inline FunctionLogger::FunctionLogger(const char * const file, const int line, const char * const function) :
+ mFile(file), mLine(line), mFunction(function), mThreadId(androidGetThreadId()), mExitLine(-1)
+{
+ Debug * const debug = Debug::instance();
+ debug->increaseOffsetForCurrentThread();
+ LOGD(TI_UTILS_DEBUG_TIMESTAMP_TOKEN "(%x) %s+ %s:%d %s - ENTER",
+ TI_UTILS_DEBUG_TIMESTAMP_VARIABLE
+ (int)mThreadId, IndentString<>(debug->offsetForCurrentThread()).string(),
+ mFile, mLine, mFunction);
+}
+
+
+inline FunctionLogger::~FunctionLogger()
+{
+ Debug * const debug = Debug::instance();
+ LOGD(TI_UTILS_DEBUG_TIMESTAMP_TOKEN "(%x) %s- %s:%d %s - EXIT",
+ TI_UTILS_DEBUG_TIMESTAMP_VARIABLE
+ (int)mThreadId, IndentString<>(debug->offsetForCurrentThread()).string(),
+ mFile, mExitLine == -1 ? mLine : mExitLine, mFunction);
+ debug->decreaseOffsetForCurrentThread();
+}
+
+
+inline void FunctionLogger::setExitLine(const int line)
+{
+ if ( mExitLine != -1 )
+ {
+ Debug * const debug = Debug::instance();
+ LOGD(TI_UTILS_DEBUG_TIMESTAMP_TOKEN "(%x) %s %s:%d %s - Double function exit trace detected. Previous: %d",
+ TI_UTILS_DEBUG_TIMESTAMP_VARIABLE
+ (int)mThreadId, IndentString<>(debug->offsetForCurrentThread()).string(),
+ mFile, line, mFunction, mExitLine);
+ }
+
+ mExitLine = line;
+}
+
+
+
+
+} // namespace Ti
+
+
+
+
+#endif //DEBUG_UTILS_H
diff --git a/libtiutils/MessageQueue.h b/libtiutils/MessageQueue.h
index 6d05201..7d6581c 100644
--- a/libtiutils/MessageQueue.h
+++ b/libtiutils/MessageQueue.h
@@ -22,31 +22,17 @@
#include "DebugUtils.h"
#include <stdint.h>
-///Uncomment this macro to debug the message queue implementation
-//#define DEBUG_LOG
-
-///Camera HAL Logging Functions
-#ifndef DEBUG_LOG
-
-#define MSGQ_LOGDA(str)
-#define MSGQ_LOGDB(str, ...)
-
-#undef LOG_FUNCTION_NAME
-#undef LOG_FUNCTION_NAME_EXIT
-#define LOG_FUNCTION_NAME
-#define LOG_FUNCTION_NAME_EXIT
-
+#ifdef MSGQ_DEBUG
+# define MSGQ_LOGDA DBGUTILS_LOGDA
+# define MSGQ_LOGDB DBGUTILS_LOGDB
#else
-
-#define MSGQ_LOGDA DBGUTILS_LOGDA
-#define MSGQ_LOGDB DBGUTILS_LOGDB
-
+# define MSGQ_LOGDA(str)
+# define MSGQ_LOGDB(str, ...)
#endif
#define MSGQ_LOGEA DBGUTILS_LOGEA
#define MSGQ_LOGEB DBGUTILS_LOGEB
-
namespace TIUTILS {
///Message type