sde: Add support for conditional logging.

1. Add support for conditional logging.
2. Move log handling to hwc client.

Change-Id: I76bb2f9b420a178f22c4ee2ebf64da6daf5b87ed
This commit is contained in:
Dileep Marchya
2014-12-04 16:31:37 -08:00
parent d8501be546
commit 3ffb4703cf
31 changed files with 270 additions and 210 deletions

27
displayengine/include/core/core_interface.h Normal file → Executable file
View File

@@ -35,20 +35,20 @@
#include <stdint.h> #include <stdint.h>
#include "display_interface.h" #include "display_interface.h"
#include "display_types.h" #include "sde_types.h"
/*! @brief Display core interface version. /*! @brief Display engine interface version.
@details Display core interfaces are version tagged to maintain backward compatibility. This @details Display engine interfaces are version tagged to maintain backward compatibility. This
version is supplied as a default argument during display core initialization. version is supplied as a default argument during display core initialization.
Client may use an older version of interfaces and link to a higher version of display core Client may use an older version of interfaces and link to a higher version of display engine
library, but vice versa is not allowed. library, but vice versa is not allowed.
A 32-bit client must use 32-bit display core library and a 64-bit client must use 64-bit display A 32-bit client must use 32-bit display core library and a 64-bit client must use 64-bit display
core library. core library.
Display core interfaces follow default data structures alignment. Client must not override the Display engine interfaces follow default data structures alignment. Client must not override the
default padding rules while using these interfaces. default padding rules while using these interfaces.
@warning It is assumed that client upgrades or downgrades display core interface all at once @warning It is assumed that client upgrades or downgrades display core interface all at once
@@ -57,11 +57,11 @@
@sa CoreInterface::CreateCore @sa CoreInterface::CreateCore
*/ */
#define CORE_REVISION_MAJOR (1) #define SDE_REVISION_MAJOR (1)
#define CORE_REVISION_MINOR (0) #define SDE_REVISION_MINOR (0)
#define CORE_VERSION_TAG ((uint32_t) ((CORE_REVISION_MAJOR << 24) | (CORE_REVISION_MINOR << 16) \ #define SDE_VERSION_TAG ((uint32_t) ((SDE_REVISION_MAJOR << 24) | (SDE_REVISION_MINOR << 16) | \
| (sizeof(DisplayCompatibility) << 8) | sizeof(int *))) (sizeof(SDECompatibility) << 8) | sizeof(int *)))
namespace sde { namespace sde {
@@ -120,15 +120,16 @@ class CoreInterface {
This interface shall be called only once. This interface shall be called only once.
@param[in] event_handler \link CoreEventHandler \endlink @param[in] event_handler \link CoreEventHandler \endlink
@param[in] log_handler \link LogHandler \endlink
@param[out] interface \link CoreInterface \endlink @param[out] interface \link CoreInterface \endlink
@param[in] version \link CORE_VERSION_TAG \endlink. Client must not override this argument. @param[in] version \link SDE_VERSION_TAG \endlink. Client must not override this argument.
@return \link DisplayError \endlink @return \link DisplayError \endlink
@sa DestroyCore @sa DestroyCore
*/ */
static DisplayError CreateCore(CoreEventHandler *event_handler, CoreInterface **interface, static DisplayError CreateCore(CoreEventHandler *event_handler, LogHandler *log_handler,
uint32_t version = CORE_VERSION_TAG); CoreInterface **interface, uint32_t version = SDE_VERSION_TAG);
/*! @brief Method to release handle to display core interface. /*! @brief Method to release handle to display core interface.
@@ -159,7 +160,7 @@ class CoreInterface {
@sa DestroyDisplay @sa DestroyDisplay
*/ */
virtual DisplayError CreateDisplay(DisplayType type, DisplayEventHandler *event_handler, virtual DisplayError CreateDisplay(DisplayType type, DisplayEventHandler *event_handler,
DisplayInterface **interface) = 0; DisplayInterface **interface) = 0;
/*! @brief Method to destroy a display device. /*! @brief Method to destroy a display device.

2
displayengine/include/core/display_interface.h Normal file → Executable file
View File

@@ -36,7 +36,7 @@
#include <stdint.h> #include <stdint.h>
#include "layer_stack.h" #include "layer_stack.h"
#include "display_types.h" #include "sde_types.h"
namespace sde { namespace sde {

2
displayengine/include/core/dump_interface.h Normal file → Executable file
View File

@@ -31,7 +31,7 @@
#include <stdint.h> #include <stdint.h>
#include "display_types.h" #include "sde_types.h"
namespace sde { namespace sde {

2
displayengine/include/core/layer_buffer.h Normal file → Executable file
View File

@@ -31,7 +31,7 @@
#include <stdint.h> #include <stdint.h>
#include "display_types.h" #include "sde_types.h"
namespace sde { namespace sde {

2
displayengine/include/core/layer_stack.h Normal file → Executable file
View File

@@ -34,7 +34,7 @@
#include <stdint.h> #include <stdint.h>
#include "layer_buffer.h" #include "layer_buffer.h"
#include "display_types.h" #include "sde_types.h"
namespace sde { namespace sde {

View File

@@ -22,18 +22,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/*! @file display_types.h /*! @file sde_types.h
@brief This file contains miscellaneous data types used across display interfaces. @brief This file contains miscellaneous data types used across display interfaces.
*/ */
#ifndef __DISPLAY_TYPES_H__ #ifndef __SDE_TYPES_H__
#define __DISPLAY_TYPES_H__ #define __SDE_TYPES_H__
namespace sde { namespace sde {
/*! @brief This enum represents different error codes that display interfaces may return. /*! @brief This enum represents different error codes that display interfaces may return.
*/ */
enum DisplayError { enum DisplayError {
kErrorNone = 0, //!< Call executed successfully. kErrorNone, //!< Call executed successfully.
kErrorUndefined, //!< An unspecified error has occured. kErrorUndefined, //!< An unspecified error has occured.
kErrorNotSupported, //!< Requested operation is not supported. kErrorNotSupported, //!< Requested operation is not supported.
kErrorVersion, //!< Client is using advanced version of interfaces and calling into an kErrorVersion, //!< Client is using advanced version of interfaces and calling into an
@@ -48,11 +48,64 @@ enum DisplayError {
kErrorTimeOut, //!< The operation has timed out to prevent client from waiting forever. kErrorTimeOut, //!< The operation has timed out to prevent client from waiting forever.
}; };
/*! @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 DisplayLogHandler
*/
enum LogTag {
kTagNone, //!< Log is not tagged. This type of logs should always be printed.
kTagResources, //!< Log is tagged for resource management.
kTagStrategy, //!< Log is tagged for strategy decisions.
};
/*! @brief Display log handler class.
@details This class defines display log handler. The handle contains methods which client should
implement to get different levels of logging from display engine. Display engine will call into
these methods at appropriate times to send logging information.
@sa CoreInterface::CreateCore
*/
class LogHandler {
public:
/*! @brief Method to handle error messages.
@param[in] tag \link LogTag \endlink
@param[in] format \link message format with variable argument list \endlink
*/
virtual void Error(LogTag tag, const char *format, ...) = 0;
/*! @brief Method to handle warning messages.
@param[in] tag \link LogTag \endlink
@param[in] format \link message format with variable argument list \endlink
*/
virtual void Warning(LogTag tag, const char *format, ...) = 0;
/*! @brief Method to handle informative messages.
@param[in] tag \link LogTag \endlink
@param[in] format \link message format with variable argument list \endlink
*/
virtual void Info(LogTag tag, const char *format, ...) = 0;
/*! @brief Method to handle verbose messages.
@param[in] tag \link LogTag \endlink
@param[in] format \link message format with variable argument list \endlink
*/
virtual void Verbose(LogTag tag, const char *format, ...) = 0;
protected:
virtual ~LogHandler() { }
};
/*! @brief This structure is defined for client and library compatibility check purpose only. This /*! @brief This structure is defined for client and library compatibility check purpose only. This
structure is used in CORE_VERSION_TAG definition only. Client should not refer it directly for structure is used in SDE_VERSION_TAG definition only. Client should not refer it directly for
any purpose. any purpose.
*/ */
struct DisplayCompatibility { struct SDECompatibility {
char c1; char c1;
int i1; int i1;
char c2; char c2;
@@ -61,5 +114,5 @@ struct DisplayCompatibility {
} // namespace sde } // namespace sde
#endif // __DISPLAY_TYPES_H__ #endif // __SDE_TYPES_H__

View File

@@ -29,7 +29,7 @@
#ifndef __STRATEGY_INTERFACE_H__ #ifndef __STRATEGY_INTERFACE_H__
#define __STRATEGY_INTERFACE_H__ #define __STRATEGY_INTERFACE_H__
#include <core/display_types.h> #include <core/sde_types.h>
namespace sde { namespace sde {

55
displayengine/include/utils/debug.h Normal file → Executable file
View File

@@ -25,45 +25,44 @@
#ifndef __DEBUG_H__ #ifndef __DEBUG_H__
#define __DEBUG_H__ #define __DEBUG_H__
#ifndef SDE_LOG_TAG #include <core/sde_types.h>
#define SDE_LOG_TAG kLogTagNone
#endif
#ifndef SDE_MODULE_NAME #define DLOG(tag, method, format, ...) Debug::GetLogHandler()->method(tag, \
#define SDE_MODULE_NAME "SDE" __CLASS__ "::%s: " format, __FUNCTION__, ##__VA_ARGS__)
#endif
#define DLOG(method, format, ...) Debug::method(SDE_LOG_TAG, SDE_MODULE_NAME ": " format, \ #define DLOGE_IF(tag, format, ...) DLOG(tag, Error, format, ##__VA_ARGS__)
##__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 DLOGV_IF(tag, format, ...) DLOG(tag, Verbose, format, ##__VA_ARGS__)
// SDE_LOG_TAG and SDE_MODULE_NAME must be defined before #include this header file in #define DLOGE(format, ...) DLOGE_IF(kTagNone, format, ##__VA_ARGS__)
// respective module, else default definitions are used. #define DLOGW(format, ...) DLOGW_IF(kTagNone, format, ##__VA_ARGS__)
#define DLOGE(format, ...) DLOG(Error, format, ##__VA_ARGS__) #define DLOGI(format, ...) DLOGI_IF(kTagNone, format, ##__VA_ARGS__)
#define DLOGW(format, ...) DLOG(Warning, format, ##__VA_ARGS__) #define DLOGV(format, ...) DLOGV_IF(kTagNone, format, ##__VA_ARGS__)
#define DLOGI(format, ...) DLOG(Info, format, ##__VA_ARGS__)
#define DLOGV(format, ...) DLOG(Verbose, format, ##__VA_ARGS__)
namespace sde { namespace sde {
enum LogTag {
kTagNone = 0, // Log tag name is not specified.
kTagCore, // Log is tagged for display core.
kTagStrategy, // Log is tagged for composition strategy.
};
class Debug { class Debug {
public: public:
// Log handlers static inline void SetLogHandler(LogHandler *log_handler) { debug_.log_handler_ = log_handler; }
static void Error(const LogTag &tag, const char *format, ...); static inline LogHandler* GetLogHandler() { return debug_.log_handler_; }
static void Warning(const LogTag &tag, const char *format, ...); static inline bool IsVirtualDriver() { return debug_.virtual_driver_; }
static void Info(const LogTag &tag, const char *format, ...);
static void Verbose(const LogTag &tag, const char *format, ...);
// Debug properties
static bool IsVirtualDriver() { return debug_.virtual_driver_; }
private: private:
Debug(); Debug();
// By default, drop any log messages coming from Display Engine. It will be overriden by Display
// Engine client when core is successfully initialized.
class DefaultLogHandler : public LogHandler {
public:
virtual void Error(LogTag /*tag*/, const char */*format*/, ...) { }
virtual void Warning(LogTag /*tag*/, const char */*format*/, ...) { }
virtual void Info(LogTag /*tag*/, const char */*format*/, ...) { }
virtual void Verbose(LogTag /*tag*/, const char */*format*/, ...) { }
};
DefaultLogHandler default_log_handler_;
LogHandler *log_handler_;
bool virtual_driver_; bool virtual_driver_;
static Debug debug_; static Debug debug_;
}; };

View File

@@ -22,16 +22,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include.
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "CompManager"
#include <utils/debug.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <utils/constants.h> #include <utils/constants.h>
#include <utils/debug.h>
#include "comp_manager.h" #include "comp_manager.h"
#define __CLASS__ "CompManager"
namespace sde { namespace sde {
CompManager::CompManager() : strategy_lib_(NULL), strategy_intf_(NULL), registered_displays_(0), CompManager::CompManager() : strategy_lib_(NULL), strategy_intf_(NULL), registered_displays_(0),

8
displayengine/libs/core/core_impl.cpp Normal file → Executable file
View File

@@ -22,19 +22,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include.
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "CoreImpl"
#include <utils/debug.h>
#include <utils/locker.h> #include <utils/locker.h>
#include <utils/constants.h> #include <utils/constants.h>
#include <utils/debug.h>
#include "core_impl.h" #include "core_impl.h"
#include "display_primary.h" #include "display_primary.h"
#include "display_hdmi.h" #include "display_hdmi.h"
#include "display_virtual.h" #include "display_virtual.h"
#define __CLASS__ "CoreImpl"
namespace sde { namespace sde {
CoreImpl::CoreImpl(CoreEventHandler *event_handler) CoreImpl::CoreImpl(CoreEventHandler *event_handler)

View File

@@ -22,16 +22,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include.
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "CoreInterface"
#include <utils/debug.h>
#include <utils/locker.h> #include <utils/locker.h>
#include <utils/constants.h> #include <utils/constants.h>
#include <utils/debug.h>
#include "core_impl.h" #include "core_impl.h"
#define __CLASS__ "CoreInterface"
#define GET_REVISION(version) (version >> 16) #define GET_REVISION(version) (version >> 16)
#define GET_DATA_ALIGNMENT(version) ((version >> 8) & 0xFF) #define GET_DATA_ALIGNMENT(version) ((version >> 8) & 0xFF)
#define GET_INSTRUCTION_SET(version) (version & 0xFF) #define GET_INSTRUCTION_SET(version) (version & 0xFF)
@@ -47,16 +45,16 @@ struct CoreSingleton {
Locker locker; Locker locker;
} g_core; } g_core;
DisplayError CoreInterface::CreateCore(CoreEventHandler *event_handler, CoreInterface **interface, DisplayError CoreInterface::CreateCore(CoreEventHandler *event_handler, LogHandler *log_handler,
uint32_t client_version) { CoreInterface **interface, uint32_t client_version) {
SCOPE_LOCK(g_core.locker); SCOPE_LOCK(g_core.locker);
if (UNLIKELY(!event_handler || !interface)) { if (UNLIKELY(!event_handler || !log_handler || !interface)) {
return kErrorParameters; return kErrorParameters;
} }
// Check compatibility of client and core. // Check compatibility of client and core.
uint32_t lib_version = CORE_VERSION_TAG; uint32_t lib_version = SDE_VERSION_TAG;
if (UNLIKELY(GET_REVISION(client_version) > GET_REVISION(lib_version))) { if (UNLIKELY(GET_REVISION(client_version) > GET_REVISION(lib_version))) {
return kErrorVersion; return kErrorVersion;
} else if (UNLIKELY(GET_DATA_ALIGNMENT(client_version) != GET_DATA_ALIGNMENT(lib_version))) { } else if (UNLIKELY(GET_DATA_ALIGNMENT(client_version) != GET_DATA_ALIGNMENT(lib_version))) {
@@ -67,10 +65,11 @@ DisplayError CoreInterface::CreateCore(CoreEventHandler *event_handler, CoreInte
CoreImpl *&core_impl = g_core.core_impl; CoreImpl *&core_impl = g_core.core_impl;
if (UNLIKELY(core_impl)) { if (UNLIKELY(core_impl)) {
DLOGE("Only one display core session is supported at present.");
return kErrorUndefined; return kErrorUndefined;
} }
Debug::SetLogHandler(log_handler);
// Create appropriate CoreImpl object based on client version. // Create appropriate CoreImpl object based on client version.
if (GET_REVISION(client_version) == CoreImpl::kRevision) { if (GET_REVISION(client_version) == CoreImpl::kRevision) {
core_impl = new CoreImpl(event_handler); core_impl = new CoreImpl(event_handler);

12
displayengine/libs/core/display_base.cpp Normal file → Executable file
View File

@@ -22,15 +22,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <utils/constants.h>
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "DisplayBase"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include "display_base.h" #include "display_base.h"
#define __CLASS__ "DisplayBase"
namespace sde { namespace sde {
DisplayBase::DisplayBase(DisplayType display_type, DisplayEventHandler *event_handler, DisplayBase::DisplayBase(DisplayType display_type, DisplayEventHandler *event_handler,
@@ -224,7 +222,7 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
DisplayError error = kErrorNone; DisplayError error = kErrorNone;
DLOGI("Set state: %d", state); DLOGI("Set state = %d", state);
if (UNLIKELY(state == state_)) { if (UNLIKELY(state == state_)) {
DLOGI("Same state transition is requested."); DLOGI("Same state transition is requested.");
@@ -251,7 +249,7 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
break; break;
default: default:
DLOGE("Spurious state %d transition requested.", state); DLOGE("Spurious state = %d transition requested.", state);
break; break;
} }

8
displayengine/libs/core/display_hdmi.cpp Normal file → Executable file
View File

@@ -22,15 +22,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <utils/constants.h>
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "DisplayHDMI"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include "display_hdmi.h" #include "display_hdmi.h"
#define __CLASS__ "DisplayHDMI"
namespace sde { namespace sde {
DisplayHDMI::DisplayHDMI(DisplayEventHandler *event_handler, HWInterface *hw_intf, DisplayHDMI::DisplayHDMI(DisplayEventHandler *event_handler, HWInterface *hw_intf,

8
displayengine/libs/core/display_primary.cpp Normal file → Executable file
View File

@@ -22,15 +22,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <utils/constants.h>
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "DisplayPrimary"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include "display_primary.h" #include "display_primary.h"
#define __CLASS__ "DisplayPrimary"
namespace sde { namespace sde {
DisplayPrimary::DisplayPrimary(DisplayEventHandler *event_handler, HWInterface *hw_intf, DisplayPrimary::DisplayPrimary(DisplayEventHandler *event_handler, HWInterface *hw_intf,

8
displayengine/libs/core/display_virtual.cpp Normal file → Executable file
View File

@@ -22,15 +22,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <utils/constants.h>
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "DisplayVirtual"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include "display_virtual.h" #include "display_virtual.h"
#define __CLASS__ "DisplayVirtual"
namespace sde { namespace sde {
DisplayVirtual::DisplayVirtual(DisplayEventHandler *event_handler, HWInterface *hw_intf, DisplayVirtual::DisplayVirtual(DisplayEventHandler *event_handler, HWInterface *hw_intf,

5
displayengine/libs/core/dump_impl.cpp Normal file → Executable file
View File

@@ -22,11 +22,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include.
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "DumpInterface"
#include <utils/debug.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

28
displayengine/libs/core/hw_framebuffer.cpp Normal file → Executable file
View File

@@ -22,11 +22,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include.
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "HWFrameBuffer"
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <utils/debug.h>
#include <math.h> #include <math.h>
#include <fcntl.h> #include <fcntl.h>
@@ -39,9 +35,12 @@
#include <sys/prctl.h> #include <sys/prctl.h>
#include <pthread.h> #include <pthread.h>
#include <utils/constants.h> #include <utils/constants.h>
#include <utils/debug.h>
#include "hw_framebuffer.h" #include "hw_framebuffer.h"
#define __CLASS__ "HWFrameBuffer"
#define IOCTL_LOGE(ioctl) DLOGE("ioctl %s, errno = %d, desc = %s", #ioctl, errno, strerror(errno)) #define IOCTL_LOGE(ioctl) DLOGE("ioctl %s, errno = %d, desc = %s", #ioctl, errno, strerror(errno))
#ifdef DISPLAY_CORE_VIRTUAL_DRIVER #ifdef DISPLAY_CORE_VIRTUAL_DRIVER
@@ -383,7 +382,7 @@ DisplayError HWFrameBuffer::Validate(Handle device, HWLayers *hw_layers) {
mdp_commit.flags |= MDP_VALIDATE_LAYER; mdp_commit.flags |= MDP_VALIDATE_LAYER;
if (ioctl_(hw_context->device_fd, MSMFB_ATOMIC_COMMIT, &hw_context->mdp_commit) == -1) { if (ioctl_(hw_context->device_fd, MSMFB_ATOMIC_COMMIT, &hw_context->mdp_commit) == -1) {
IOCTL_LOGE("validate:"MSMFB_ATOMIC_COMMIT); IOCTL_LOGE(MSMFB_ATOMIC_COMMIT);
return kErrorHardware; return kErrorHardware;
} }
@@ -425,7 +424,7 @@ DisplayError HWFrameBuffer::Commit(Handle device, HWLayers *hw_layers) {
mdp_commit.flags |= MDP_COMMIT_RETIRE_FENCE; mdp_commit.flags |= MDP_COMMIT_RETIRE_FENCE;
mdp_commit.flags &= ~MDP_VALIDATE_LAYER; mdp_commit.flags &= ~MDP_VALIDATE_LAYER;
if (ioctl_(hw_context->device_fd, MSMFB_ATOMIC_COMMIT, &hw_context->mdp_commit) == -1) { if (ioctl_(hw_context->device_fd, MSMFB_ATOMIC_COMMIT, &hw_context->mdp_commit) == -1) {
IOCTL_LOGE("commit:"MSMFB_ATOMIC_COMMIT); IOCTL_LOGE(MSMFB_ATOMIC_COMMIT);
return kErrorHardware; return kErrorHardware;
} }
@@ -521,7 +520,7 @@ void* HWFrameBuffer::DisplayEventThreadHandler() {
while (!exit_threads_) { while (!exit_threads_) {
int error = poll_(poll_fds_[0], kNumPhysicalDisplays * kNumDisplayEvents, -1); int error = poll_(poll_fds_[0], kNumPhysicalDisplays * kNumDisplayEvents, -1);
if (error < 0) { if (error < 0) {
DLOGW("poll failed errno: %s", strerror(errno)); DLOGW("poll failed. error = %s", strerror(errno));
continue; continue;
} }
@@ -533,7 +532,8 @@ void* HWFrameBuffer::DisplayEventThreadHandler() {
ssize_t length = pread_(poll_fd.fd, data, kMaxStringLength, 0); ssize_t length = pread_(poll_fd.fd, data, kMaxStringLength, 0);
if (length < 0) { if (length < 0) {
// If the read was interrupted - it is not a fatal error, just continue. // If the read was interrupted - it is not a fatal error, just continue.
DLOGW("Failed to read event:%d for display=%d: %s", event, display, strerror(errno)); DLOGW("pread failed. event = %d, display = %d, error = %s",
event, display, strerror(errno));
continue; continue;
} }
@@ -750,18 +750,18 @@ DisplayError HWFrameBuffer::PopulateHWCapabilities() {
} }
} }
DLOGI("SDE Version: %d SDE Revision: %x RGB : %d, VIG: %d DMA: %d Cursor: %d", DLOGI("SDE Version = %d, SDE Revision = %x, RGB = %d, VIG = %d, DMA = %d, Cursor = %d",
hw_resource_.hw_version, hw_resource_.hw_revision, hw_resource_.num_rgb_pipe, hw_resource_.hw_version, hw_resource_.hw_revision, hw_resource_.num_rgb_pipe,
hw_resource_.num_vig_pipe, hw_resource_.num_dma_pipe, hw_resource_.num_cursor_pipe); hw_resource_.num_vig_pipe, hw_resource_.num_dma_pipe, hw_resource_.num_cursor_pipe);
DLOGI("Upscale Ratio: %d Downscale Ratio: %d Blending Stages: %d", hw_resource_.max_scale_up, DLOGI("Upscale Ratio = %d, Downscale Ratio = %d, Blending Stages = %d", hw_resource_.max_scale_up,
hw_resource_.max_scale_down, hw_resource_.num_blending_stages); hw_resource_.max_scale_down, hw_resource_.num_blending_stages);
DLOGI("BWC: %d Decimation: %d Tile Format: %d: Rotator Downscale: %d", hw_resource_.has_bwc, DLOGI("BWC = %d, Decimation = %d, Tile Format = %d, Rotator Downscale = %d", hw_resource_.has_bwc,
hw_resource_.has_decimation, hw_resource_.has_macrotile, hw_resource_.has_decimation, hw_resource_.has_macrotile,
hw_resource_.has_rotator_downscale); hw_resource_.has_rotator_downscale);
DLOGI("Left Split: %d Right Split: %d", hw_resource_.split_info.left_split, DLOGI("Left Split = %d, Right Split = %d", hw_resource_.split_info.left_split,
hw_resource_.split_info.right_split); hw_resource_.split_info.right_split);
DLOGI("SourceSplit: %d Always: %d", hw_resource_.is_src_split, hw_resource_.always_src_split); DLOGI("SourceSplit = %d, Always = %d", hw_resource_.is_src_split, hw_resource_.always_src_split);
DLOGI("MaxLowBw: %"PRIu64" MaxHighBw: %"PRIu64"", hw_resource_.max_bandwidth_low, DLOGI("MaxLowBw = %"PRIu64", MaxHighBw = %"PRIu64"", hw_resource_.max_bandwidth_low,
hw_resource_.max_bandwidth_high); hw_resource_.max_bandwidth_high);
return error; return error;

5
displayengine/libs/core/hw_interface.cpp Normal file → Executable file
View File

@@ -22,11 +22,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include.
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "HWInterface"
#include <utils/debug.h>
#include <utils/constants.h> #include <utils/constants.h>
#include "hw_interface.h" #include "hw_interface.h"

8
displayengine/libs/core/offline_ctrl.cpp Normal file → Executable file
View File

@@ -22,15 +22,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <utils/constants.h>
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "OfflineCtrl"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include "offline_ctrl.h" #include "offline_ctrl.h"
#define __CLASS__ "OfflineCtrl"
namespace sde { namespace sde {
OfflineCtrl::OfflineCtrl() : hw_intf_(NULL) { OfflineCtrl::OfflineCtrl() : hw_intf_(NULL) {

10
displayengine/libs/core/res_config.cpp Normal file → Executable file
View File

@@ -22,16 +22,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <math.h>
#define SDE_LOG_TAG kTagCore #include <utils/constants.h>
#define SDE_MODULE_NAME "ResConfig"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include <math.h>
#include "res_manager.h" #include "res_manager.h"
#define __CLASS__ "ResManager"
namespace sde { namespace sde {
DisplayError ResManager::Config(DisplayResourceContext *display_resource_ctx, HWLayers *hw_layers) { DisplayError ResManager::Config(DisplayResourceContext *display_resource_ctx, HWLayers *hw_layers) {

20
displayengine/libs/core/res_manager.cpp Normal file → Executable file
View File

@@ -22,15 +22,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <utils/constants.h>
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "ResManager"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include "res_manager.h" #include "res_manager.h"
#define __CLASS__ "ResManager"
namespace sde { namespace sde {
ResManager::ResManager() ResManager::ResManager()
@@ -38,8 +36,6 @@ ResManager::ResManager()
} }
DisplayError ResManager::Init(const HWResourceInfo &hw_res_info) { DisplayError ResManager::Init(const HWResourceInfo &hw_res_info) {
DLOGV("Init");
hw_res_info_ = hw_res_info; hw_res_info_ = hw_res_info;
DisplayError error = kErrorNone; DisplayError error = kErrorNone;
@@ -280,21 +276,21 @@ void ResManager::PostCommit(Handle display_ctx, HWLayers *hw_layers) {
HWBlockType hw_block_id = display_resource_ctx->hw_block_id; HWBlockType hw_block_id = display_resource_ctx->hw_block_id;
uint64_t frame_count = display_resource_ctx->frame_count; uint64_t frame_count = display_resource_ctx->frame_count;
DLOGV("Resource for hw_block=%d frame_count=%d", hw_block_id, frame_count); DLOGV_IF(kTagResources, "Resource for hw_block = %d, frame_count = %d", hw_block_id, frame_count);
for (uint32_t i = 0; i < num_pipe_; i++) { for (uint32_t i = 0; i < num_pipe_; i++) {
if (src_pipes_[i].reserved) { if (src_pipes_[i].reserved) {
src_pipes_[i].hw_block_id = hw_block_id; src_pipes_[i].hw_block_id = hw_block_id;
src_pipes_[i].state = kPipeStateAcquired; src_pipes_[i].state = kPipeStateAcquired;
src_pipes_[i].state_frame_count = frame_count; src_pipes_[i].state_frame_count = frame_count;
DLOGV("Pipe acquired index=%d type=%d pipe_id=%x", i, src_pipes_[i].type, DLOGV_IF(kTagResources, "Pipe acquired index = %d, type = %d, pipe_id = %x", i,
src_pipes_[i].mdss_pipe_id); src_pipes_[i].type, src_pipes_[i].mdss_pipe_id);
} else if ((src_pipes_[i].hw_block_id == hw_block_id) && } else if ((src_pipes_[i].hw_block_id == hw_block_id) &&
(src_pipes_[i].state == kPipeStateAcquired)) { (src_pipes_[i].state == kPipeStateAcquired)) {
src_pipes_[i].state = kPipeStateToRelease; src_pipes_[i].state = kPipeStateToRelease;
src_pipes_[i].state_frame_count = frame_count; src_pipes_[i].state_frame_count = frame_count;
DLOGV("Pipe to release index=%d type=%d pipe_id=%x", i, src_pipes_[i].type, DLOGV_IF(kTagResources, "Pipe to release index = %d, type = %d, pipe_id = %x", i,
src_pipes_[i].mdss_pipe_id); src_pipes_[i].type, src_pipes_[i].mdss_pipe_id);
} }
} }

View File

@@ -22,15 +22,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// SDE_LOG_TAG definition must precede debug.h include. #include <utils/constants.h>
#define SDE_LOG_TAG kTagCore
#define SDE_MODULE_NAME "StrategyDefault"
#include <utils/debug.h> #include <utils/debug.h>
#include <utils/constants.h>
#include "strategy_default.h" #include "strategy_default.h"
#define __CLASS__ "StrategyDefault"
namespace sde { namespace sde {
DisplayError StrategyDefault::GetNextStrategy(StrategyConstraints *constraints, DisplayError StrategyDefault::GetNextStrategy(StrategyConstraints *constraints,

5
displayengine/libs/hwc/Android.mk Normal file → Executable file
View File

@@ -6,7 +6,7 @@ LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"HWComposer\" LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"SDE\"
LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL libhardware_legacy \ LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL libhardware_legacy \
libdl libsync \ libdl libsync \
libbinder libmedia libskia libsde libbinder libmedia libskia libsde
@@ -15,6 +15,7 @@ LOCAL_SRC_FILES := hwc_session.cpp \
hwc_display.cpp \ hwc_display.cpp \
hwc_display_primary.cpp \ hwc_display_primary.cpp \
hwc_display_external.cpp \ hwc_display_external.cpp \
hwc_display_virtual.cpp hwc_display_virtual.cpp \
hwc_logger.cpp
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View File

@@ -26,11 +26,10 @@
#include <gralloc_priv.h> #include <gralloc_priv.h>
#include <utils/constants.h> #include <utils/constants.h>
// HWC_MODULE_NAME definition must precede hwc_logger.h include. #include "hwc_display.h"
#define HWC_MODULE_NAME "HWCDisplay"
#include "hwc_logger.h" #include "hwc_logger.h"
#include "hwc_display.h" #define __CLASS__ "HWCDisplay"
namespace sde { namespace sde {
@@ -42,7 +41,7 @@ HWCDisplay::HWCDisplay(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
int HWCDisplay::Init() { int HWCDisplay::Init() {
DisplayError error = core_intf_->CreateDisplay(type_, this, &display_intf_); DisplayError error = core_intf_->CreateDisplay(type_, this, &display_intf_);
if (UNLIKELY(error != kErrorNone)) { if (UNLIKELY(error != kErrorNone)) {
DLOGE("Display device create failed. Error = %d", error); DLOGE("Display create failed. Error = %d", error);
return -EINVAL; return -EINVAL;
} }
@@ -52,7 +51,7 @@ int HWCDisplay::Init() {
int HWCDisplay::Deinit() { int HWCDisplay::Deinit() {
DisplayError error = core_intf_->DestroyDisplay(display_intf_); DisplayError error = core_intf_->DestroyDisplay(display_intf_);
if (UNLIKELY(error != kErrorNone)) { if (UNLIKELY(error != kErrorNone)) {
DLOGE("Display device destroy failed. Error = %d", error); DLOGE("Display destroy failed. Error = %d", error);
return -EINVAL; return -EINVAL;
} }
@@ -74,11 +73,11 @@ int HWCDisplay::EventControl(int event, int enable) {
// TODO(user): Need to handle this case // TODO(user): Need to handle this case
break; break;
default: default:
DLOGW("Unsupported event control type : %d", event); DLOGW("Unsupported event = %d", event);
} }
if (UNLIKELY(error != kErrorNone)) { if (UNLIKELY(error != kErrorNone)) {
DLOGE("EventControl failed. event = %d, enable = %d, error = %d", event, enable, error); DLOGE("Failed. event = %d, enable = %d, error = %d", event, enable, error);
return -EINVAL; return -EINVAL;
} }
@@ -86,7 +85,7 @@ int HWCDisplay::EventControl(int event, int enable) {
} }
int HWCDisplay::Blank(int blank) { int HWCDisplay::Blank(int blank) {
DLOGI("Blank : %d, display : %d", blank, id_); DLOGI("blank = %d, display = %d", blank, id_);
DisplayState state = blank ? kStateOff : kStateOn; DisplayState state = blank ? kStateOff : kStateOn;
return SetState(state); return SetState(state);
} }
@@ -128,7 +127,7 @@ int HWCDisplay::GetDisplayAttributes(uint32_t config, const uint32_t *attributes
values[i] = INT32(variable_config.y_dpi * 1000.0f); values[i] = INT32(variable_config.y_dpi * 1000.0f);
break; break;
default: default:
DLOGW("Spurious attribute type %d", attributes[i]); DLOGW("Spurious attribute type = %d", attributes[i]);
return -EINVAL; return -EINVAL;
} }
} }
@@ -465,7 +464,7 @@ int HWCDisplay::SetFormat(const int32_t &source, LayerBufferFormat *target) {
case HAL_PIXEL_FORMAT_RGB_565: *target = kFormatRGB565; break; case HAL_PIXEL_FORMAT_RGB_565: *target = kFormatRGB565; break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS: *target = kFormatYCbCr420SemiPlanarVenus; break; case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS: *target = kFormatYCbCr420SemiPlanarVenus; break;
default: default:
DLOGW("Unsupported format type %d", source); DLOGW("Unsupported format type = %d", source);
return -EINVAL; return -EINVAL;
} }

5
displayengine/libs/hwc/hwc_display_external.cpp Normal file → Executable file
View File

@@ -24,11 +24,10 @@
#include <utils/constants.h> #include <utils/constants.h>
// HWC_MODULE_NAME definition must precede hwc_logger.h include. #include "hwc_display_external.h"
#define HWC_MODULE_NAME "HWCDisplayExternal"
#include "hwc_logger.h" #include "hwc_logger.h"
#include "hwc_display_external.h" #define __CLASS__ "HWCDisplayExternal"
namespace sde { namespace sde {

5
displayengine/libs/hwc/hwc_display_primary.cpp Normal file → Executable file
View File

@@ -24,11 +24,10 @@
#include <utils/constants.h> #include <utils/constants.h>
// HWC_MODULE_NAME definition must precede hwc_logger.h include. #include "hwc_display_primary.h"
#define HWC_MODULE_NAME "HWCDisplayPrimary"
#include "hwc_logger.h" #include "hwc_logger.h"
#include "hwc_display_primary.h" #define __CLASS__ "HWCDisplayPrimary"
namespace sde { namespace sde {

5
displayengine/libs/hwc/hwc_display_virtual.cpp Normal file → Executable file
View File

@@ -24,11 +24,10 @@
#include <utils/constants.h> #include <utils/constants.h>
// HWC_MODULE_NAME definition must precede hwc_logger.h include. #include "hwc_display_virtual.h"
#define HWC_MODULE_NAME "HWCDisplayVirtual"
#include "hwc_logger.h" #include "hwc_logger.h"
#include "hwc_display_virtual.h" #define __CLASS__ "HWCDisplayVirtual"
namespace sde { namespace sde {

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2014, 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.
*/
#include "hwc_logger.h"
namespace sde {
HWCLogHandler HWCLogHandler::log_handler_;
void HWCLogHandler::Error(LogTag /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, list);
}
void HWCLogHandler::Warning(LogTag /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, format, list);
}
void HWCLogHandler::Info(LogTag /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, list);
}
void HWCLogHandler::Verbose(LogTag /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_VERBOSE, LOG_TAG, format, list);
}
} // namespace sde

32
displayengine/libs/hwc/hwc_logger.h Normal file → Executable file
View File

@@ -25,20 +25,32 @@
#ifndef __HWC_LOGGER_H__ #ifndef __HWC_LOGGER_H__
#define __HWC_LOGGER_H__ #define __HWC_LOGGER_H__
#include <core/sde_types.h>
#include <cutils/log.h> #include <cutils/log.h>
#ifndef HWC_MODULE_NAME #define DLOG(Macro, format, ...) Macro(__CLASS__ "::%s: " format, __FUNCTION__, ##__VA_ARGS__)
#define HWC_MODULE_NAME "HWComposer"
#endif
#define HWC_LOG(Macro, format, ...) Macro(HWC_MODULE_NAME ": " format, ##__VA_ARGS__) #define DLOGE(format, ...) DLOG(ALOGE, format, ##__VA_ARGS__)
#define DLOGW(format, ...) DLOG(ALOGW, format, ##__VA_ARGS__)
#define DLOGI(format, ...) DLOG(ALOGI, format, ##__VA_ARGS__)
#define DLOGV(format, ...) DLOG(ALOGV, format, ##__VA_ARGS__)
// HWC_MODULE_NAME must be defined before #include this header file in respective namespace sde {
// module, else default definition is used.
#define DLOGE(format, ...) HWC_LOG(ALOGE, format, ##__VA_ARGS__) class HWCLogHandler : public LogHandler {
#define DLOGW(format, ...) HWC_LOG(ALOGW, format, ##__VA_ARGS__) public:
#define DLOGI(format, ...) HWC_LOG(ALOGI, format, ##__VA_ARGS__) virtual void Error(LogTag tag, const char *format, ...);
#define DLOGV(format, ...) HWC_LOG(ALOGV, format, ##__VA_ARGS__) virtual void Warning(LogTag tag, const char *format, ...);
virtual void Info(LogTag tag, const char *format, ...);
virtual void Verbose(LogTag tag, const char *format, ...);
static inline LogHandler* Get() { return &log_handler_; }
private:
static HWCLogHandler log_handler_;
};
} // namespace sde
#endif // __HWC_LOGGER_H__ #endif // __HWC_LOGGER_H__

13
displayengine/libs/hwc/hwc_session.cpp Normal file → Executable file
View File

@@ -25,11 +25,10 @@
#include <core/dump_interface.h> #include <core/dump_interface.h>
#include <utils/constants.h> #include <utils/constants.h>
// HWC_MODULE_NAME definition must precede hwc_logger.h include. #include "hwc_session.h"
#define HWC_MODULE_NAME "HWCSession"
#include "hwc_logger.h" #include "hwc_logger.h"
#include "hwc_session.h" #define __CLASS__ "HWCSession"
static sde::HWCSession::HWCModuleMethods g_hwc_module_methods; static sde::HWCSession::HWCModuleMethods g_hwc_module_methods;
@@ -68,7 +67,7 @@ HWCSession::HWCSession(const hw_module_t *module) : core_intf_(NULL), hwc_procs_
} }
int HWCSession::Init() { int HWCSession::Init() {
DisplayError error = CoreInterface::CreateCore(this, &core_intf_); DisplayError error = CoreInterface::CreateCore(this, HWCLogHandler::Get(), &core_intf_);
if (UNLIKELY(error != kErrorNone)) { if (UNLIKELY(error != kErrorNone)) {
DLOGE("Display core initialization failed. Error = %d", error); DLOGE("Display core initialization failed. Error = %d", error);
return -EINVAL; return -EINVAL;
@@ -116,7 +115,7 @@ int HWCSession::Deinit() {
int HWCSession::Open(const hw_module_t *module, const char *name, hw_device_t **device) { int HWCSession::Open(const hw_module_t *module, const char *name, hw_device_t **device) {
if (UNLIKELY(!module || !name || !device)) { if (UNLIKELY(!module || !name || !device)) {
DLOGE("::%s Invalid parameters.", __FUNCTION__); DLOGE("Invalid parameters.");
return -EINVAL; return -EINVAL;
} }
@@ -167,7 +166,7 @@ int HWCSession::Prepare(hwc_composer_device_1 *device, size_t num_displays,
for (size_t i = 0; i < num_displays; i++) { for (size_t i = 0; i < num_displays; i++) {
hwc_display_contents_1_t *content_list = displays[i]; hwc_display_contents_1_t *content_list = displays[i];
if (UNLIKELY(!content_list || !content_list->numHwLayers)) { if (UNLIKELY(!content_list || !content_list->numHwLayers)) {
DLOGW("::%s Invalid content list.", __FUNCTION__); DLOGW("Invalid content list.");
return -EINVAL; return -EINVAL;
} }
@@ -201,7 +200,7 @@ int HWCSession::Set(hwc_composer_device_1 *device, size_t num_displays,
for (size_t i = 0; i < num_displays; i++) { for (size_t i = 0; i < num_displays; i++) {
hwc_display_contents_1_t *content_list = displays[i]; hwc_display_contents_1_t *content_list = displays[i];
if (UNLIKELY(!content_list || !content_list->numHwLayers)) { if (UNLIKELY(!content_list || !content_list->numHwLayers)) {
DLOGW("::%s Invalid content list.", __FUNCTION__); DLOGW("Invalid content list.");
return -EINVAL; return -EINVAL;
} }

26
displayengine/libs/utils/debug_android.cpp Normal file → Executable file
View File

@@ -31,36 +31,12 @@ namespace sde {
Debug Debug::debug_; Debug Debug::debug_;
Debug::Debug() : virtual_driver_(false) { Debug::Debug() : log_handler_(&default_log_handler_), virtual_driver_(false) {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get("displaycore.virtualdriver", property, NULL) > 0) { if (property_get("displaycore.virtualdriver", property, NULL) > 0) {
virtual_driver_ = (atoi(property) == 1); virtual_driver_ = (atoi(property) == 1);
} }
} }
void Debug::Error(const LogTag & /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, list);
}
void Debug::Warning(const LogTag & /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, format, list);
}
void Debug::Info(const LogTag & /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, list);
}
void Debug::Verbose(const LogTag & /*tag*/, const char *format, ...) {
va_list list;
va_start(list, format);
__android_log_vprint(ANDROID_LOG_VERBOSE, LOG_TAG, format, list);
}
} // namespace sde } // namespace sde