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:
25
displayengine/include/core/core_interface.h
Normal file → Executable file
25
displayengine/include/core/core_interface.h
Normal file → Executable file
@@ -35,20 +35,20 @@
|
||||
#include <stdint.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.
|
||||
|
||||
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.
|
||||
|
||||
A 32-bit client must use 32-bit display core library and a 64-bit client must use 64-bit display
|
||||
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.
|
||||
|
||||
@warning It is assumed that client upgrades or downgrades display core interface all at once
|
||||
@@ -57,11 +57,11 @@
|
||||
|
||||
@sa CoreInterface::CreateCore
|
||||
*/
|
||||
#define CORE_REVISION_MAJOR (1)
|
||||
#define CORE_REVISION_MINOR (0)
|
||||
#define SDE_REVISION_MAJOR (1)
|
||||
#define SDE_REVISION_MINOR (0)
|
||||
|
||||
#define CORE_VERSION_TAG ((uint32_t) ((CORE_REVISION_MAJOR << 24) | (CORE_REVISION_MINOR << 16) \
|
||||
| (sizeof(DisplayCompatibility) << 8) | sizeof(int *)))
|
||||
#define SDE_VERSION_TAG ((uint32_t) ((SDE_REVISION_MAJOR << 24) | (SDE_REVISION_MINOR << 16) | \
|
||||
(sizeof(SDECompatibility) << 8) | sizeof(int *)))
|
||||
|
||||
namespace sde {
|
||||
|
||||
@@ -120,15 +120,16 @@ class CoreInterface {
|
||||
This interface shall be called only once.
|
||||
|
||||
@param[in] event_handler \link CoreEventHandler \endlink
|
||||
@param[in] log_handler \link LogHandler \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
|
||||
|
||||
@sa DestroyCore
|
||||
*/
|
||||
static DisplayError CreateCore(CoreEventHandler *event_handler, CoreInterface **interface,
|
||||
uint32_t version = CORE_VERSION_TAG);
|
||||
static DisplayError CreateCore(CoreEventHandler *event_handler, LogHandler *log_handler,
|
||||
CoreInterface **interface, uint32_t version = SDE_VERSION_TAG);
|
||||
|
||||
/*! @brief Method to release handle to display core interface.
|
||||
|
||||
|
||||
2
displayengine/include/core/display_interface.h
Normal file → Executable file
2
displayengine/include/core/display_interface.h
Normal file → Executable file
@@ -36,7 +36,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "layer_stack.h"
|
||||
#include "display_types.h"
|
||||
#include "sde_types.h"
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
2
displayengine/include/core/dump_interface.h
Normal file → Executable file
2
displayengine/include/core/dump_interface.h
Normal file → Executable file
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "display_types.h"
|
||||
#include "sde_types.h"
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
2
displayengine/include/core/layer_buffer.h
Normal file → Executable file
2
displayengine/include/core/layer_buffer.h
Normal file → Executable file
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "display_types.h"
|
||||
#include "sde_types.h"
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
2
displayengine/include/core/layer_stack.h
Normal file → Executable file
2
displayengine/include/core/layer_stack.h
Normal file → Executable file
@@ -34,7 +34,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "layer_buffer.h"
|
||||
#include "display_types.h"
|
||||
#include "sde_types.h"
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
67
displayengine/include/core/display_types.h → displayengine/include/core/sde_types.h
Normal file → Executable file
67
displayengine/include/core/display_types.h → displayengine/include/core/sde_types.h
Normal file → Executable file
@@ -22,18 +22,18 @@
|
||||
* 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.
|
||||
*/
|
||||
#ifndef __DISPLAY_TYPES_H__
|
||||
#define __DISPLAY_TYPES_H__
|
||||
#ifndef __SDE_TYPES_H__
|
||||
#define __SDE_TYPES_H__
|
||||
|
||||
namespace sde {
|
||||
|
||||
/*! @brief This enum represents different error codes that display interfaces may return.
|
||||
*/
|
||||
enum DisplayError {
|
||||
kErrorNone = 0, //!< Call executed successfully.
|
||||
kErrorNone, //!< Call executed successfully.
|
||||
kErrorUndefined, //!< An unspecified error has occured.
|
||||
kErrorNotSupported, //!< Requested operation is not supported.
|
||||
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.
|
||||
};
|
||||
|
||||
/*! @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
|
||||
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.
|
||||
*/
|
||||
struct DisplayCompatibility {
|
||||
struct SDECompatibility {
|
||||
char c1;
|
||||
int i1;
|
||||
char c2;
|
||||
@@ -61,5 +114,5 @@ struct DisplayCompatibility {
|
||||
|
||||
} // namespace sde
|
||||
|
||||
#endif // __DISPLAY_TYPES_H__
|
||||
#endif // __SDE_TYPES_H__
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#ifndef __STRATEGY_INTERFACE_H__
|
||||
#define __STRATEGY_INTERFACE_H__
|
||||
|
||||
#include <core/display_types.h>
|
||||
#include <core/sde_types.h>
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
55
displayengine/include/utils/debug.h
Normal file → Executable file
55
displayengine/include/utils/debug.h
Normal file → Executable file
@@ -25,45 +25,44 @@
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
#ifndef SDE_LOG_TAG
|
||||
#define SDE_LOG_TAG kLogTagNone
|
||||
#endif
|
||||
#include <core/sde_types.h>
|
||||
|
||||
#ifndef SDE_MODULE_NAME
|
||||
#define SDE_MODULE_NAME "SDE"
|
||||
#endif
|
||||
#define DLOG(tag, method, format, ...) Debug::GetLogHandler()->method(tag, \
|
||||
__CLASS__ "::%s: " format, __FUNCTION__, ##__VA_ARGS__)
|
||||
|
||||
#define DLOG(method, format, ...) Debug::method(SDE_LOG_TAG, SDE_MODULE_NAME ": " format, \
|
||||
##__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 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
|
||||
// respective module, else default definitions are used.
|
||||
#define DLOGE(format, ...) DLOG(Error, format, ##__VA_ARGS__)
|
||||
#define DLOGW(format, ...) DLOG(Warning, format, ##__VA_ARGS__)
|
||||
#define DLOGI(format, ...) DLOG(Info, format, ##__VA_ARGS__)
|
||||
#define DLOGV(format, ...) DLOG(Verbose, format, ##__VA_ARGS__)
|
||||
#define DLOGE(format, ...) DLOGE_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__)
|
||||
|
||||
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 {
|
||||
public:
|
||||
// Log handlers
|
||||
static void Error(const LogTag &tag, const char *format, ...);
|
||||
static void Warning(const LogTag &tag, const char *format, ...);
|
||||
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_; }
|
||||
static inline void SetLogHandler(LogHandler *log_handler) { debug_.log_handler_ = log_handler; }
|
||||
static inline LogHandler* GetLogHandler() { return debug_.log_handler_; }
|
||||
static inline bool IsVirtualDriver() { return debug_.virtual_driver_; }
|
||||
|
||||
private:
|
||||
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_;
|
||||
static Debug debug_;
|
||||
};
|
||||
|
||||
@@ -22,16 +22,14 @@
|
||||
* 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 <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "comp_manager.h"
|
||||
|
||||
#define __CLASS__ "CompManager"
|
||||
|
||||
namespace sde {
|
||||
|
||||
CompManager::CompManager() : strategy_lib_(NULL), strategy_intf_(NULL), registered_displays_(0),
|
||||
|
||||
8
displayengine/libs/core/core_impl.cpp
Normal file → Executable file
8
displayengine/libs/core/core_impl.cpp
Normal file → Executable file
@@ -22,19 +22,17 @@
|
||||
* 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/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "core_impl.h"
|
||||
#include "display_primary.h"
|
||||
#include "display_hdmi.h"
|
||||
#include "display_virtual.h"
|
||||
|
||||
#define __CLASS__ "CoreImpl"
|
||||
|
||||
namespace sde {
|
||||
|
||||
CoreImpl::CoreImpl(CoreEventHandler *event_handler)
|
||||
|
||||
@@ -22,16 +22,14 @@
|
||||
* 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/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "core_impl.h"
|
||||
|
||||
#define __CLASS__ "CoreInterface"
|
||||
|
||||
#define GET_REVISION(version) (version >> 16)
|
||||
#define GET_DATA_ALIGNMENT(version) ((version >> 8) & 0xFF)
|
||||
#define GET_INSTRUCTION_SET(version) (version & 0xFF)
|
||||
@@ -47,16 +45,16 @@ struct CoreSingleton {
|
||||
Locker locker;
|
||||
} g_core;
|
||||
|
||||
DisplayError CoreInterface::CreateCore(CoreEventHandler *event_handler, CoreInterface **interface,
|
||||
uint32_t client_version) {
|
||||
DisplayError CoreInterface::CreateCore(CoreEventHandler *event_handler, LogHandler *log_handler,
|
||||
CoreInterface **interface, uint32_t client_version) {
|
||||
SCOPE_LOCK(g_core.locker);
|
||||
|
||||
if (UNLIKELY(!event_handler || !interface)) {
|
||||
if (UNLIKELY(!event_handler || !log_handler || !interface)) {
|
||||
return kErrorParameters;
|
||||
}
|
||||
|
||||
// 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))) {
|
||||
return kErrorVersion;
|
||||
} 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;
|
||||
if (UNLIKELY(core_impl)) {
|
||||
DLOGE("Only one display core session is supported at present.");
|
||||
return kErrorUndefined;
|
||||
}
|
||||
|
||||
Debug::SetLogHandler(log_handler);
|
||||
|
||||
// Create appropriate CoreImpl object based on client version.
|
||||
if (GET_REVISION(client_version) == CoreImpl::kRevision) {
|
||||
core_impl = new CoreImpl(event_handler);
|
||||
|
||||
12
displayengine/libs/core/display_base.cpp
Normal file → Executable file
12
displayengine/libs/core/display_base.cpp
Normal file → Executable file
@@ -22,15 +22,13 @@
|
||||
* 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 "DisplayBase"
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include "display_base.h"
|
||||
|
||||
#define __CLASS__ "DisplayBase"
|
||||
|
||||
namespace sde {
|
||||
|
||||
DisplayBase::DisplayBase(DisplayType display_type, DisplayEventHandler *event_handler,
|
||||
@@ -224,7 +222,7 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
|
||||
|
||||
DisplayError error = kErrorNone;
|
||||
|
||||
DLOGI("Set state: %d", state);
|
||||
DLOGI("Set state = %d", state);
|
||||
|
||||
if (UNLIKELY(state == state_)) {
|
||||
DLOGI("Same state transition is requested.");
|
||||
@@ -251,7 +249,7 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
|
||||
break;
|
||||
|
||||
default:
|
||||
DLOGE("Spurious state %d transition requested.", state);
|
||||
DLOGE("Spurious state = %d transition requested.", state);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
8
displayengine/libs/core/display_hdmi.cpp
Normal file → Executable file
8
displayengine/libs/core/display_hdmi.cpp
Normal file → Executable file
@@ -22,15 +22,13 @@
|
||||
* 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 "DisplayHDMI"
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include "display_hdmi.h"
|
||||
|
||||
#define __CLASS__ "DisplayHDMI"
|
||||
|
||||
namespace sde {
|
||||
|
||||
DisplayHDMI::DisplayHDMI(DisplayEventHandler *event_handler, HWInterface *hw_intf,
|
||||
|
||||
8
displayengine/libs/core/display_primary.cpp
Normal file → Executable file
8
displayengine/libs/core/display_primary.cpp
Normal file → Executable file
@@ -22,15 +22,13 @@
|
||||
* 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 "DisplayPrimary"
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include "display_primary.h"
|
||||
|
||||
#define __CLASS__ "DisplayPrimary"
|
||||
|
||||
namespace sde {
|
||||
|
||||
DisplayPrimary::DisplayPrimary(DisplayEventHandler *event_handler, HWInterface *hw_intf,
|
||||
|
||||
8
displayengine/libs/core/display_virtual.cpp
Normal file → Executable file
8
displayengine/libs/core/display_virtual.cpp
Normal file → Executable file
@@ -22,15 +22,13 @@
|
||||
* 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 "DisplayVirtual"
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include "display_virtual.h"
|
||||
|
||||
#define __CLASS__ "DisplayVirtual"
|
||||
|
||||
namespace sde {
|
||||
|
||||
DisplayVirtual::DisplayVirtual(DisplayEventHandler *event_handler, HWInterface *hw_intf,
|
||||
|
||||
5
displayengine/libs/core/dump_impl.cpp
Normal file → Executable file
5
displayengine/libs/core/dump_impl.cpp
Normal file → Executable file
@@ -22,11 +22,6 @@
|
||||
* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
28
displayengine/libs/core/hw_framebuffer.cpp
Normal file → Executable file
28
displayengine/libs/core/hw_framebuffer.cpp
Normal file → Executable file
@@ -22,11 +22,7 @@
|
||||
* 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
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
@@ -39,9 +35,12 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <pthread.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include "hw_framebuffer.h"
|
||||
|
||||
#define __CLASS__ "HWFrameBuffer"
|
||||
|
||||
#define IOCTL_LOGE(ioctl) DLOGE("ioctl %s, errno = %d, desc = %s", #ioctl, errno, strerror(errno))
|
||||
|
||||
#ifdef DISPLAY_CORE_VIRTUAL_DRIVER
|
||||
@@ -383,7 +382,7 @@ DisplayError HWFrameBuffer::Validate(Handle device, HWLayers *hw_layers) {
|
||||
|
||||
mdp_commit.flags |= MDP_VALIDATE_LAYER;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -425,7 +424,7 @@ DisplayError HWFrameBuffer::Commit(Handle device, HWLayers *hw_layers) {
|
||||
mdp_commit.flags |= MDP_COMMIT_RETIRE_FENCE;
|
||||
mdp_commit.flags &= ~MDP_VALIDATE_LAYER;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -521,7 +520,7 @@ void* HWFrameBuffer::DisplayEventThreadHandler() {
|
||||
while (!exit_threads_) {
|
||||
int error = poll_(poll_fds_[0], kNumPhysicalDisplays * kNumDisplayEvents, -1);
|
||||
if (error < 0) {
|
||||
DLOGW("poll failed errno: %s", strerror(errno));
|
||||
DLOGW("poll failed. error = %s", strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -533,7 +532,8 @@ void* HWFrameBuffer::DisplayEventThreadHandler() {
|
||||
ssize_t length = pread_(poll_fd.fd, data, kMaxStringLength, 0);
|
||||
if (length < 0) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -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_.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);
|
||||
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_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);
|
||||
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("SourceSplit = %d, Always = %d", hw_resource_.is_src_split, hw_resource_.always_src_split);
|
||||
DLOGI("MaxLowBw = %"PRIu64", MaxHighBw = %"PRIu64"", hw_resource_.max_bandwidth_low,
|
||||
hw_resource_.max_bandwidth_high);
|
||||
|
||||
return error;
|
||||
|
||||
5
displayengine/libs/core/hw_interface.cpp
Normal file → Executable file
5
displayengine/libs/core/hw_interface.cpp
Normal file → Executable file
@@ -22,11 +22,6 @@
|
||||
* 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 "hw_interface.h"
|
||||
|
||||
8
displayengine/libs/core/offline_ctrl.cpp
Normal file → Executable file
8
displayengine/libs/core/offline_ctrl.cpp
Normal file → Executable file
@@ -22,15 +22,13 @@
|
||||
* 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 "OfflineCtrl"
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include "offline_ctrl.h"
|
||||
|
||||
#define __CLASS__ "OfflineCtrl"
|
||||
|
||||
namespace sde {
|
||||
|
||||
OfflineCtrl::OfflineCtrl() : hw_intf_(NULL) {
|
||||
|
||||
10
displayengine/libs/core/res_config.cpp
Normal file → Executable file
10
displayengine/libs/core/res_config.cpp
Normal file → Executable file
@@ -22,16 +22,14 @@
|
||||
* 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 "ResConfig"
|
||||
#include <math.h>
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "res_manager.h"
|
||||
|
||||
#define __CLASS__ "ResManager"
|
||||
|
||||
namespace sde {
|
||||
|
||||
DisplayError ResManager::Config(DisplayResourceContext *display_resource_ctx, HWLayers *hw_layers) {
|
||||
|
||||
20
displayengine/libs/core/res_manager.cpp
Normal file → Executable file
20
displayengine/libs/core/res_manager.cpp
Normal file → Executable file
@@ -22,15 +22,13 @@
|
||||
* 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 "ResManager"
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include "res_manager.h"
|
||||
|
||||
#define __CLASS__ "ResManager"
|
||||
|
||||
namespace sde {
|
||||
|
||||
ResManager::ResManager()
|
||||
@@ -38,8 +36,6 @@ ResManager::ResManager()
|
||||
}
|
||||
|
||||
DisplayError ResManager::Init(const HWResourceInfo &hw_res_info) {
|
||||
DLOGV("Init");
|
||||
|
||||
hw_res_info_ = hw_res_info;
|
||||
|
||||
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;
|
||||
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++) {
|
||||
if (src_pipes_[i].reserved) {
|
||||
src_pipes_[i].hw_block_id = hw_block_id;
|
||||
src_pipes_[i].state = kPipeStateAcquired;
|
||||
src_pipes_[i].state_frame_count = frame_count;
|
||||
DLOGV("Pipe acquired index=%d type=%d pipe_id=%x", i, src_pipes_[i].type,
|
||||
src_pipes_[i].mdss_pipe_id);
|
||||
DLOGV_IF(kTagResources, "Pipe acquired index = %d, type = %d, pipe_id = %x", i,
|
||||
src_pipes_[i].type, src_pipes_[i].mdss_pipe_id);
|
||||
} else if ((src_pipes_[i].hw_block_id == hw_block_id) &&
|
||||
(src_pipes_[i].state == kPipeStateAcquired)) {
|
||||
src_pipes_[i].state = kPipeStateToRelease;
|
||||
src_pipes_[i].state_frame_count = frame_count;
|
||||
DLOGV("Pipe to release index=%d type=%d pipe_id=%x", i, src_pipes_[i].type,
|
||||
src_pipes_[i].mdss_pipe_id);
|
||||
DLOGV_IF(kTagResources, "Pipe to release index = %d, type = %d, pipe_id = %x", i,
|
||||
src_pipes_[i].type, src_pipes_[i].mdss_pipe_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,15 +22,13 @@
|
||||
* 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 "StrategyDefault"
|
||||
#include <utils/constants.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include "strategy_default.h"
|
||||
|
||||
#define __CLASS__ "StrategyDefault"
|
||||
|
||||
namespace sde {
|
||||
|
||||
DisplayError StrategyDefault::GetNextStrategy(StrategyConstraints *constraints,
|
||||
|
||||
5
displayengine/libs/hwc/Android.mk
Normal file → Executable file
5
displayengine/libs/hwc/Android.mk
Normal file → Executable file
@@ -6,7 +6,7 @@ LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
|
||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
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 \
|
||||
libdl libsync \
|
||||
libbinder libmedia libskia libsde
|
||||
@@ -15,6 +15,7 @@ LOCAL_SRC_FILES := hwc_session.cpp \
|
||||
hwc_display.cpp \
|
||||
hwc_display_primary.cpp \
|
||||
hwc_display_external.cpp \
|
||||
hwc_display_virtual.cpp
|
||||
hwc_display_virtual.cpp \
|
||||
hwc_logger.cpp
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -26,11 +26,10 @@
|
||||
#include <gralloc_priv.h>
|
||||
#include <utils/constants.h>
|
||||
|
||||
// HWC_MODULE_NAME definition must precede hwc_logger.h include.
|
||||
#define HWC_MODULE_NAME "HWCDisplay"
|
||||
#include "hwc_display.h"
|
||||
#include "hwc_logger.h"
|
||||
|
||||
#include "hwc_display.h"
|
||||
#define __CLASS__ "HWCDisplay"
|
||||
|
||||
namespace sde {
|
||||
|
||||
@@ -42,7 +41,7 @@ HWCDisplay::HWCDisplay(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
|
||||
int HWCDisplay::Init() {
|
||||
DisplayError error = core_intf_->CreateDisplay(type_, this, &display_intf_);
|
||||
if (UNLIKELY(error != kErrorNone)) {
|
||||
DLOGE("Display device create failed. Error = %d", error);
|
||||
DLOGE("Display create failed. Error = %d", error);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -52,7 +51,7 @@ int HWCDisplay::Init() {
|
||||
int HWCDisplay::Deinit() {
|
||||
DisplayError error = core_intf_->DestroyDisplay(display_intf_);
|
||||
if (UNLIKELY(error != kErrorNone)) {
|
||||
DLOGE("Display device destroy failed. Error = %d", error);
|
||||
DLOGE("Display destroy failed. Error = %d", error);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -74,11 +73,11 @@ int HWCDisplay::EventControl(int event, int enable) {
|
||||
// TODO(user): Need to handle this case
|
||||
break;
|
||||
default:
|
||||
DLOGW("Unsupported event control type : %d", event);
|
||||
DLOGW("Unsupported event = %d", event);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -86,7 +85,7 @@ int HWCDisplay::EventControl(int event, int enable) {
|
||||
}
|
||||
|
||||
int HWCDisplay::Blank(int blank) {
|
||||
DLOGI("Blank : %d, display : %d", blank, id_);
|
||||
DLOGI("blank = %d, display = %d", blank, id_);
|
||||
DisplayState state = blank ? kStateOff : kStateOn;
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
DLOGW("Spurious attribute type %d", attributes[i]);
|
||||
DLOGW("Spurious attribute type = %d", attributes[i]);
|
||||
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_YCbCr_420_SP_VENUS: *target = kFormatYCbCr420SemiPlanarVenus; break;
|
||||
default:
|
||||
DLOGW("Unsupported format type %d", source);
|
||||
DLOGW("Unsupported format type = %d", source);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
5
displayengine/libs/hwc/hwc_display_external.cpp
Normal file → Executable file
5
displayengine/libs/hwc/hwc_display_external.cpp
Normal file → Executable file
@@ -24,11 +24,10 @@
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
// HWC_MODULE_NAME definition must precede hwc_logger.h include.
|
||||
#define HWC_MODULE_NAME "HWCDisplayExternal"
|
||||
#include "hwc_display_external.h"
|
||||
#include "hwc_logger.h"
|
||||
|
||||
#include "hwc_display_external.h"
|
||||
#define __CLASS__ "HWCDisplayExternal"
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
5
displayengine/libs/hwc/hwc_display_primary.cpp
Normal file → Executable file
5
displayengine/libs/hwc/hwc_display_primary.cpp
Normal file → Executable file
@@ -24,11 +24,10 @@
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
// HWC_MODULE_NAME definition must precede hwc_logger.h include.
|
||||
#define HWC_MODULE_NAME "HWCDisplayPrimary"
|
||||
#include "hwc_display_primary.h"
|
||||
#include "hwc_logger.h"
|
||||
|
||||
#include "hwc_display_primary.h"
|
||||
#define __CLASS__ "HWCDisplayPrimary"
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
5
displayengine/libs/hwc/hwc_display_virtual.cpp
Normal file → Executable file
5
displayengine/libs/hwc/hwc_display_virtual.cpp
Normal file → Executable file
@@ -24,11 +24,10 @@
|
||||
|
||||
#include <utils/constants.h>
|
||||
|
||||
// HWC_MODULE_NAME definition must precede hwc_logger.h include.
|
||||
#define HWC_MODULE_NAME "HWCDisplayVirtual"
|
||||
#include "hwc_display_virtual.h"
|
||||
#include "hwc_logger.h"
|
||||
|
||||
#include "hwc_display_virtual.h"
|
||||
#define __CLASS__ "HWCDisplayVirtual"
|
||||
|
||||
namespace sde {
|
||||
|
||||
|
||||
56
displayengine/libs/hwc/hwc_logger.cpp
Executable file
56
displayengine/libs/hwc/hwc_logger.cpp
Executable 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
32
displayengine/libs/hwc/hwc_logger.h
Normal file → Executable file
@@ -25,20 +25,32 @@
|
||||
#ifndef __HWC_LOGGER_H__
|
||||
#define __HWC_LOGGER_H__
|
||||
|
||||
#include <core/sde_types.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#ifndef HWC_MODULE_NAME
|
||||
#define HWC_MODULE_NAME "HWComposer"
|
||||
#endif
|
||||
#define DLOG(Macro, format, ...) Macro(__CLASS__ "::%s: " format, __FUNCTION__, ##__VA_ARGS__)
|
||||
|
||||
#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
|
||||
// module, else default definition is used.
|
||||
#define DLOGE(format, ...) HWC_LOG(ALOGE, format, ##__VA_ARGS__)
|
||||
#define DLOGW(format, ...) HWC_LOG(ALOGW, format, ##__VA_ARGS__)
|
||||
#define DLOGI(format, ...) HWC_LOG(ALOGI, format, ##__VA_ARGS__)
|
||||
#define DLOGV(format, ...) HWC_LOG(ALOGV, format, ##__VA_ARGS__)
|
||||
namespace sde {
|
||||
|
||||
class HWCLogHandler : 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, ...);
|
||||
|
||||
static inline LogHandler* Get() { return &log_handler_; }
|
||||
|
||||
private:
|
||||
static HWCLogHandler log_handler_;
|
||||
};
|
||||
|
||||
} // namespace sde
|
||||
|
||||
#endif // __HWC_LOGGER_H__
|
||||
|
||||
|
||||
13
displayengine/libs/hwc/hwc_session.cpp
Normal file → Executable file
13
displayengine/libs/hwc/hwc_session.cpp
Normal file → Executable file
@@ -25,11 +25,10 @@
|
||||
#include <core/dump_interface.h>
|
||||
#include <utils/constants.h>
|
||||
|
||||
// HWC_MODULE_NAME definition must precede hwc_logger.h include.
|
||||
#define HWC_MODULE_NAME "HWCSession"
|
||||
#include "hwc_session.h"
|
||||
#include "hwc_logger.h"
|
||||
|
||||
#include "hwc_session.h"
|
||||
#define __CLASS__ "HWCSession"
|
||||
|
||||
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() {
|
||||
DisplayError error = CoreInterface::CreateCore(this, &core_intf_);
|
||||
DisplayError error = CoreInterface::CreateCore(this, HWCLogHandler::Get(), &core_intf_);
|
||||
if (UNLIKELY(error != kErrorNone)) {
|
||||
DLOGE("Display core initialization failed. Error = %d", error);
|
||||
return -EINVAL;
|
||||
@@ -116,7 +115,7 @@ int HWCSession::Deinit() {
|
||||
|
||||
int HWCSession::Open(const hw_module_t *module, const char *name, hw_device_t **device) {
|
||||
if (UNLIKELY(!module || !name || !device)) {
|
||||
DLOGE("::%s Invalid parameters.", __FUNCTION__);
|
||||
DLOGE("Invalid parameters.");
|
||||
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++) {
|
||||
hwc_display_contents_1_t *content_list = displays[i];
|
||||
if (UNLIKELY(!content_list || !content_list->numHwLayers)) {
|
||||
DLOGW("::%s Invalid content list.", __FUNCTION__);
|
||||
DLOGW("Invalid content list.");
|
||||
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++) {
|
||||
hwc_display_contents_1_t *content_list = displays[i];
|
||||
if (UNLIKELY(!content_list || !content_list->numHwLayers)) {
|
||||
DLOGW("::%s Invalid content list.", __FUNCTION__);
|
||||
DLOGW("Invalid content list.");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
26
displayengine/libs/utils/debug_android.cpp
Normal file → Executable file
26
displayengine/libs/utils/debug_android.cpp
Normal file → Executable file
@@ -31,36 +31,12 @@ namespace sde {
|
||||
|
||||
Debug Debug::debug_;
|
||||
|
||||
Debug::Debug() : virtual_driver_(false) {
|
||||
Debug::Debug() : log_handler_(&default_log_handler_), virtual_driver_(false) {
|
||||
char property[PROPERTY_VALUE_MAX];
|
||||
if (property_get("displaycore.virtualdriver", property, NULL) > 0) {
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user