sdm: Use generic libdebug utility.
CRs-Fixed: 2211061
Change-Id: Ib949c40ff63a61a4476876c45357a40a702c9a01
diff --git a/sdm/include/core/core_interface.h b/sdm/include/core/core_interface.h
index 85001bd..d169956 100644
--- a/sdm/include/core/core_interface.h
+++ b/sdm/include/core/core_interface.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, 2018 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -73,10 +73,6 @@
namespace sdm {
-/*! @brief Forward declaration for debug handler.
-*/
-class DebugHandler;
-
/*! @brief This enum represents max bandwidth limit mode.
@sa DisplayInterface::SetMaxBandwidthMode
@@ -119,28 +115,6 @@
object of display core is created and handle to this object is returned via output parameter.
This interface shall be called only once.
- @param[in] debug_handler \link DebugHandler \endlink
- @param[in] buffer_allocator \link BufferAllocator \endlink
- @param[in] buffer_sync_handler \link BufferSyncHandler \endlink
- @param[out] interface \link CoreInterface \endlink
- @param[in] version \link SDM_VERSION_TAG \endlink. Client must not override this argument.
-
- @return \link DisplayError \endlink
-
- @sa DestroyCore
- */
- static DisplayError CreateCore(DebugHandler *debug_handler, BufferAllocator *buffer_allocator,
- BufferSyncHandler *buffer_sync_handler, CoreInterface **interface,
- uint32_t version = SDM_VERSION_TAG);
-
- /*! @brief Method to create and get handle to display core interface.
-
- @details This method is the entry point into the display core. Client can create and operate on
- different display devices only through a valid interface handle obtained using this method. An
- object of display core is created and handle to this object is returned via output parameter.
- This interface shall be called only once.
-
- @param[in] debug_handler \link DebugHandler \endlink
@param[in] buffer_allocator \link BufferAllocator \endlink
@param[in] buffer_sync_handler \link BufferSyncHandler \endlink
@param[in] socket_handler \link SocketHandler \endlink
@@ -151,7 +125,7 @@
@sa DestroyCore
*/
- static DisplayError CreateCore(DebugHandler *debug_handler, BufferAllocator *buffer_allocator,
+ static DisplayError CreateCore(BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler,
SocketHandler *socket_handler, CoreInterface **interface,
uint32_t version = SDM_VERSION_TAG);
diff --git a/sdm/include/core/debug_interface.h b/sdm/include/core/debug_interface.h
deleted file mode 100644
index dba85ac..0000000
--- a/sdm/include/core/debug_interface.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-* Copyright (c) 2015 - 2017, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its
-* contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*! @file debug_interface.h
- @brief This file provides the debug interface for display manager.
-*/
-#ifndef __DEBUG_INTERFACE_H__
-#define __DEBUG_INTERFACE_H__
-
-namespace sdm {
-
-/*! @brief This enum represents different modules/logical unit tags that a log message may
- be associated with. Client may use this to filter messages for dynamic logging.
-
- @sa DebugHandler
-*/
-enum DebugTag {
- kTagNone, //!< Debug log is not tagged. This type of logs should always be printed.
- kTagResources, //!< Debug log is tagged for resource management.
- kTagStrategy, //!< Debug log is tagged for strategy decisions.
- kTagCompManager, //!< Debug log is tagged for composition manager.
- kTagDriverConfig, //!< Debug log is tagged for driver config.
- kTagRotator, //!< Debug log is tagged for rotator.
- kTagScalar, //!< Debug log is tagged for Scalar Helper.
- kTagQDCM, //!< Debug log is tagged for display QDCM color managing.
- kTagQOSClient, //!< Debug log is tagged for Qos client.
- kTagDisplay, //!< Debug log is tagged for display core logs.
- kTagClient, //!< Debug log is tagged for SDM client.
-};
-
-/*! @brief Display debug handler class.
-
- @details This class defines display debug handler. The handle contains methods which client
- should implement to get different levels of logging/tracing from display manager. Display manager
- will call into these methods at appropriate times to send logging/tracing information.
-
- @sa CoreInterface::CreateCore
-*/
-class DebugHandler {
- public:
- /*! @brief Method to handle error messages.
-
- @param[in] tag \link DebugTag \endlink
- @param[in] format \link message format with variable argument list \endlink
- */
- virtual void Error(DebugTag tag, const char *format, ...) = 0;
-
- /*! @brief Method to handle warning messages.
-
- @param[in] tag \link DebugTag \endlink
- @param[in] format \link message format with variable argument list \endlink
- */
- virtual void Warning(DebugTag tag, const char *format, ...) = 0;
-
- /*! @brief Method to handle informative messages.
-
- @param[in] tag \link DebugTag \endlink
- @param[in] format \link message format with variable argument list \endlink
- */
- virtual void Info(DebugTag tag, const char *format, ...) = 0;
-
- /*! @brief Method to handle debug messages.
-
- @param[in] tag \link DebugTag \endlink
- @param[in] format \link message format with variable argument list \endlink
- */
- virtual void Debug(DebugTag tag, const char *format, ...) = 0;
-
- /*! @brief Method to handle verbose messages.
-
- @param[in] tag \link DebugTag \endlink
- @param[in] format \link message format with variable argument list \endlink
- */
- virtual void Verbose(DebugTag tag, const char *format, ...) = 0;
-
- /*! @brief Method to begin trace for a module/logical unit.
-
- @param[in] class_name \link name of the class that the function belongs to \endlink
- @param[in] function_name \link name of the function to be traced \endlink
- @param[in] custom_string \link custom string for multiple traces within a function \endlink
- */
- virtual void BeginTrace(const char *class_name, const char *function_name,
- const char *custom_string) = 0;
-
- /*! @brief Method to end trace for a module/logical unit.
- */
- virtual void EndTrace() = 0;
-
- /*! @brief Method to get property value corresponding to give string.
-
- @param[in] property_name name of the property
- @param[out] integer converted value corresponding to the property name
-
- @return \link DisplayError \endlink
- */
- virtual DisplayError GetProperty(const char *property_name, int *value) = 0;
-
- /*! @brief Method to get property value corresponding to give string.
-
- @param[in] property_name name of the property
- @param[out] string value corresponding to the property name
-
- @return \link DisplayError \endlink
- */
- virtual DisplayError GetProperty(const char *property_name, char *value) = 0;
-
- /*! @brief Method to set a property to a given string value.
-
- @param[in] property_name name of the property
- @param[in] value new value of the property name
-
- @return \link DisplayError \endlink
- */
- virtual DisplayError SetProperty(const char *property_name, const char *value) = 0;
-
- protected:
- virtual ~DebugHandler() { }
-};
-
-/*! @brief Scope tracer template class.
-
- @details This class template implements the funtionality to capture the trace for function/
- module. It starts the trace upon object creation and ends the trace upon object destruction.
-*/
-template <class T>
-class ScopeTracer {
- public:
- ScopeTracer(const char *class_name, const char *function_name) {
- T::Get()->BeginTrace(class_name, function_name, "");
- }
-
- ~ScopeTracer() { T::Get()->EndTrace(); }
-};
-
-} // namespace sdm
-
-#endif // __DEBUG_INTERFACE_H__
-
-
-
diff --git a/sdm/include/core/sdm_types.h b/sdm/include/core/sdm_types.h
index 0d3bf33..b624049 100644
--- a/sdm/include/core/sdm_types.h
+++ b/sdm/include/core/sdm_types.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -71,6 +71,24 @@
int i2;
};
+/*! @brief This enum represents different modules/logical unit tags that a log message may
+ be associated with. Client may use this to filter messages for dynamic logging.
+
+*/
+enum DebugTag {
+ kTagNone, //!< Debug log is not tagged. This type of logs should always be printed.
+ kTagResources, //!< Debug log is tagged for resource management.
+ kTagStrategy, //!< Debug log is tagged for strategy decisions.
+ kTagCompManager, //!< Debug log is tagged for composition manager.
+ kTagDriverConfig, //!< Debug log is tagged for driver config.
+ kTagRotator, //!< Debug log is tagged for rotator.
+ kTagScalar, //!< Debug log is tagged for Scalar Helper.
+ kTagQDCM, //!< Debug log is tagged for display QDCM color managing.
+ kTagQOSClient, //!< Debug log is tagged for Qos client.
+ kTagDisplay, //!< Debug log is tagged for display core logs.
+ kTagClient, //!< Debug log is tagged for SDM client.
+};
+
} // namespace sdm
#endif // __SDM_TYPES_H__
diff --git a/sdm/include/utils/debug.h b/sdm/include/utils/debug.h
index d5974d9..5b9dfa6 100644
--- a/sdm/include/utils/debug.h
+++ b/sdm/include/utils/debug.h
@@ -31,37 +31,17 @@
#define __DEBUG_H__
#include <stdint.h>
+#include <debug_handler.h>
#include <core/sdm_types.h>
-#include <core/debug_interface.h>
#include <core/display_interface.h>
-#define DLOG(tag, method, format, ...) Debug::Get()->method(tag, __CLASS__ "::%s: " format, \
- __FUNCTION__, ##__VA_ARGS__)
-
-#define DLOGE_IF(tag, format, ...) DLOG(tag, Error, format, ##__VA_ARGS__)
-#define DLOGW_IF(tag, format, ...) DLOG(tag, Warning, format, ##__VA_ARGS__)
-#define DLOGI_IF(tag, format, ...) DLOG(tag, Info, format, ##__VA_ARGS__)
-#define DLOGD_IF(tag, format, ...) DLOG(tag, Debug, format, ##__VA_ARGS__)
-#define DLOGV_IF(tag, format, ...) DLOG(tag, Verbose, format, ##__VA_ARGS__)
-
-#define DLOGE(format, ...) DLOGE_IF(kTagNone, format, ##__VA_ARGS__)
-#define DLOGD(format, ...) DLOGD_IF(kTagNone, format, ##__VA_ARGS__)
-#define DLOGW(format, ...) DLOGW_IF(kTagNone, format, ##__VA_ARGS__)
-#define DLOGI(format, ...) DLOGI_IF(kTagNone, format, ##__VA_ARGS__)
-#define DLOGV(format, ...) DLOGV_IF(kTagNone, format, ##__VA_ARGS__)
-
-#define DTRACE_BEGIN(custom_string) Debug::Get()->BeginTrace(__CLASS__, __FUNCTION__, custom_string)
-#define DTRACE_END() Debug::Get()->EndTrace()
-#define DTRACE_SCOPED() ScopeTracer <Debug> scope_tracer(__CLASS__, __FUNCTION__)
-
namespace sdm {
+using display::DebugHandler;
+
class Debug {
public:
- static inline void SetDebugHandler(DebugHandler *debug_handler) {
- debug_.debug_handler_ = debug_handler;
- }
- static inline DebugHandler* Get() { return debug_.debug_handler_; }
+ static inline DebugHandler* Get() { return DebugHandler::Get(); }
static int GetSimulationFlag();
static bool GetExternalResolution(char *val);
static void GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms);
@@ -82,38 +62,8 @@
static DisplayError GetMixerResolution(uint32_t *width, uint32_t *height);
static DisplayError GetReducedConfig(uint32_t *num_vig_pipes, uint32_t *num_dma_pipes);
static int GetExtMaxlayers();
- static bool GetProperty(const char *property_name, char *value);
- static bool SetProperty(const char *property_name, const char *value);
-
- private:
- Debug();
-
- // By default, drop any log messages/traces coming from Display manager. It will be overriden by
- // Display manager client when core is successfully initialized.
- class DefaultDebugHandler : public DebugHandler {
- public:
- virtual void Error(DebugTag /*tag*/, const char */*format*/, ...) { }
- virtual void Warning(DebugTag /*tag*/, const char */*format*/, ...) { }
- virtual void Info(DebugTag /*tag*/, const char */*format*/, ...) { }
- virtual void Debug(DebugTag /*tag*/, const char */*format*/, ...) { }
- virtual void Verbose(DebugTag /*tag*/, const char */*format*/, ...) { }
- virtual void BeginTrace(const char */*class_name*/, const char */*function_name*/,
- const char */*custom_string*/) { }
- virtual void EndTrace() { }
- virtual DisplayError GetProperty(const char */*property_name*/, int */*value*/) {
- return kErrorNotSupported;
- }
- virtual DisplayError GetProperty(const char */*property_name*/, char */*value*/) {
- return kErrorNotSupported;
- }
- virtual DisplayError SetProperty(const char */*property_name*/, const char */*value*/) {
- return kErrorNotSupported;
- }
- };
-
- DefaultDebugHandler default_debug_handler_;
- DebugHandler *debug_handler_;
- static Debug debug_;
+ static DisplayError GetProperty(const char *property_name, char *value);
+ static DisplayError GetProperty(const char *property_name, int *value);
};
} // namespace sdm