sdm: Use generic libdebug utility.

CRs-Fixed: 2211061
Change-Id: Ib949c40ff63a61a4476876c45357a40a702c9a01
diff --git a/include/Android.mk b/include/Android.mk
index b00416b..27161c9 100644
--- a/include/Android.mk
+++ b/include/Android.mk
@@ -21,6 +21,7 @@
                                  $(display_top)/gpu_tonemapper \
                                  $(display_top)/sdm/include \
                                  $(display_top)/gralloc \
-                                 $(display_top)/libgralloc1
+                                 $(display_top)/libgralloc1 \
+                                 $(display_top)/libdebug
 
 include $(BUILD_HEADER_LIBRARY)
diff --git a/libdrmutils/Android.mk b/libdrmutils/Android.mk
index ebcfc8a..97c052b 100644
--- a/libdrmutils/Android.mk
+++ b/libdrmutils/Android.mk
@@ -6,7 +6,8 @@
 LOCAL_MODULE_TAGS             := optional
 LOCAL_C_INCLUDES              := external/libdrm \
                                  $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_SHARED_LIBRARIES        := libdrm libdl
+LOCAL_HEADER_LIBRARIES        := display_headers
+LOCAL_SHARED_LIBRARIES        := libdrm libdl libdisplaydebug
 LOCAL_CFLAGS                  := -DLOG_TAG=\"DRMUTILS\" -Wall -std=c++11 -Werror -fno-operator-names
 LOCAL_CLANG                   := true
 LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
diff --git a/libdrmutils/drm_logger.h b/libdrmutils/drm_logger.h
index 8e8bb72..7f81d88 100644
--- a/libdrmutils/drm_logger.h
+++ b/libdrmutils/drm_logger.h
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017 - 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
@@ -30,39 +30,18 @@
 #ifndef __DRM_LOGGER_H__
 #define __DRM_LOGGER_H__
 
+#include <debug_handler.h>
 #include <utility>
 
 namespace drm_utils {
 
-class DRMLogger {
- public:
-  virtual ~DRMLogger() {}
-  virtual void Error(const char *format, ...) = 0;
-  virtual void Warning(const char *format, ...) = 0;
-  virtual void Info(const char *format, ...) = 0;
-  virtual void Debug(const char *format, ...) = 0;
-  virtual void Verbose(const char *format, ...) = 0;
+#define DRM_LOG_TAG  4  // = kTagRotator
 
-  static void Set(DRMLogger *logger) { s_instance = logger; }
-  static DRMLogger *Get() { return s_instance; }
-
- private:
-  static DRMLogger *s_instance;
-};
-
-#define DRM_LOG(method, format, ...)                            \
-  if (drm_utils::DRMLogger::Get()) {                            \
-    drm_utils::DRMLogger::Get()->method(format, ##__VA_ARGS__); \
-  }
-
-#define DRM_LOG_CONTEXT(method, format, ...) \
-  DRM_LOG(method, __CLASS__ "::%s: " format, __FUNCTION__, ##__VA_ARGS__);
-
-#define DRM_LOGE(format, ...) DRM_LOG_CONTEXT(Error, format, ##__VA_ARGS__)
-#define DRM_LOGW(format, ...) DRM_LOG_CONTEXT(Warning, format, ##__VA_ARGS__)
-#define DRM_LOGI(format, ...) DRM_LOG_CONTEXT(Info, format, ##__VA_ARGS__)
-#define DRM_LOGD(format, ...) DRM_LOG_CONTEXT(Debug, format, ##__VA_ARGS__)
-#define DRM_LOGV(format, ...) DRM_LOG_CONTEXT(Verbose, format, ##__VA_ARGS__)
+#define DRM_LOGE(format, ...) DLOGE(format, ##__VA_ARGS__)
+#define DRM_LOGW(format, ...) DLOGW_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)
+#define DRM_LOGI(format, ...) DLOGI_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)
+#define DRM_LOGD(format, ...) DLOGD_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)
+#define DRM_LOGV(format, ...) DLOGV_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)
 
 }  // namespace drm_utils
 
diff --git a/libdrmutils/drm_master.cpp b/libdrmutils/drm_master.cpp
index ff7770b..f0d14b1 100644
--- a/libdrmutils/drm_master.cpp
+++ b/libdrmutils/drm_master.cpp
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017 - 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
@@ -53,7 +53,6 @@
 
 namespace drm_utils {
 
-DRMLogger *DRMLogger::s_instance = nullptr;
 DRMMaster *DRMMaster::s_instance = nullptr;
 mutex DRMMaster::s_lock;
 
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
diff --git a/sdm/libs/core/Android.mk b/sdm/libs/core/Android.mk
index d8c9f85..d4aa933 100644
--- a/sdm/libs/core/Android.mk
+++ b/sdm/libs/core/Android.mk
@@ -10,7 +10,7 @@
 LOCAL_CFLAGS                  := -fno-operator-names -Wno-unused-parameter -DLOG_TAG=\"SDM\" \
                                  $(common_flags)
 LOCAL_HW_INTF_PATH_1          := fb
-LOCAL_SHARED_LIBRARIES        := libdl libsdmutils
+LOCAL_SHARED_LIBRARIES        := libdl libdisplaydebug libsdmutils
 
 ifneq ($(TARGET_IS_HEADLESS), true)
     LOCAL_CFLAGS              += -isystem external/libdrm
@@ -65,7 +65,6 @@
 LOCAL_COPY_HEADERS             = $(SDM_HEADER_PATH)/core/buffer_allocator.h \
                                  $(SDM_HEADER_PATH)/core/buffer_sync_handler.h \
                                  $(SDM_HEADER_PATH)/core/core_interface.h \
-                                 $(SDM_HEADER_PATH)/core/debug_interface.h \
                                  $(SDM_HEADER_PATH)/core/display_interface.h \
                                  $(SDM_HEADER_PATH)/core/layer_buffer.h \
                                  $(SDM_HEADER_PATH)/core/layer_stack.h \
diff --git a/sdm/libs/core/core_interface.cpp b/sdm/libs/core/core_interface.cpp
index 911ad01..b880298 100644
--- a/sdm/libs/core/core_interface.cpp
+++ b/sdm/libs/core/core_interface.cpp
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2015, 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
@@ -51,23 +51,13 @@
   Locker locker;
 } g_core;
 
-// TODO(user): Have a single structure handle carries all the interface pointers.
-DisplayError CoreInterface::CreateCore(DebugHandler *debug_handler,
-                                       BufferAllocator *buffer_allocator,
-                                       BufferSyncHandler *buffer_sync_handler,
-                                       CoreInterface **interface, uint32_t client_version) {
-  return CreateCore(debug_handler, buffer_allocator, buffer_sync_handler, NULL,
-                    interface, client_version);
-}
-
-DisplayError CoreInterface::CreateCore(DebugHandler *debug_handler,
-                                       BufferAllocator *buffer_allocator,
+DisplayError CoreInterface::CreateCore(BufferAllocator *buffer_allocator,
                                        BufferSyncHandler *buffer_sync_handler,
                                        SocketHandler *socket_handler,
                                        CoreInterface **interface, uint32_t client_version) {
   SCOPE_LOCK(g_core.locker);
 
-  if (!debug_handler || !buffer_allocator || !buffer_sync_handler || !interface) {
+  if (!buffer_allocator || !buffer_sync_handler || !interface) {
     return kErrorParameters;
   }
 
@@ -86,8 +76,6 @@
     return kErrorUndefined;
   }
 
-  Debug::SetDebugHandler(debug_handler);
-
   // Create appropriate CoreImpl object based on client version.
   if (GET_REVISION(client_version) == CoreImpl::kRevision) {
     core_impl = new CoreImpl(buffer_allocator, buffer_sync_handler, socket_handler);
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 18241d9..871a04f 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -113,7 +113,7 @@
     DisplayBase::SetMaxMixerStages(max_mixer_stages);
   }
 
-  Debug::Get()->GetProperty("sdm.disable_hdr_lut_gen", &disable_hdr_lut_gen_);
+  Debug::GetProperty("sdm.disable_hdr_lut_gen", &disable_hdr_lut_gen_);
   // TODO(user): Temporary changes, to be removed when DRM driver supports
   // Partial update with Destination scaler enabled.
   SetPUonDestScaler();
diff --git a/sdm/libs/core/drm/hw_info_drm.cpp b/sdm/libs/core/drm/hw_info_drm.cpp
index ae3c424..dc5a557 100644
--- a/sdm/libs/core/drm/hw_info_drm.cpp
+++ b/sdm/libs/core/drm/hw_info_drm.cpp
@@ -68,7 +68,6 @@
 
 using drm_utils::DRMMaster;
 using drm_utils::DRMResMgr;
-using drm_utils::DRMLogger;
 using drm_utils::DRMLibLoader;
 using sde_drm::GetDRMManager;
 using sde_drm::DRMPlanesInfo;
@@ -83,25 +82,6 @@
 
 namespace sdm {
 
-class DRMLoggerImpl : public DRMLogger {
- public:
-#define PRINTLOG(tag, method, format, buf)        \
-  va_list list;                              \
-  va_start(list, format);                    \
-  vsnprintf(buf, sizeof(buf), format, list); \
-  va_end(list);                              \
-  Debug::Get()->method(tag, "%s", buf);
-
-  void Error(const char *format, ...) { PRINTLOG(kTagNone, Error, format, buf_); }
-  void Warning(const char *format, ...) { PRINTLOG(kTagDriverConfig, Warning, format, buf_); }
-  void Info(const char *format, ...) { PRINTLOG(kTagDriverConfig, Info, format, buf_); }
-  void Debug(const char *format, ...) { PRINTLOG(kTagDriverConfig, Debug, format, buf_); }
-  void Verbose(const char *format, ...) { PRINTLOG(kTagDriverConfig, Verbose, format, buf_); }
-
- private:
-  char buf_[1024] = {};
-};
-
 static HWQseedStepVersion GetQseedStepVersion(sde_drm::QSEEDStepVersion drm_version) {
   HWQseedStepVersion sdm_version;
   switch (drm_version) {
@@ -133,7 +113,6 @@
 HWResourceInfo *HWInfoDRM::hw_resource_ = nullptr;
 
 HWInfoDRM::HWInfoDRM() {
-  DRMLogger::Set(new DRMLoggerImpl());
   default_mode_ = (DRMLibLoader::GetInstance()->IsLoaded() == false);
   if (!default_mode_) {
     DRMMaster *drm_master = {};
@@ -228,7 +207,7 @@
   // through property
   int value = 0;
   bool disable_dest_scalar = false;
-  if (Debug::Get()->GetProperty("sdm.debug.disable_dest_scalar", &value) == kErrorNone) {
+  if (Debug::GetProperty("sdm.debug.disable_dest_scalar", &value) == kErrorNone) {
     disable_dest_scalar = (value == 1);
   }
   DynLib extension_lib;
diff --git a/sdm/libs/core/fb/hw_hdmi.cpp b/sdm/libs/core/fb/hw_hdmi.cpp
index e339908..532c3ba 100644
--- a/sdm/libs/core/fb/hw_hdmi.cpp
+++ b/sdm/libs/core/fb/hw_hdmi.cpp
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2015 - 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 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
@@ -675,8 +675,8 @@
   }
 
   ssize_t length = 0;
-  bool prop_read_success = Debug::GetProperty(name, property_value);
-  if (!prop_read_success) {
+  DisplayError error = Debug::GetProperty(name, property_value);
+  if (error != kErrorNone) {
     return;
   }
 
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index 0e839ce..483d7e7 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -19,9 +19,9 @@
 
 LOCAL_SHARED_LIBRARIES        := libsdmcore libqservice libbinder libhardware libhardware_legacy \
                                  libutils libcutils libsync libqdutils libqdMetaData \
-                                 libsdmutils libc++ liblog libgrallocutils libui libgpu_tonemapper \
-                                 libhidlbase libhidltransport vendor.display.config@1.0 \
-                                 android.hardware.graphics.mapper@2.0\
+                                 libdisplaydebug libsdmutils libc++ liblog libgrallocutils libui \
+                                 libgpu_tonemapper libhidlbase libhidltransport \
+                                 vendor.display.config@1.0 android.hardware.graphics.mapper@2.0 \
                                  android.hardware.graphics.allocator@2.0
 
 ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
diff --git a/sdm/libs/hwc2/hwc_debugger.cpp b/sdm/libs/hwc2/hwc_debugger.cpp
index 8b51799..39416c5 100644
--- a/sdm/libs/hwc2/hwc_debugger.cpp
+++ b/sdm/libs/hwc2/hwc_debugger.cpp
@@ -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
@@ -35,147 +35,161 @@
 namespace sdm {
 
 HWCDebugHandler HWCDebugHandler::debug_handler_;
-std::bitset<32> HWCDebugHandler::debug_flags_ = 0x1;
-int32_t HWCDebugHandler::verbose_level_ = 0x0;
+
+HWCDebugHandler::HWCDebugHandler() {
+  DebugHandler::Set(HWCDebugHandler::Get());
+}
 
 void HWCDebugHandler::DebugAll(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_ = 0x7FFFFFFF;
+    debug_handler_.log_mask_ = 0x7FFFFFFF;
     if (verbose_level) {
-      // Enable verbose scalar logs only when explicitely enabled
-      debug_flags_[kTagScalar] = 0;
+      // Enable verbose scalar logs only when explicitly enabled
+      debug_handler_.log_mask_[kTagScalar] = 0;
     }
-    verbose_level_ = verbose_level;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_ = 0x1;   // kTagNone should always be printed.
-    verbose_level_ = 0;
+    debug_handler_.log_mask_ = 0x1;   // kTagNone should always be printed.
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugResources(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagResources] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagResources] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagResources] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagResources] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugStrategy(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagStrategy] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagStrategy] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagStrategy] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagStrategy] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugCompManager(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagCompManager] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagCompManager] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagCompManager] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagCompManager] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugDriverConfig(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagDriverConfig] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagDriverConfig] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagDriverConfig] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagDriverConfig] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugRotator(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagRotator] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagRotator] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagRotator] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagRotator] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugScalar(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagScalar] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagScalar] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagScalar] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagScalar] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugQdcm(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagQDCM] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagQDCM] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagQDCM] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagQDCM] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugClient(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagClient] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagClient] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagClient] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagClient] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
 void HWCDebugHandler::DebugDisplay(bool enable, int verbose_level) {
   if (enable) {
-    debug_flags_[kTagDisplay] = 1;
-    verbose_level_ = verbose_level;
+    debug_handler_.log_mask_[kTagDisplay] = 1;
+    debug_handler_.verbose_level_ = verbose_level;
   } else {
-    debug_flags_[kTagDisplay] = 0;
-    verbose_level_ = 0;
+    debug_handler_.log_mask_[kTagDisplay] = 0;
+    debug_handler_.verbose_level_ = 0;
   }
+
+  DebugHandler::SetLogMask(debug_handler_.log_mask_);
 }
 
-void HWCDebugHandler::Error(DebugTag tag, const char *format, ...) {
-  if (debug_flags_[tag]) {
-    va_list list;
-    va_start(list, format);
-    __android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, list);
-  }
+void HWCDebugHandler::Error(const char *format, ...) {
+  va_list list;
+  va_start(list, format);
+  __android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, list);
 }
 
-void HWCDebugHandler::Warning(DebugTag tag, const char *format, ...) {
-  if (debug_flags_[tag]) {
-    va_list list;
-    va_start(list, format);
-    __android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, format, list);
-  }
+void HWCDebugHandler::Warning(const char *format, ...) {
+  va_list list;
+  va_start(list, format);
+  __android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, format, list);
 }
 
-void HWCDebugHandler::Info(DebugTag tag, const char *format, ...) {
-  if (debug_flags_[tag]) {
-    va_list list;
-    va_start(list, format);
-    __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, list);
-  }
+void HWCDebugHandler::Info(const char *format, ...) {
+  va_list list;
+  va_start(list, format);
+  __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, list);
 }
 
-void HWCDebugHandler::Debug(DebugTag tag, const char *format, ...) {
-  if (debug_flags_[tag]) {
-    va_list list;
-    va_start(list, format);
-    __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, list);
-  }
+void HWCDebugHandler::Debug(const char *format, ...) {
+  va_list list;
+  va_start(list, format);
+  __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, list);
 }
 
-void HWCDebugHandler::Verbose(DebugTag tag, const char *format, ...) {
-  if (debug_flags_[tag] && verbose_level_) {
+void HWCDebugHandler::Verbose(const char *format, ...) {
+  if (debug_handler_.verbose_level_) {
     va_list list;
     va_start(list, format);
     __android_log_vprint(ANDROID_LOG_VERBOSE, LOG_TAG, format, list);
@@ -202,7 +216,7 @@
   return value;
 }
 
-DisplayError HWCDebugHandler::GetProperty(const char *property_name, int *value) {
+int HWCDebugHandler::GetProperty(const char *property_name, int *value) {
   char property[PROPERTY_VALUE_MAX];
 
   if (property_get(property_name, property, NULL) > 0) {
@@ -213,7 +227,7 @@
   return kErrorNotSupported;
 }
 
-DisplayError HWCDebugHandler::GetProperty(const char *property_name, char *value) {
+int HWCDebugHandler::GetProperty(const char *property_name, char *value) {
   if (property_get(property_name, value, NULL) > 0) {
     return kErrorNone;
   }
@@ -221,13 +235,5 @@
   return kErrorNotSupported;
 }
 
-DisplayError HWCDebugHandler::SetProperty(const char *property_name, const char *value) {
-  if (property_set(property_name, value) == 0) {
-    return kErrorNone;
-  }
-
-  return kErrorNotSupported;
-}
-
 }  // namespace sdm
 
diff --git a/sdm/libs/hwc2/hwc_debugger.h b/sdm/libs/hwc2/hwc_debugger.h
index 3a3d787..7ebca8a 100644
--- a/sdm/libs/hwc2/hwc_debugger.h
+++ b/sdm/libs/hwc2/hwc_debugger.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
@@ -33,15 +33,18 @@
 #define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
 
 #include <core/sdm_types.h>
-#include <core/debug_interface.h>
+#include <debug_handler.h>
 #include <log/log.h>
 #include <utils/Trace.h>
 #include <bitset>
 
 namespace sdm {
 
+using display::DebugHandler;
+
 class HWCDebugHandler : public DebugHandler {
  public:
+  HWCDebugHandler();
   static inline DebugHandler* Get() { return &debug_handler_; }
   static const char* DumpDir() { return "/data/vendor/display"; }
 
@@ -57,22 +60,21 @@
   static void DebugDisplay(bool enable, int verbose_level);
   static int  GetIdleTimeoutMs();
 
-  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 Error(const char *format, ...);
+  virtual void Warning(const char *format, ...);
+  virtual void Info(const char *format, ...);
+  virtual void Debug(const char *format, ...);
+  virtual void Verbose(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);
-  virtual DisplayError GetProperty(const char *property_name, char *value);
-  virtual DisplayError SetProperty(const char *property_name, const char *value);
+  virtual int GetProperty(const char *property_name, int *value);
+  virtual int GetProperty(const char *property_name, char *value);
 
  private:
   static HWCDebugHandler debug_handler_;
-  static std::bitset<32> debug_flags_;
-  static int32_t verbose_level_;
+  std::bitset<32> log_mask_;
+  int32_t verbose_level_;
 };
 
 }  // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 8a69776..bdc84aa 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -171,8 +171,8 @@
   } else {
     g_hwc_uevent_.Register(this);
 
-    error = CoreInterface::CreateCore(HWCDebugHandler::Get(), &buffer_allocator_,
-                                      &buffer_sync_handler_, &socket_handler_, &core_intf_);
+    error = CoreInterface::CreateCore(&buffer_allocator_, &buffer_sync_handler_, &socket_handler_,
+                                      &core_intf_);
 
     error = core_intf_->GetFirstDisplayInterfaceType(&hw_disp_info);
 
diff --git a/sdm/libs/utils/Android.mk b/sdm/libs/utils/Android.mk
index 481ea39..a9d705c 100644
--- a/sdm/libs/utils/Android.mk
+++ b/sdm/libs/utils/Android.mk
@@ -14,6 +14,7 @@
                                  formats.cpp \
                                  utils.cpp
 
+LOCAL_SHARED_LIBRARIES        := libdisplaydebug
 include $(BUILD_SHARED_LIBRARY)
 
 SDM_HEADER_PATH := ../../include
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index ee881ef..62a6cad 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -35,21 +35,16 @@
 
 namespace sdm {
 
-Debug Debug::debug_;
-
-Debug::Debug() : debug_handler_(&default_debug_handler_) {
-}
-
 int Debug::GetSimulationFlag() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.composition_simulation", &value);
+  DebugHandler::Get()->GetProperty("sdm.composition_simulation", &value);
 
   return value;
 }
 
 bool Debug::GetExternalResolution(char *value) {
   uint32_t retval = 0;
-  debug_.debug_handler_->GetProperty("hw.hdmi.resolution", value);
+  DebugHandler::Get()->GetProperty("hw.hdmi.resolution", value);
   if (value[0]) {
     retval = 1;
   }
@@ -61,8 +56,8 @@
   int active_val = IDLE_TIMEOUT_ACTIVE_MS;
   int inactive_val = IDLE_TIMEOUT_INACTIVE_MS;
 
-  debug_.debug_handler_->GetProperty("sdm.idle_time", &active_val);
-  debug_.debug_handler_->GetProperty("sdm.idle_time.inactive", &inactive_val);
+  DebugHandler::Get()->GetProperty("sdm.idle_time", &active_val);
+  DebugHandler::Get()->GetProperty("sdm.idle_time.inactive", &inactive_val);
 
   *active_ms = UINT32(active_val);
   *inactive_ms = UINT32(inactive_val);
@@ -70,21 +65,21 @@
 
 int Debug::GetBootAnimLayerCount() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.boot_anim_layer_count", &value);
+  DebugHandler::Get()->GetProperty("sdm.boot_anim_layer_count", &value);
 
   return value;
 }
 
 bool Debug::IsRotatorDownScaleDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.debug.rotator_downscale", &value);
+  DebugHandler::Get()->GetProperty("sdm.debug.rotator_downscale", &value);
 
   return (value == 1);
 }
 
 bool Debug::IsDecimationDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.disable_decimation", &value);
+  DebugHandler::Get()->GetProperty("sdm.disable_decimation", &value);
 
   return (value == 1);
 }
@@ -93,13 +88,13 @@
   int value = -1;
   switch (display_type) {
   case kPrimary:
-    debug_.debug_handler_->GetProperty("sdm.primary.mixer_stages", &value);
+    DebugHandler::Get()->GetProperty("sdm.primary.mixer_stages", &value);
     break;
   case kHDMI:
-    debug_.debug_handler_->GetProperty("sdm.external.mixer_stages", &value);
+    DebugHandler::Get()->GetProperty("sdm.external.mixer_stages", &value);
     break;
   case kVirtual:
-    debug_.debug_handler_->GetProperty("sdm.virtual.mixer_stages", &value);
+    DebugHandler::Get()->GetProperty("sdm.virtual.mixer_stages", &value);
     break;
   default:
     break;
@@ -110,35 +105,35 @@
 
 int Debug::GetMaxUpscale() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.max_upscale", &value);
+  DebugHandler::Get()->GetProperty("sdm.max_upscale", &value);
 
   return value;
 }
 
 bool Debug::IsVideoModeEnabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.video_mode_panel", &value);
+  DebugHandler::Get()->GetProperty("sdm.video_mode_panel", &value);
 
   return (value == 1);
 }
 
 bool Debug::IsRotatorUbwcDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.debug.rotator_disable_ubwc", &value);
+  DebugHandler::Get()->GetProperty("sdm.debug.rotator_disable_ubwc", &value);
 
   return (value == 1);
 }
 
 bool Debug::IsRotatorSplitDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.debug.disable_rotator_split", &value);
+  DebugHandler::Get()->GetProperty("sdm.debug.disable_rotator_split", &value);
 
   return (value == 1);
 }
 
 bool Debug::IsScalarDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.debug.disable_scalar", &value);
+  DebugHandler::Get()->GetProperty("sdm.debug.disable_scalar", &value);
 
   return (value == 1);
 }
@@ -147,10 +142,10 @@
   int ubwc_disabled = 0;
   int ubwc_framebuffer = 0;
 
-  debug_.debug_handler_->GetProperty("debug.gralloc.gfx_ubwc_disable", &ubwc_disabled);
+  DebugHandler::Get()->GetProperty("debug.gralloc.gfx_ubwc_disable", &ubwc_disabled);
 
   if (!ubwc_disabled) {
-    debug_.debug_handler_->GetProperty("debug.gralloc.enable_fb_ubwc", &ubwc_framebuffer);
+    DebugHandler::Get()->GetProperty("debug.gralloc.enable_fb_ubwc", &ubwc_framebuffer);
   }
 
   return (ubwc_framebuffer == 1);
@@ -158,28 +153,28 @@
 
 bool Debug::IsAVRDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.debug.disable_avr", &value);
+  DebugHandler::Get()->GetProperty("sdm.debug.disable_avr", &value);
 
   return (value == 1);
 }
 
 bool Debug::IsExtAnimDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sys.disable_ext_animation", &value);
+  DebugHandler::Get()->GetProperty("sys.disable_ext_animation", &value);
 
   return (value == 1);
 }
 
 bool Debug::IsPartialSplitDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.debug.disable_partial_split", &value);
+  DebugHandler::Get()->GetProperty("sdm.debug.disable_partial_split", &value);
 
   return (value == 1);
 }
 
 bool Debug::IsSrcSplitPreferred() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.debug.prefersplit", &value);
+  DebugHandler::Get()->GetProperty("sdm.debug.prefersplit", &value);
 
   return (value == 1);
 }
@@ -187,9 +182,9 @@
 DisplayError Debug::GetMixerResolution(uint32_t *width, uint32_t *height) {
   char value[64] = {};
 
-  DisplayError error = debug_.debug_handler_->GetProperty("sdm.mixer_resolution", value);
-  if (error !=kErrorNone) {
-    return error;
+  int error = DebugHandler::Get()->GetProperty("sdm.mixer_resolution", value);
+  if (error != 0) {
+    return kErrorUndefined;
   }
 
   std::string str(value);
@@ -203,9 +198,9 @@
 DisplayError Debug::GetReducedConfig(uint32_t *num_vig_pipes, uint32_t *num_dma_pipes) {
   char value[64] = {};
 
-  DisplayError error = debug_.debug_handler_->GetProperty("sdm.debug.reduced_config", value);
-  if (error != kErrorNone) {
-    return error;
+  int error = DebugHandler::Get()->GetProperty("sdm.debug.reduced_config", value);
+  if (error != 0) {
+    return kErrorUndefined;
   }
 
   std::string str(value);
@@ -218,25 +213,25 @@
 
 int Debug::GetExtMaxlayers() {
   int max_external_layers = 0;
-  debug_.debug_handler_->GetProperty("sdm.max_external_layers", &max_external_layers);
+  DebugHandler::Get()->GetProperty("sdm.max_external_layers", &max_external_layers);
 
   return std::max(max_external_layers, 2);
 }
 
-bool Debug::GetProperty(const char* property_name, char* value) {
-  if (debug_.debug_handler_->GetProperty(property_name, value) != kErrorNone) {
-    return false;
+DisplayError Debug::GetProperty(const char *property_name, char *value) {
+  if (DebugHandler::Get()->GetProperty(property_name, value)) {
+    return kErrorUndefined;
   }
 
-  return true;
+  return kErrorNone;
 }
 
-bool Debug::SetProperty(const char* property_name, const char* value) {
-  if (debug_.debug_handler_->SetProperty(property_name, value) != kErrorNone) {
-    return false;
+DisplayError Debug::GetProperty(const char *property_name, int *value) {
+  if (DebugHandler::Get()->GetProperty(property_name, value)) {
+    return kErrorUndefined;
   }
 
-  return true;
+  return kErrorNone;
 }
 
 }  // namespace sdm