sde: Snapdragon Display Engine (SDE) implementation skeleton.

Define classes and files required for SDE implementation.

Change-Id: Ic2d8572699b895f1980c7c127301e9ce0d4c8b03
diff --git a/Android.mk b/Android.mk
index d8b168d..4a951c8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,6 +1,16 @@
-display-hals := libgralloc libgenlock libcopybit liblight
-display-hals += libhwcomposer liboverlay libqdutils libhdmi libqservice
-display-hals += libmemtrack
+# This flag will be set to true during migration to Snapdragon Display Engine.
+TARGET_USES_SDE = false
+
+display-hals := libgralloc libcopybit liblight libmemtrack
+
+ifeq ($(TARGET_USES_SDE), true)
+    sde-libs := displayengine/libs
+    display-hals += $(sde-libs)/utils $(sde-libs)/core $(sde-libs)/hwc
+else
+    display-hals += libgenlock libhwcomposer liboverlay libqdutils libhdmi
+    display-hals += libqservice
+endif
+
 ifeq ($(call is-vendor-board-platform,QCOM),true)
     include $(call all-named-subdir-makefiles,$(display-hals))
 else
diff --git a/displayengine/libs/common.mk b/displayengine/libs/common.mk
new file mode 100644
index 0000000..79ba738
--- /dev/null
+++ b/displayengine/libs/common.mk
@@ -0,0 +1,39 @@
+#Common headers
+common_includes := hardware/qcom/display/displayengine/include/
+common_includes += hardware/qcom/display/libgralloc/
+common_includes += hardware/qcom/display/libcopybit/
+
+common_header_export_path := qcom/display
+
+#Common libraries external to display HAL
+common_libs := liblog libutils libcutils libhardware
+
+#Common C flags
+common_flags := -DDEBUG_CALC_FPS -Wno-missing-field-initializers
+common_flags += -Wconversion -Wall -Werror
+common_flags += -Wno-unused-parameter -Wno-unused-variable
+
+ifeq ($(ARCH_ARM_HAVE_NEON),true)
+    common_flags += -D__ARM_HAVE_NEON
+endif
+
+ifeq ($(call is-board-platform-in-list, $(MSM_VIDC_TARGET_LIST)), true)
+    common_flags += -DVENUS_COLOR_FORMAT
+endif
+
+ifeq ($(call is-board-platform-in-list, msm8994), true)
+    common_flags += -DMDSS_TARGET
+endif
+
+common_deps  :=
+kernel_includes :=
+
+ifeq ($(call is-vendor-board-platform,QCOM),true)
+# This check is to pick the kernel headers from the right location.
+# If the macro above is defined, we make the assumption that we have the kernel
+# available in the build tree.
+# If the macro is not present, the headers are picked from hardware/qcom/msmXXXX
+# failing which, they are picked from bionic.
+    common_deps += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
+    kernel_includes += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
+endif
diff --git a/displayengine/libs/core/Android.mk b/displayengine/libs/core/Android.mk
new file mode 100644
index 0000000..519c404
--- /dev/null
+++ b/displayengine/libs/core/Android.mk
@@ -0,0 +1,25 @@
+LOCAL_PATH := $(call my-dir)
+include hardware/qcom/display/displayengine/libs/common.mk
+include $(CLEAR_VARS)
+
+LOCAL_MODULE                  := libsdecore
+LOCAL_MODULE_TAGS             := optional
+LOCAL_C_INCLUDES              := $(common_includes) $(kernel_includes)
+LOCAL_CFLAGS                  := $(common_flags) -DLOG_TAG=\"SDE\"
+LOCAL_SHARED_LIBRARIES        := $(common_libs) libdl libsdeutils
+LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
+LOCAL_SRC_FILES               := core_interface.cpp \
+                                 core_impl.cpp \
+                                 device_base.cpp \
+                                 device_primary.cpp \
+                                 device_hdmi.cpp \
+                                 device_virtual.cpp \
+                                 comp_manager.cpp \
+                                 strategy_default.cpp \
+                                 res_manager.cpp \
+                                 writeback_session.cpp \
+                                 hw_interface.cpp \
+                                 hw_framebuffer.cpp \
+                                 debug_interface.cpp
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/displayengine/libs/core/comp_manager.cpp b/displayengine/libs/core/comp_manager.cpp
new file mode 100644
index 0000000..3ca38bd
--- /dev/null
+++ b/displayengine/libs/core/comp_manager.cpp
@@ -0,0 +1,49 @@
+/*
+* 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 "CompManager"
+#include <utils/logger.h>
+
+#include <dlfcn.h>
+#include <utils/constants.h>
+
+#include "comp_manager.h"
+
+namespace sde {
+
+CompManager::CompManager() : strategy_lib_(NULL), strategy_intf_(NULL) {
+}
+
+DisplayError CompManager::Init() {
+  return kErrorNone;
+}
+
+DisplayError CompManager::Deinit() {
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/comp_manager.h b/displayengine/libs/core/comp_manager.h
new file mode 100644
index 0000000..318ddb4
--- /dev/null
+++ b/displayengine/libs/core/comp_manager.h
@@ -0,0 +1,52 @@
+/*
+* 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 __COMP_MANAGER_H__
+#define __COMP_MANAGER_H__
+
+#include <core/device_interface.h>
+
+#include "hw_interface.h"
+#include "strategy_default.h"
+#include "res_manager.h"
+
+namespace sde {
+
+class CompManager {
+ public:
+  CompManager();
+  DisplayError Init();
+  DisplayError Deinit();
+
+ private:
+  void *strategy_lib_;
+  StrategyInterface *strategy_intf_;
+  StrategyDefault strategy_default_;
+  ResManager res_mgr_;
+};
+
+}  // namespace sde
+
+#endif  // __COMP_MANAGER_H__
+
diff --git a/displayengine/libs/core/core_impl.cpp b/displayengine/libs/core/core_impl.cpp
new file mode 100644
index 0000000..f8b07b3
--- /dev/null
+++ b/displayengine/libs/core/core_impl.cpp
@@ -0,0 +1,92 @@
+/*
+* 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 "CoreImpl"
+#include <utils/logger.h>
+
+#include <utils/locker.h>
+#include <utils/constants.h>
+
+#include "core_impl.h"
+#include "device_primary.h"
+
+namespace sde {
+
+CoreImpl::CoreImpl(CoreEventHandler *event_handler)
+  : event_handler_(event_handler), hw_intf_(NULL) {
+}
+
+DisplayError CoreImpl::Init() {
+  SCOPE_LOCK(locker_);
+
+  DisplayError error = kErrorNone;
+
+  error = HWInterface::Create(&hw_intf_);
+  if (UNLIKELY(error != kErrorNone)) {
+    return error;
+  }
+
+  error = comp_mgr_.Init();
+  if (UNLIKELY(error != kErrorNone)) {
+    HWInterface::Destroy(hw_intf_);
+    return error;
+  }
+
+  return kErrorNone;
+}
+
+DisplayError CoreImpl::Deinit() {
+  SCOPE_LOCK(locker_);
+
+  comp_mgr_.Deinit();
+  HWInterface::Destroy(hw_intf_);
+
+  return kErrorNone;
+}
+
+DisplayError CoreImpl::CreateDevice(DeviceType type, DeviceEventHandler *event_handler,
+                                    DeviceInterface **intf) {
+  SCOPE_LOCK(locker_);
+
+  if (UNLIKELY(!event_handler || !intf)) {
+    return kErrorParameters;
+  }
+
+  return kErrorNone;
+}
+
+DisplayError CoreImpl::DestroyDevice(DeviceInterface *intf) {
+  SCOPE_LOCK(locker_);
+
+  if (UNLIKELY(!intf)) {
+    return kErrorParameters;
+  }
+
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/core_impl.h b/displayengine/libs/core/core_impl.h
new file mode 100644
index 0000000..d4b2859
--- /dev/null
+++ b/displayengine/libs/core/core_impl.h
@@ -0,0 +1,68 @@
+/*
+* 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 __CORE_IMPL_H__
+#define __CORE_IMPL_H__
+
+#include <core/core_interface.h>
+#include <private/strategy_interface.h>
+#include <utils/locker.h>
+
+#include "hw_interface.h"
+#include "comp_manager.h"
+
+#define SET_REVISION(major, minor) ((major << 8) | minor)
+
+namespace sde {
+
+class CoreImpl : public CoreInterface {
+ public:
+  // This class implements display core interface revision 1.0.
+  static const uint16_t kRevision = SET_REVISION(1, 0);
+
+  explicit CoreImpl(CoreEventHandler *event_handler);
+  virtual ~CoreImpl() { }
+
+  // This method returns the interface revision for the current display core object.
+  // Future revisions will override this method and return the appropriate revision upon query.
+  virtual uint16_t GetRevision() { return kRevision; }
+  virtual DisplayError Init();
+  virtual DisplayError Deinit();
+
+  // Methods from core interface
+  virtual DisplayError CreateDevice(DeviceType type, DeviceEventHandler *event_handler,
+                                    DeviceInterface **intf);
+  virtual DisplayError DestroyDevice(DeviceInterface *intf);
+
+ protected:
+  Locker locker_;
+  CoreEventHandler *event_handler_;
+  HWInterface *hw_intf_;
+  CompManager comp_mgr_;
+};
+
+}  // namespace sde
+
+#endif  // __CORE_IMPL_H__
+
diff --git a/displayengine/libs/core/core_interface.cpp b/displayengine/libs/core/core_interface.cpp
new file mode 100644
index 0000000..7bb83ab
--- /dev/null
+++ b/displayengine/libs/core/core_interface.cpp
@@ -0,0 +1,118 @@
+/*
+* 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 "CoreInterface"
+#include <utils/logger.h>
+
+#include <utils/locker.h>
+#include <utils/constants.h>
+
+#include "core_impl.h"
+
+#define GET_REVISION(version) (version >> 16)
+#define GET_DATA_ALIGNMENT(version) ((version >> 8) & 0xFF)
+#define GET_INSTRUCTION_SET(version) (version & 0xFF)
+
+namespace sde {
+
+// Currently, we support only one client and one session for display core. So, create a global
+// singleton core object.
+struct CoreSingleton {
+  CoreSingleton() : core_impl(NULL) { }
+
+  CoreImpl *core_impl;
+  Locker locker;
+} g_core;
+
+DisplayError CoreInterface::CreateCore(CoreEventHandler *event_handler, CoreInterface **interface,
+                                 uint32_t version) {
+  SCOPE_LOCK(g_core.locker);
+
+  if (UNLIKELY(!event_handler || !interface)) {
+    return kErrorParameters;
+  }
+
+  // Check compatibility of client and core.
+  uint32_t lib_version = CORE_VERSION_TAG;
+  if (UNLIKELY(!interface)) {
+    return kErrorParameters;
+  } else if (UNLIKELY(GET_REVISION(version) > GET_REVISION(lib_version))) {
+    return kErrorVersion;
+  } else if (UNLIKELY(GET_DATA_ALIGNMENT(version) != GET_DATA_ALIGNMENT(lib_version))) {
+    return kErrorDataAlignment;
+  } else if (UNLIKELY(GET_INSTRUCTION_SET(version) != GET_INSTRUCTION_SET(lib_version))) {
+    return kErrorInstructionSet;
+  }
+
+  CoreImpl *&core_impl = g_core.core_impl;
+  if (UNLIKELY(core_impl)) {
+    DLOGE("Only one display core session is supported at present.");
+    return kErrorUndefined;
+  }
+
+  // Create appropriate CoreImpl object based on client version.
+  if (GET_REVISION(version) == CoreImpl::kRevision) {
+    core_impl = new CoreImpl(event_handler);
+  } else {
+    return kErrorNotSupported;
+  }
+
+  if (UNLIKELY(!core_impl)) {
+    return kErrorMemory;
+  }
+
+  DisplayError displayError = core_impl->Init();
+  if (UNLIKELY(displayError != kErrorNone)) {
+    delete core_impl;
+    core_impl = NULL;
+    return displayError;
+  }
+
+  *interface = core_impl;
+  DLOGI("Open interface handle = %p", *interface);
+
+  return kErrorNone;
+}
+
+DisplayError CoreInterface::DestroyCore() {
+  SCOPE_LOCK(g_core.locker);
+
+  DLOGI("Close handle");
+
+  CoreImpl *&core_impl = g_core.core_impl;
+  if (UNLIKELY(!core_impl)) {
+    return kErrorUndefined;
+  }
+
+  core_impl->Deinit();
+  delete core_impl;
+  core_impl = NULL;
+
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/debug_interface.cpp b/displayengine/libs/core/debug_interface.cpp
new file mode 100644
index 0000000..5518ec2
--- /dev/null
+++ b/displayengine/libs/core/debug_interface.cpp
@@ -0,0 +1,44 @@
+/*
+* 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
new file mode 100644
index 0000000..40d6649
--- /dev/null
+++ b/displayengine/libs/core/device_base.cpp
@@ -0,0 +1,136 @@
+/*
+* 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 "DeviceBase"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "device_base.h"
+
+namespace sde {
+
+DeviceBase::DeviceBase(HWInterfaceType type, DeviceEventHandler *event_handler,
+                       HWInterface *hw_interface, CompManager *comp_manager)
+  : type_(type), event_handler_(event_handler), hw_intf_(hw_interface), comp_manager_(comp_manager),
+    state_(kStateOff) {
+}
+
+DisplayError DeviceBase::Init() {
+  SCOPE_LOCK(locker_);
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::Deinit() {
+  SCOPE_LOCK(locker_);
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::Prepare(LayerStack *layer_stack) {
+  SCOPE_LOCK(locker_);
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::Commit(LayerStack *layer_stack) {
+  SCOPE_LOCK(locker_);
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::GetDeviceState(DeviceState *state) {
+  SCOPE_LOCK(locker_);
+
+  if (UNLIKELY(!state)) {
+    return kErrorParameters;
+  }
+
+  *state = state_;
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::GetNumVariableInfoConfigs(uint32_t *count) {
+  SCOPE_LOCK(locker_);
+
+  if (UNLIKELY(!count)) {
+    return kErrorParameters;
+  }
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::GetConfig(DeviceConfigFixedInfo *fixed_info) {
+  SCOPE_LOCK(locker_);
+
+  if (UNLIKELY(!fixed_info)) {
+    return kErrorParameters;
+  }
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::GetConfig(DeviceConfigVariableInfo *variable_info, uint32_t mode) {
+  SCOPE_LOCK(locker_);
+
+  if (UNLIKELY(!variable_info)) {
+    return kErrorParameters;
+  }
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::GetVSyncState(bool *enabled) {
+  SCOPE_LOCK(locker_);
+
+  if (UNLIKELY(!enabled)) {
+    return kErrorParameters;
+  }
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::SetDeviceState(DeviceState state) {
+  SCOPE_LOCK(locker_);
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::SetConfig(uint32_t mode) {
+  SCOPE_LOCK(locker_);
+
+  return kErrorNone;
+}
+
+DisplayError DeviceBase::SetVSyncState(bool enabled) {
+  SCOPE_LOCK(locker_);
+
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/device_base.h b/displayengine/libs/core/device_base.h
new file mode 100644
index 0000000..ce71ab9
--- /dev/null
+++ b/displayengine/libs/core/device_base.h
@@ -0,0 +1,67 @@
+/*
+* 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 __DEVICE_BASE_H__
+#define __DEVICE_BASE_H__
+
+#include <core/device_interface.h>
+#include <private/strategy_interface.h>
+#include <utils/locker.h>
+
+#include "hw_interface.h"
+#include "comp_manager.h"
+
+namespace sde {
+
+class DeviceBase : public DeviceInterface {
+ public:
+  DeviceBase(HWInterfaceType type, DeviceEventHandler *event_handler, HWInterface *hw_interface,
+             CompManager *comp_manager);
+  virtual ~DeviceBase() { }
+  virtual DisplayError Init();
+  virtual DisplayError Deinit();
+  virtual DisplayError Prepare(LayerStack *layer_stack);
+  virtual DisplayError Commit(LayerStack *layer_stack);
+  virtual DisplayError GetDeviceState(DeviceState *state);
+  virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count);
+  virtual DisplayError GetConfig(DeviceConfigFixedInfo *fixed_info);
+  virtual DisplayError GetConfig(DeviceConfigVariableInfo *variable_info, uint32_t mode);
+  virtual DisplayError GetVSyncState(bool *enabled);
+  virtual DisplayError SetDeviceState(DeviceState state);
+  virtual DisplayError SetConfig(uint32_t mode);
+  virtual DisplayError SetVSyncState(bool enabled);
+
+ protected:
+  Locker locker_;
+  HWInterfaceType type_;
+  DeviceEventHandler *event_handler_;
+  HWInterface *hw_intf_;
+  CompManager *comp_manager_;
+  DeviceState state_;
+};
+
+}  // namespace sde
+
+#endif  // __DEVICE_BASE_H__
+
diff --git a/displayengine/libs/core/device_hdmi.cpp b/displayengine/libs/core/device_hdmi.cpp
new file mode 100644
index 0000000..87fe8db
--- /dev/null
+++ b/displayengine/libs/core/device_hdmi.cpp
@@ -0,0 +1,42 @@
+/*
+* 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 "DeviceHDMI"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "device_hdmi.h"
+
+namespace sde {
+
+DeviceHDMI::DeviceHDMI(DeviceEventHandler *event_handler, HWInterface *hw_intf,
+                       CompManager *comp_manager)
+  : DeviceBase(kHWHDMI, event_handler, hw_intf, comp_manager) {
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/device_hdmi.h b/displayengine/libs/core/device_hdmi.h
new file mode 100644
index 0000000..7d8cbc6
--- /dev/null
+++ b/displayengine/libs/core/device_hdmi.h
@@ -0,0 +1,40 @@
+/*
+* 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 __DEVICE_HDMI_H__
+#define __DEVICE_HDMI_H__
+
+#include "device_base.h"
+
+namespace sde {
+
+class DeviceHDMI : public DeviceBase {
+ public:
+  DeviceHDMI(DeviceEventHandler *event_handler, HWInterface *hw_intf, CompManager *comp_manager);
+};
+
+}  // namespace sde
+
+#endif  // __DEVICE_HDMI_H__
+
diff --git a/displayengine/libs/core/device_primary.cpp b/displayengine/libs/core/device_primary.cpp
new file mode 100644
index 0000000..9b99c3a
--- /dev/null
+++ b/displayengine/libs/core/device_primary.cpp
@@ -0,0 +1,42 @@
+/*
+* 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 "DevicePrimary"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "device_primary.h"
+
+namespace sde {
+
+DevicePrimary::DevicePrimary(DeviceEventHandler *event_handler, HWInterface *hw_intf,
+                             CompManager *comp_manager)
+  : DeviceBase(kHWPrimary, event_handler, hw_intf, comp_manager) {
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/device_primary.h b/displayengine/libs/core/device_primary.h
new file mode 100644
index 0000000..771a6f7
--- /dev/null
+++ b/displayengine/libs/core/device_primary.h
@@ -0,0 +1,40 @@
+/*
+* 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 __DEVICE_PRIMARY_H__
+#define __DEVICE_PRIMARY_H__
+
+#include "device_base.h"
+
+namespace sde {
+
+class DevicePrimary : public DeviceBase {
+ public:
+  DevicePrimary(DeviceEventHandler *event_handler, HWInterface *hw_intf, CompManager *comp_manager);
+};
+
+}  // namespace sde
+
+#endif  // __DEVICE_PRIMARY_H__
+
diff --git a/displayengine/libs/core/device_virtual.cpp b/displayengine/libs/core/device_virtual.cpp
new file mode 100644
index 0000000..5632c81
--- /dev/null
+++ b/displayengine/libs/core/device_virtual.cpp
@@ -0,0 +1,42 @@
+/*
+* 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 "DeviceVirtual"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "device_virtual.h"
+
+namespace sde {
+
+DeviceVirtual::DeviceVirtual(DeviceEventHandler *event_handler, HWInterface *hw_intf,
+                             CompManager *comp_manager)
+  : DeviceBase(kHWWriteback, event_handler, hw_intf, comp_manager) {
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/device_virtual.h b/displayengine/libs/core/device_virtual.h
new file mode 100644
index 0000000..e279f12
--- /dev/null
+++ b/displayengine/libs/core/device_virtual.h
@@ -0,0 +1,40 @@
+/*
+* 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 __DEVICE_VIRTUAL_H__
+#define __DEVICE_VIRTUAL_H__
+
+#include "device_base.h"
+
+namespace sde {
+
+class DeviceVirtual : public DeviceBase {
+ public:
+  DeviceVirtual(DeviceEventHandler *event_handler, HWInterface *hw_intf, CompManager *comp_manager);
+};
+
+}  // namespace sde
+
+#endif  // __DEVICE_VIRTUAL_H__
+
diff --git a/displayengine/libs/core/hw_framebuffer.cpp b/displayengine/libs/core/hw_framebuffer.cpp
new file mode 100644
index 0000000..7d62310
--- /dev/null
+++ b/displayengine/libs/core/hw_framebuffer.cpp
@@ -0,0 +1,148 @@
+/*
+* 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 "HWFrameBuffer"
+#include <utils/logger.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <linux/fb.h>
+#include <utils/constants.h>
+#include <utils/debug.h>
+
+#include "hw_framebuffer.h"
+
+#define IOCTL_LOGE(ioctl) DLOGE("ioctl %s, errno = %d, desc = %s", #ioctl, errno, strerror(errno))
+
+#ifdef DISPLAY_CORE_VIRTUAL_DRIVER
+extern int virtual_ioctl(int fd, int cmd, ...);
+extern int virtual_open(const char *file_name, int access, ...);
+extern int virtual_close(int fd);
+#endif
+
+namespace sde {
+
+HWFrameBuffer::HWFrameBuffer() {
+  // Point to actual driver interfaces.
+  ioctl_ = ::ioctl;
+  open_ = ::open;
+  close_ = ::close;
+
+#ifdef DISPLAY_CORE_VIRTUAL_DRIVER
+  // If debug property to use virtual driver is set, point to virtual driver interfaces.
+  if (Debug::IsVirtualDriver()) {
+    ioctl_ = virtual_ioctl;
+    open_ = virtual_open;
+    close_ = virtual_close;
+  }
+#endif
+}
+
+DisplayError HWFrameBuffer::Init() {
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::Deinit() {
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::GetCapabilities(HWResourceInfo *hw_res_info) {
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::Open(HWInterfaceType type, Handle *device) {
+  DisplayError error = kErrorNone;
+
+  HWContext *hw_context = new HWContext();
+  if (UNLIKELY(!hw_context)) {
+    return kErrorMemory;
+  }
+
+  *device = hw_context;
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::Close(Handle device) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  delete hw_context;
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::GetConfig(Handle device, DeviceConfigVariableInfo *variable_info) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::PowerOn(Handle device) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  if (UNLIKELY(ioctl_(hw_context->device_fd, FBIOBLANK, FB_BLANK_UNBLANK) == -1)) {
+    IOCTL_LOGE(FB_BLANK_UNBLANK);
+    return kErrorHardware;
+  }
+
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::PowerOff(Handle device) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::Doze(Handle device) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::Standby(Handle device) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::Prepare(Handle device, HWLayers *hw_layers) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  return kErrorNone;
+}
+
+DisplayError HWFrameBuffer::Commit(Handle device, HWLayers *hw_layers) {
+  HWContext *hw_context = reinterpret_cast<HWContext *>(device);
+
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/hw_framebuffer.h b/displayengine/libs/core/hw_framebuffer.h
new file mode 100644
index 0000000..59bd52b
--- /dev/null
+++ b/displayengine/libs/core/hw_framebuffer.h
@@ -0,0 +1,64 @@
+/*
+* 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 __HW_FRAMEBUFFER_H__
+#define __HW_FRAMEBUFFER_H__
+
+#include <linux/msm_mdp.h>
+#include "hw_interface.h"
+
+namespace sde {
+
+struct HWContext {
+  HWInterfaceType type;
+  int device_fd;
+};
+
+class HWFrameBuffer : public HWInterface {
+ public:
+  HWFrameBuffer();
+  DisplayError Init();
+  DisplayError Deinit();
+  virtual DisplayError GetCapabilities(HWResourceInfo *hw_res_info);
+  virtual DisplayError Open(HWInterfaceType type, Handle *device);
+  virtual DisplayError Close(Handle device);
+  virtual DisplayError GetConfig(Handle device, DeviceConfigVariableInfo *variable_info);
+  virtual DisplayError PowerOn(Handle device);
+  virtual DisplayError PowerOff(Handle device);
+  virtual DisplayError Doze(Handle device);
+  virtual DisplayError Standby(Handle device);
+  virtual DisplayError Prepare(Handle device, HWLayers *hw_layers);
+  virtual DisplayError Commit(Handle device, HWLayers *hw_layers);
+
+ private:
+  // For dynamically linking virtual driver
+  int (*ioctl_)(int, int, ...);
+  int (*open_)(const char *, int, ...);
+  int (*close_)(int);
+};
+
+}  // namespace sde
+
+#endif  // __HW_FRAMEBUFFER_H__
+
diff --git a/displayengine/libs/core/hw_interface.cpp b/displayengine/libs/core/hw_interface.cpp
new file mode 100644
index 0000000..6500c21
--- /dev/null
+++ b/displayengine/libs/core/hw_interface.cpp
@@ -0,0 +1,60 @@
+/*
+* 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 "HWInterface"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "hw_interface.h"
+#include "hw_framebuffer.h"
+
+namespace sde {
+
+DisplayError HWInterface::Create(HWInterface **intf) {
+  DisplayError error = kErrorNone;
+  HWFrameBuffer *hw_frame_buffer = NULL;
+
+  hw_frame_buffer = new HWFrameBuffer();
+  error = hw_frame_buffer->Init();
+  if (UNLIKELY(error != kErrorNone)) {
+    delete hw_frame_buffer;
+  } else {
+    *intf = hw_frame_buffer;
+  }
+
+  return error;
+}
+
+DisplayError HWInterface::Destroy(HWInterface *intf) {
+  HWFrameBuffer *hw_frame_buffer = static_cast<HWFrameBuffer *>(intf);
+  hw_frame_buffer->Deinit();
+  delete hw_frame_buffer;
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/hw_interface.h b/displayengine/libs/core/hw_interface.h
new file mode 100644
index 0000000..ce74660
--- /dev/null
+++ b/displayengine/libs/core/hw_interface.h
@@ -0,0 +1,68 @@
+/*
+* 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 __HW_INTERFACE_H__
+#define __HW_INTERFACE_H__
+
+#include <core/device_interface.h>
+#include <private/strategy_interface.h>
+#include <utils/constants.h>
+
+namespace sde {
+
+enum HWInterfaceType {
+  kHWPrimary,
+  kHWHDMI,
+  kHWWriteback,
+};
+
+struct HWResourceInfo {
+};
+
+struct HWLayers {
+};
+
+class HWInterface {
+ public:
+  static DisplayError Create(HWInterface **intf);
+  static DisplayError Destroy(HWInterface *intf);
+  virtual DisplayError GetCapabilities(HWResourceInfo *hw_res_info) = 0;
+  virtual DisplayError Open(HWInterfaceType type, Handle *device) = 0;
+  virtual DisplayError Close(Handle device) = 0;
+  virtual DisplayError GetConfig(Handle device, DeviceConfigVariableInfo *variable_info) = 0;
+  virtual DisplayError PowerOn(Handle device) = 0;
+  virtual DisplayError PowerOff(Handle device) = 0;
+  virtual DisplayError Doze(Handle device) = 0;
+  virtual DisplayError Standby(Handle device) = 0;
+  virtual DisplayError Prepare(Handle device, HWLayers *hw_layers) = 0;
+  virtual DisplayError Commit(Handle device, HWLayers *hw_layers) = 0;
+
+ protected:
+  virtual ~HWInterface() { }
+};
+
+}  // namespace sde
+
+#endif  // __HW_INTERFACE_H__
+
diff --git a/displayengine/libs/core/res_manager.cpp b/displayengine/libs/core/res_manager.cpp
new file mode 100644
index 0000000..1c487bf
--- /dev/null
+++ b/displayengine/libs/core/res_manager.cpp
@@ -0,0 +1,45 @@
+/*
+* 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 "ResManager"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "res_manager.h"
+
+namespace sde {
+
+DisplayError ResManager::Init() {
+  return kErrorNone;
+}
+
+DisplayError ResManager::Deinit() {
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/res_manager.h b/displayengine/libs/core/res_manager.h
new file mode 100644
index 0000000..9fa7657
--- /dev/null
+++ b/displayengine/libs/core/res_manager.h
@@ -0,0 +1,46 @@
+/*
+* 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 __RES_MANAGER_H__
+#define __RES_MANAGER_H__
+
+#include <core/device_interface.h>
+#include <utils/locker.h>
+
+#include "hw_interface.h"
+
+namespace sde {
+
+class ResManager {
+ public:
+  DisplayError Init();
+  DisplayError Deinit();
+
+ private:
+};
+
+}  // namespace sde
+
+#endif  // __RES_MANAGER_H__
+
diff --git a/displayengine/libs/core/strategy_default.cpp b/displayengine/libs/core/strategy_default.cpp
new file mode 100644
index 0000000..ba5ae99
--- /dev/null
+++ b/displayengine/libs/core/strategy_default.cpp
@@ -0,0 +1,43 @@
+/*
+* 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 "StrategyDefault"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "strategy_default.h"
+
+namespace sde {
+
+DisplayError StrategyDefault::GetNextStrategy(StrategyConstraints *constraints,
+                                              HWLayersInfo *hw_layers_info) {
+
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/strategy_default.h b/displayengine/libs/core/strategy_default.h
new file mode 100644
index 0000000..c72bab9
--- /dev/null
+++ b/displayengine/libs/core/strategy_default.h
@@ -0,0 +1,44 @@
+/*
+* 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 __STRATEGY_DEFAULT_H__
+#define __STRATEGY_DEFAULT_H__
+
+#include <core/device_interface.h>
+#include <private/strategy_interface.h>
+
+namespace sde {
+
+class StrategyDefault : public StrategyInterface {
+ public:
+  virtual DisplayError GetNextStrategy(StrategyConstraints *constraints,
+                                       HWLayersInfo *hw_layers_info);
+
+ private:
+};
+
+}  // namespace sde
+
+#endif  // __STRATEGY_DEFAULT_H__
+
diff --git a/displayengine/libs/core/writeback_session.cpp b/displayengine/libs/core/writeback_session.cpp
new file mode 100644
index 0000000..53eb4ec
--- /dev/null
+++ b/displayengine/libs/core/writeback_session.cpp
@@ -0,0 +1,45 @@
+/*
+* 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 "WritebackSession"
+#include <utils/logger.h>
+
+#include <utils/constants.h>
+
+#include "writeback_session.h"
+
+namespace sde {
+
+DisplayError WritebackSession::Init() {
+  return kErrorNone;
+}
+
+DisplayError WritebackSession::Deinit() {
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/core/writeback_session.h b/displayengine/libs/core/writeback_session.h
new file mode 100644
index 0000000..daf18c3
--- /dev/null
+++ b/displayengine/libs/core/writeback_session.h
@@ -0,0 +1,45 @@
+/*
+* 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 __WRITEBACK_SESSION_H__
+#define __WRITEBACK_SESSION_H__
+
+#include <utils/locker.h>
+
+#include "hw_interface.h"
+
+namespace sde {
+
+class WritebackSession {
+ public:
+  DisplayError Init();
+  DisplayError Deinit();
+
+ private:
+};
+
+}  // namespace sde
+
+#endif  // __WRITEBACK_SESSION_H__
+
diff --git a/displayengine/libs/hwc/Android.mk b/displayengine/libs/hwc/Android.mk
new file mode 100644
index 0000000..be7e18c
--- /dev/null
+++ b/displayengine/libs/hwc/Android.mk
@@ -0,0 +1,20 @@
+LOCAL_PATH := $(call my-dir)
+include hardware/qcom/display/displayengine/libs/common.mk
+include $(CLEAR_VARS)
+
+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_SHARED_LIBRARIES        := $(common_libs) libEGL libhardware_legacy \
+                                 libdl libsync \
+                                 libbinder libmedia libskia libsdecore
+LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
+LOCAL_SRC_FILES               := hwc_session.cpp \
+                                 hwc_sink.cpp \
+                                 hwc_sink_primary.cpp \
+                                 hwc_sink_external.cpp \
+                                 hwc_sink_virtual.cpp
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/displayengine/libs/hwc/hwc_logger.h b/displayengine/libs/hwc/hwc_logger.h
new file mode 100644
index 0000000..cee38e9
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_logger.h
@@ -0,0 +1,44 @@
+/*
+* 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 __HWC_LOGGER_H__
+#define __HWC_LOGGER_H__
+
+#include <cutils/log.h>
+
+#ifndef HWC_MODULE_NAME
+#define HWC_MODULE_NAME "HWComposer"
+#endif
+
+#define HWC_LOG(Macro, format, ...) Macro(HWC_MODULE_NAME ": " 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__)
+
+#endif  // __HWC_LOGGER_H__
+
diff --git a/displayengine/libs/hwc/hwc_session.cpp b/displayengine/libs/hwc/hwc_session.cpp
new file mode 100644
index 0000000..10e99b4
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_session.cpp
@@ -0,0 +1,133 @@
+/*
+* 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 <core/debug_interface.h>
+#include <utils/constants.h>
+
+// HWC_MODULE_NAME definition must precede hwc_logger.h include.
+#define HWC_MODULE_NAME "HWCSession"
+#include "hwc_logger.h"
+
+#include "hwc_session.h"
+
+static sde::HWCSession::HWCModuleMethods g_hwc_module_methods;
+
+hwc_module_t HAL_MODULE_INFO_SYM = {
+  common: {
+    tag: HARDWARE_MODULE_TAG,
+    version_major: 2,
+    version_minor: 0,
+    id: HWC_HARDWARE_MODULE_ID,
+    name: "QTI Hardware Composer Module",
+    author: "CodeAurora Forum",
+    methods: &g_hwc_module_methods,
+    dso: 0,
+    reserved: {0},
+  }
+};
+
+namespace sde {
+
+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;
+  hwc_composer_device_1_t::common.module = const_cast<hw_module_t*>(module);
+  hwc_composer_device_1_t::common.close = Close;
+  hwc_composer_device_1_t::prepare = Prepare;
+  hwc_composer_device_1_t::set = Set;
+  hwc_composer_device_1_t::eventControl = EventControl;
+  hwc_composer_device_1_t::blank = Blank;
+  hwc_composer_device_1_t::query = Query;
+  hwc_composer_device_1_t::registerProcs = RegisterProcs;
+  hwc_composer_device_1_t::dump = Dump;
+  hwc_composer_device_1_t::getDisplayConfigs = GetDisplayConfigs;
+  hwc_composer_device_1_t::getDisplayAttributes = GetDisplayAttributes;
+}
+
+int HWCSession::Init() {
+  return 0;
+}
+
+int HWCSession::Deinit() {
+  return 0;
+}
+
+int HWCSession::Open(const hw_module_t *module, const char *name, hw_device_t **device) {
+  return 0;
+}
+
+int HWCSession::Close(hw_device_t *device) {
+  return 0;
+}
+
+int HWCSession::Prepare(hwc_composer_device_1 *device, size_t num_displays,
+                        hwc_display_contents_1_t **displays) {
+  return 0;
+}
+
+int HWCSession::Set(hwc_composer_device_1 *device, size_t num_displays,
+                    hwc_display_contents_1_t **displays) {
+  return 0;
+}
+
+int HWCSession::EventControl(hwc_composer_device_1 *device, int disp, int event, int enable) {
+  return 0;
+}
+
+int HWCSession::Blank(hwc_composer_device_1 *device, int disp, int blank) {
+  return 0;
+}
+
+int HWCSession::Query(hwc_composer_device_1 *device, int param, int *value) {
+  return 0;
+}
+
+void HWCSession::RegisterProcs(hwc_composer_device_1 *device, hwc_procs_t const *procs) {
+  if (UNLIKELY(!device || !procs)) {
+    return;
+  }
+
+  HWCSession *hwc_session = static_cast<HWCSession *>(device);
+  hwc_session->hwc_procs_ = procs;
+}
+
+void HWCSession::Dump(hwc_composer_device_1 *device, char *buffer, int length) {
+}
+
+int HWCSession::GetDisplayConfigs(hwc_composer_device_1 *device, int disp, uint32_t *configs,
+                                  size_t *num_configs) {
+  return 0;
+}
+
+int HWCSession::GetDisplayAttributes(hwc_composer_device_1 *device, int disp, uint32_t config,
+                                     const uint32_t *attributes, int32_t *values) {
+  return 0;
+}
+
+DisplayError HWCSession::Hotplug(const CoreEventHotplug &hotplug) {
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/hwc/hwc_session.h b/displayengine/libs/hwc/hwc_session.h
new file mode 100644
index 0000000..eb6d08f
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_session.h
@@ -0,0 +1,76 @@
+/*
+* 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 __HWC_SESSION_H__
+#define __HWC_SESSION_H__
+
+#include <hardware/hwcomposer.h>
+#include <core/core_interface.h>
+
+#include "hwc_sink_primary.h"
+
+namespace sde {
+
+class HWCSession : public hwc_composer_device_1_t, public CoreEventHandler {
+ public:
+  struct HWCModuleMethods : public hw_module_methods_t {
+    HWCModuleMethods() {
+      hw_module_methods_t::open = HWCSession::Open;
+    }
+  };
+
+  explicit HWCSession(const hw_module_t *module);
+  int Init();
+  int Deinit();
+
+ private:
+  // hwc methods
+  static int Open(const hw_module_t *module, const char* name, hw_device_t **device);
+  static int Close(hw_device_t *device);
+  static int Prepare(hwc_composer_device_1 *device, size_t num_displays,
+                     hwc_display_contents_1_t **displays);
+  static int Set(hwc_composer_device_1 *device, size_t num_displays,
+                 hwc_display_contents_1_t **displays);
+  static int EventControl(hwc_composer_device_1 *device, int disp, int event, int enable);
+  static int Blank(hwc_composer_device_1 *device, int disp, int blank);
+  static int Query(hwc_composer_device_1 *device, int param, int *value);
+  static void RegisterProcs(hwc_composer_device_1 *device, hwc_procs_t const *procs);
+  static void Dump(hwc_composer_device_1 *device, char *buffer, int length);
+  static int GetDisplayConfigs(hwc_composer_device_1 *device, int disp, uint32_t *configs,
+                               size_t *numConfigs);
+  static int GetDisplayAttributes(hwc_composer_device_1 *device, int disp, uint32_t config,
+                                  const uint32_t *attributes, int32_t *values);
+
+  // CoreEventHandler methods
+  virtual DisplayError Hotplug(const CoreEventHotplug &hotplug);
+
+  CoreInterface *core_intf_;
+  hwc_procs_t const *hwc_procs_;
+  HWCSinkPrimary *sink_primary_;
+};
+
+}  // namespace sde
+
+#endif  // __HWC_SESSION_H__
+
diff --git a/displayengine/libs/hwc/hwc_sink.cpp b/displayengine/libs/hwc/hwc_sink.cpp
new file mode 100644
index 0000000..6aee841
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink.cpp
@@ -0,0 +1,71 @@
+/*
+* 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 <errno.h>
+#include <gralloc_priv.h>
+#include <utils/constants.h>
+
+// HWC_MODULE_NAME definition must precede hwc_logger.h include.
+#define HWC_MODULE_NAME "HWCSink"
+#include "hwc_logger.h"
+
+#include "hwc_sink.h"
+
+namespace sde {
+
+HWCSink::HWCSink(CoreInterface *core_intf, hwc_procs_t const *hwc_procs, DeviceType type, int id)
+  : core_intf_(core_intf), hwc_procs_(hwc_procs), type_(type), id_(id),
+    device_intf_(NULL) {
+}
+
+int HWCSink::Init() {
+  return 0;
+}
+
+int HWCSink::Deinit() {
+  return 0;
+}
+
+int HWCSink::Blank(int blank) {
+  return 0;
+}
+
+int HWCSink::GetDisplayConfigs(uint32_t *configs, size_t *num_configs) {
+  return 0;
+}
+
+int HWCSink::GetDisplayAttributes(uint32_t config, const uint32_t *attributes, int32_t *values) {
+  return 0;
+}
+
+DisplayError HWCSink::VSync(const DeviceEventVSync &vsync) {
+  return kErrorNone;
+}
+
+DisplayError HWCSink::Refresh() {
+  return kErrorNone;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/hwc/hwc_sink.h b/displayengine/libs/hwc/hwc_sink.h
new file mode 100644
index 0000000..97e07c5
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink.h
@@ -0,0 +1,61 @@
+/*
+* 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 __HWC_SINK_H__
+#define __HWC_SINK_H__
+
+#include <hardware/hwcomposer.h>
+#include <core/core_interface.h>
+
+namespace sde {
+
+class HWCSink : public DeviceEventHandler {
+ public:
+  virtual int Init();
+  virtual int Deinit();
+  virtual int Prepare(hwc_display_contents_1_t *content_list) = 0;
+  virtual int Commit(hwc_display_contents_1_t *content_list) = 0;
+  virtual int Blank(int blank);
+  virtual int GetDisplayConfigs(uint32_t *configs, size_t *num_configs);
+  virtual int GetDisplayAttributes(uint32_t config, const uint32_t *attributes, int32_t *values);
+
+ protected:
+  HWCSink(CoreInterface *core_intf, hwc_procs_t const *hwc_procs, DeviceType type, int id);
+  virtual ~HWCSink() { }
+
+  // DeviceEventHandler methods
+  virtual DisplayError VSync(const DeviceEventVSync &vsync);
+  virtual DisplayError Refresh();
+
+  CoreInterface *core_intf_;
+  hwc_procs_t const *hwc_procs_;
+  DeviceType type_;
+  int id_;
+  DeviceInterface *device_intf_;
+};
+
+}  // namespace sde
+
+#endif  // __HWC_SINK_H__
+
diff --git a/displayengine/libs/hwc/hwc_sink_external.cpp b/displayengine/libs/hwc/hwc_sink_external.cpp
new file mode 100644
index 0000000..977b26e
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink_external.cpp
@@ -0,0 +1,64 @@
+/*
+* 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 <utils/constants.h>
+
+// HWC_MODULE_NAME definition must precede hwc_logger.h include.
+#define HWC_MODULE_NAME "HWCSinkExternal"
+#include "hwc_logger.h"
+
+#include "hwc_sink_external.h"
+
+namespace sde {
+
+HWCSinkExternal::HWCSinkExternal(CoreInterface *core_intf, hwc_procs_t const *hwc_procs)
+  : HWCSink(core_intf, hwc_procs, kHDMI, HWC_DISPLAY_EXTERNAL) {
+}
+
+int HWCSinkExternal::Init() {
+  return 0;
+}
+
+int HWCSinkExternal::Deinit() {
+  return 0;
+}
+
+int HWCSinkExternal::Prepare(hwc_display_contents_1_t *content_list) {
+  return 0;
+}
+
+int HWCSinkExternal::Commit(hwc_display_contents_1_t *content_list) {
+  return 0;
+}
+
+int HWCSinkExternal::PowerOn() {
+  return 0;
+}
+
+int HWCSinkExternal::PowerOff() {
+  return 0;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/hwc/hwc_sink_external.h b/displayengine/libs/hwc/hwc_sink_external.h
new file mode 100644
index 0000000..1c0abce
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink_external.h
@@ -0,0 +1,46 @@
+/*
+* 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 __HWC_SINK_EXTERNAL_H__
+#define __HWC_SINK_EXTERNAL_H__
+
+#include "hwc_sink.h"
+
+namespace sde {
+
+class HWCSinkExternal : public HWCSink {
+ public:
+  explicit HWCSinkExternal(CoreInterface *core_intf, hwc_procs_t const *hwc_procs);
+  virtual int Init();
+  virtual int Deinit();
+  virtual int Prepare(hwc_display_contents_1_t *content_list);
+  virtual int Commit(hwc_display_contents_1_t *content_list);
+  virtual int PowerOn();
+  virtual int PowerOff();
+};
+
+}  // namespace sde
+
+#endif  // __HWC_SINK_EXTERNAL_H__
+
diff --git a/displayengine/libs/hwc/hwc_sink_primary.cpp b/displayengine/libs/hwc/hwc_sink_primary.cpp
new file mode 100644
index 0000000..36d7b29
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink_primary.cpp
@@ -0,0 +1,64 @@
+/*
+* 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 <utils/constants.h>
+
+// HWC_MODULE_NAME definition must precede hwc_logger.h include.
+#define HWC_MODULE_NAME "HWCSinkPrimary"
+#include "hwc_logger.h"
+
+#include "hwc_sink_primary.h"
+
+namespace sde {
+
+HWCSinkPrimary::HWCSinkPrimary(CoreInterface *core_intf, hwc_procs_t const *hwc_procs)
+  : HWCSink(core_intf, hwc_procs, kPrimary, HWC_DISPLAY_PRIMARY) {
+}
+
+int HWCSinkPrimary::Init() {
+  return 0;
+}
+
+int HWCSinkPrimary::Deinit() {
+  return 0;
+}
+
+int HWCSinkPrimary::Prepare(hwc_display_contents_1_t *content_list) {
+  return 0;
+}
+
+int HWCSinkPrimary::Commit(hwc_display_contents_1_t *content_list) {
+  return 0;
+}
+
+int HWCSinkPrimary::PowerOn() {
+  return 0;
+}
+
+int HWCSinkPrimary::PowerOff() {
+  return 0;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/hwc/hwc_sink_primary.h b/displayengine/libs/hwc/hwc_sink_primary.h
new file mode 100644
index 0000000..a4eef22
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink_primary.h
@@ -0,0 +1,46 @@
+/*
+* 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 __HWC_SINK_PRIMARY_H__
+#define __HWC_SINK_PRIMARY_H__
+
+#include "hwc_sink.h"
+
+namespace sde {
+
+class HWCSinkPrimary : public HWCSink {
+ public:
+  explicit HWCSinkPrimary(CoreInterface *core_intf, hwc_procs_t const *hwc_procs);
+  virtual int Init();
+  virtual int Deinit();
+  virtual int Prepare(hwc_display_contents_1_t *content_list);
+  virtual int Commit(hwc_display_contents_1_t *content_list);
+  virtual int PowerOn();
+  virtual int PowerOff();
+};
+
+}  // namespace sde
+
+#endif  // __HWC_SINK_PRIMARY_H__
+
diff --git a/displayengine/libs/hwc/hwc_sink_virtual.cpp b/displayengine/libs/hwc/hwc_sink_virtual.cpp
new file mode 100644
index 0000000..f692552
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink_virtual.cpp
@@ -0,0 +1,64 @@
+/*
+* 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 <utils/constants.h>
+
+// HWC_MODULE_NAME definition must precede hwc_logger.h include.
+#define HWC_MODULE_NAME "HWCSinkVirtual"
+#include "hwc_logger.h"
+
+#include "hwc_sink_virtual.h"
+
+namespace sde {
+
+HWCSinkVirtual::HWCSinkVirtual(CoreInterface *core_intf, hwc_procs_t const *hwc_procs)
+  : HWCSink(core_intf, hwc_procs, kVirtual, HWC_DISPLAY_VIRTUAL) {
+}
+
+int HWCSinkVirtual::Init() {
+  return 0;
+}
+
+int HWCSinkVirtual::Deinit() {
+  return 0;
+}
+
+int HWCSinkVirtual::Prepare(hwc_display_contents_1_t *content_list) {
+  return 0;
+}
+
+int HWCSinkVirtual::Commit(hwc_display_contents_1_t *content_list) {
+  return 0;
+}
+
+int HWCSinkVirtual::PowerOn() {
+  return 0;
+}
+
+int HWCSinkVirtual::PowerOff() {
+  return 0;
+}
+
+}  // namespace sde
+
diff --git a/displayengine/libs/hwc/hwc_sink_virtual.h b/displayengine/libs/hwc/hwc_sink_virtual.h
new file mode 100644
index 0000000..41c1d0d
--- /dev/null
+++ b/displayengine/libs/hwc/hwc_sink_virtual.h
@@ -0,0 +1,46 @@
+/*
+* 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 __HWC_SINK_VIRTUAL_H__
+#define __HWC_SINK_VIRTUAL_H__
+
+#include "hwc_sink.h"
+
+namespace sde {
+
+class HWCSinkVirtual : public HWCSink {
+ public:
+  explicit HWCSinkVirtual(CoreInterface *core_intf, hwc_procs_t const *hwc_procs);
+  virtual int Init();
+  virtual int Deinit();
+  virtual int Prepare(hwc_display_contents_1_t *content_list);
+  virtual int Commit(hwc_display_contents_1_t *content_list);
+  virtual int PowerOn();
+  virtual int PowerOff();
+};
+
+}  // namespace sde
+
+#endif  // __HWC_SINK_VIRTUAL_H__
+
diff --git a/displayengine/libs/utils/Android.mk b/displayengine/libs/utils/Android.mk
new file mode 100644
index 0000000..d5ba512
--- /dev/null
+++ b/displayengine/libs/utils/Android.mk
@@ -0,0 +1,13 @@
+LOCAL_PATH := $(call my-dir)
+include hardware/qcom/display/displayengine/libs/common.mk
+include $(CLEAR_VARS)
+
+LOCAL_MODULE                  := libsdeutils
+LOCAL_MODULE_TAGS             := optional
+LOCAL_C_INCLUDES              := $(common_includes) $(kernel_includes)
+LOCAL_CFLAGS                  := $(common_flags) -DLOG_TAG=\"SDE\"
+LOCAL_SHARED_LIBRARIES        := $(common_libs)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
+LOCAL_SRC_FILES               := debug_android.cpp
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/displayengine/libs/utils/debug_android.cpp b/displayengine/libs/utils/debug_android.cpp
new file mode 100644
index 0000000..09b32fe
--- /dev/null
+++ b/displayengine/libs/utils/debug_android.cpp
@@ -0,0 +1,66 @@
+/*
+* 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 <stdlib.h>
+#include <utils/debug.h>
+#include <cutils/log.h>
+#include <cutils/properties.h>
+
+namespace sde {
+
+Debug Debug::debug_;
+
+Debug::Debug() : 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
+