sde: Add hooks for dump information.
1. Implement dump interface and provide hooks for adding
dump information from different modules.
2. Rename writeback session module to offline controller.
3. Merge logger.h functionality into debug.h
4. Rename DISPLAY_* as SDE_*.
Change-Id: I3e8df27a848475d067801037bcdc807561d35cc8
diff --git a/displayengine/include/core/debug_interface.h b/displayengine/include/core/dump_interface.h
similarity index 67%
rename from displayengine/include/core/debug_interface.h
rename to displayengine/include/core/dump_interface.h
index 2c6349a..674e60f 100644
--- a/displayengine/include/core/debug_interface.h
+++ b/displayengine/include/core/dump_interface.h
@@ -22,12 +22,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*! @file debug_interface.h
- @brief Interface file for debugging options provided by display engine.
+/*! @file dump_interface.h
+ @brief Interface file for dump options provided by display engine.
*/
-#ifndef __DEBUG_INTERFACE_H__
-#define __DEBUG_INTERFACE_H__
+#ifndef __DUMP_INTERFACE_H__
+#define __DUMP_INTERFACE_H__
#include <stdint.h>
@@ -35,31 +35,35 @@
namespace sde {
-/*! @brief Display debug interface.
+/*! @brief Display dump interface.
- @details This class defines debugging methods provided by display engine.
+ @details This class defines dump methods provided by display engine.
*/
-class DebugInterface {
+class DumpInterface {
public:
- /*! @brief Method to get debugging information in form of a string.
+ /*! @brief Method to get dump information in form of a string.
- @details Client shall use this method to get current snapshot of display engine context in form
- of a formatted string for logging or dumping purposes.
+ @details Client shall use this method to get current snapshot of display engine context as a
+ formatted string for logging or dumping purposes.
- @param[out] buffer String buffer allocated by the client. Filled with debugging information
- upon return.
+ @param[inout] buffer String buffer allocated by the client. Filled with dump information upon
+ return.
@param[in] length Length of the string buffer. Length shall be offset adjusted if any.
+ @param[in] filled Number of bytes filled into the string buffer.
@return \link DisplayError \endlink
+
+ @warning Client shall ensure that this interface is not used while a device is being either
+ created or destroyed through display core.
*/
- static DisplayError GetDump(uint8_t *buffer, uint32_t length);
+ static DisplayError GetDump(uint8_t *buffer, uint32_t length, uint32_t *filled);
protected:
- virtual ~DebugInterface() { }
+ virtual ~DumpInterface() { }
};
} // namespace sde
-#endif // __DEBUG_INTERFACE_H__
+#endif // __DUMP_INTERFACE_H__
diff --git a/displayengine/include/utils/debug.h b/displayengine/include/utils/debug.h
index 6b1d418..10d5ea6 100644
--- a/displayengine/include/utils/debug.h
+++ b/displayengine/include/utils/debug.h
@@ -25,6 +25,24 @@
#ifndef __DEBUG_H__
#define __DEBUG_H__
+#ifndef SDE_LOG_TAG
+#define SDE_LOG_TAG kLogTagNone
+#endif
+
+#ifndef SDE_MODULE_NAME
+#define SDE_MODULE_NAME "SDE"
+#endif
+
+#define DLOG(method, format, ...) Debug::method(SDE_LOG_TAG, SDE_MODULE_NAME ": " 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__)
+
namespace sde {
enum LogTag {
diff --git a/displayengine/include/utils/logger.h b/displayengine/include/utils/logger.h
deleted file mode 100644
index 03c398a..0000000
--- a/displayengine/include/utils/logger.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* 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.
-*/
-
-#ifndef __LOGGER_H__
-#define __LOGGER_H__
-
-#include "debug.h"
-
-namespace sde {
-
-#ifndef DISPLAY_LOG_TAG
-#define DISPLAY_LOG_TAG kLogTagNone
-#endif
-
-#ifndef DISPLAY_MODULE_NAME
-#define DISPLAY_MODULE_NAME "SDE"
-#endif
-
-#define DLOG(method, format, ...) Debug::method(DISPLAY_LOG_TAG, \
- DISPLAY_MODULE_NAME ": " format, ##__VA_ARGS__)
-
-// DISPLAY_LOG_TAG and DISPLAY_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__)
-
-} // namespace sde
-
-#endif // __LOGGER_H__
-
diff --git a/displayengine/libs/core/Android.mk b/displayengine/libs/core/Android.mk
index 6854c8c..496c899 100644
--- a/displayengine/libs/core/Android.mk
+++ b/displayengine/libs/core/Android.mk
@@ -18,9 +18,9 @@
strategy_default.cpp \
res_manager.cpp \
res_config.cpp \
- writeback_session.cpp \
+ offline_ctrl.cpp \
hw_interface.cpp \
hw_framebuffer.cpp \
- debug_interface.cpp
+ dump_impl.cpp
include $(BUILD_SHARED_LIBRARY)
diff --git a/displayengine/libs/core/comp_manager.cpp b/displayengine/libs/core/comp_manager.cpp
index b264038..560db52 100644
--- a/displayengine/libs/core/comp_manager.cpp
+++ b/displayengine/libs/core/comp_manager.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "CompManager"
-#include <utils/logger.h>
+// 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>
@@ -187,5 +187,11 @@
res_mgr_.Purge(comp_mgr_device->res_mgr_device);
}
+uint32_t CompManager::GetDump(uint8_t *buffer, uint32_t length) {
+ SCOPE_LOCK(locker_);
+
+ return 0;
+}
+
} // namespace sde
diff --git a/displayengine/libs/core/comp_manager.h b/displayengine/libs/core/comp_manager.h
index 1e1245d..e6954a8 100644
--- a/displayengine/libs/core/comp_manager.h
+++ b/displayengine/libs/core/comp_manager.h
@@ -30,10 +30,11 @@
#include "hw_interface.h"
#include "strategy_default.h"
#include "res_manager.h"
+#include "dump_impl.h"
namespace sde {
-class CompManager {
+class CompManager : public DumpImpl {
public:
CompManager();
DisplayError Init(const HWResourceInfo &hw_res_info_);
@@ -46,6 +47,9 @@
void PostCommit(Handle device, HWLayers *hw_layers);
void Purge(Handle device);
+ // DumpImpl method
+ virtual uint32_t GetDump(uint8_t *buffer, uint32_t length);
+
private:
struct CompManagerDevice {
StrategyConstraints constraints;
diff --git a/displayengine/libs/core/core_impl.cpp b/displayengine/libs/core/core_impl.cpp
index cdbd414..9a1fa12 100644
--- a/displayengine/libs/core/core_impl.cpp
+++ b/displayengine/libs/core/core_impl.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "CoreImpl"
-#include <utils/logger.h>
+// 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>
@@ -64,7 +64,7 @@
return error;
}
- error = wb_session_.Init(hw_intf_, hw_res_info);
+ error = offline_ctrl_.Init(hw_intf_, hw_res_info);
if (UNLIKELY(error != kErrorNone)) {
comp_mgr_.Deinit();
HWInterface::Destroy(hw_intf_);
@@ -77,7 +77,7 @@
DisplayError CoreImpl::Deinit() {
SCOPE_LOCK(locker_);
- wb_session_.Deinit();
+ offline_ctrl_.Deinit();
comp_mgr_.Deinit();
HWInterface::Destroy(hw_intf_);
diff --git a/displayengine/libs/core/core_impl.h b/displayengine/libs/core/core_impl.h
index 3509274..16a01f2 100644
--- a/displayengine/libs/core/core_impl.h
+++ b/displayengine/libs/core/core_impl.h
@@ -31,7 +31,7 @@
#include "hw_interface.h"
#include "comp_manager.h"
-#include "writeback_session.h"
+#include "offline_ctrl.h"
#define SET_REVISION(major, minor) ((major << 8) | minor)
@@ -61,7 +61,7 @@
CoreEventHandler *event_handler_;
HWInterface *hw_intf_;
CompManager comp_mgr_;
- WritebackSession wb_session_;
+ OfflineCtrl offline_ctrl_;
};
} // namespace sde
diff --git a/displayengine/libs/core/core_interface.cpp b/displayengine/libs/core/core_interface.cpp
index 8cfd9e7..7cd85b0 100644
--- a/displayengine/libs/core/core_interface.cpp
+++ b/displayengine/libs/core/core_interface.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "CoreInterface"
-#include <utils/logger.h>
+// 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>
diff --git a/displayengine/libs/core/debug_interface.cpp b/displayengine/libs/core/debug_interface.cpp
deleted file mode 100644
index 5518ec2..0000000
--- a/displayengine/libs/core/debug_interface.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* 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.
-*/
-
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "DebugInterface"
-#include <utils/logger.h>
-
-#include <core/debug_interface.h>
-#include <utils/constants.h>
-
-namespace sde {
-
-DisplayError DebugInterface::GetDump(uint8_t *buffer, uint32_t length) {
- if (UNLIKELY(!buffer || !length)) {
- return kErrorParameters;
- }
-
- return kErrorNone;
-}
-
-} // namespace sde
-
diff --git a/displayengine/libs/core/device_base.cpp b/displayengine/libs/core/device_base.cpp
index a04bf45..8854098 100644
--- a/displayengine/libs/core/device_base.cpp
+++ b/displayengine/libs/core/device_base.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "DeviceBase"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "DeviceBase"
+#include <utils/debug.h>
#include <utils/constants.h>
@@ -273,5 +273,11 @@
return kErrorNone;
}
+uint32_t DeviceBase::GetDump(uint8_t *buffer, uint32_t length) {
+ SCOPE_LOCK(locker_);
+
+ return 0;
+}
+
} // namespace sde
diff --git a/displayengine/libs/core/device_base.h b/displayengine/libs/core/device_base.h
index fad3023..6693142 100644
--- a/displayengine/libs/core/device_base.h
+++ b/displayengine/libs/core/device_base.h
@@ -34,7 +34,7 @@
namespace sde {
-class DeviceBase : public DeviceInterface {
+class DeviceBase : public DeviceInterface, DumpImpl {
public:
DeviceBase(DeviceType device_type, DeviceEventHandler *event_handler,
HWBlockType hw_block_type, HWInterface *hw_intf, CompManager *comp_manager);
@@ -52,6 +52,9 @@
virtual DisplayError SetConfig(uint32_t mode);
virtual DisplayError SetVSyncState(bool enabled);
+ // DumpImpl method
+ virtual uint32_t GetDump(uint8_t *buffer, uint32_t length);
+
protected:
Locker locker_;
DeviceType device_type_;
diff --git a/displayengine/libs/core/device_hdmi.cpp b/displayengine/libs/core/device_hdmi.cpp
index 1a7bf26..a7c8c4f 100644
--- a/displayengine/libs/core/device_hdmi.cpp
+++ b/displayengine/libs/core/device_hdmi.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "DeviceHDMI"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "DeviceHDMI"
+#include <utils/debug.h>
#include <utils/constants.h>
diff --git a/displayengine/libs/core/device_primary.cpp b/displayengine/libs/core/device_primary.cpp
index b10546f..c5d45b8 100644
--- a/displayengine/libs/core/device_primary.cpp
+++ b/displayengine/libs/core/device_primary.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "DevicePrimary"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "DevicePrimary"
+#include <utils/debug.h>
#include <utils/constants.h>
diff --git a/displayengine/libs/core/device_virtual.cpp b/displayengine/libs/core/device_virtual.cpp
index 9fc9df4..4e18f93 100644
--- a/displayengine/libs/core/device_virtual.cpp
+++ b/displayengine/libs/core/device_virtual.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "DeviceVirtual"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "DeviceVirtual"
+#include <utils/debug.h>
#include <utils/constants.h>
diff --git a/displayengine/libs/core/dump_impl.cpp b/displayengine/libs/core/dump_impl.cpp
new file mode 100644
index 0000000..b15573c
--- /dev/null
+++ b/displayengine/libs/core/dump_impl.cpp
@@ -0,0 +1,85 @@
+/*
+* 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.
+*/
+
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "DumpInterface"
+#include <utils/debug.h>
+
+#include <utils/constants.h>
+
+#include "dump_impl.h"
+
+namespace sde {
+
+DumpImpl* DumpImpl::dump_list_[] = { 0 };
+uint32_t DumpImpl::dump_count_ = 0;
+
+DisplayError DumpInterface::GetDump(uint8_t *buffer, uint32_t length, uint32_t *filled) {
+ if (!buffer || !length || !filled) {
+ return kErrorParameters;
+ }
+
+ DumpImpl::GetDump(buffer, length, filled);
+ return kErrorNone;
+}
+
+DumpImpl::DumpImpl() {
+ Register(this);
+}
+
+DumpImpl::~DumpImpl() {
+ Unregister(this);
+}
+
+// Caller has to ensure that it does not create or destroy devices while using dump interface.
+void DumpImpl::GetDump(uint8_t *buffer, uint32_t length, uint32_t *filled) {
+ *filled = 0;
+ for (uint32_t i = 0; (i < DumpImpl::dump_count_) && (*filled < length); i++) {
+ *filled += DumpImpl::dump_list_[i]->GetDump(buffer + *filled, length - *filled);
+ }
+}
+
+// Every object is created or destroyed through display core only, which itself protects the
+// the access, so no need to protect registration or de-registration.
+void DumpImpl::Register(DumpImpl *dump_impl) {
+ if (dump_count_ < kMaxDumpObjects) {
+ dump_list_[dump_count_] = dump_impl;
+ dump_count_++;
+ }
+}
+
+void DumpImpl::Unregister(DumpImpl *dump_impl) {
+ for (uint32_t i = 0; i < dump_count_; i++) {
+ if (dump_list_[i] == dump_impl) {
+ dump_count_--;
+ for (; i < dump_count_; i++) {
+ dump_list_[i] = dump_list_[i + 1];
+ }
+ }
+ }
+}
+
+} // namespace sde
+
diff --git a/displayengine/libs/core/writeback_session.h b/displayengine/libs/core/dump_impl.h
similarity index 68%
copy from displayengine/libs/core/writeback_session.h
copy to displayengine/libs/core/dump_impl.h
index ed6b938..7d652ec 100644
--- a/displayengine/libs/core/writeback_session.h
+++ b/displayengine/libs/core/dump_impl.h
@@ -22,26 +22,37 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __WRITEBACK_SESSION_H__
-#define __WRITEBACK_SESSION_H__
+#ifndef __DUMP_IMPL_H__
+#define __DUMP_IMPL_H__
-#include <utils/locker.h>
-
-#include "hw_interface.h"
+#include <core/dump_interface.h>
namespace sde {
-class WritebackSession {
+class DumpImpl {
public:
- WritebackSession();
- DisplayError Init(HWInterface *hw_intf, HWResourceInfo hw_res_info);
- DisplayError Deinit();
+ // To be implemented in the modules which will add dump information to final dump buffer.
+ // buffer address & length will be already adjusted before calling into these modules.
+ virtual uint32_t GetDump(uint8_t *buffer, uint32_t length) = 0;
+ static void GetDump(uint8_t *buffer, uint32_t length, uint32_t *filled);
+
+ protected:
+ DumpImpl();
+ virtual ~DumpImpl();
private:
- HWInterface *hw_intf_;
+ static const uint32_t kMaxDumpObjects = 32;
+
+ static void Register(DumpImpl *dump_impl);
+ static void Unregister(DumpImpl *dump_impl);
+
+ static DumpImpl *dump_list_[kMaxDumpObjects];
+ static uint32_t dump_count_;
+
+ friend DumpInterface;
};
} // namespace sde
-#endif // __WRITEBACK_SESSION_H__
+#endif // __DUMP_IMPL_H__
diff --git a/displayengine/libs/core/hw_framebuffer.cpp b/displayengine/libs/core/hw_framebuffer.cpp
index 41dd731..2908d60 100644
--- a/displayengine/libs/core/hw_framebuffer.cpp
+++ b/displayengine/libs/core/hw_framebuffer.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "HWFrameBuffer"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "HWFrameBuffer"
+#include <utils/debug.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/displayengine/libs/core/hw_interface.cpp b/displayengine/libs/core/hw_interface.cpp
index 6500c21..f39cc21 100644
--- a/displayengine/libs/core/hw_interface.cpp
+++ b/displayengine/libs/core/hw_interface.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "HWInterface"
-#include <utils/logger.h>
+// 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>
diff --git a/displayengine/libs/core/writeback_session.cpp b/displayengine/libs/core/offline_ctrl.cpp
similarity index 81%
rename from displayengine/libs/core/writeback_session.cpp
rename to displayengine/libs/core/offline_ctrl.cpp
index d49381a..be01cef 100644
--- a/displayengine/libs/core/writeback_session.cpp
+++ b/displayengine/libs/core/offline_ctrl.cpp
@@ -22,26 +22,26 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "WritebackSession"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "OfflineCtrl"
+#include <utils/debug.h>
#include <utils/constants.h>
-#include "writeback_session.h"
+#include "offline_ctrl.h"
namespace sde {
-WritebackSession::WritebackSession() : hw_intf_(NULL) {
+OfflineCtrl::OfflineCtrl() : hw_intf_(NULL) {
}
-DisplayError WritebackSession::Init(HWInterface *hw_intf, HWResourceInfo hw_res_info) {
+DisplayError OfflineCtrl::Init(HWInterface *hw_intf, HWResourceInfo hw_res_info) {
hw_intf_ = hw_intf;
return kErrorNone;
}
-DisplayError WritebackSession::Deinit() {
+DisplayError OfflineCtrl::Deinit() {
return kErrorNone;
}
diff --git a/displayengine/libs/core/writeback_session.h b/displayengine/libs/core/offline_ctrl.h
similarity index 92%
rename from displayengine/libs/core/writeback_session.h
rename to displayengine/libs/core/offline_ctrl.h
index ed6b938..8987bb3 100644
--- a/displayengine/libs/core/writeback_session.h
+++ b/displayengine/libs/core/offline_ctrl.h
@@ -22,8 +22,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __WRITEBACK_SESSION_H__
-#define __WRITEBACK_SESSION_H__
+#ifndef __OFFLINE_CTRL_H__
+#define __OFFLINE_CTRL_H__
#include <utils/locker.h>
@@ -31,9 +31,9 @@
namespace sde {
-class WritebackSession {
+class OfflineCtrl {
public:
- WritebackSession();
+ OfflineCtrl();
DisplayError Init(HWInterface *hw_intf, HWResourceInfo hw_res_info);
DisplayError Deinit();
@@ -43,5 +43,5 @@
} // namespace sde
-#endif // __WRITEBACK_SESSION_H__
+#endif // __OFFLINE_CTRL_H__
diff --git a/displayengine/libs/core/res_config.cpp b/displayengine/libs/core/res_config.cpp
index a4cc8a2..7d16c00 100644
--- a/displayengine/libs/core/res_config.cpp
+++ b/displayengine/libs/core/res_config.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "ResConfig"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "ResConfig"
+#include <utils/debug.h>
#include <utils/constants.h>
#include <math.h>
diff --git a/displayengine/libs/core/res_manager.cpp b/displayengine/libs/core/res_manager.cpp
index 66a3ae3..cb44747 100644
--- a/displayengine/libs/core/res_manager.cpp
+++ b/displayengine/libs/core/res_manager.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "ResManager"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "ResManager"
+#include <utils/debug.h>
#include <utils/constants.h>
@@ -441,5 +441,11 @@
((dst_roi.bottom - dst_roi.top) != (src_roi.bottom - src_roi.top));
}
+uint32_t ResManager::GetDump(uint8_t *buffer, uint32_t length) {
+ SCOPE_LOCK(locker_);
+
+ return 0;
+}
+
} // namespace sde
diff --git a/displayengine/libs/core/res_manager.h b/displayengine/libs/core/res_manager.h
index 9199c15..ccd6433 100644
--- a/displayengine/libs/core/res_manager.h
+++ b/displayengine/libs/core/res_manager.h
@@ -29,10 +29,11 @@
#include <utils/locker.h>
#include "hw_interface.h"
+#include "dump_impl.h"
namespace sde {
-class ResManager {
+class ResManager : public DumpImpl {
public:
ResManager();
DisplayError Init(const HWResourceInfo &hw_res_info);
@@ -46,6 +47,9 @@
void PostCommit(Handle device, HWLayers *hw_layers);
void Purge(Handle device);
+ // DumpImpl method
+ virtual uint32_t GetDump(uint8_t *buffer, uint32_t length);
+
private:
enum PipeId {
kPipeIdVIG0,
diff --git a/displayengine/libs/core/strategy_default.cpp b/displayengine/libs/core/strategy_default.cpp
index 4e824d5..b8188aa 100644
--- a/displayengine/libs/core/strategy_default.cpp
+++ b/displayengine/libs/core/strategy_default.cpp
@@ -22,10 +22,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// DISPLAY_LOG_TAG definition must precede logger.h include.
-#define DISPLAY_LOG_TAG kTagCore
-#define DISPLAY_MODULE_NAME "StrategyDefault"
-#include <utils/logger.h>
+// SDE_LOG_TAG definition must precede debug.h include.
+#define SDE_LOG_TAG kTagCore
+#define SDE_MODULE_NAME "StrategyDefault"
+#include <utils/debug.h>
#include <utils/constants.h>
diff --git a/displayengine/libs/hwc/hwc_session.cpp b/displayengine/libs/hwc/hwc_session.cpp
index b9f9994..51b9a80 100644
--- a/displayengine/libs/hwc/hwc_session.cpp
+++ b/displayengine/libs/hwc/hwc_session.cpp
@@ -22,7 +22,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <core/debug_interface.h>
+#include <core/dump_interface.h>
#include <utils/constants.h>
// HWC_MODULE_NAME definition must precede hwc_logger.h include.
@@ -49,6 +49,8 @@
namespace sde {
+Locker HWCSession::locker_;
+
HWCSession::HWCSession(const hw_module_t *module) : core_intf_(NULL), hwc_procs_(NULL) {
hwc_composer_device_1_t::common.tag = HARDWARE_DEVICE_TAG;
hwc_composer_device_1_t::common.version = HWC_DEVICE_API_VERSION_1_3;
@@ -153,6 +155,8 @@
int HWCSession::Prepare(hwc_composer_device_1 *device, size_t num_displays,
hwc_display_contents_1_t **displays) {
+ SCOPE_LOCK(locker_);
+
if (UNLIKELY(!device || !displays)) {
return -EINVAL;
}
@@ -185,6 +189,8 @@
int HWCSession::Set(hwc_composer_device_1 *device, size_t num_displays,
hwc_display_contents_1_t **displays) {
+ SCOPE_LOCK(locker_);
+
if (UNLIKELY(!device || !displays)) {
return -EINVAL;
}
@@ -216,6 +222,8 @@
}
int HWCSession::EventControl(hwc_composer_device_1 *device, int disp, int event, int enable) {
+ SCOPE_LOCK(locker_);
+
if (UNLIKELY(!device)) {
return -EINVAL;
}
@@ -235,6 +243,8 @@
}
int HWCSession::Blank(hwc_composer_device_1 *device, int disp, int blank) {
+ SCOPE_LOCK(locker_);
+
if (UNLIKELY(!device)) {
return -EINVAL;
}
@@ -271,11 +281,14 @@
}
void HWCSession::Dump(hwc_composer_device_1 *device, char *buffer, int length) {
+ SCOPE_LOCK(locker_);
+
if (UNLIKELY(!device || !buffer || !length)) {
return;
}
- DebugInterface::GetDump(reinterpret_cast<uint8_t *>(buffer), length);
+ uint32_t filled = 0;
+ DumpInterface::GetDump(reinterpret_cast<uint8_t *>(buffer), length, &filled);
}
int HWCSession::GetDisplayConfigs(hwc_composer_device_1 *device, int disp, uint32_t *configs,
diff --git a/displayengine/libs/hwc/hwc_session.h b/displayengine/libs/hwc/hwc_session.h
index eb6d08f..8390459 100644
--- a/displayengine/libs/hwc/hwc_session.h
+++ b/displayengine/libs/hwc/hwc_session.h
@@ -27,6 +27,7 @@
#include <hardware/hwcomposer.h>
#include <core/core_interface.h>
+#include <utils/locker.h>
#include "hwc_sink_primary.h"
@@ -65,6 +66,7 @@
// CoreEventHandler methods
virtual DisplayError Hotplug(const CoreEventHotplug &hotplug);
+ static Locker locker_;
CoreInterface *core_intf_;
hwc_procs_t const *hwc_procs_;
HWCSinkPrimary *sink_primary_;