diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2018-04-06 14:39:13 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-04-06 14:39:13 -0700 |
commit | bf9942f9d53141687cedb985da29219d3a91307d (patch) | |
tree | 9bcb60a5ca777878d2d4063b0ec48dcb187c8bb8 /sdm | |
parent | a84950e3c2a4a4d9f58fe62515d05c8c450c2dff (diff) | |
parent | f95583aacb332ced183c33a00073f9c7e98a3a1d (diff) | |
download | android_hardware_qcom_sdm710_display-bf9942f9d53141687cedb985da29219d3a91307d.tar.gz android_hardware_qcom_sdm710_display-bf9942f9d53141687cedb985da29219d3a91307d.tar.bz2 android_hardware_qcom_sdm710_display-bf9942f9d53141687cedb985da29219d3a91307d.zip |
Merge "sdm: Use generic libdebug utility."
Diffstat (limited to 'sdm')
-rw-r--r-- | sdm/include/core/core_interface.h | 30 | ||||
-rw-r--r-- | sdm/include/core/debug_interface.h | 166 | ||||
-rw-r--r-- | sdm/include/core/sdm_types.h | 20 | ||||
-rw-r--r-- | sdm/include/utils/debug.h | 62 | ||||
-rw-r--r-- | sdm/libs/core/Android.mk | 3 | ||||
-rw-r--r-- | sdm/libs/core/core_interface.cpp | 18 | ||||
-rw-r--r-- | sdm/libs/core/display_base.cpp | 2 | ||||
-rw-r--r-- | sdm/libs/core/drm/hw_info_drm.cpp | 23 | ||||
-rw-r--r-- | sdm/libs/core/fb/hw_hdmi.cpp | 6 | ||||
-rw-r--r-- | sdm/libs/hwc2/Android.mk | 3 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_debugger.cpp | 168 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_debugger.h | 26 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_session.cpp | 4 | ||||
-rw-r--r-- | sdm/libs/utils/Android.mk | 1 | ||||
-rw-r--r-- | sdm/libs/utils/debug.cpp | 78 |
15 files changed, 178 insertions, 432 deletions
diff --git a/sdm/include/core/core_interface.h b/sdm/include/core/core_interface.h index 85001bd9..d169956d 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 @@ class CoreInterface { 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 @@ class CoreInterface { @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 dba85ac5..00000000 --- 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 0d3bf336..b624049e 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 @@ struct SDMCompatibility { 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 78daa12a..b4334b7c 100644 --- a/sdm/include/utils/debug.h +++ b/sdm/include/utils/debug.h @@ -31,38 +31,18 @@ #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> #include <display_properties.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); @@ -83,38 +63,8 @@ class Debug { 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 d8c9f855..d4aa9331 100644 --- a/sdm/libs/core/Android.mk +++ b/sdm/libs/core/Android.mk @@ -10,7 +10,7 @@ LOCAL_HEADER_LIBRARIES := display_headers 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_TO := $(common_header_export_path)/sdm/core 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 911ad014..b880298d 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 @@ struct CoreSingleton { 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 @@ DisplayError CoreInterface::CreateCore(DebugHandler *debug_handler, 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 29050f3c..534363d6 100644 --- a/sdm/libs/core/display_base.cpp +++ b/sdm/libs/core/display_base.cpp @@ -114,7 +114,7 @@ DisplayError DisplayBase::Init() { DisplayBase::SetMaxMixerStages(max_mixer_stages); } - Debug::Get()->GetProperty(DISABLE_HDR_LUT_GEN, &disable_hdr_lut_gen_); + Debug::GetProperty(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 d46d0abb..68ca41d8 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 @@ using std::to_string; 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) { @@ -122,7 +102,6 @@ static HWQseedStepVersion GetQseedStepVersion(sde_drm::QSEEDStepVersion drm_vers HWResourceInfo *HWInfoDRM::hw_resource_ = nullptr; HWInfoDRM::HWInfoDRM() { - DRMLogger::Set(new DRMLoggerImpl()); default_mode_ = (DRMLibLoader::GetInstance()->IsLoaded() == false); if (!default_mode_) { DRMMaster *drm_master = {}; @@ -217,7 +196,7 @@ DisplayError HWInfoDRM::GetHWResourceInfo(HWResourceInfo *hw_resource) { // through property int value = 0; bool disable_dest_scalar = false; - if (Debug::Get()->GetProperty(DISABLE_DESTINATION_SCALER_PROP, &value) == kErrorNone) { + if (Debug::GetProperty(DISABLE_DESTINATION_SCALER_PROP, &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 e339908e..532c3ba1 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 @@ void HWHDMI::SetSourceProductInformation(const char *node, const char *name) { } 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 29b0c97e..1212073d 100644 --- a/sdm/libs/hwc2/Android.mk +++ b/sdm/libs/hwc2/Android.mk @@ -22,7 +22,8 @@ LOCAL_SHARED_LIBRARIES := libsdmcore libqservice libbinder libhardware li libhidlbase libhidltransport vendor.display.config@1.0 \ android.hardware.graphics.mapper@2.0 \ android.hardware.graphics.mapper@2.1 \ - android.hardware.graphics.allocator@2.0 + android.hardware.graphics.allocator@2.0 \ + libdisplaydebug ifeq ($(display_config_version), DISPLAY_CONFIG_1_1) LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1 diff --git a/sdm/libs/hwc2/hwc_debugger.cpp b/sdm/libs/hwc2/hwc_debugger.cpp index 94965d8e..e92f1709 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 @@ -36,147 +36,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); @@ -203,7 +217,7 @@ int HWCDebugHandler::GetIdleTimeoutMs() { 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) { @@ -214,7 +228,7 @@ DisplayError HWCDebugHandler::GetProperty(const char *property_name, int *value) 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; } @@ -222,13 +236,5 @@ DisplayError HWCDebugHandler::GetProperty(const char *property_name, char *value 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 3a3d7872..7ebca8a6 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 @@ class HWCDebugHandler : public DebugHandler { 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 b863346b..11bb60fc 100644 --- a/sdm/libs/hwc2/hwc_session.cpp +++ b/sdm/libs/hwc2/hwc_session.cpp @@ -163,8 +163,8 @@ int HWCSession::Init() { g_hwc_uevent_.Register(this); - auto error = CoreInterface::CreateCore(HWCDebugHandler::Get(), &buffer_allocator_, - &buffer_sync_handler_, &socket_handler_, &core_intf_); + auto error = CoreInterface::CreateCore(&buffer_allocator_, &buffer_sync_handler_, + &socket_handler_, &core_intf_); // If HDMI display is primary display, defer display creation until hotplug event is received. HWDisplayInterfaceInfo hw_disp_info = {}; diff --git a/sdm/libs/utils/Android.mk b/sdm/libs/utils/Android.mk index 481ea39b..a9d705cd 100644 --- a/sdm/libs/utils/Android.mk +++ b/sdm/libs/utils/Android.mk @@ -14,6 +14,7 @@ LOCAL_SRC_FILES := debug.cpp \ 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 8bbc94b9..cf8abb09 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(COMPOSITION_MASK_PROP, &value); + DebugHandler::Get()->GetProperty(COMPOSITION_MASK_PROP, &value); return value; } bool Debug::GetExternalResolution(char *value) { uint32_t retval = 0; - debug_.debug_handler_->GetProperty(HDMI_CONFIG_INDEX_PROP, value); + DebugHandler::Get()->GetProperty(HDMI_CONFIG_INDEX_PROP, value); if (value[0]) { retval = 1; } @@ -61,8 +56,8 @@ void Debug::GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms) { int active_val = IDLE_TIMEOUT_ACTIVE_MS; int inactive_val = IDLE_TIMEOUT_INACTIVE_MS; - debug_.debug_handler_->GetProperty(IDLE_TIME_PROP, &active_val); - debug_.debug_handler_->GetProperty(IDLE_TIME_INACTIVE_PROP, &inactive_val); + DebugHandler::Get()->GetProperty(IDLE_TIME_PROP, &active_val); + DebugHandler::Get()->GetProperty(IDLE_TIME_INACTIVE_PROP, &inactive_val); *active_ms = UINT32(active_val); *inactive_ms = UINT32(inactive_val); @@ -70,21 +65,21 @@ void Debug::GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms) { int Debug::GetBootAnimLayerCount() { int value = 0; - debug_.debug_handler_->GetProperty(BOOT_ANIMATION_LAYER_COUNT_PROP, &value); + DebugHandler::Get()->GetProperty(BOOT_ANIMATION_LAYER_COUNT_PROP, &value); return value; } bool Debug::IsRotatorDownScaleDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_ROTATOR_DOWNSCALE_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_ROTATOR_DOWNSCALE_PROP, &value); return (value == 1); } bool Debug::IsDecimationDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_DECIMATION_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_DECIMATION_PROP, &value); return (value == 1); } @@ -93,13 +88,13 @@ int Debug::GetMaxPipesPerMixer(DisplayType display_type) { int value = -1; switch (display_type) { case kPrimary: - debug_.debug_handler_->GetProperty(PRIMARY_MIXER_STAGES_PROP, &value); + DebugHandler::Get()->GetProperty(PRIMARY_MIXER_STAGES_PROP, &value); break; case kHDMI: - debug_.debug_handler_->GetProperty(EXTERNAL_MIXER_STAGES_PROP, &value); + DebugHandler::Get()->GetProperty(EXTERNAL_MIXER_STAGES_PROP, &value); break; case kVirtual: - debug_.debug_handler_->GetProperty(VIRTUAL_MIXER_STAGES_PROP, &value); + DebugHandler::Get()->GetProperty(VIRTUAL_MIXER_STAGES_PROP, &value); break; default: break; @@ -110,35 +105,35 @@ int Debug::GetMaxPipesPerMixer(DisplayType display_type) { int Debug::GetMaxUpscale() { int value = 0; - debug_.debug_handler_->GetProperty(MAX_UPSCALE_PROP, &value); + DebugHandler::Get()->GetProperty(MAX_UPSCALE_PROP, &value); return value; } bool Debug::IsVideoModeEnabled() { int value = 0; - debug_.debug_handler_->GetProperty(VIDEO_MODE_PANEL_PROP, &value); + DebugHandler::Get()->GetProperty(VIDEO_MODE_PANEL_PROP, &value); return (value == 1); } bool Debug::IsRotatorUbwcDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_ROTATOR_UBWC_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_ROTATOR_UBWC_PROP, &value); return (value == 1); } bool Debug::IsRotatorSplitDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_ROTATOR_SPLIT_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_ROTATOR_SPLIT_PROP, &value); return (value == 1); } bool Debug::IsScalarDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_SCALER_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_SCALER_PROP, &value); return (value == 1); } @@ -147,10 +142,10 @@ bool Debug::IsUbwcTiledFrameBuffer() { int ubwc_disabled = 0; int ubwc_framebuffer = 0; - debug_.debug_handler_->GetProperty(DISABLE_UBWC_PROP, &ubwc_disabled); + DebugHandler::Get()->GetProperty(DISABLE_UBWC_PROP, &ubwc_disabled); if (!ubwc_disabled) { - debug_.debug_handler_->GetProperty(ENABLE_FB_UBWC_PROP, &ubwc_framebuffer); + DebugHandler::Get()->GetProperty(ENABLE_FB_UBWC_PROP, &ubwc_framebuffer); } return (ubwc_framebuffer == 1); @@ -158,28 +153,28 @@ bool Debug::IsUbwcTiledFrameBuffer() { bool Debug::IsAVRDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_AVR_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_AVR_PROP, &value); return (value == 1); } bool Debug::IsExtAnimDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_EXTERNAL_ANIMATION_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_EXTERNAL_ANIMATION_PROP, &value); return (value == 1); } bool Debug::IsPartialSplitDisabled() { int value = 0; - debug_.debug_handler_->GetProperty(DISABLE_PARTIAL_SPLIT_PROP, &value); + DebugHandler::Get()->GetProperty(DISABLE_PARTIAL_SPLIT_PROP, &value); return (value == 1); } bool Debug::IsSrcSplitPreferred() { int value = 0; - debug_.debug_handler_->GetProperty(PREFER_SOURCE_SPLIT_PROP, &value); + DebugHandler::Get()->GetProperty(PREFER_SOURCE_SPLIT_PROP, &value); return (value == 1); } @@ -187,9 +182,9 @@ bool Debug::IsSrcSplitPreferred() { DisplayError Debug::GetMixerResolution(uint32_t *width, uint32_t *height) { char value[64] = {}; - DisplayError error = debug_.debug_handler_->GetProperty(MIXER_RESOLUTION_PROP, value); - if (error !=kErrorNone) { - return error; + int error = DebugHandler::Get()->GetProperty(MIXER_RESOLUTION_PROP, value); + if (error != 0) { + return kErrorUndefined; } std::string str(value); @@ -203,9 +198,9 @@ DisplayError Debug::GetMixerResolution(uint32_t *width, uint32_t *height) { DisplayError Debug::GetReducedConfig(uint32_t *num_vig_pipes, uint32_t *num_dma_pipes) { char value[64] = {}; - DisplayError error = debug_.debug_handler_->GetProperty(SIMULATED_CONFIG_PROP, value); - if (error != kErrorNone) { - return error; + int error = DebugHandler::Get()->GetProperty(SIMULATED_CONFIG_PROP, value); + if (error != 0) { + return kErrorUndefined; } std::string str(value); @@ -218,26 +213,25 @@ DisplayError Debug::GetReducedConfig(uint32_t *num_vig_pipes, uint32_t *num_dma_ int Debug::GetExtMaxlayers() { int max_external_layers = 0; - debug_.debug_handler_->GetProperty(MAX_EXTERNAL_LAYERS_PROP, &max_external_layers); + DebugHandler::Get()->GetProperty(MAX_EXTERNAL_LAYERS_PROP, &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 - |