Skip to content

Commit

Permalink
sdm: Use generic libdebug utility.
Browse files Browse the repository at this point in the history
CRs-Fixed: 2211061
Change-Id: Ib949c40ff63a61a4476876c45357a40a702c9a01
  • Loading branch information
Dileep Marchya committed Apr 18, 2018
1 parent 46115bc commit 2d58644
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 466 deletions.
3 changes: 2 additions & 1 deletion include/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) \
$(display_top)/gpu_tonemapper \
$(display_top)/sdm/include \
$(display_top)/gralloc \
$(display_top)/libgralloc1
$(display_top)/libgralloc1 \
$(display_top)/libdebug

include $(BUILD_HEADER_LIBRARY)
3 changes: 2 additions & 1 deletion libdrmutils/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := external/libdrm \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_SHARED_LIBRARIES := libdrm libdl
LOCAL_HEADER_LIBRARIES := display_headers
LOCAL_SHARED_LIBRARIES := libdrm libdl libdisplaydebug
LOCAL_CFLAGS := -DLOG_TAG=\"DRMUTILS\" -Wall -std=c++11 -Werror -fno-operator-names
LOCAL_CLANG := true
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
Expand Down
37 changes: 8 additions & 29 deletions libdrmutils/drm_logger.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2017 - 2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -30,39 +30,18 @@
#ifndef __DRM_LOGGER_H__
#define __DRM_LOGGER_H__

#include <debug_handler.h>
#include <utility>

namespace drm_utils {

class DRMLogger {
public:
virtual ~DRMLogger() {}
virtual void Error(const char *format, ...) = 0;
virtual void Warning(const char *format, ...) = 0;
virtual void Info(const char *format, ...) = 0;
virtual void Debug(const char *format, ...) = 0;
virtual void Verbose(const char *format, ...) = 0;
#define DRM_LOG_TAG 4 // = kTagRotator

static void Set(DRMLogger *logger) { s_instance = logger; }
static DRMLogger *Get() { return s_instance; }

private:
static DRMLogger *s_instance;
};

#define DRM_LOG(method, format, ...) \
if (drm_utils::DRMLogger::Get()) { \
drm_utils::DRMLogger::Get()->method(format, ##__VA_ARGS__); \
}

#define DRM_LOG_CONTEXT(method, format, ...) \
DRM_LOG(method, __CLASS__ "::%s: " format, __FUNCTION__, ##__VA_ARGS__);

#define DRM_LOGE(format, ...) DRM_LOG_CONTEXT(Error, format, ##__VA_ARGS__)
#define DRM_LOGW(format, ...) DRM_LOG_CONTEXT(Warning, format, ##__VA_ARGS__)
#define DRM_LOGI(format, ...) DRM_LOG_CONTEXT(Info, format, ##__VA_ARGS__)
#define DRM_LOGD(format, ...) DRM_LOG_CONTEXT(Debug, format, ##__VA_ARGS__)
#define DRM_LOGV(format, ...) DRM_LOG_CONTEXT(Verbose, format, ##__VA_ARGS__)
#define DRM_LOGE(format, ...) DLOGE(format, ##__VA_ARGS__)
#define DRM_LOGW(format, ...) DLOGW_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)
#define DRM_LOGI(format, ...) DLOGI_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)
#define DRM_LOGD(format, ...) DLOGD_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)
#define DRM_LOGV(format, ...) DLOGV_IF(DRM_LOG_TAG, format, ##__VA_ARGS__)

} // namespace drm_utils

Expand Down
3 changes: 1 addition & 2 deletions libdrmutils/drm_master.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2017 - 2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -53,7 +53,6 @@ using std::fill;

namespace drm_utils {

DRMLogger *DRMLogger::s_instance = nullptr;
DRMMaster *DRMMaster::s_instance = nullptr;
mutex DRMMaster::s_lock;

Expand Down
30 changes: 2 additions & 28 deletions sdm/include/core/core_interface.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
166 changes: 0 additions & 166 deletions sdm/include/core/debug_interface.h

This file was deleted.

20 changes: 19 additions & 1 deletion sdm/include/core/sdm_types.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__
Expand Down
Loading

0 comments on commit 2d58644

Please sign in to comment.