display: Cleanup unused code
CRs-Fixed: 2048735
Change-Id: Ief7f8ae4006ab211272191b66bd4bd854d9098b2
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index 9f1f3c7..782263d 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -13,8 +13,7 @@
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
-std=c++11 -fcolor-diagnostics\
- -DLOG_TAG=\"SDM\" $(common_flags) \
- -I $(display_top)/sdm/libs/hwc
+ -DLOG_TAG=\"SDM\" $(common_flags)
LOCAL_CLANG := true
LOCAL_SHARED_LIBRARIES := libsdmcore libqservice libbinder libhardware libhardware_legacy \
@@ -22,31 +21,22 @@
libsdmutils libc++ liblog libgrallocutils libui libgpu_tonemapper \
libhidlbase libhidltransport vendor.display.config@1.0
-ifneq ($(TARGET_USES_GRALLOC1), true)
- LOCAL_SHARED_LIBRARIES += libmemalloc
-endif
-
LOCAL_SRC_FILES := hwc_session.cpp \
hwc_session_services.cpp \
hwc_display.cpp \
hwc_display_primary.cpp \
hwc_display_external.cpp \
hwc_display_virtual.cpp \
- ../hwc/hwc_debugger.cpp \
- ../hwc/hwc_buffer_sync_handler.cpp \
+ hwc_debugger.cpp \
+ hwc_buffer_sync_handler.cpp \
hwc_color_manager.cpp \
hwc_layers.cpp \
hwc_callbacks.cpp \
- ../hwc/cpuhint.cpp \
- ../hwc/hwc_socket_handler.cpp \
+ cpuhint.cpp \
hwc_tonemapper.cpp \
- display_null.cpp
-
-ifneq ($(TARGET_USES_GRALLOC1), true)
- LOCAL_SRC_FILES += ../hwc/hwc_buffer_allocator.cpp
-else
- LOCAL_SRC_FILES += hwc_buffer_allocator.cpp
-endif
+ display_null.cpp \
+ hwc_socket_handler.cpp \
+ hwc_buffer_allocator.cpp
ifeq ($(TARGET_HAS_WIDE_COLOR_DISPLAY), true)
LOCAL_CFLAGS += -DFEATURE_WIDE_COLOR
diff --git a/sdm/libs/hwc2/cpuhint.cpp b/sdm/libs/hwc2/cpuhint.cpp
new file mode 100644
index 0000000..551fa24
--- /dev/null
+++ b/sdm/libs/hwc2/cpuhint.cpp
@@ -0,0 +1,108 @@
+/* Copyright (c) 2015, The Linux Foundataion. 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 <cutils/properties.h>
+#include <dlfcn.h>
+#include <utils/debug.h>
+
+#include "cpuhint.h"
+#include "hwc_debugger.h"
+
+#define __CLASS__ "CPUHint"
+
+namespace sdm {
+
+DisplayError CPUHint::Init(HWCDebugHandler *debug_handler) {
+ char path[PROPERTY_VALUE_MAX];
+ if (debug_handler->GetProperty("ro.vendor.extension_library", path) != kErrorNone) {
+ DLOGI("Vendor Extension Library not enabled");
+ return kErrorNotSupported;
+ }
+
+ int pre_enable_window = -1;
+ debug_handler->GetProperty("sdm.perf_hint_window", &pre_enable_window);
+ if (pre_enable_window <= 0) {
+ DLOGI("Invalid CPU Hint Pre-enable Window %d", pre_enable_window);
+ return kErrorNotSupported;
+ }
+
+ DLOGI("CPU Hint Pre-enable Window %d", pre_enable_window);
+ pre_enable_window_ = pre_enable_window;
+
+ if (vendor_ext_lib_.Open(path)) {
+ if (!vendor_ext_lib_.Sym("perf_lock_acq", reinterpret_cast<void **>(&fn_lock_acquire_)) ||
+ !vendor_ext_lib_.Sym("perf_lock_rel", reinterpret_cast<void **>(&fn_lock_release_))) {
+ DLOGW("Failed to load symbols for Vendor Extension Library");
+ return kErrorNotSupported;
+ }
+ DLOGI("Successfully Loaded Vendor Extension Library symbols");
+ enabled_ = true;
+ } else {
+ DLOGW("Failed to open %s : %s", path, vendor_ext_lib_.Error());
+ }
+
+ return kErrorNone;
+}
+
+void CPUHint::Set() {
+ if (!enabled_) {
+ return;
+ }
+ if (lock_acquired_) {
+ return;
+ }
+ if (frame_countdown_) {
+ --frame_countdown_;
+ return;
+ }
+
+ int hint = HINT;
+ lock_handle_ = fn_lock_acquire_(0 /*handle*/, 0/*duration*/,
+ &hint, sizeof(hint) / sizeof(int));
+ if (lock_handle_ >= 0) {
+ lock_acquired_ = true;
+ }
+}
+
+void CPUHint::Reset() {
+ if (!enabled_) {
+ return;
+ }
+
+ frame_countdown_ = pre_enable_window_;
+
+ if (!lock_acquired_) {
+ return;
+ }
+
+ fn_lock_release_(lock_handle_);
+ lock_acquired_ = false;
+}
+
+} // namespace sdm
diff --git a/sdm/libs/hwc2/cpuhint.h b/sdm/libs/hwc2/cpuhint.h
new file mode 100644
index 0000000..e758763
--- /dev/null
+++ b/sdm/libs/hwc2/cpuhint.h
@@ -0,0 +1,61 @@
+/* Copyright (c) 2015, The Linux Foundataion. 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 __CPUHINT_H__
+#define __CPUHINT_H__
+
+#include <core/sdm_types.h>
+#include <utils/sys.h>
+
+namespace sdm {
+
+class HWCDebugHandler;
+
+class CPUHint {
+ public:
+ DisplayError Init(HWCDebugHandler *debug_handler);
+ void Set();
+ void Reset();
+
+ private:
+ enum { HINT = 0x4501 /* 45-display layer hint, 01-Enable */ };
+ bool enabled_ = false;
+ // frames to wait before setting this hint
+ int pre_enable_window_ = 0;
+ int frame_countdown_ = 0;
+ int lock_handle_ = 0;
+ bool lock_acquired_ = false;
+ DynLib vendor_ext_lib_;
+ int (*fn_lock_acquire_)(int handle, int duration, int *hints, int num_args) = NULL;
+ int (*fn_lock_release_)(int value) = NULL;
+};
+
+} // namespace sdm
+
+#endif // __CPUHINT_H__
diff --git a/sdm/libs/hwc2/hwc_buffer_sync_handler.cpp b/sdm/libs/hwc2/hwc_buffer_sync_handler.cpp
new file mode 100644
index 0000000..784e91b
--- /dev/null
+++ b/sdm/libs/hwc2/hwc_buffer_sync_handler.cpp
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2015, 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 <sync/sync.h>
+#include <utils/constants.h>
+#include <utils/debug.h>
+
+#include "hwc_debugger.h"
+#include "hwc_buffer_sync_handler.h"
+
+#define __CLASS__ "HWCBufferSyncHandler"
+
+namespace sdm {
+
+DisplayError HWCBufferSyncHandler::SyncWait(int fd) {
+ int error = 0;
+
+ if (fd >= 0) {
+ error = sync_wait(fd, 1000);
+ if (error < 0) {
+ DLOGE("sync_wait error errno = %d, desc = %s", errno, strerror(errno));
+ return kErrorTimeOut;
+ }
+ }
+
+ return kErrorNone;
+}
+
+DisplayError HWCBufferSyncHandler::SyncMerge(int fd1, int fd2, int *merged_fd) {
+ DisplayError error = kErrorNone;
+
+ // Merge the two fences. In the case where one of the fences is not a
+ // valid fence (e.g. NO_FENCE) merge the one valid fence with itself so
+ // that a new fence with the given name is created.
+ // TODO(user): "SyncMerge"string should be replaced with user-defined string to represent
+ // why it is merged.
+ if (fd1 >= 0 && fd2 >= 0) {
+ *merged_fd = sync_merge("SyncMerge", fd1, fd2);
+ } else if (fd1 >= 0) {
+ *merged_fd = sync_merge("SyncMerge", fd1, fd1);
+ } else if (fd2 >= 0) {
+ *merged_fd = sync_merge("SyncMerge", fd2, fd2);
+ } else {
+ *merged_fd = -1;
+ return kErrorNone;
+ }
+
+ if (*merged_fd == -1) {
+ DLOGE("Sync merge error! fd1 %d fd2 %d", fd1, fd2);
+ error = kErrorFileDescriptor;
+ }
+
+ return error;
+}
+
+bool HWCBufferSyncHandler::IsSyncSignaled(int fd) {
+ if (sync_wait(fd, 0) < 0) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+} // namespace sdm
+
diff --git a/sdm/libs/hwc2/hwc_buffer_sync_handler.h b/sdm/libs/hwc2/hwc_buffer_sync_handler.h
new file mode 100644
index 0000000..81479d8
--- /dev/null
+++ b/sdm/libs/hwc2/hwc_buffer_sync_handler.h
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2015, 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 __HWC_BUFFER_SYNC_HANDLER_H__
+#define __HWC_BUFFER_SYNC_HANDLER_H__
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <core/sdm_types.h>
+#include <core/buffer_sync_handler.h>
+
+namespace sdm {
+
+class HWCBufferSyncHandler : public BufferSyncHandler {
+ public:
+ HWCBufferSyncHandler() { }
+
+ virtual DisplayError SyncWait(int fd);
+ virtual DisplayError SyncMerge(int fd1, int fd2, int *merged_fd);
+ virtual bool IsSyncSignaled(int fd);
+};
+
+} // namespace sdm
+#endif // __HWC_BUFFER_SYNC_HANDLER_H__
+
+
diff --git a/sdm/libs/hwc2/hwc_debugger.cpp b/sdm/libs/hwc2/hwc_debugger.cpp
new file mode 100644
index 0000000..ffbb5c5
--- /dev/null
+++ b/sdm/libs/hwc2/hwc_debugger.cpp
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <utils/constants.h>
+#include <cutils/properties.h>
+
+#include "hwc_debugger.h"
+
+namespace sdm {
+
+HWCDebugHandler HWCDebugHandler::debug_handler_;
+std::bitset<32> HWCDebugHandler::debug_flags_ = 0x1;
+int32_t HWCDebugHandler::verbose_level_ = 0x0;
+
+void HWCDebugHandler::DebugAll(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_ = 0x7FFFFFFF;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_ = 0x1; // kTagNone should always be printed.
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::DebugResources(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_[kTagResources] = 1;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_[kTagResources] = 0;
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::DebugStrategy(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_[kTagStrategy] = 1;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_[kTagStrategy] = 0;
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::DebugCompManager(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_[kTagCompManager] = 1;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_[kTagCompManager] = 0;
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::DebugDriverConfig(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_[kTagDriverConfig] = 1;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_[kTagDriverConfig] = 0;
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::DebugRotator(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_[kTagRotator] = 1;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_[kTagRotator] = 0;
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::DebugScalar(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_[kTagScalar] = 1;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_[kTagScalar] = 0;
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::DebugQdcm(bool enable, int verbose_level) {
+ if (enable) {
+ debug_flags_[kTagQDCM] = 1;
+ verbose_level_ = verbose_level;
+ } else {
+ debug_flags_[kTagQDCM] = 0;
+ verbose_level_ = 0;
+ }
+}
+
+void HWCDebugHandler::Error(DebugTag tag, const char *format, ...) {
+ if (debug_flags_[tag]) {
+ va_list list;
+ va_start(list, format);
+ __android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, list);
+ }
+}
+
+void HWCDebugHandler::Warning(DebugTag tag, const char *format, ...) {
+ if (debug_flags_[tag]) {
+ va_list list;
+ va_start(list, format);
+ __android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, format, list);
+ }
+}
+
+void HWCDebugHandler::Info(DebugTag tag, const char *format, ...) {
+ if (debug_flags_[tag]) {
+ va_list list;
+ va_start(list, format);
+ __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, list);
+ }
+}
+
+void HWCDebugHandler::Debug(DebugTag tag, const char *format, ...) {
+ if (debug_flags_[tag]) {
+ va_list list;
+ va_start(list, format);
+ __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, list);
+ }
+}
+
+void HWCDebugHandler::Verbose(DebugTag tag, const char *format, ...) {
+ if (debug_flags_[tag] && verbose_level_) {
+ va_list list;
+ va_start(list, format);
+ __android_log_vprint(ANDROID_LOG_VERBOSE, LOG_TAG, format, list);
+ }
+}
+
+void HWCDebugHandler::BeginTrace(const char *class_name, const char *function_name,
+ const char *custom_string) {
+ if (atrace_is_tag_enabled(ATRACE_TAG)) {
+ char name[PATH_MAX] = {0};
+ snprintf(name, sizeof(name), "%s::%s::%s", class_name, function_name, custom_string);
+ atrace_begin(ATRACE_TAG, name);
+ }
+}
+
+void HWCDebugHandler::EndTrace() {
+ atrace_end(ATRACE_TAG);
+}
+
+int HWCDebugHandler::GetIdleTimeoutMs() {
+ int value = IDLE_TIMEOUT_DEFAULT_MS;
+ debug_handler_.GetProperty("sdm.idle_time", &value);
+
+ return value;
+}
+
+DisplayError HWCDebugHandler::GetProperty(const char *property_name, int *value) {
+ char property[PROPERTY_VALUE_MAX];
+
+ if (property_get(property_name, property, NULL) > 0) {
+ *value = atoi(property);
+ return kErrorNone;
+ }
+
+ return kErrorNotSupported;
+}
+
+DisplayError HWCDebugHandler::GetProperty(const char *property_name, char *value) {
+ if (property_get(property_name, value, NULL) > 0) {
+ return kErrorNone;
+ }
+
+ return kErrorNotSupported;
+}
+
+DisplayError HWCDebugHandler::SetProperty(const char *property_name, const char *value) {
+ if (property_set(property_name, value) == 0) {
+ return kErrorNone;
+ }
+
+ return kErrorNotSupported;
+}
+
+} // namespace sdm
+
diff --git a/sdm/libs/hwc2/hwc_debugger.h b/sdm/libs/hwc2/hwc_debugger.h
new file mode 100644
index 0000000..82ff2f2
--- /dev/null
+++ b/sdm/libs/hwc2/hwc_debugger.h
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __HWC_DEBUGGER_H__
+#define __HWC_DEBUGGER_H__
+
+#define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
+
+#include <core/sdm_types.h>
+#include <core/debug_interface.h>
+#include <cutils/log.h>
+#include <utils/Trace.h>
+#include <bitset>
+
+namespace sdm {
+
+class HWCDebugHandler : public DebugHandler {
+ public:
+ static inline DebugHandler* Get() { return &debug_handler_; }
+ static const char* DumpDir() { return "/data/vendor/display"; }
+
+ static void DebugAll(bool enable, int verbose_level);
+ static void DebugResources(bool enable, int verbose_level);
+ static void DebugStrategy(bool enable, int verbose_level);
+ static void DebugCompManager(bool enable, int verbose_level);
+ static void DebugDriverConfig(bool enable, int verbose_level);
+ static void DebugRotator(bool enable, int verbose_level);
+ static void DebugScalar(bool enable, int verbose_level);
+ static void DebugQdcm(bool enable, int verbose_level);
+ static int GetIdleTimeoutMs();
+
+ virtual void Error(DebugTag tag, const char *format, ...);
+ virtual void Warning(DebugTag tag, const char *format, ...);
+ virtual void Info(DebugTag tag, const char *format, ...);
+ virtual void Debug(DebugTag tag, const char *format, ...);
+ virtual void Verbose(DebugTag tag, const char *format, ...);
+ virtual void BeginTrace(const char *class_name, const char *function_name,
+ const char *custom_string);
+ virtual void EndTrace();
+ virtual DisplayError GetProperty(const char *property_name, int *value);
+ virtual DisplayError GetProperty(const char *property_name, char *value);
+ virtual DisplayError SetProperty(const char *property_name, const char *value);
+
+ private:
+ static HWCDebugHandler debug_handler_;
+ static std::bitset<32> debug_flags_;
+ static int32_t verbose_level_;
+};
+
+} // namespace sdm
+
+#endif // __HWC_DEBUGGER_H__
+
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 0331464..0887fbe 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -39,7 +39,6 @@
#include "hwc_display.h"
#include "hwc_debugger.h"
-#include "blit_engine_c2d.h"
#include "hwc_tonemapper.h"
#ifndef USE_GRALLOC1
diff --git a/sdm/libs/hwc2/hwc_socket_handler.cpp b/sdm/libs/hwc2/hwc_socket_handler.cpp
new file mode 100644
index 0000000..7ebaab4
--- /dev/null
+++ b/sdm/libs/hwc2/hwc_socket_handler.cpp
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2016, 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 <cutils/sockets.h>
+#include "hwc_socket_handler.h"
+
+#define __CLASS__ "HWCSocketHandler"
+
+#define DPPS_SOCKET "pps"
+
+namespace sdm {
+
+int HWCSocketHandler::GetSocketFd(SocketType socket_type) {
+ switch (socket_type) {
+ case kDpps:
+ return socket_local_client(DPPS_SOCKET, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM);
+ default:
+ return -1;
+ }
+}
+
+} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_socket_handler.h b/sdm/libs/hwc2/hwc_socket_handler.h
new file mode 100644
index 0000000..5b2292a
--- /dev/null
+++ b/sdm/libs/hwc2/hwc_socket_handler.h
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2016, 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 __HWC_SOCKET_HANDLER_H__
+#define __HWC_SOCKET_HANDLER_H__
+
+#include <core/socket_handler.h>
+
+namespace sdm {
+
+class HWCSocketHandler : public SocketHandler {
+ public:
+ HWCSocketHandler() { }
+
+ virtual int GetSocketFd(SocketType socket_type);
+};
+
+} // namespace sdm
+
+#endif // __HWC_SOCKET_HANDLER_H__