diff --git a/display-commonsys-intf/.clang-format b/display-commonsys-intf/.clang-format
deleted file mode 100644
index 26ce4fe..0000000
--- a/display-commonsys-intf/.clang-format
+++ /dev/null
@@ -1,14 +0,0 @@
----
-Language:        Cpp
-BasedOnStyle:  Google
-Standard : C++11
-AllowShortIfStatementsOnASingleLine: false
-AllowShortLoopsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: Inline
-AllowShortBlocksOnASingleLine: false
-ColumnLimit:     100
-ConstructorInitializerAllOnOneLineOrOnePerLine: true
-ConstructorInitializerIndentWidth: 4
-DerivePointerAlignment: false
-PointerAlignment: Right
-#ReflowComments: false
diff --git a/display-commonsys-intf/.gitignore b/display-commonsys-intf/.gitignore
deleted file mode 100644
index ad71dd6..0000000
--- a/display-commonsys-intf/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-CMakeLists.txt
-.idea/
-.editorconfig
-.clang-complete
diff --git a/display-commonsys-intf/Android.bp b/display-commonsys-intf/Android.bp
deleted file mode 100644
index 408e904..0000000
--- a/display-commonsys-intf/Android.bp
+++ /dev/null
@@ -1,10 +0,0 @@
-cc_library_headers {
-    name: "display_intf_headers",
-    vendor_available: true,
-    export_include_dirs: [
-        "gralloc",
-        "include",
-        "libqdmetadata",
-        "services",
-    ],
-}
diff --git a/display-commonsys-intf/Makefile.am b/display-commonsys-intf/Makefile.am
deleted file mode 100644
index 8009b42..0000000
--- a/display-commonsys-intf/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = libqdmetadata
diff --git a/display-commonsys-intf/config/display-interfaces-product.mk b/display-commonsys-intf/config/display-interfaces-product.mk
deleted file mode 100644
index 8f2edc4..0000000
--- a/display-commonsys-intf/config/display-interfaces-product.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-PRODUCT_PACKAGES += vendor.qti.hardware.display.allocator@1.0.vendor \
-                    vendor.qti.hardware.display.allocator@3.0.vendor \
-                    vendor.qti.hardware.display.composer@1.0.vendor \
-                    vendor.qti.hardware.display.composer@2.0.vendor \
-                    vendor.display.config@1.0.vendor \
-                    vendor.display.config@1.1.vendor \
-                    vendor.display.config@1.2.vendor \
-                    vendor.display.config@1.3.vendor \
-                    vendor.display.config@1.4.vendor \
-                    vendor.display.config@1.5.vendor \
-                    vendor.display.config@1.6.vendor \
-                    vendor.display.config@1.7.vendor \
-                    vendor.display.config@1.8.vendor \
-                    vendor.display.config@1.9.vendor \
-                    vendor.display.config@1.10.vendor \
-                    vendor.display.config@1.11.vendor \
-                    vendor.display.config@2.0.vendor \
-                    vendor.qti.hardware.display.mapper@1.0.vendor \
-                    vendor.qti.hardware.display.mapper@1.1.vendor \
-                    vendor.qti.hardware.display.mapper@2.0.vendor \
-                    vendor.qti.hardware.display.mapper@3.0.vendor \
-                    vendor.qti.hardware.display.mapper@4.0.vendor \
-                    vendor.qti.hardware.display.mapperextensions@1.0.vendor \
-                    vendor.qti.hardware.display.mapperextensions@1.1.vendor
diff --git a/display-commonsys-intf/config/display-product-system.mk b/display-commonsys-intf/config/display-product-system.mk
deleted file mode 100644
index 6509648..0000000
--- a/display-commonsys-intf/config/display-product-system.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-PRODUCT_PACKAGES += libdisplayconfig \
-                    libqdMetaData \
-                    libqdMetaData.system \
-                    libgralloc.qti \
-                    libdrm \
-                    vendor.display.config@1.0 \
-                    vendor.display.config@1.1 \
-                    vendor.display.config@1.2 \
-                    vendor.display.config@1.3 \
-                    vendor.display.config@1.4 \
-                    vendor.display.config@1.5 \
-                    libsmomo.qti \
-                    liblayerext.qti \
-                    libsmomoconfig.qti \
-                    libcomposerextn.qti \
-                    libdisplayconfig.qti
-
-SOONG_CONFIG_NAMESPACES += qtidisplaycommonsys
-# Soong Keys
-SOONG_CONFIG_qtidisplaycommonsys := displayconfig_enabled
-# Soong Values
-SOONG_CONFIG_qtidisplaycommonsys_displayconfig_enabled := false
-
-ifeq ($(call is-vendor-board-platform,QCOM),true)
-    SOONG_CONFIG_qtidisplaycommonsys_displayconfig_enabled := true
-endif
diff --git a/display-commonsys-intf/configure.ac b/display-commonsys-intf/configure.ac
deleted file mode 100644
index 8950b21..0000000
--- a/display-commonsys-intf/configure.ac
+++ /dev/null
@@ -1,52 +0,0 @@
-#                                               -*- Autoconf -*-
-# configure.ac -- Autoconf script for display commonsys intf
-#
-
-# Process this file with autoconf to produce a configure script
-
-# Requires autoconf tool later than 2.61
-AC_PREREQ(2.61)
-# Initialize the display commonsys intf package version 1.0.0
-AC_INIT([disp-commonsys-intf],1.0.0)
-# Does not strictly follow GNU Coding standards
-AM_INIT_AUTOMAKE([foreign])
-# Disables auto rebuilding of configure, Makefile.ins
-AM_MAINTAINER_MODE
-# defines some macros variable to be included by source
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_MACRO_DIR([m4])
-AC_SUBST([AM_CPPFLAGS], [--std=c++11])
-
-AC_ARG_WITH([core_includes],
-    AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
-       [Specify the location of the core headers]),
-    [core_incdir=$withval],
-    with_core_includes=no)
-
-if test "x$with_core_includes" != "xno"; then
-   CFLAGS="${CFLAGS} -I${core_incdir}"
-fi
-
-AC_ARG_WITH(sanitized-headers,
-   AS_HELP_STRING([--with-sanitized-headers=DIR],
-       [Specify the location of the sanitized Linux headers]),
-   [CPPFLAGS="$CPPFLAGS -I$withval"])
-
-# Checks for programs.
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_CXX
-AC_PROG_LIBTOOL
-AC_PROG_AWK
-AC_PROG_CPP
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-
-AC_SUBST([CFLAGS])
-AC_SUBST([CC])
-AC_CONFIG_FILES([ \
-        Makefile \
-        libqdmetadata/Makefile
-        ])
-AC_OUTPUT
diff --git a/display-commonsys-intf/gralloc/Android.bp b/display-commonsys-intf/gralloc/Android.bp
deleted file mode 100644
index c7339c2..0000000
--- a/display-commonsys-intf/gralloc/Android.bp
+++ /dev/null
@@ -1,23 +0,0 @@
-cc_library_shared {
-    name: "libgralloc.qti",
-    vendor_available: true,
-    system_ext_specific: true,
-    cflags: [
-        "-Wno-sign-conversion",
-        "-DLOG_TAG=\"qtigralloc\"",
-    ],
-    shared_libs: [
-         "liblog",
-         "libcutils",
-         "libutils",
-         "libgralloctypes",
-         "libhidlbase",
-         "libhardware",
-         "android.hardware.graphics.mapper@4.0",
-    ],
-
-    srcs: ["QtiGralloc.cpp"],
-
-    header_libs: ["display_intf_headers"],
-}
-
diff --git a/display-commonsys-intf/gralloc/QtiGralloc.cpp b/display-commonsys-intf/gralloc/QtiGralloc.cpp
deleted file mode 100644
index 5172ad5..0000000
--- a/display-commonsys-intf/gralloc/QtiGralloc.cpp
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Copyright (c) 2020, 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 "QtiGralloc.h"
-
-#include <log/log.h>
-namespace qtigralloc {
-
-using android::hardware::graphics::mapper::V4_0::IMapper;
-
-static sp<IMapper> getInstance() {
-  static sp<IMapper> mapper = IMapper::getService();
-  return mapper;
-}
-
-Error decodeMetadataState(hidl_vec<uint8_t> &in, bool *out) {
-  if (!in.size() || !out) {
-    return Error::BAD_VALUE;
-  }
-  memcpy(out, in.data(), METADATA_SET_SIZE);
-  return Error::NONE;
-}
-
-Error encodeMetadataState(bool *in, hidl_vec<uint8_t> *out) {
-  if (!in || !out) {
-    return Error::BAD_VALUE;
-  }
-  out->resize(sizeof(bool) * METADATA_SET_SIZE);
-  memcpy(out->data(), in, sizeof(bool) * METADATA_SET_SIZE);
-  return Error::NONE;
-}
-
-Error decodeColorMetadata(hidl_vec<uint8_t> &in, ColorMetaData *out) {
-  if (!in.size() || !out) {
-    return Error::BAD_VALUE;
-  }
-  memcpy(out, in.data(), sizeof(ColorMetaData));
-  return Error::NONE;
-}
-
-Error encodeColorMetadata(ColorMetaData &in, hidl_vec<uint8_t> *out) {
-  if (!out) {
-    return Error::BAD_VALUE;
-  }
-  out->resize(sizeof(ColorMetaData));
-  memcpy(out->data(), &in, sizeof(ColorMetaData));
-  return Error::NONE;
-}
-
-// decode the raw graphics metadata from bytestream and store it in 'data' member of
-// GraphicsMetadata struct during mapper->set call, 'size' member is unused.
-Error decodeGraphicsMetadata(hidl_vec<uint8_t> &in, GraphicsMetadata *out) {
-  if (!in.size() || !out) {
-    return Error::BAD_VALUE;
-  }
-  memcpy(&(out->data), in.data(), GRAPHICS_METADATA_SIZE_IN_BYTES);
-  return Error::NONE;
-}
-
-// encode only 'data' member of GraphicsMetadata struct for retrieval of
-// graphics metadata during mapper->get call
-Error encodeGraphicsMetadata(GraphicsMetadata &in, hidl_vec<uint8_t> *out) {
-  if (!out) {
-    return Error::BAD_VALUE;
-  }
-  out->resize(GRAPHICS_METADATA_SIZE_IN_BYTES);
-  memcpy(out->data(), &(in.data), GRAPHICS_METADATA_SIZE_IN_BYTES);
-  return Error::NONE;
-}
-
-// decode the raw graphics metadata from bytestream before presenting it to caller
-Error decodeGraphicsMetadataRaw(hidl_vec<uint8_t> &in, void *out) {
-  if (!in.size() || !out) {
-    return Error::BAD_VALUE;
-  }
-  memcpy(out, in.data(), GRAPHICS_METADATA_SIZE_IN_BYTES);
-  return Error::NONE;
-}
-
-// encode the raw graphics metadata in bytestream before calling mapper->set
-Error encodeGraphicsMetadataRaw(void *in, hidl_vec<uint8_t> *out) {
-  if (!in || !out) {
-    return Error::BAD_VALUE;
-  }
-  out->resize(GRAPHICS_METADATA_SIZE_IN_BYTES);
-  memcpy(out->data(), in, GRAPHICS_METADATA_SIZE_IN_BYTES);
-  return Error::NONE;
-}
-
-Error decodeUBWCStats(hidl_vec<uint8_t> &in, UBWCStats *out) {
-  if (!in.size() || !out) {
-    return Error::BAD_VALUE;
-  }
-  memcpy(out, in.data(), UBWC_STATS_ARRAY_SIZE * sizeof(UBWCStats));
-  return Error::NONE;
-}
-
-Error encodeUBWCStats(UBWCStats *in, hidl_vec<uint8_t> *out) {
-  if (!in || !out) {
-    return Error::BAD_VALUE;
-  }
-  out->resize(UBWC_STATS_ARRAY_SIZE * sizeof(UBWCStats));
-  memcpy(out->data(), in, UBWC_STATS_ARRAY_SIZE * sizeof(UBWCStats));
-  return Error::NONE;
-}
-
-Error decodeCVPMetadata(hidl_vec<uint8_t> &in, CVPMetadata *out) {
-  if (!in.size() || !out) {
-    return Error::BAD_VALUE;
-  }
-  memcpy(out, in.data(), sizeof(CVPMetadata));
-  return Error::NONE;
-}
-
-Error encodeCVPMetadata(CVPMetadata &in, hidl_vec<uint8_t> *out) {
-  if (!out) {
-    return Error::BAD_VALUE;
-  }
-  out->resize(sizeof(CVPMetadata));
-  memcpy(out->data(), &in, sizeof(CVPMetadata));
-  return Error::NONE;
-}
-
-Error decodeVideoHistogramMetadata(hidl_vec<uint8_t> &in, VideoHistogramMetadata *out) {
-  if (!in.size() || !out) {
-    return Error::BAD_VALUE;
-  }
-  memcpy(out, in.data(), sizeof(VideoHistogramMetadata));
-  return Error::NONE;
-}
-
-Error encodeVideoHistogramMetadata(VideoHistogramMetadata &in, hidl_vec<uint8_t> *out) {
-  if (!out) {
-    return Error::BAD_VALUE;
-  }
-  out->resize(sizeof(VideoHistogramMetadata));
-  memcpy(out->data(), &in, sizeof(VideoHistogramMetadata));
-  return Error::NONE;
-}
-
-MetadataType getMetadataType(uint32_t in) {
-  switch (in) {
-    case QTI_VT_TIMESTAMP:
-      return MetadataType_VTTimestamp;
-    case QTI_VIDEO_PERF_MODE:
-      return MetadataType_VideoPerfMode;
-    case QTI_LINEAR_FORMAT:
-      return MetadataType_LinearFormat;
-    case QTI_SINGLE_BUFFER_MODE:
-      return MetadataType_SingleBufferMode;
-    case QTI_PP_PARAM_INTERLACED:
-      return MetadataType_PPParamInterlaced;
-    case QTI_MAP_SECURE_BUFFER:
-      return MetadataType_MapSecureBuffer;
-    case QTI_COLOR_METADATA:
-      return MetadataType_ColorMetadata;
-    case QTI_GRAPHICS_METADATA:
-      return MetadataType_GraphicsMetadata;
-    case QTI_UBWC_CR_STATS_INFO:
-      return MetadataType_UBWCCRStatsInfo;
-    case QTI_REFRESH_RATE:
-      return MetadataType_RefreshRate;
-    case QTI_CVP_METADATA:
-      return MetadataType_CVPMetadata;
-    case QTI_VIDEO_HISTOGRAM_STATS:
-      return MetadataType_VideoHistogramStats;
-    case QTI_FD:
-      return MetadataType_FD;
-    case QTI_PRIVATE_FLAGS:
-      return MetadataType_PrivateFlags;
-    case QTI_ALIGNED_WIDTH_IN_PIXELS:
-      return MetadataType_AlignedWidthInPixels;
-    case QTI_ALIGNED_HEIGHT_IN_PIXELS:
-      return MetadataType_AlignedHeightInPixels;
-    case QTI_STANDARD_METADATA_STATUS:
-      return MetadataType_StandardMetadataStatus;
-    case QTI_VENDOR_METADATA_STATUS:
-      return MetadataType_VendorMetadataStatus;
-    case QTI_BUFFER_TYPE:
-      return MetadataType_BufferType;
-    default:
-      return MetadataType_Invalid;
-  }
-}
-
-Error get(void *buffer, uint32_t type, void *param) {
-  hidl_vec<uint8_t> bytestream;
-  sp<IMapper> mapper = getInstance();
-
-  MetadataType metadata_type = getMetadataType(type);
-  if (metadata_type == MetadataType_Invalid) {
-    param = nullptr;
-    return Error::UNSUPPORTED;
-  }
-
-  auto err = Error::UNSUPPORTED;
-  mapper->get(buffer, metadata_type, [&](const auto &tmpError, const auto &tmpByteStream) {
-    err = tmpError;
-    bytestream = tmpByteStream;
-  });
-
-  if (err != Error::NONE) {
-    return err;
-  }
-
-  switch (type) {
-    case QTI_VT_TIMESTAMP:
-      err = static_cast<Error>(android::gralloc4::decodeUint64(qtigralloc::MetadataType_VTTimestamp,
-                                                               bytestream, (uint64_t *)param));
-      break;
-    case QTI_VIDEO_PERF_MODE:
-      err = static_cast<Error>(android::gralloc4::decodeUint32(
-          qtigralloc::MetadataType_VideoPerfMode, bytestream, (uint32_t *)param));
-      break;
-    case QTI_LINEAR_FORMAT:
-      err = static_cast<Error>(android::gralloc4::decodeUint32(
-          qtigralloc::MetadataType_LinearFormat, bytestream, (uint32_t *)param));
-      break;
-    case QTI_SINGLE_BUFFER_MODE:
-      err = static_cast<Error>(android::gralloc4::decodeUint32(
-          qtigralloc::MetadataType_SingleBufferMode, bytestream, (uint32_t *)param));
-      break;
-    case QTI_PP_PARAM_INTERLACED:
-      err = static_cast<Error>(android::gralloc4::decodeInt32(
-          qtigralloc::MetadataType_PPParamInterlaced, bytestream, (int32_t *)param));
-      break;
-    case QTI_MAP_SECURE_BUFFER:
-      err = static_cast<Error>(android::gralloc4::decodeInt32(
-          qtigralloc::MetadataType_MapSecureBuffer, bytestream, (int32_t *)param));
-      break;
-    case QTI_COLOR_METADATA:
-      err = decodeColorMetadata(bytestream, (ColorMetaData *)param);
-      break;
-    case QTI_GRAPHICS_METADATA:
-      err = decodeGraphicsMetadataRaw(bytestream, param);
-      break;
-    case QTI_UBWC_CR_STATS_INFO:
-      err = decodeUBWCStats(bytestream, (UBWCStats *)param);
-      break;
-    case QTI_REFRESH_RATE:
-      err = static_cast<Error>(android::gralloc4::decodeFloat(qtigralloc::MetadataType_RefreshRate,
-                                                              bytestream, (float *)param));
-      break;
-    case QTI_CVP_METADATA:
-      err = decodeCVPMetadata(bytestream, (CVPMetadata *)param);
-      break;
-    case QTI_VIDEO_HISTOGRAM_STATS:
-      err = decodeVideoHistogramMetadata(bytestream, (VideoHistogramMetadata *)param);
-      break;
-    case QTI_FD:
-      err = static_cast<Error>(android::gralloc4::decodeInt32(qtigralloc::MetadataType_FD,
-                                                              bytestream, (int32_t *)param));
-      break;
-    case QTI_PRIVATE_FLAGS:
-      err = static_cast<Error>(android::gralloc4::decodeInt32(qtigralloc::MetadataType_PrivateFlags,
-                                                              bytestream, (int32_t *)param));
-      break;
-    case QTI_ALIGNED_WIDTH_IN_PIXELS:
-      err = static_cast<Error>(android::gralloc4::decodeUint32(
-          qtigralloc::MetadataType_AlignedWidthInPixels, bytestream, (uint32_t *)param));
-      break;
-    case QTI_ALIGNED_HEIGHT_IN_PIXELS:
-      err = static_cast<Error>(android::gralloc4::decodeUint32(
-          qtigralloc::MetadataType_AlignedHeightInPixels, bytestream, (uint32_t *)param));
-      break;
-    case QTI_STANDARD_METADATA_STATUS:
-    case QTI_VENDOR_METADATA_STATUS:
-      err = decodeMetadataState(bytestream, (bool *)param);
-      break;
-    case QTI_BUFFER_TYPE:
-      err = static_cast<Error>(android::gralloc4::decodeUint32(
-          qtigralloc::MetadataType_BufferType, bytestream, (uint32_t *)param));
-      break;
-    default:
-      param = nullptr;
-      return Error::UNSUPPORTED;
-  }
-
-  return err;
-}
-
-Error set(void *buffer, uint32_t type, void *param) {
-  hidl_vec<uint8_t> bytestream;
-  sp<IMapper> mapper = getInstance();
-
-  Error err = Error::UNSUPPORTED;
-  MetadataType metadata_type = getMetadataType(type);
-  if (metadata_type == MetadataType_Invalid) {
-    return err;
-  }
-
-  switch (type) {
-    case QTI_VT_TIMESTAMP:
-      err = static_cast<Error>(android::gralloc4::encodeUint64(qtigralloc::MetadataType_VTTimestamp,
-                                                               *(uint64_t *)param, &bytestream));
-      break;
-    case QTI_VIDEO_PERF_MODE:
-      err = static_cast<Error>(android::gralloc4::encodeUint32(
-          qtigralloc::MetadataType_VideoPerfMode, *(uint32_t *)param, &bytestream));
-      break;
-    case QTI_LINEAR_FORMAT:
-      err = static_cast<Error>(android::gralloc4::encodeUint32(
-          qtigralloc::MetadataType_LinearFormat, *(uint32_t *)param, &bytestream));
-      break;
-    case QTI_SINGLE_BUFFER_MODE:
-      err = static_cast<Error>(android::gralloc4::encodeUint32(
-          qtigralloc::MetadataType_SingleBufferMode, *(uint32_t *)param, &bytestream));
-      break;
-    case QTI_PP_PARAM_INTERLACED:
-      err = static_cast<Error>(android::gralloc4::encodeInt32(
-          qtigralloc::MetadataType_PPParamInterlaced, *(int32_t *)param, &bytestream));
-      break;
-    case QTI_MAP_SECURE_BUFFER:
-      err = static_cast<Error>(android::gralloc4::encodeInt32(
-          qtigralloc::MetadataType_MapSecureBuffer, *(int32_t *)param, &bytestream));
-      break;
-    case QTI_COLOR_METADATA:
-      err = encodeColorMetadata(*(ColorMetaData *)param, &bytestream);
-      break;
-    case QTI_GRAPHICS_METADATA:
-      err = encodeGraphicsMetadataRaw(param, &bytestream);
-      break;
-    case QTI_UBWC_CR_STATS_INFO:
-      err = encodeUBWCStats((UBWCStats *)param, &bytestream);
-      break;
-    case QTI_REFRESH_RATE:
-      err = static_cast<Error>(android::gralloc4::encodeFloat(qtigralloc::MetadataType_RefreshRate,
-                                                              *(float *)param, &bytestream));
-      break;
-    case QTI_CVP_METADATA:
-      err = encodeCVPMetadata(*(CVPMetadata *)param, &bytestream);
-      break;
-    case QTI_VIDEO_HISTOGRAM_STATS:
-      err = encodeVideoHistogramMetadata(*(VideoHistogramMetadata *)param, &bytestream);
-      break;
-    default:
-      param = nullptr;
-      return Error::UNSUPPORTED;
-  }
-
-  if (err != Error::NONE) {
-    return err;
-  }
-
-  return mapper->set((void *)buffer, metadata_type, bytestream);
-}
-
-int getMetadataState(void *buffer, uint32_t type) {
-  bool metadata_set[METADATA_SET_SIZE];
-  Error err;
-  if (IS_VENDOR_METADATA_TYPE(type)) {
-    err = get(buffer, QTI_VENDOR_METADATA_STATUS, &metadata_set);
-  } else {
-    err = get(buffer, QTI_STANDARD_METADATA_STATUS, &metadata_set);
-  }
-
-  if (err != Error::NONE) {
-    ALOGE("Unable to get metadata state");
-    return -1;
-  }
-
-  if (IS_VENDOR_METADATA_TYPE(type)) {
-    return metadata_set[GET_VENDOR_METADATA_STATUS_INDEX(type)];
-  } else if (GET_STANDARD_METADATA_STATUS_INDEX(type) < METADATA_SET_SIZE) {
-    return metadata_set[GET_STANDARD_METADATA_STATUS_INDEX(type)];
-  } else {
-    return -1;
-  }
-}
-
-}  // namespace qtigralloc
diff --git a/display-commonsys-intf/gralloc/QtiGralloc.h b/display-commonsys-intf/gralloc/QtiGralloc.h
deleted file mode 100644
index 9ab8732..0000000
--- a/display-commonsys-intf/gralloc/QtiGralloc.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2020 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 __QTIGRALLOC_H__
-#define __QTIGRALLOC_H__
-
-#include <android/hardware/graphics/mapper/4.0/IMapper.h>
-#include <gralloctypes/Gralloc4.h>
-#include <hidl/HidlSupport.h>
-#include <stdint.h>
-
-#include <string>
-
-#include "QtiGrallocDefs.h"
-#include "QtiGrallocMetadata.h"
-
-namespace qtigralloc {
-using android::sp;
-using android::hardware::hidl_vec;
-using MetadataType = android::hardware::graphics::mapper::V4_0::IMapper::MetadataType;
-using android::hardware::graphics::mapper::V4_0::Error;
-// from gr_priv_handle.h
-enum {
-  PRIV_FLAGS_USES_ION = 0x00000008,
-  PRIV_FLAGS_NEEDS_FLUSH = 0x00000020,
-  PRIV_FLAGS_NON_CPU_WRITER = 0x00000080,
-  PRIV_FLAGS_CACHED = 0x00000200,
-  PRIV_FLAGS_SECURE_BUFFER = 0x00000400,
-  PRIV_FLAGS_VIDEO_ENCODER = 0x00010000,
-  PRIV_FLAGS_CAMERA_WRITE = 0x00020000,
-  PRIV_FLAGS_CAMERA_READ = 0x00040000,
-  PRIV_FLAGS_HW_TEXTURE = 0x00100000,
-  PRIV_FLAGS_SECURE_DISPLAY = 0x01000000,
-  PRIV_FLAGS_UBWC_ALIGNED = 0x08000000,
-  PRIV_FLAGS_UBWC_ALIGNED_PI = 0x40000000,  // PI format
-};
-
-// Metadata
-static const std::string VENDOR_QTI = "QTI";
-
-Error get(void *buffer, uint32_t type, void *param);
-Error set(void *buffer, uint32_t type, void *param);
-MetadataType getMetadataType(uint32_t in);
-int getMetadataState(void *buffer, uint32_t type);
-
-static const MetadataType MetadataType_VTTimestamp = {VENDOR_QTI, QTI_VT_TIMESTAMP};
-
-static const MetadataType MetadataType_ColorMetadata = {VENDOR_QTI, QTI_COLOR_METADATA};
-
-static const MetadataType MetadataType_PPParamInterlaced = {VENDOR_QTI, QTI_PP_PARAM_INTERLACED};
-
-static const MetadataType MetadataType_VideoPerfMode = {VENDOR_QTI, QTI_VIDEO_PERF_MODE};
-
-static const MetadataType MetadataType_GraphicsMetadata = {VENDOR_QTI, QTI_GRAPHICS_METADATA};
-
-static const MetadataType MetadataType_UBWCCRStatsInfo = {VENDOR_QTI, QTI_UBWC_CR_STATS_INFO};
-
-static const MetadataType MetadataType_RefreshRate = {VENDOR_QTI, QTI_REFRESH_RATE};
-static const MetadataType MetadataType_MapSecureBuffer = {VENDOR_QTI, QTI_MAP_SECURE_BUFFER};
-
-static const MetadataType MetadataType_LinearFormat = {VENDOR_QTI, QTI_LINEAR_FORMAT};
-
-static const MetadataType MetadataType_SingleBufferMode = {VENDOR_QTI, QTI_SINGLE_BUFFER_MODE};
-
-static const MetadataType MetadataType_CVPMetadata = {VENDOR_QTI, QTI_CVP_METADATA};
-
-static const MetadataType MetadataType_VideoHistogramStats = {VENDOR_QTI,
-                                                              QTI_VIDEO_HISTOGRAM_STATS};
-
-static const MetadataType MetadataType_FD = {VENDOR_QTI, QTI_FD};
-
-static const MetadataType MetadataType_PrivateFlags = {VENDOR_QTI, QTI_PRIVATE_FLAGS};
-
-static const MetadataType MetadataType_AlignedWidthInPixels = {VENDOR_QTI,
-                                                               QTI_ALIGNED_WIDTH_IN_PIXELS};
-
-static const MetadataType MetadataType_AlignedHeightInPixels = {VENDOR_QTI,
-                                                                QTI_ALIGNED_HEIGHT_IN_PIXELS};
-
-static const MetadataType MetadataType_StandardMetadataStatus = {VENDOR_QTI,
-                                                                 QTI_STANDARD_METADATA_STATUS};
-
-static const MetadataType MetadataType_VendorMetadataStatus = {VENDOR_QTI,
-                                                               QTI_VENDOR_METADATA_STATUS};
-
-static const MetadataType MetadataType_BufferType = {VENDOR_QTI,
-                                                     QTI_BUFFER_TYPE};
-
-// 0 is also used as invalid value in standard metadata
-static const MetadataType MetadataType_Invalid = {VENDOR_QTI, 0};
-
-static const aidl::android::hardware::graphics::common::ExtendableType Compression_QtiUBWC = {
-    VENDOR_QTI, COMPRESSION_QTI_UBWC};
-static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_Qti = {
-    VENDOR_QTI, INTERLACED_QTI};
-
-static const aidl::android::hardware::graphics::common::ExtendableType
-    PlaneLayoutComponentType_Raw = {VENDOR_QTI, PLANE_COMPONENT_TYPE_RAW};
-static const aidl::android::hardware::graphics::common::ExtendableType
-    PlaneLayoutComponentType_Meta = {VENDOR_QTI, PLANE_COMPONENT_TYPE_META};
-
-Error decodeMetadataState(hidl_vec<uint8_t> &in, bool *out);
-Error encodeMetadataState(bool *in, hidl_vec<uint8_t> *out);
-Error decodeColorMetadata(hidl_vec<uint8_t> &in, ColorMetaData *out);
-Error encodeColorMetadata(ColorMetaData &in, hidl_vec<uint8_t> *out);
-Error decodeGraphicsMetadata(hidl_vec<uint8_t> &in, GraphicsMetadata *out);
-Error encodeGraphicsMetadata(GraphicsMetadata &in, hidl_vec<uint8_t> *out);
-Error decodeGraphicsMetadataRaw(hidl_vec<uint8_t> &in, void *out);
-Error encodeGraphicsMetadataRaw(void *in, hidl_vec<uint8_t> *out);
-Error decodeUBWCStats(hidl_vec<uint8_t> &in, UBWCStats *out);
-Error encodeUBWCStats(UBWCStats *in, hidl_vec<uint8_t> *out);
-Error decodeCVPMetadata(hidl_vec<uint8_t> &in, CVPMetadata *out);
-Error encodeCVPMetadata(CVPMetadata &in, hidl_vec<uint8_t> *out);
-Error decodeVideoHistogramMetadata(hidl_vec<uint8_t> &in, VideoHistogramMetadata *out);
-Error encodeVideoHistogramMetadata(VideoHistogramMetadata &in, hidl_vec<uint8_t> *out);
-}  // namespace qtigralloc
-
-#endif  //__QTIGRALLOC_H__
diff --git a/display-commonsys-intf/gralloc/QtiGrallocDefs.h b/display-commonsys-intf/gralloc/QtiGrallocDefs.h
deleted file mode 100644
index 93272dd..0000000
--- a/display-commonsys-intf/gralloc/QtiGrallocDefs.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2020 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 __QTIGRALLOCDEFS_H__
-#define __QTIGRALLOCDEFS_H__
-
-// From gralloc_priv.h
-
-/* Gralloc usage bits indicating the type of allocation that should be used */
-/* Refer to BufferUsage in hardware/interfaces/graphics/common/<ver>/types.hal */
-
-/* The bits below are in officially defined vendor space
- * i.e bits 28-31 and 48-63*/
-/* Non linear, Universal Bandwidth Compression */
-#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC (UINT32_C(1) << 28)
-
-/* Set this for allocating uncached memory (using O_DSYNC),
- * cannot be used with noncontiguous heaps */
-#define GRALLOC_USAGE_PRIVATE_UNCACHED (UINT32_C(1) << 29)
-
-/* This flag is used to indicate 10 bit format.
- * When both GRALLOC_USAGE_PRIVATE_ALLOC_UBWC & GRALLOC_USAGE_PRIVATE_10BIT
- * are set then it will indicate UBWC_TP10 format.
- * When only GRALLOC_USAGE_PRIVATE_10BIT is set it will indicate linear P010 format.
- */
-#define GRALLOC_USAGE_PRIVATE_10BIT (UINT32_C(1) << 30)
-
-/* This flag is used for SECURE display usecase */
-#define GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY (UINT32_C(1) << 31)
-
-/* This flag is used to indicate video NV21 format */
-#define GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER 1ULL << 48
-
-/* unused legacy flags */
-#define GRALLOC_USAGE_PRIVATE_MM_HEAP 0
-#define GRALLOC_USAGE_PRIVATE_IOMMU_HEAP 0
-
-/* This flag is set for WFD usecase */
-#define GRALLOC_USAGE_PRIVATE_WFD 1ULL << 51
-
-/* This flag is set for HEIF usecase */
-#define GRALLOC_USAGE_PRIVATE_HEIF (UINT32_C(1) << 27)
-
-/* TODO(user): Remove when clients stop referencing this flag */
-#define GRALLOC_USAGE_PRIVATE_10BIT_TP 0
-
-/* This flag indicates PI format is being used */
-#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI 1ULL << 49
-
-/* This flag is set while CDSP accesses the buffer */
-#define GRALLOC_USAGE_PRIVATE_CDSP 1ULL << 50
-
-// OEM specific HAL formats
-#define HAL_PIXEL_FORMAT_RGBA_5551 6
-#define HAL_PIXEL_FORMAT_RGBA_4444 7
-#define HAL_PIXEL_FORMAT_NV12_ENCODEABLE 0x102
-#define HAL_PIXEL_FORMAT_NV21_ENCODEABLE 0x7FA30C00
-#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS 0x7FA30C04
-#define HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED 0x7FA30C03
-#define HAL_PIXEL_FORMAT_YCbCr_420_SP 0x109
-#define HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO 0x7FA30C01
-#define HAL_PIXEL_FORMAT_YCrCb_422_SP 0x10B
-#define HAL_PIXEL_FORMAT_R_8 0x10D
-#define HAL_PIXEL_FORMAT_RG_88 0x10E
-#define HAL_PIXEL_FORMAT_YCbCr_444_SP 0x10F
-#define HAL_PIXEL_FORMAT_YCrCb_444_SP 0x110
-#define HAL_PIXEL_FORMAT_YCrCb_422_I 0x111
-#define HAL_PIXEL_FORMAT_BGRX_8888 0x112
-#define HAL_PIXEL_FORMAT_NV21_ZSL 0x113
-#define HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS 0x114
-#define HAL_PIXEL_FORMAT_BGR_565 0x115
-#define HAL_PIXEL_FORMAT_RAW8 0x123
-#define HAL_PIXEL_FORMAT_NV12_HEIF 0x116
-
-// 10 bit
-#define HAL_PIXEL_FORMAT_ARGB_2101010 0x117
-#define HAL_PIXEL_FORMAT_RGBX_1010102 0x118
-#define HAL_PIXEL_FORMAT_XRGB_2101010 0x119
-#define HAL_PIXEL_FORMAT_BGRA_1010102 0x11A
-#define HAL_PIXEL_FORMAT_ABGR_2101010 0x11B
-#define HAL_PIXEL_FORMAT_BGRX_1010102 0x11C
-#define HAL_PIXEL_FORMAT_XBGR_2101010 0x11D
-#define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x36  // HAL_PIXEL_FORMAT_YCBCR_P010
-#define HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC 0x124
-#define HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS 0x7FA30C0A
-
-#define HAL_PIXEL_FORMAT_CbYCrY_422_I 0x120
-#define HAL_PIXEL_FORMAT_BGR_888 0x121
-
-#define HAL_PIXEL_FORMAT_INTERLACE 0x180
-
-// Camera utils format
-#define HAL_PIXEL_FORMAT_NV12_LINEAR_FLEX 0x125
-#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX 0x126
-#define HAL_PIXEL_FORMAT_MULTIPLANAR_FLEX 0x127
-#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_2_BATCH 0x128
-#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_4_BATCH 0x129
-#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_8_BATCH 0x130
-
-// v4l2_fourcc('Y', 'U', 'Y', 'L'). 24 bpp YUYV 4:2:2 10 bit per component
-#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT 0x4C595559
-
-// v4l2_fourcc('Y', 'B', 'W', 'C'). 10 bit per component. This compressed
-// format reduces the memory access bandwidth
-#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT_COMPRESSED 0x43574259
-
-// UBWC aligned Venus format
-#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC 0x7FA30C06
-#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x7FA30C09
-
-// Khronos ASTC formats
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-
-enum { BUFFER_TYPE_UI = 0, BUFFER_TYPE_VIDEO };
-
-#endif  //__QTIGRALLOCDEFS_H__
diff --git a/display-commonsys-intf/gralloc/QtiGrallocMetadata.h b/display-commonsys-intf/gralloc/QtiGrallocMetadata.h
deleted file mode 100644
index 35bf4a0..0000000
--- a/display-commonsys-intf/gralloc/QtiGrallocMetadata.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2020 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 __QTIGRALLOCMETADATA_H__
-#define __QTIGRALLOCMETADATA_H__
-
-#include <color_metadata.h>
-
-#define QTI_VT_TIMESTAMP 10000
-#define QTI_COLOR_METADATA 10001
-#define QTI_PP_PARAM_INTERLACED 10002
-#define QTI_VIDEO_PERF_MODE 10003
-#define QTI_GRAPHICS_METADATA 10004
-#define QTI_UBWC_CR_STATS_INFO 10005
-#define QTI_REFRESH_RATE 10006
-#define QTI_MAP_SECURE_BUFFER 10007
-#define QTI_LINEAR_FORMAT 10008
-#define QTI_SINGLE_BUFFER_MODE 10009
-#define QTI_CVP_METADATA 10010
-#define QTI_VIDEO_HISTOGRAM_STATS 10011
-// File descriptor for allocated buffer
-#define QTI_FD 10012
-// Flags from the private handle of the allocated buffer
-#define QTI_PRIVATE_FLAGS 10013
-// Width of the allocated buffer in pixels
-#define QTI_ALIGNED_WIDTH_IN_PIXELS 10014
-// Height of the allocated buffer in pixels
-#define QTI_ALIGNED_HEIGHT_IN_PIXELS 10015
-// Indicates whether metadata is using default value or has been set
-#define QTI_STANDARD_METADATA_STATUS 10016
-#define QTI_VENDOR_METADATA_STATUS 10017
-#define QTI_BUFFER_TYPE 10018
-
-// Used to indicate to framework that internal definitions are used instead
-#define COMPRESSION_QTI_UBWC 20001
-#define INTERLACED_QTI 20002
-
-#define PLANE_COMPONENT_TYPE_RAW 20003
-#define PLANE_COMPONENT_TYPE_META 20004
-
-#define MAX_NAME_LEN 256
-
-// GRAPHICS_METADATA
-#define GRAPHICS_METADATA_SIZE 4096
-#define GRAPHICS_METADATA_SIZE_IN_BYTES (GRAPHICS_METADATA_SIZE * sizeof(uint32_t))
-typedef struct GraphicsMetadata {
-  uint32_t size;  //unused in Gralloc4, in Gralloc3 it was never returned on Get()
-  uint32_t data[GRAPHICS_METADATA_SIZE]; //Clients must set only raw data with Gralloc4
-} GraphicsMetadata;
-
-// UBWC_CR_STATS_INFO
-#define MAX_UBWC_STATS_LENGTH 32
-enum UBWC_Version {
-  UBWC_UNUSED = 0,
-  UBWC_1_0 = 0x1,
-  UBWC_2_0 = 0x2,
-  UBWC_3_0 = 0x3,
-  UBWC_4_0 = 0x4,
-  UBWC_MAX_VERSION = 0xFF,
-};
-
-struct UBWC_2_0_Stats {
-  uint32_t nCRStatsTile32;  /**< UBWC Stats info for  32 Byte Tile */
-  uint32_t nCRStatsTile64;  /**< UBWC Stats info for  64 Byte Tile */
-  uint32_t nCRStatsTile96;  /**< UBWC Stats info for  96 Byte Tile */
-  uint32_t nCRStatsTile128; /**< UBWC Stats info for 128 Byte Tile */
-  uint32_t nCRStatsTile160; /**< UBWC Stats info for 160 Byte Tile */
-  uint32_t nCRStatsTile192; /**< UBWC Stats info for 192 Byte Tile */
-  uint32_t nCRStatsTile256; /**< UBWC Stats info for 256 Byte Tile */
-};
-
-struct UBWCStats {
-  enum UBWC_Version version; /* Union depends on this version. */
-  uint8_t bDataValid;        /* If [non-zero], CR Stats data is valid.
-                              * Consumers may use stats data.
-                              * If [zero], CR Stats data is invalid.
-                              * Consumers *Shall* not use stats data */
-  union {
-    struct UBWC_2_0_Stats ubwc_stats;
-    uint32_t reserved[MAX_UBWC_STATS_LENGTH]; /* This is for future */
-  };
-};
-
-#define UBWC_STATS_ARRAY_SIZE 2
-struct CropRectangle_t {
-  int32_t left;
-  int32_t top;
-  int32_t right;
-  int32_t bottom;
-};
-
-// CVP_METADATA
-#define CVP_METADATA_SIZE 1024
-enum CVPMetadataFlags {
-  /* bit wise flags */
-  CVP_METADATA_FLAG_NONE = 0x00000000,
-  CVP_METADATA_FLAG_REPEAT = 0x00000001,
-};
-
-typedef struct CVPMetadata {
-  uint32_t size; /* payload size in bytes */
-  uint8_t payload[CVP_METADATA_SIZE];
-  uint32_t capture_frame_rate;
-  /* Frame rate in Q16 format.
-          Eg: fps = 7.5, then
-          capture_frame_rate = 7 << 16 --> Upper 16 bits to represent 7
-          capture_frame_rate |= 5 -------> Lower 16 bits to represent 5
-
-     If size > 0, framerate is valid
-     If size = 0, invalid data, so ignore all parameters */
-  uint32_t cvp_frame_rate;
-  enum CVPMetadataFlags flags;
-  uint32_t reserved[8];
-} CVPMetadata;
-
-// VIDEO_HISTOGRAM_STATS
-
-#define VIDEO_HISTOGRAM_STATS_SIZE (4 * 1024)
-struct VideoHistogramMetadata {
-  uint32_t stats_info[1024]; /* video stats payload */
-  uint32_t stat_len;         /* Payload size in bytes */
-  uint32_t frame_type;       /* bit mask to indicate frame type */
-  uint32_t display_width;
-  uint32_t display_height;
-  uint32_t decode_width;
-  uint32_t decode_height;
-  uint32_t reserved[12];
-};
-
-#define RESERVED_REGION_SIZE 4096
-typedef struct ReservedRegion {
-  uint32_t size;
-  uint8_t data[RESERVED_REGION_SIZE];
-} ReservedRegion;
-
-#define METADATA_SET_SIZE 512
-
-#define IS_VENDOR_METADATA_TYPE(x) (x >= QTI_VT_TIMESTAMP)
-
-#define GET_STANDARD_METADATA_STATUS_INDEX(x) x
-#define GET_VENDOR_METADATA_STATUS_INDEX(x) x - QTI_VT_TIMESTAMP
-
-#endif  //__QTIGRALLOCMETADATA_H__
diff --git a/display-commonsys-intf/gralloc/QtiGrallocPriv.h b/display-commonsys-intf/gralloc/QtiGrallocPriv.h
deleted file mode 100644
index 3874ecd..0000000
--- a/display-commonsys-intf/gralloc/QtiGrallocPriv.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2020 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 __QTIGRALLOCPRIV_H__
-#define __QTIGRALLOCPRIV_H__
-
-#include <color_metadata.h>
-#include <cutils/native_handle.h>
-#include <log/log.h>
-
-#include <cinttypes>
-#include <string>
-
-#include "QtiGrallocMetadata.h"
-
-#ifndef __QTI_DISPLAY_GRALLOC__
-#pragma message "QtiGrallocPriv.h should not be included"
-#endif
-
-/*
- *
- * DISCLAIMER:
- * INTERNAL GRALLOC USE ONLY - THIS FILE SHOULD NOT BE INCLUDED BY GRALLOC CLIENTS
- * The location will be changed and this file will not be exposed
- * once qdMetaData copy functions are deprecated
- *
- */
-
-#define METADATA_V2
-
-// TODO: MetaData_t should be in qtigralloc namespace
-struct MetaData_t {
-  int32_t operation;
-  int32_t interlaced;
-  float refreshrate;
-  int32_t mapSecureBuffer;
-  /* Deprecated */
-  uint32_t s3dFormat;
-  /* VENUS output buffer is linear for UBWC Interlaced video */
-  uint32_t linearFormat;
-  /* Set by graphics to indicate that this buffer will be written to but not
-   * swapped out */
-  uint32_t isSingleBufferMode;
-
-  /* Set by camera to program the VT Timestamp */
-  uint64_t vtTimeStamp;
-  /* Color Aspects + HDR info */
-  ColorMetaData color;
-  /* Consumer should read this data as follows based on
-   * Gralloc flag "interlaced" listed above.
-   * [0] : If it is progressive.
-   * [0] : Top field, if it is interlaced.
-   * [1] : Do not read, if it is progressive.
-   * [1] : Bottom field, if it is interlaced.
-   */
-  struct UBWCStats ubwcCRStats[UBWC_STATS_ARRAY_SIZE];
-  /* Set by camera to indicate that this buffer will be used for a High
-   * Performance Video Usecase */
-  uint32_t isVideoPerfMode;
-  /* Populated and used by adreno during buffer size calculation.
-   * Set only for RGB formats. */
-  GraphicsMetadata graphics_metadata;
-  /* Video hisogram stats populated by video decoder */
-  struct VideoHistogramMetadata video_histogram_stats;
-  /*
-   * Producer (camera) will set cvp metadata and consumer (video) will
-   * use it. The format of metadata is known to producer and consumer.
-   */
-  CVPMetadata cvpMetadata;
-  CropRectangle_t crop;
-  int32_t blendMode;
-  char name[MAX_NAME_LEN];
-  ReservedRegion reservedRegion;
-  bool isStandardMetadataSet[METADATA_SET_SIZE];
-  bool isVendorMetadataSet[METADATA_SET_SIZE];
-  uint64_t reservedSize;
-};
-
-namespace qtigralloc {
-#define QTI_HANDLE_CONST(exp) static_cast<const private_handle_t *>(exp)
-
-#pragma pack(push, 4)
-struct private_handle_t : public native_handle_t {
-  // file-descriptors dup'd over IPC
-  int fd;
-  int fd_metadata;
-
-  // values sent over IPC
-  int magic;
-  int flags;
-  int width;             // holds width of the actual buffer allocated
-  int height;            // holds height of the  actual buffer allocated
-  int unaligned_width;   // holds width client asked to allocate
-  int unaligned_height;  // holds height client asked to allocate
-  int format;
-  int buffer_type;
-  unsigned int layer_count;
-  uint64_t id;
-  uint64_t usage;
-
-  unsigned int size;
-  unsigned int offset;
-  unsigned int offset_metadata;
-  uint64_t base;
-  uint64_t base_metadata;
-  uint64_t gpuaddr;
-  static const int kNumFds = 2;
-  static const int kMagic = 'gmsm';
-
-  static inline int NumInts() {
-    return ((sizeof(private_handle_t) - sizeof(native_handle_t)) / sizeof(int)) - kNumFds;
-  }
-
-  private_handle_t(int fd, int meta_fd, int flags, int width, int height, int uw, int uh,
-                   int format, int buf_type, unsigned int size, uint64_t usage = 0)
-      : fd(fd),
-        fd_metadata(meta_fd),
-        magic(kMagic),
-        flags(flags),
-        width(width),
-        height(height),
-        unaligned_width(uw),
-        unaligned_height(uh),
-        format(format),
-        buffer_type(buf_type),
-        layer_count(1),
-        id(0),
-        usage(usage),
-        size(size),
-        offset(0),
-        offset_metadata(0),
-        base(0),
-        base_metadata(0),
-        gpuaddr(0) {
-    version = static_cast<int>(sizeof(native_handle));
-    numInts = NumInts();
-    numFds = kNumFds;
-  }
-
-  ~private_handle_t() { magic = 0; }
-
-  static int validate(const native_handle *h) {
-    auto *hnd = static_cast<const private_handle_t *>(h);
-    if (!h || h->version != sizeof(native_handle) || h->numInts != NumInts() ||
-        h->numFds != kNumFds) {
-      ALOGE("Invalid gralloc handle (at %p): ver(%d/%zu) ints(%d/%d) fds(%d/%d)", h,
-            h ? h->version : -1, sizeof(native_handle), h ? h->numInts : -1, NumInts(),
-            h ? h->numFds : -1, kNumFds);
-      return -1;
-    }
-    if (hnd->magic != kMagic) {
-      ALOGE("handle = %p  invalid  magic(%c%c%c%c/%c%c%c%c)", hnd,
-            hnd ? (((hnd->magic >> 24) & 0xFF) ? ((hnd->magic >> 24) & 0xFF) : '-') : '?',
-            hnd ? (((hnd->magic >> 16) & 0xFF) ? ((hnd->magic >> 16) & 0xFF) : '-') : '?',
-            hnd ? (((hnd->magic >> 8) & 0xFF) ? ((hnd->magic >> 8) & 0xFF) : '-') : '?',
-            hnd ? (((hnd->magic >> 0) & 0xFF) ? ((hnd->magic >> 0) & 0xFF) : '-') : '?',
-            (kMagic >> 24) & 0xFF, (kMagic >> 16) & 0xFF, (kMagic >> 8) & 0xFF,
-            (kMagic >> 0) & 0xFF);
-      return -1;
-    }
-
-    return 0;
-  }
-
-  static void Dump(const private_handle_t *hnd) {
-    ALOGD("handle id:%" PRIu64
-          " wxh:%dx%d uwxuh:%dx%d size: %d fd:%d fd_meta:%d flags:0x%x "
-          "usage:0x%" PRIx64 "  format:0x%x layer_count: %d",
-          hnd->id, hnd->width, hnd->height, hnd->unaligned_width, hnd->unaligned_height, hnd->size,
-          hnd->fd, hnd->fd_metadata, hnd->flags, hnd->usage, hnd->format, hnd->layer_count);
-  }
-};
-#pragma pack(pop)
-
-}  // namespace qtigralloc
-
-#endif  //__QTIGRALLOCPRIV_H__
diff --git a/display-commonsys-intf/gralloc/gr_priv_handle.h b/display-commonsys-intf/gralloc/gr_priv_handle.h
deleted file mode 100644
index 98f9f69..0000000
--- a/display-commonsys-intf/gralloc/gr_priv_handle.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
- * Not a Contribution
- *
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __GR_PRIV_HANDLE_H__
-#define __GR_PRIV_HANDLE_H__
-
-#include <log/log.h>
-#include <hardware/gralloc.h>
-#include <hardware/gralloc1.h>
-#ifdef __cplusplus
-#include <cinttypes>
-#endif
-
-#define GRALLOC1_FUNCTION_PERFORM 0x00001000
-
-#define DBG_HANDLE false
-
-typedef gralloc1_error_t (*GRALLOC1_PFN_PERFORM)(gralloc1_device_t *device, int operation, ...);
-
-#define PRIV_HANDLE_CONST(exp) static_cast<const private_handle_t *>(exp)
-
-#pragma pack(push, 4)
-#ifdef __cplusplus
-struct private_handle_t : public native_handle_t {
-#else
-struct private_handle_t {
-        native_handle_t nativeHandle;
-#endif
-  enum {
-    PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
-    PRIV_FLAGS_USES_ION = 0x00000008,
-    PRIV_FLAGS_NEEDS_FLUSH = 0x00000020,
-    PRIV_FLAGS_INTERNAL_ONLY = 0x00000040,
-    PRIV_FLAGS_NON_CPU_WRITER = 0x00000080,
-    PRIV_FLAGS_CACHED = 0x00000200,
-    PRIV_FLAGS_SECURE_BUFFER = 0x00000400,
-    PRIV_FLAGS_EXTERNAL_ONLY = 0x00002000,
-    PRIV_FLAGS_PROTECTED_BUFFER = 0x00004000,
-    PRIV_FLAGS_VIDEO_ENCODER = 0x00010000,
-    PRIV_FLAGS_CAMERA_WRITE = 0x00020000,
-    PRIV_FLAGS_CAMERA_READ = 0x00040000,
-    PRIV_FLAGS_HW_COMPOSER = 0x00080000,
-    PRIV_FLAGS_HW_TEXTURE = 0x00100000,
-    PRIV_FLAGS_ITU_R_601 = 0x00200000,     // Unused from display
-    PRIV_FLAGS_ITU_R_601_FR = 0x00400000,  // Unused from display
-    PRIV_FLAGS_ITU_R_709 = 0x00800000,     // Unused from display
-    PRIV_FLAGS_SECURE_DISPLAY = 0x01000000,
-    PRIV_FLAGS_TILE_RENDERED = 0x02000000,
-    PRIV_FLAGS_CPU_RENDERED = 0x04000000,
-    PRIV_FLAGS_UBWC_ALIGNED = 0x08000000,
-    PRIV_FLAGS_DISP_CONSUMER = 0x10000000,
-    PRIV_FLAGS_CLIENT_ALLOCATED = 0x20000000,  // Ion buffer allocated outside of gralloc
-    PRIV_FLAGS_UBWC_ALIGNED_PI = 0x40000000,  // PI format
-  };
-
-  // file-descriptors dup'd over IPC
-  int fd;
-  int fd_metadata;
-
-  // values sent over IPC
-  int magic;
-  int flags;
-  int width;             // holds width of the actual buffer allocated
-  int height;            // holds height of the  actual buffer allocated
-  int unaligned_width;   // holds width client asked to allocate
-  int unaligned_height;  // holds height client asked to allocate
-  int format;
-  int buffer_type;
-  unsigned int layer_count;
-  uint64_t id;
-  uint64_t usage;
-
-  unsigned int size;
-  unsigned int offset;
-  unsigned int offset_metadata;
-  uint64_t base;
-  uint64_t base_metadata;
-  uint64_t gpuaddr;
-#ifdef __cplusplus
-  static const int kNumFds = 2;
-  static const int kMagic = 'gmsm';
-
-  static inline int NumInts() {
-    return ((sizeof(private_handle_t) - sizeof(native_handle_t)) / sizeof(int)) - kNumFds;
-  }
-
-  private_handle_t(int fd, int meta_fd, int flags, int width, int height, int uw, int uh,
-                   int format, int buf_type, unsigned int size, uint64_t usage = 0)
-      : fd(fd),
-        fd_metadata(meta_fd),
-        magic(kMagic),
-        flags(flags),
-        width(width),
-        height(height),
-        unaligned_width(uw),
-        unaligned_height(uh),
-        format(format),
-        buffer_type(buf_type),
-        layer_count(1),
-        id(0),
-        usage(usage),
-        size(size),
-        offset(0),
-        offset_metadata(0),
-        base(0),
-        base_metadata(0),
-        gpuaddr(0) {
-    version = static_cast<int>(sizeof(native_handle));
-    numInts = NumInts();
-    numFds = kNumFds;
-  }
-
-  // Legacy constructor used by some clients
-  private_handle_t(int fd, unsigned int size, int usage, int buf_type, int format, int w, int h)
-      : private_handle_t(fd, -1, PRIV_FLAGS_CLIENT_ALLOCATED, w, h, 0, 0, format, buf_type, size,
-                         static_cast<uint64_t>(usage)) {}
-
-  ~private_handle_t() {
-    magic = 0;
-    ALOGE_IF(DBG_HANDLE, "Deleting buffer handle %p", this);
-  }
-
-  static int validate(const native_handle *h) {
-    auto *hnd = static_cast<const private_handle_t *>(h);
-    if (!h || h->version != sizeof(native_handle) || h->numInts != NumInts() ||
-        h->numFds != kNumFds) {
-      ALOGE("Invalid gralloc handle (at %p): ver(%d/%zu) ints(%d/%d) fds(%d/%d)",
-          h, h ? h->version : -1, sizeof(native_handle), h ? h->numInts : -1, NumInts(),
-          h ? h->numFds : -1, kNumFds);
-      return -EINVAL;
-    }
-    if (hnd->magic != kMagic) {
-      ALOGE("handle = %p  invalid  magic(%c%c%c%c/%c%c%c%c)",hnd,
-          hnd ? (((hnd->magic >> 24) & 0xFF) ? ((hnd->magic >> 24) & 0xFF) : '-') : '?',
-          hnd ? (((hnd->magic >> 16) & 0xFF) ? ((hnd->magic >> 16) & 0xFF) : '-') : '?',
-          hnd ? (((hnd->magic >> 8) & 0xFF) ? ((hnd->magic >> 8) & 0xFF) : '-') : '?',
-          hnd ? (((hnd->magic >> 0) & 0xFF) ? ((hnd->magic >> 0) & 0xFF) : '-') : '?',
-          (kMagic >> 24) & 0xFF, (kMagic >> 16) & 0xFF, (kMagic >> 8) & 0xFF, (kMagic >> 0) & 0xFF);
-      return -EINVAL;
-    }
-
-    return 0;
-  }
-
-  static void Dump(const private_handle_t *hnd) {
-    ALOGD("handle id:%" PRIu64
-          " wxh:%dx%d uwxuh:%dx%d size: %d fd:%d fd_meta:%d flags:0x%x "
-          "usage:0x%" PRIx64 "  format:0x%x layer_count: %d",
-          hnd->id, hnd->width, hnd->height, hnd->unaligned_width, hnd->unaligned_height, hnd->size,
-          hnd->fd, hnd->fd_metadata, hnd->flags, hnd->usage, hnd->format, hnd->layer_count);
-  }
-
-  int GetUnalignedWidth() const { return unaligned_width; }
-
-  int GetUnalignedHeight() const { return unaligned_height; }
-
-  int GetColorFormat() const { return format; }
-
-  unsigned int GetLayerCount() const { return layer_count; }
-
-  int GetStride() const {
-    // In handle we currently store aligned width after allocation.
-    return width;
-  }
-
-  uint64_t GetUsage() const { return usage; }
-
-  uint64_t GetBackingstore() const { return id; }
-#endif
-};
-#pragma pack(pop)
-
-#endif  // __GR_PRIV_HANDLE_H__
diff --git a/display-commonsys-intf/gralloc/gralloc_priv.h b/display-commonsys-intf/gralloc/gralloc_priv.h
deleted file mode 100644
index 77c8787..0000000
--- a/display-commonsys-intf/gralloc/gralloc_priv.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
- * Not a Contribution
- *
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __GRALLOC_PRIV_H__
-#define __GRALLOC_PRIV_H__
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "QtiGrallocDefs.h"
-#include "gr_priv_handle.h"
-
-#pragma message "Warning: gralloc_priv.h is deprecated"
-
-#define GRALLOC_PROP_PREFIX  "vendor.gralloc."
-#define GRALLOC_PROP(prop_name) GRALLOC_PROP_PREFIX prop_name
-
-#define DISABLE_UBWC_PROP                    GRALLOC_PROP("disable_ubwc")
-#define DISABLE_AHARDWAREBUFFER_PROP         GRALLOC_PROP("disable_ahardware_buffer")
-#define ENABLE_FB_UBWC_PROP                  GRALLOC_PROP("enable_fb_ubwc")
-#define MAP_FB_MEMORY_PROP                   GRALLOC_PROP("map_fb_memory")
-#define USE_SYSTEM_HEAP_FOR_SENSORS          GRALLOC_PROP("use_system_heap_for_sensors")
-
-#define ROUND_UP_PAGESIZE(x) roundUpToPageSize(x)
-inline int roundUpToPageSize(int x) {
-  return (x + (getpagesize() - 1)) & ~(getpagesize() - 1);
-}
-
-/* Legacy gralloc1 definitions */
-/* Some clients may still be using the old flags */
-#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ADSP_HEAP GRALLOC_USAGE_PRIVATE_ADSP_HEAP
-#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ALLOC_UBWC GRALLOC_USAGE_PRIVATE_ALLOC_UBWC
-#define GRALLOC1_PRODUCER_USAGE_PRIVATE_UNCACHED GRALLOC_USAGE_PRIVATE_UNCACHED
-#define GRALLOC1_CONSUMER_USAGE_PRIVATE_SECURE_DISPLAY GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY
-#define GRALLOC1_PRODUCER_USAGE_PRIVATE_MM_HEAP GRALLOC_USAGE_PRIVATE_MM_HEAP
-#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT GRALLOC_USAGE_PRIVATE_10BIT
-#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
-#define GRALLOC1_CONSUMER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
-#define GRALLOC1_PRODUCER_USAGE_PRIVATE_VIDEO_NV21_ENCODER GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER
-
-// for PERFORM API :
-#define GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER 1
-#define GRALLOC_MODULE_PERFORM_GET_STRIDE 2
-#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE 3
-#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE 4
-#define GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES 5
-#define GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE 6
-#define GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO 7
-#define GRALLOC_MODULE_PERFORM_GET_MAP_SECURE_BUFFER_INFO 8
-#define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG 9
-#define GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS 10
-#define GRALLOC_MODULE_PERFORM_GET_IGC 11
-#define GRALLOC_MODULE_PERFORM_SET_IGC 12
-#define GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE 13
-#define GRALLOC1_MODULE_PERFORM_GET_BUFFER_SIZE_AND_DIMENSIONS 14
-#define GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG 15
-#define GRALLOC_MODULE_PERFORM_GET_GRAPHICS_METADATA 16
-
-/* possible values for inverse gamma correction */
-#define HAL_IGC_NOT_SPECIFIED 0
-#define HAL_IGC_s_RGB 1
-
-/* Color Space: Values maps to ColorSpace_t in qdMetadata.h */
-#define HAL_CSC_ITU_R_601 0
-#define HAL_CSC_ITU_R_601_FR 1
-#define HAL_CSC_ITU_R_709 2
-#define HAL_CSC_ITU_R_2020 3
-#define HAL_CSC_ITU_R_2020_FR 4
-
-/* possible formats for 3D content*/
-enum {
-  HAL_NO_3D = 0x0,
-  HAL_3D_SIDE_BY_SIDE_L_R = 0x1,
-  HAL_3D_SIDE_BY_SIDE_R_L = 0x2,
-  HAL_3D_TOP_BOTTOM = 0x4,
-  HAL_3D_IN_SIDE_BY_SIDE_L_R = 0x10000,  // unused legacy format
-};
-
-/* Flag to determine interlaced content
- * Value maps to Flags presents in types.hal of QtiMapperextensions
- */
-enum {
-  LAYOUT_INTERLACED_FLAG = 1 << 0,
-};
-
-#endif  // __GRALLOC_PRIV_H__
diff --git a/display-commonsys-intf/include/color_metadata.h b/display-commonsys-intf/include/color_metadata.h
deleted file mode 100644
index c8a5890..0000000
--- a/display-commonsys-intf/include/color_metadata.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
-* Copyright (c) 2016-2018, 2020 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 __COLOR_METADATA_H__
-#define __COLOR_METADATA_H__
-
-#ifdef __cplusplus
-extern "C" {
-#else
-#include <stdbool.h>
-#endif
-#include <stdint.h>
-
-typedef enum ColorRange {
-  Range_Limited   = 0,
-  Range_Full      = 1,
-  Range_Extended  = 2,
-  Range_Max     = 0xff,
-} ColorRange;
-
-// The following values matches the HEVC spec
-typedef enum ColorPrimaries {
-  // Unused = 0;
-  ColorPrimaries_BT709_5     = 1,  // ITU-R BT.709-5 or equivalent
-  /* Unspecified = 2, Reserved = 3*/
-  ColorPrimaries_BT470_6M    = 4,  // ITU-R BT.470-6 System M or equivalent
-  ColorPrimaries_BT601_6_625 = 5,  // ITU-R BT.601-6 625 or equivalent
-  ColorPrimaries_BT601_6_525 = 6,  // ITU-R BT.601-6 525 or equivalent
-  ColorPrimaries_SMPTE_240M  = 7,  // SMPTE_240M
-  ColorPrimaries_GenericFilm = 8,  // Generic Film
-  ColorPrimaries_BT2020      = 9,  // ITU-R BT.2020 or equivalent
-  ColorPrimaries_SMPTE_ST428 = 10,  // SMPTE_240M
-  ColorPrimaries_AdobeRGB    = 11,
-  ColorPrimaries_DCIP3       = 12,
-  ColorPrimaries_EBU3213     = 22,
-  ColorPrimaries_Max         = 0xff,
-} ColorPrimaries;
-
-typedef enum GammaTransfer {
-  // Unused = 0;
-  Transfer_sRGB            = 1,  // ITR-BT.709-5
-  /* Unspecified = 2, Reserved = 3 */
-  Transfer_Gamma2_2        = 4,
-  Transfer_Gamma2_8        = 5,
-  Transfer_SMPTE_170M      = 6,  // BT.601-6 525 or 625
-  Transfer_SMPTE_240M      = 7,  // SMPTE_240M
-  Transfer_Linear          = 8,
-  Transfer_Log             = 9,
-  Transfer_Log_Sqrt        = 10,
-  Transfer_XvYCC           = 11,  // IEC 61966-2-4
-  Transfer_BT1361          = 12,  // Rec.ITU-R BT.1361 extended gamut
-  Transfer_sYCC            = 13,  // IEC 61966-2-1 sRGB or sYCC
-  Transfer_BT2020_2_1      = 14,  // Rec. ITU-R BT.2020-2 (same as the values 1, 6, and 15)
-  Transfer_BT2020_2_2      = 15,  // Rec. ITU-R BT.2020-2 (same as the values 1, 6, and 14)
-  Transfer_SMPTE_ST2084    = 16,  // 2084
-  // transfers unlikely to be required by Android
-  Transfer_ST_428          = 17,  // SMPTE ST 428-1
-  Transfer_HLG             = 18,  // ARIB STD-B67
-  Transfer_Max             = 0xff,
-} GammaTransfer;
-
-typedef enum MatrixCoEfficients {
-  MatrixCoEff_Identity           = 0,
-  MatrixCoEff_BT709_5            = 1,
-  /* Unspecified = 2, Reserved = 3 */
-  MatrixCoeff_FCC_73_682         = 4,
-  MatrixCoEff_BT601_6_625        = 5,
-  MatrixCoEff_BT601_6_525        = 6,
-  MatrixCoEff_SMPTE240M          = 7,  // used with 601_525_Unadjusted
-  MatrixCoEff_YCgCo              = 8,
-  MatrixCoEff_BT2020             = 9,
-  MatrixCoEff_BT2020Constant     = 10,
-  MatrixCoEff_BT601_6_Unadjusted = 11,  // Used with BT601_625(KR=0.222, KB=0.071)
-  MatrixCoEff_DCIP3              = 12,
-  MatrixCoEff_Chroma_NonConstant = 13,
-  MatrixCoEff_Max                = 0xff,
-} MatrixCoEfficients;
-
-typedef struct Primaries {
-  uint32_t rgbPrimaries[3][2];  // unit 1/50000;
-  uint32_t whitePoint[2];  // unit 1/50000;
-} Primaries;
-
-typedef struct MasteringDisplay {
-  bool      colorVolumeSEIEnabled;
-  Primaries primaries;
-  uint32_t  maxDisplayLuminance;  // unit: cd/m^2.
-  uint32_t  minDisplayLuminance;  // unit: 1/10000 cd/m^2.
-} MasteringDisplay;
-
-typedef struct ContentLightLevel {
-  bool     lightLevelSEIEnabled;
-  uint32_t maxContentLightLevel;  // unit: cd/m^2.
-  uint32_t minPicAverageLightLevel;  // unit: cd/m^2, will be DEPRECATED, use below
-  uint32_t maxPicAverageLightLevel;  // unit: cd/m^2, its same as maxFrameAvgLightLevel(CTA-861-G)
-} ContentLightLevel;
-
-typedef struct ColorRemappingInfo {
-  bool               criEnabled;
-  uint32_t           crId;
-  uint32_t           crCancelFlag;
-  uint32_t           crPersistenceFlag;
-  uint32_t           crVideoSignalInfoPresentFlag;
-  uint32_t           crRange;
-  ColorPrimaries     crPrimaries;
-  GammaTransfer      crTransferFunction;
-  MatrixCoEfficients crMatrixCoefficients;
-  uint32_t           crInputBitDepth;
-  uint32_t           crOutputBitDepth;
-  uint32_t           crPreLutNumValMinusOne[3];
-  uint32_t           crPreLutCodedValue[3*33];
-  uint32_t           crPreLutTargetValue[3*33];
-  uint32_t           crMatrixPresentFlag;
-  uint32_t           crLog2MatrixDenom;
-  int32_t            crCoefficients[3*3];
-  uint32_t           crPostLutNumValMinusOne[3];
-  uint32_t           crPostLutCodedValue[3*33];
-  uint32_t           crPostLutTargetValue[3*33];
-} ColorRemappingInfo;
-
-#define HDR_DYNAMIC_META_DATA_SZ 1024
-typedef struct ColorMetaData {
-  // Default values based on sRGB, needs to be overridden in gralloc
-  // based on the format and size.
-  ColorPrimaries     colorPrimaries;
-  ColorRange         range;
-  GammaTransfer      transfer;
-  MatrixCoEfficients matrixCoefficients;
-
-  MasteringDisplay   masteringDisplayInfo;
-  ContentLightLevel  contentLightLevel;
-  ColorRemappingInfo cRI;
-
-  // Dynamic meta data elements
-  bool dynamicMetaDataValid;
-  uint32_t dynamicMetaDataLen;
-  uint8_t dynamicMetaDataPayload[HDR_DYNAMIC_META_DATA_SZ];
-} ColorMetaData;
-
-typedef struct Color10Bit {
-  uint32_t R: 10;
-  uint32_t G: 10;
-  uint32_t B: 10;
-  uint32_t A: 2;
-} Color10Bit;
-
-typedef struct Lut3d {
-  uint16_t dim;  // dimension of each side of LUT cube (ex: 13, 17)in lutEntries
-  uint16_t gridSize;  // number of elements in the gridEntries
-  /* Matrix ordering convension
-  for (b = 0; b < dim; b++) {
-    for (g = 0; g < dim; g++) {
-      for (r = 0; r < dim; r++) {
-        read/write [mR mG mB] associated w/ 3DLUT[r][g][b] to/from file
-      }
-    }
-  } */
-  Color10Bit *lutEntries;
-  bool validLutEntries;  // Indicates if entries are valid and can be used.
-  /*
-   The grid is a 1D LUT for each of the R,G,B channels that can be
-   used to apply an independent nonlinear transformation to each
-   channel before it is used as a coordinate for addressing
-   the uniform 3D LUT.  This effectively creates a non-uniformly
-   sampled 3D LUT.  This is useful for having independent control
-   of the sampling grid density along each dimension for greater
-   precision in spite of having a relatively small number of samples.i
-  */
-  Color10Bit *gridEntries;
-  bool validGridEntries;  // Indicates if entries are valid and can be used.
-} Lut3d;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __COLOR_METADATA_H__
diff --git a/display-commonsys-intf/include/composer_extn_intf.h b/display-commonsys-intf/include/composer_extn_intf.h
deleted file mode 100644
index 9bc3f0d..0000000
--- a/display-commonsys-intf/include/composer_extn_intf.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2019-2020, 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 __COMPOSER_EXTN_INTF_H__
-#define __COMPOSER_EXTN_INTF_H__
-
-#include <dlfcn.h>
-#include "frame_scheduler_intf.h"
-#include "display_extn_intf.h"
-
-#define COMPOSER_EXTN_REV_MAJOR (1)
-#define COMPOSER_EXTN_REV_MINOR (0)
-#define COMPOSER_EXTN_VERSION_TAG ((uint16_t) ((COMPOSER_EXTN_REV_MAJOR << 8) \
-                                              | COMPOSER_EXTN_REV_MINOR))
-
-namespace composer {
-
-class ComposerExtnIntf {
- public:
-  virtual int CreateFrameScheduler(FrameSchedulerIntf **intf) = 0;
-  virtual void DestroyFrameScheduler(FrameSchedulerIntf *intf) = 0;
-  virtual int CreateDisplayExtn(DisplayExtnIntf **intf) = 0;
-  virtual void DestroyDisplayExtn(DisplayExtnIntf *intf) = 0;
- protected:
-  virtual ~ComposerExtnIntf() { }
-};
-
-class ComposerExtnLib {
- public:
-  static ComposerExtnIntf * GetInstance() {
-    return g_composer_ext_lib_.composer_ext_intf_;
-  }
-
- private:
-  const char *lib_name = "libcomposerextn.qti.so";
-
-  typedef int (*CreateComposerExtn)(uint16_t version, ComposerExtnIntf **intf);
-  typedef void (*DestroyComposerExtn)(ComposerExtnIntf *intf);
-
-  ComposerExtnLib() {
-    lib_obj_ = ::dlopen(lib_name, RTLD_NOW);
-    if (!lib_obj_) {
-      return;
-    }
-
-    create_composer_ext_fn_ = reinterpret_cast<CreateComposerExtn>(
-                                    ::dlsym(lib_obj_, "CreateComposerExtn"));
-    destroy_composer_ext_fn_ = reinterpret_cast<DestroyComposerExtn>(
-                                    ::dlsym(lib_obj_, "DestroyComposerExtn"));
-    if (create_composer_ext_fn_ && destroy_composer_ext_fn_) {
-      create_composer_ext_fn_(COMPOSER_EXTN_VERSION_TAG, &composer_ext_intf_);
-    }
-  }
-
-  ~ComposerExtnLib() {
-    if (composer_ext_intf_) {
-      destroy_composer_ext_fn_(composer_ext_intf_);
-    }
-
-    if (lib_obj_) {
-      ::dlclose(lib_obj_);
-    }
-  }
-
-  static ComposerExtnLib g_composer_ext_lib_;
-  void *lib_obj_ = nullptr;
-  CreateComposerExtn create_composer_ext_fn_ = nullptr;
-  DestroyComposerExtn destroy_composer_ext_fn_ = nullptr;
-  ComposerExtnIntf *composer_ext_intf_ = nullptr;
-};
-
-}  // namespace composer
-
-#endif  // __COMPOSER_EXTN_INTF_H__
diff --git a/display-commonsys-intf/include/display_color_processing.h b/display-commonsys-intf/include/display_color_processing.h
deleted file mode 100644
index 49cb5d7..0000000
--- a/display-commonsys-intf/include/display_color_processing.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-* Copyright (c) 2015-2020, 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 __DISP_COLOR_PROCESSING_H__
-#define __DISP_COLOR_PROCESSING_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LUT3D_ENTRIES_SIZE (17 * 17 * 17)
-#define LUT3D_GC_ENTRIES_SIZE 1024
-
-struct rgb {
-  uint32_t r;
-  uint32_t g;
-  uint32_t b;
-};
-
-struct rgb_entry {
-  struct rgb in;
-  struct rgb out;
-};
-
-/*
-struct lut3d_info
-  flags     -- Reserved
-  lut3d_id  -- Unique ID used to distinguish individual 3D Lut tables
-  uniform   -- Identifies if coefficients are uniform (1) or non-uniform (0)
-  num_entries-- Identifies the number of lut values in the table
-  entries   -- Table buffer holding the lut values.
-
-               All coefficients are expected to be tightly packed in the
-               structure, any unused buffer space shall exist at the end
-               of the buffer.
-*/
-struct lut3d_info {
-  uint32_t flags;
-  uint32_t lut3d_id;
-  uint32_t uniform;
-  uint32_t num_entries;
-  struct rgb_entry entries[LUT3D_ENTRIES_SIZE];
-};
-
-/*
-struct lut1d_info
-  flags       -- Reserved
-  bit_width   -- Bit width of each entry
-  num_entries -- Identifies the number of lut values in the table
-  entries     -- Table buffer holding the lut values
-*/
-#define LUT1D_ENTRIES_SIZE (256)
-struct lut1d_info {
-  uint32_t flags;
-  uint32_t bit_width;
-  uint32_t strength;
-  uint32_t num_entries;
-  struct rgb entries[LUT1D_ENTRIES_SIZE];
-};
-
-static const uint32_t kDeTuningFlagSharpFactor = 0x01;
-static const uint32_t kDeTuningFlagClip = 0x02;
-static const uint32_t kDeTuningFlagThrQuiet = 0x04;
-static const uint32_t kDeTuningFlagThrDieout = 0x08;
-static const uint32_t kDeTuningFlagThrLow = 0x10;
-static const uint32_t kDeTuningFlagThrHigh = 0x20;
-static const uint32_t kDeTuningFlagContentQualLevel = 0x40;
-static const uint32_t kDeTuningFlagDeBlend = 0x80;
-
-typedef enum {
-  kDeContentQualUnknown,
-  kDeContentQualLow,
-  kDeContentQualMedium,
-  kDeContentQualHigh,
-  kDeContentQualMax,
-} PPDEContentQualLevel;
-
-typedef enum {
-  kDeContentTypeUnknown,
-  kDeContentTypeVideo,
-  kDeContentTypeGraphics,
-  kDeContentTypeMax,
-} PPDEContentType;
-
-/*
-struct PPDETuningCfg
-*/
-struct PPDETuningCfg {
-  uint32_t flags;
-  int32_t sharp_factor;
-  uint16_t thr_quiet;
-  uint16_t thr_dieout;
-  uint16_t thr_low;
-  uint16_t thr_high;
-  uint16_t clip;
-  PPDEContentQualLevel quality;
-  PPDEContentType content_type;
-  uint32_t de_blend;
-};
-
-struct PPDETuningCfgData {
-  uint32_t cfg_en;
-  struct PPDETuningCfg params;
-  bool cfg_pending;
-};
-
-#ifdef __cplusplus
-}
-#endif
-#endif  // __DISP_COLOR_PROCESSING_H__
diff --git a/display-commonsys-intf/include/display_extn_intf.h b/display-commonsys-intf/include/display_extn_intf.h
deleted file mode 100644
index c3e0c83..0000000
--- a/display-commonsys-intf/include/display_extn_intf.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2020, 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 __DISP_EXTN_INTF_H__
-#define __DISP_EXTN_INTF_H__
-
-#define EARLY_WAKEUP_FEATURE 1
-
-namespace composer {
-
-class DisplayExtnIntf {
- public:
-  virtual int SetContentFps(uint32_t fps) = 0;
-  virtual void RegisterDisplay(uint32_t display_id) = 0;
-  virtual void UnregisterDisplay(uint32_t display_id) = 0;
-  virtual int SetActiveConfig(uint32_t display_id, uint32_t config_id) = 0;
-  virtual int NotifyEarlyWakeUp(bool gpu, bool display) = 0;
-  virtual int NotifyDisplayEarlyWakeUp(uint32_t display_id) = 0;
-
- protected:
-  virtual ~DisplayExtnIntf() { }
-};
-
-}  // namespace composer
-
-#endif  // __DISP_EXTN_INTF_H__
diff --git a/display-commonsys-intf/include/frame_extn_intf.h b/display-commonsys-intf/include/frame_extn_intf.h
deleted file mode 100644
index b6bfe41..0000000
--- a/display-commonsys-intf/include/frame_extn_intf.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2019, 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 __FRAME_EXTN_INTF_H__
-#define __FRAME_EXTN_INTF_H__
-
-#include <utils/Timers.h>
-#include <sys/types.h>
-#include <string>
-
-#define EXTENSION_LIBRARY_NAME "libframeextension.so"
-#define CREATE_FRAME_EXTN_INTERFACE "CreateFrameExtnInterface"
-#define DESTROY_FRAME_EXTN_INTERFACE "DestroyFrameExtnInterface"
-
-namespace composer {
-
-class FrameExtnIntf;
-
-// Function addresses queried at runtime using ::dlsym()
-typedef bool (*CreateFrameExtnInterface)(FrameExtnIntf **interface);
-typedef bool (*DestroyFrameExtnInterface)(FrameExtnIntf *interface);
-
-/*! @brief This structure defines extension version.
-
-    @details It is used to avoid any mismatch of versions between frameextension library
-    implementation and its clients usage (like SurfaceFlinger).
-
-  @sa FrameInfo
-*/
-struct Version {
-  uint8_t minor;
-  uint8_t major;
-};
-
-/*! @brief This structure defines the Frame info required by FrameExtnIntf.
-
-  @sa FrameExtnIntf::SetFrameInfo
-*/
-struct FrameInfo {
-  Version version;
-  bool transparent_region;
-  int width;
-  int height;
-  int max_queued_frames;
-  int num_idle;
-  std::string max_queued_layer_name;
-  std::string layer_name;
-  nsecs_t current_timestamp;
-  nsecs_t previous_timestamp;
-  nsecs_t vsync_timestamp;
-  nsecs_t refresh_timestamp;
-  nsecs_t ref_latency;
-  nsecs_t vsync_period;
-};
-
-
-/*! @brief This interface shall be implemented by frameextension library.
-
-  @details This class declares prototype for frameextension public interfaces which must be
-  implemented by frameextension library.
-*/
-class FrameExtnIntf {
- public:
-  /*! @brief Set the FrameInfo used by frameextension.
-
-    @details This function is called once per refresh cycle so that required frame info are
-    feed to frameextension.
-
-    @param[in] frameInfo \link FrameInfo \endlink
-
-    @return \link int \endlink
-  */
-  virtual int SetFrameInfo(FrameInfo &frameInfo) = 0;
-
- protected:
-  virtual ~FrameExtnIntf() { };
-};
-
-}  // namespace composer
-
-#endif  // __FRAME_EXTN_INTF_H__
diff --git a/display-commonsys-intf/include/frame_scheduler_intf.h b/display-commonsys-intf/include/frame_scheduler_intf.h
deleted file mode 100644
index 2d706e1..0000000
--- a/display-commonsys-intf/include/frame_scheduler_intf.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2019, 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 __FRAME_SCHEDULER_INTF_H__
-#define __FRAME_SCHEDULER_INTF_H__
-
-#include <utils/Timers.h>
-
-namespace composer {
-
-class FrameSchedulerIntf {
- public:
-  virtual int UpdateFrameScheduling(int fenceFd, nsecs_t *timeStamp) = 0;
- protected:
-  virtual ~FrameSchedulerIntf() { }
-};
-
-}  // namespace composer
-
-#endif  // __FRAME_SCHEDULER_INTF_H__
diff --git a/display-commonsys-intf/include/layer_extn_intf.h b/display-commonsys-intf/include/layer_extn_intf.h
deleted file mode 100644
index adf36bb..0000000
--- a/display-commonsys-intf/include/layer_extn_intf.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2019, 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 __LAYER_EXTN_INTF_H__
-#define __LAYER_EXTN_INTF_H__
-
-#include <sys/types.h>
-
-#include <vector>
-#include <string>
-
-namespace composer {
-
-#define LAYER_EXTN_LIBRARY_NAME "liblayerext.qti.so"
-#define CREATE_LAYER_EXTN_INTERFACE "CreateLayerExtnInterface"
-#define DESTROY_LAYER_EXTN_INTERFACE "DestroyLayerExtnInterface"
-
-#define LAYER_EXTN_REVISION_MAJOR (1)
-#define LAYER_EXTN_REVISION_MINOR (0)
-#define LAYER_EXTN_VERSION_TAG ((uint16_t) ((LAYER_EXTN_REVISION_MAJOR << 8) \
-                                          | LAYER_EXTN_REVISION_MINOR))
-
-class LayerExtnIntf {
- public:
-  virtual ~LayerExtnIntf() = default;
-  virtual int GetLayerClass(const std::string &name) = 0;
-  virtual void UpdateLayerState(const std::vector<std::string> &layers, int num_layers) = 0;
-};
-
-typedef bool (*CreateLayerExtnInterface)(uint16_t version, LayerExtnIntf **interface);
-typedef void (*DestroyLayerExtnInterface)(LayerExtnIntf *interface);
-
-}  // namespace composer
-
-#endif  // __LAYER_EXTN_INTF_H__
diff --git a/display-commonsys-intf/include/smomo_config.h b/display-commonsys-intf/include/smomo_config.h
deleted file mode 100644
index ff409d6..0000000
--- a/display-commonsys-intf/include/smomo_config.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) 2019, 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.
-*/
-
-/*! @file smomo_config.h
-  @brief Interface file for the client of Smomo service, which provides tuning parameters of Smomo
-
-  @details Smomo clients use these interfaces to enable or disable Smomo, tune parameters to
-  optimize the display performance.
-*/
-
-#ifndef __SMOMO_CONFIG_H__
-#define __SMOMO_CONFIG_H__
-
-#include <cstdint>
-
-namespace smomoconfig {
-
-int EnableSmomo(bool enable);
-
-int GetSmomoMode(uint32_t *mode_idx);
-
-int SetSmomoMode(uint32_t mode_idx);
-
-}  // namespace smomoconfig
-
-#endif  // __SMOMO_CONFIG_H__
-
diff --git a/display-commonsys-intf/include/smomo_interface.h b/display-commonsys-intf/include/smomo_interface.h
deleted file mode 100644
index c16111e..0000000
--- a/display-commonsys-intf/include/smomo_interface.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-* Copyright (c) 2019, 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.
-*/
-
-/*! @file smomo.h
-  @brief Interface file for SmoMo which defines the public interface exposed to SmoMo clients.
-
-  @details SmoMo clients use these interfaces to feed SmoMo required info like frame rate, refresh
-  rate, these info are used to update SmoMo internal state.
-*/
-
-#ifndef __SMOMO_INTERFACE_H__
-#define __SMOMO_INTERFACE_H__
-
-#include <sys/types.h>
-
-#include <vector>
-#include <string>
-
-namespace smomo {
-
-#define SMOMO_LIBRARY_NAME "libsmomo.qti.so"
-#define CREATE_SMOMO_INTERFACE_NAME "CreateSmomoInterface"
-#define DESTROY_SMOMO_INTERFACE_NAME "DestroySmomoInterface"
-
-#define SMOMO_REVISION_MAJOR (1)
-#define SMOMO_REVISION_MINOR (0)
-#define SMOMO_VERSION_TAG ((uint16_t) ((SMOMO_REVISION_MAJOR << 8) \
-                                          | SMOMO_REVISION_MINOR))
-
-typedef int64_t nsecs_t;
-
-/*! @brief This structure defines the layer stats required by SmoMo.
-
-  @sa SmomoIntf::updateSmomoState
-*/
-struct SmomoLayerStats {
-  std::string name;  // layer full name
-  int32_t id;  // layer ID
-};
-
-/*! @brief This structure defines the buffer stats required by SmoMo.
-
-  @sa SmomoIntf::CollectLayerStats
-  @sa SmomoIntf::ShouldPresentNow
-*/
-struct SmomoBufferStats {
-  int32_t id;  // layer ID
-  int32_t queued_frames;  // queued frame count of this layer
-  bool auto_timestamp;  // whether timestamp was generated automatically
-  nsecs_t timestamp;  // layer buffer's timestamp
-  nsecs_t dequeue_latency;  // last dequeue duration
-};
-
-/*! @brief SmoMo interface implemented by SmoMo library.
-
-  @details This class declares prototype for SmoMo public interfaces which must be
-  implemented by SmoMo library. SmoMo clients will use these methods to feed required
-  info to SmoMo implementation.
-*/
-class SmomoIntf {
- public:
-  virtual ~SmomoIntf() = default;
-
-  /*! @brief Update SmoMo internal state.
-
-    @details This function is called once per each composition so that required layer info are feed
-    to SmoMo, the SmoMo uses these info to update its internal state.
-
-    @param[in] layers \link SmomoLayerStats \endlink
-    @param[in] refresh_rate current display refresh rate
-
-    @return \link void \endlink
-  */
-  virtual void UpdateSmomoState(const std::vector<SmomoLayerStats> &layers,
-      float refresh_rate) = 0;
-
-  /*! @brief Collect layer buffer stats.
-
-    @details This function is called once new buffer is ready for this layer. It's used to collect
-    layer's buffer stats for SmoMo.
-
-    @param[in] \link SmomoBufferStats \endlink
-
-    @return \link void \endlink
-  */
-  virtual void CollectLayerStats(const SmomoBufferStats &buffer_stats) = 0;
-
-  /*! @brief Is this layer buffer ready to present.
-
-    @details This function is called by SmoMo clients used to check whether this layer buffer is
-    due to present.
-
-    @param[in] \link SmomoBufferStats \endlink
-    @param[in] next_vsync_time When next VSYNC arrives
-
-    @return \link bool \endlink
-  */
-  virtual bool ShouldPresentNow(const SmomoBufferStats &buffer_stats,
-      const nsecs_t next_vsync_time) = 0;
-
-  /*! @brief Change refresh rate callback type definition.
-  */
-  using ChangeRefreshRateCallback = std::function<void(int32_t)>;
-
-  /*! @brief Set the callback used by SmoMo to change display refresh rate.
-
-    @details This function is called by SmoMo clients used to set the refresh rate callback.
-
-    @param[in] callback \link ChangeRefreshRateCallback \endlink
-
-    @return \link void \endlink
-  */
-  virtual void SetChangeRefreshRateCallback(
-      const ChangeRefreshRateCallback& callback) = 0;
-
-  /*! @brief Set the refersh rates supported by display.
-
-    @details This function is called to tell SmoMo what refresh rates this display can suport.
-
-    @param[in] refresh_rates The refresh rates supported by the display
-
-    @return \link void \endlink
-  */
-  virtual void SetDisplayRefreshRates(const std::vector<float> &refresh_rates) = 0;
-
-  /*! @brief Get the current frame rate from SmoMo.
-
-    @details This function is called by SmoMo client to query the current frame rate, which is
-    based on the internal state of SmoMo. Client needs to call the UpdateSmomoState API before
-    calling this function. SmoMo only returns a valid frame rate when it's settled to a state.
-
-    @return > 0 if valid, -1 if invalid.
-
-    @return \link int \endlink
-  */
-  virtual int GetFrameRate() = 0;
-};
-
-typedef bool (*CreateSmomoInterface)(uint16_t version, SmomoIntf **interface);
-typedef void (*DestroySmomoInterface)(SmomoIntf *interface);
-
-}  // namespace smomo
-
-#endif  // __SMOMO_INTERFACE_H__
diff --git a/display-commonsys-intf/libqdmetadata/Android.bp b/display-commonsys-intf/libqdmetadata/Android.bp
deleted file mode 100644
index 3cd036b..0000000
--- a/display-commonsys-intf/libqdmetadata/Android.bp
+++ /dev/null
@@ -1,22 +0,0 @@
-cc_library_shared {
-    name: "libqdMetaData",
-    vendor_available: true,
-    system_ext_specific: true,
-    cflags: [
-        "-Wno-sign-conversion",
-        "-DLOG_TAG=\"qdmetadata\"",
-        "-D__QTI_DISPLAY_GRALLOC__",
-    ],
-    shared_libs: [
-        "liblog",
-        "libcutils",
-        "libutils",
-        "libhidlbase",
-        "libgralloc.qti",
-        "libgralloctypes",
-    ],
-    header_libs: ["libhardware_headers", "display_intf_headers"],
-    srcs: ["qdMetaData.cpp", "qd_utils.cpp"],
-    export_header_lib_headers: ["display_intf_headers"],
-}
-
diff --git a/display-commonsys-intf/libqdmetadata/Makefile.am b/display-commonsys-intf/libqdmetadata/Makefile.am
deleted file mode 100644
index 24b1c4a..0000000
--- a/display-commonsys-intf/libqdmetadata/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-h_sources = qdMetaData.h
-
-cpp_sources = qdMetaData.cpp
-
-qdMetaData_includedir = $(pkgincludedir)/display
-qdMetaData_include_HEADERS = $(h_sources)
-
-lib_LTLIBRARIES = libqdMetaData.la
-libqdMetaData_la_CC = @CC@
-libqdMetaData_la_SOURCES = $(cpp_sources)
-libqdMetaData_la_CFLAGS = $(AM_CFLAGS) -DLOG_TAG=\"DisplayMetaData\"
-libqdMetaData_la_CPPFLAGS = $(AM_CPPFLAGS)
-libqdMetaData_LDADD = -lcutils -llog
-libqdMetaData_la_LDFLAGS = -shared -avoid-version
diff --git a/display-commonsys-intf/libqdmetadata/qdMetaData.cpp b/display-commonsys-intf/libqdmetadata/qdMetaData.cpp
deleted file mode 100644
index 0fa24ca..0000000
--- a/display-commonsys-intf/libqdmetadata/qdMetaData.cpp
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- * Copyright (c) 2012-2020, 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 "qdMetaData.h"
-
-#include <QtiGrallocPriv.h>
-#include <errno.h>
-#include <gralloc_priv.h>
-#include <gralloctypes/Gralloc4.h>
-#include <log/log.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <cinttypes>
-
-static int colorMetaDataToColorSpace(ColorMetaData in, ColorSpace_t *out) {
-  if (in.colorPrimaries == ColorPrimaries_BT601_6_525 ||
-      in.colorPrimaries == ColorPrimaries_BT601_6_625) {
-    if (in.range == Range_Full) {
-      *out = ITU_R_601_FR;
-    } else {
-      *out = ITU_R_601;
-    }
-  } else if (in.colorPrimaries == ColorPrimaries_BT2020) {
-    if (in.range == Range_Full) {
-      *out = ITU_R_2020_FR;
-    } else {
-      *out = ITU_R_2020;
-    }
-  } else if (in.colorPrimaries == ColorPrimaries_BT709_5) {
-    *out = ITU_R_709;
-  } else {
-    ALOGE(
-        "Cannot convert ColorMetaData to ColorSpace_t. "
-        "Primaries = %d, Range = %d",
-        in.colorPrimaries, in.range);
-    return -1;
-  }
-
-  return 0;
-}
-
-static int colorSpaceToColorMetadata(ColorSpace_t in, ColorMetaData *out) {
-  out->transfer = Transfer_sRGB;
-  switch (in) {
-    case ITU_R_601:
-      out->colorPrimaries = ColorPrimaries_BT601_6_525;
-      out->range = Range_Limited;
-      break;
-    case ITU_R_601_FR:
-      out->colorPrimaries = ColorPrimaries_BT601_6_525;
-      out->range = Range_Full;
-      break;
-    case ITU_R_709:
-      out->colorPrimaries = ColorPrimaries_BT709_5;
-      out->range = Range_Limited;
-      break;
-    case ITU_R_2020:
-      out->colorPrimaries = ColorPrimaries_BT2020;
-      out->range = Range_Limited;
-      break;
-    case ITU_R_2020_FR:
-      out->colorPrimaries = ColorPrimaries_BT2020;
-      out->range = Range_Full;
-      break;
-    default:
-      ALOGE("Cannot convert ColorSpace_t %d to ColorMetaData", in);
-      return -1;
-      break;
-  }
-
-  return 0;
-}
-
-static bool getGralloc4Array(MetaData_t *metadata, int32_t paramType) {
-  switch (paramType) {
-    case SET_VT_TIMESTAMP:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_VT_TIMESTAMP)];
-    case COLOR_METADATA:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_COLOR_METADATA)];
-    case PP_PARAM_INTERLACED:
-      return metadata
-          ->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_PP_PARAM_INTERLACED)];
-    case SET_VIDEO_PERF_MODE:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_VIDEO_PERF_MODE)];
-    case SET_GRAPHICS_METADATA:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_GRAPHICS_METADATA)];
-    case SET_UBWC_CR_STATS_INFO:
-      return metadata
-          ->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_UBWC_CR_STATS_INFO)];
-    case UPDATE_BUFFER_GEOMETRY:
-      return metadata->isStandardMetadataSet[GET_STANDARD_METADATA_STATUS_INDEX(
-          ::android::gralloc4::MetadataType_Crop.value)];
-    case UPDATE_REFRESH_RATE:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_REFRESH_RATE)];
-    case UPDATE_COLOR_SPACE:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_COLOR_METADATA)];
-    case MAP_SECURE_BUFFER:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_MAP_SECURE_BUFFER)];
-    case LINEAR_FORMAT:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_LINEAR_FORMAT)];
-    case SET_SINGLE_BUFFER_MODE:
-      return metadata
-          ->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_SINGLE_BUFFER_MODE)];
-    case SET_CVP_METADATA:
-      return metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_CVP_METADATA)];
-    case SET_VIDEO_HISTOGRAM_STATS:
-      return metadata
-          ->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_VIDEO_HISTOGRAM_STATS)];
-    default:
-      ALOGE("paramType %d not supported", paramType);
-      return false;
-  }
-}
-
-static void setGralloc4Array(MetaData_t *metadata, int32_t paramType, bool isSet) {
-  switch (paramType) {
-    case SET_VT_TIMESTAMP:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_VT_TIMESTAMP)] = isSet;
-      break;
-    case COLOR_METADATA:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_COLOR_METADATA)] = isSet;
-      break;
-    case PP_PARAM_INTERLACED:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_PP_PARAM_INTERLACED)] =
-          isSet;
-      break;
-    case SET_VIDEO_PERF_MODE:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_VIDEO_PERF_MODE)] = isSet;
-      break;
-    case SET_GRAPHICS_METADATA:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_GRAPHICS_METADATA)] =
-          isSet;
-      break;
-    case SET_UBWC_CR_STATS_INFO:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_UBWC_CR_STATS_INFO)] =
-          isSet;
-      break;
-    case UPDATE_BUFFER_GEOMETRY:
-      metadata->isStandardMetadataSet[GET_STANDARD_METADATA_STATUS_INDEX(
-          ::android::gralloc4::MetadataType_Crop.value)] = isSet;
-      break;
-    case UPDATE_REFRESH_RATE:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_REFRESH_RATE)] = isSet;
-      break;
-    case UPDATE_COLOR_SPACE:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_COLOR_METADATA)] = isSet;
-      break;
-    case MAP_SECURE_BUFFER:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_MAP_SECURE_BUFFER)] =
-          isSet;
-      break;
-    case LINEAR_FORMAT:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_LINEAR_FORMAT)] = isSet;
-      break;
-    case SET_SINGLE_BUFFER_MODE:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_SINGLE_BUFFER_MODE)] =
-          isSet;
-      break;
-    case SET_CVP_METADATA:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_CVP_METADATA)] = isSet;
-      break;
-    case SET_VIDEO_HISTOGRAM_STATS:
-      metadata->isVendorMetadataSet[GET_VENDOR_METADATA_STATUS_INDEX(QTI_VIDEO_HISTOGRAM_STATS)] =
-          isSet;
-      break;
-    default:
-      ALOGE("paramType %d not supported in Gralloc4", paramType);
-  }
-}
-
-unsigned long getMetaDataSize() {
-    return static_cast<unsigned long>(ROUND_UP_PAGESIZE(sizeof(MetaData_t)));
-}
-
-// Cannot add default argument to existing function
-unsigned long getMetaDataSizeWithReservedRegion(uint64_t reserved_size) {
-  return static_cast<unsigned long>(ROUND_UP_PAGESIZE(sizeof(MetaData_t) + reserved_size));
-}
-
-static int validateAndMap(private_handle_t* handle) {
-    if (private_handle_t::validate(handle)) {
-        ALOGE("%s: Private handle is invalid - handle:%p", __func__, handle);
-        return -1;
-    }
-    if (handle->fd_metadata < 0) {
-      // Metadata cannot be used
-      return -1;
-    }
-
-    if (!handle->base_metadata) {
-        auto size = getMetaDataSize();
-        void *base = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED,
-                handle->fd_metadata, 0);
-        if (base == reinterpret_cast<void*>(MAP_FAILED)) {
-            ALOGE("%s: metadata mmap failed - handle:%p fd: %d err: %s",
-                __func__, handle, handle->fd_metadata, strerror(errno));
-            return -1;
-        }
-        handle->base_metadata = (uintptr_t) base;
-        auto metadata = reinterpret_cast<MetaData_t *>(handle->base_metadata);
-        if (metadata->reservedSize) {
-          auto reserved_size = metadata->reservedSize;
-          munmap(reinterpret_cast<void *>(handle->base_metadata), getMetaDataSize());
-          handle->base_metadata = 0;
-          size = getMetaDataSizeWithReservedRegion(reserved_size);
-          void *new_base =
-              mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd_metadata, 0);
-          if (new_base == reinterpret_cast<void *>(MAP_FAILED)) {
-            ALOGE("%s: metadata mmap failed - handle:%p fd: %d err: %s", __func__, handle,
-                  handle->fd_metadata, strerror(errno));
-            return -1;
-          }
-          handle->base_metadata = (uintptr_t)new_base;
-        }
-    }
-    return 0;
-}
-
-static void unmapAndReset(private_handle_t *handle) {
-    if (private_handle_t::validate(handle) == 0 && handle->base_metadata) {
-      // If reservedSize is 0, the return value will be the same as getMetaDataSize
-      auto metadata = reinterpret_cast<MetaData_t *>(handle->base_metadata);
-      auto size = getMetaDataSizeWithReservedRegion(metadata->reservedSize);
-      munmap(reinterpret_cast<void *>(handle->base_metadata), size);
-      handle->base_metadata = 0;
-    }
-}
-
-int setMetaData(private_handle_t *handle, DispParamType paramType,
-                void *param) {
-    auto err = validateAndMap(handle);
-    if (err != 0)
-        return err;
-    return setMetaDataVa(reinterpret_cast<MetaData_t*>(handle->base_metadata),
-                         paramType, param);
-}
-
-int setMetaDataVa(MetaData_t *data, DispParamType paramType,
-                  void *param) {
-    if (data == nullptr)
-        return -EINVAL;
-    // If parameter is NULL reset the specific MetaData Key
-    if (!param) {
-      setGralloc4Array(data, paramType, false);
-      switch (paramType) {
-        case SET_VIDEO_PERF_MODE:
-          data->isVideoPerfMode = 0;
-          break;
-        case SET_CVP_METADATA:
-          data->cvpMetadata.size = 0;
-          break;
-        case SET_VIDEO_HISTOGRAM_STATS:
-          data->video_histogram_stats.stat_len = 0;
-          break;
-        default:
-          ALOGE("Unknown paramType %d", paramType);
-          break;
-      }
-       // param unset
-       return 0;
-    }
-
-    setGralloc4Array(data, paramType, true);
-    switch (paramType) {
-        case PP_PARAM_INTERLACED:
-            data->interlaced = *((int32_t *)param);
-            break;
-        case UPDATE_BUFFER_GEOMETRY: {
-          BufferDim_t in = *((BufferDim_t *)param);
-          data->crop = {0, 0, in.sliceWidth, in.sliceHeight};
-          break;
-        }
-        case UPDATE_REFRESH_RATE:
-            data->refreshrate = *((float *)param);
-            break;
-        case UPDATE_COLOR_SPACE: {
-          ColorMetaData color = {};
-          if (!colorSpaceToColorMetadata(*((ColorSpace_t *)param), &color)) {
-            data->color = color;
-            break;
-          }
-          return -EINVAL;
-        }
-        case MAP_SECURE_BUFFER:
-            data->mapSecureBuffer = *((int32_t *)param);
-            break;
-        case S3D_FORMAT:
-            data->s3dFormat = *((uint32_t *)param);
-            break;
-        case LINEAR_FORMAT:
-            data->linearFormat = *((uint32_t *)param);
-            break;
-        case SET_SINGLE_BUFFER_MODE:
-            data->isSingleBufferMode = *((uint32_t *)param);
-            break;
-        case SET_VT_TIMESTAMP:
-            data->vtTimeStamp = *((uint64_t *)param);
-            break;
-        case COLOR_METADATA:
-            data->color = *((ColorMetaData *)param);
-            break;
-        case SET_UBWC_CR_STATS_INFO: {
-          struct UBWCStats *stats = (struct UBWCStats *)param;
-          int numelems = sizeof(data->ubwcCRStats) / sizeof(struct UBWCStats);
-          for (int i = 0; i < numelems; i++) {
-            data->ubwcCRStats[i] = stats[i];
-          }
-          break;
-          }
-        case SET_VIDEO_PERF_MODE:
-            data->isVideoPerfMode = *((uint32_t *)param);
-            break;
-        case SET_GRAPHICS_METADATA: {
-             GraphicsMetadata payload = *((GraphicsMetadata*)(param));
-             data->graphics_metadata.size = payload.size;
-             memcpy(data->graphics_metadata.data, payload.data,
-                    sizeof(data->graphics_metadata.data));
-             break;
-        }
-        case SET_CVP_METADATA: {
-             struct CVPMetadata *cvpMetadata = (struct CVPMetadata *)param;
-             if (cvpMetadata->size <= CVP_METADATA_SIZE) {
-                 data->cvpMetadata.size = cvpMetadata->size;
-                 memcpy(data->cvpMetadata.payload, cvpMetadata->payload,
-                        cvpMetadata->size);
-                 data->cvpMetadata.capture_frame_rate = cvpMetadata->capture_frame_rate;
-                 data->cvpMetadata.cvp_frame_rate = cvpMetadata->cvp_frame_rate;
-                 data->cvpMetadata.flags = cvpMetadata->flags;
-                 memcpy(data->cvpMetadata.reserved, cvpMetadata->reserved,
-                        (8 * sizeof(uint32_t)));
-             } else {
-               setGralloc4Array(data, paramType, false);
-               ALOGE("%s: cvp metadata length %d is more than max size %d", __func__,
-                     cvpMetadata->size, CVP_METADATA_SIZE);
-               return -EINVAL;
-             }
-             break;
-        }
-        case SET_VIDEO_HISTOGRAM_STATS: {
-            struct VideoHistogramMetadata *vidstats = (struct VideoHistogramMetadata *)param;
-            if (vidstats->stat_len <= VIDEO_HISTOGRAM_STATS_SIZE) {
-                memcpy(data->video_histogram_stats.stats_info,
-                    vidstats->stats_info, VIDEO_HISTOGRAM_STATS_SIZE);
-                data->video_histogram_stats.stat_len = vidstats->stat_len;
-                data->video_histogram_stats.frame_type = vidstats->frame_type;
-                data->video_histogram_stats.display_width = vidstats->display_width;
-                data->video_histogram_stats.display_height = vidstats->display_height;
-                data->video_histogram_stats.decode_width = vidstats->decode_width;
-                data->video_histogram_stats.decode_height = vidstats->decode_height;
-            } else {
-              setGralloc4Array(data, paramType, false);
-              ALOGE("%s: video stats length %u is more than max size %u", __func__,
-                    vidstats->stat_len, VIDEO_HISTOGRAM_STATS_SIZE);
-              return -EINVAL;
-            }
-            break;
-         }
-         default:
-            ALOGE("Unknown paramType %d", paramType);
-            break;
-    }
-    return 0;
-}
-
-int clearMetaData(private_handle_t *handle, DispParamType paramType) {
-    auto err = validateAndMap(handle);
-    if (err != 0)
-        return err;
-    return clearMetaDataVa(reinterpret_cast<MetaData_t *>(handle->base_metadata),
-            paramType);
-}
-
-int clearMetaDataVa(MetaData_t *data, DispParamType paramType) {
-    if (data == nullptr)
-        return -EINVAL;
-    data->operation &= ~paramType;
-    switch (paramType) {
-        case SET_VIDEO_PERF_MODE:
-            data->isVideoPerfMode = 0;
-            break;
-        case SET_CVP_METADATA:
-            data->cvpMetadata.size = 0;
-            break;
-        case SET_VIDEO_HISTOGRAM_STATS:
-            data->video_histogram_stats.stat_len = 0;
-            break;
-        default:
-            ALOGE("Unknown paramType %d", paramType);
-            break;
-    }
-    return 0;
-}
-
-int getMetaData(private_handle_t *handle, DispFetchParamType paramType,
-                                                    void *param) {
-    int ret = validateAndMap(handle);
-    if (ret != 0)
-        return ret;
-    return getMetaDataVa(reinterpret_cast<MetaData_t *>(handle->base_metadata),
-                         paramType, param);
-}
-
-int getMetaDataVa(MetaData_t *data, DispFetchParamType paramType,
-                  void *param) {
-    // Make sure we send 0 only if the operation queried is present
-    int ret = -EINVAL;
-    if (data == nullptr)
-        return ret;
-    if (param == nullptr)
-        return ret;
-
-    if (!getGralloc4Array(data, paramType)) {
-      return ret;
-    }
-
-    ret = 0;
-
-    switch (paramType) {
-        case GET_PP_PARAM_INTERLACED:
-          *((int32_t *)param) = data->interlaced;
-          break;
-        case GET_BUFFER_GEOMETRY:
-          *((BufferDim_t *)param) = {data->crop.right, data->crop.bottom};
-          break;
-        case GET_REFRESH_RATE:
-          *((float *)param) = data->refreshrate;
-          break;
-        case GET_COLOR_SPACE: {
-          ColorSpace_t color_space;
-          if (!colorMetaDataToColorSpace(data->color, &color_space)) {
-            *((ColorSpace_t *)param) = color_space;
-          } else {
-            ret = -EINVAL;
-          }
-          break;
-        }
-        case GET_MAP_SECURE_BUFFER:
-          *((int32_t *)param) = data->mapSecureBuffer;
-          break;
-        case GET_S3D_FORMAT:
-          *((uint32_t *)param) = data->s3dFormat;
-          break;
-        case GET_LINEAR_FORMAT:
-          *((uint32_t *)param) = data->linearFormat;
-          break;
-        case GET_SINGLE_BUFFER_MODE:
-          *((uint32_t *)param) = data->isSingleBufferMode;
-          break;
-        case GET_VT_TIMESTAMP:
-          *((uint64_t *)param) = data->vtTimeStamp;
-          break;
-        case GET_COLOR_METADATA:
-          *((ColorMetaData *)param) = data->color;
-          break;
-        case GET_UBWC_CR_STATS_INFO: {
-          struct UBWCStats *stats = (struct UBWCStats *)param;
-          int numelems = sizeof(data->ubwcCRStats) / sizeof(struct UBWCStats);
-          for (int i = 0; i < numelems; i++) {
-            stats[i] = data->ubwcCRStats[i];
-          }
-          break;
-        }
-        case GET_VIDEO_PERF_MODE:
-          *((uint32_t *)param) = data->isVideoPerfMode;
-          break;
-        case GET_GRAPHICS_METADATA:
-          memcpy(param, data->graphics_metadata.data, sizeof(data->graphics_metadata.data));
-          break;
-        case GET_CVP_METADATA: {
-          struct CVPMetadata *cvpMetadata = (struct CVPMetadata *)param;
-          cvpMetadata->size = 0;
-          if (data->cvpMetadata.size <= CVP_METADATA_SIZE) {
-            cvpMetadata->size = data->cvpMetadata.size;
-            memcpy(cvpMetadata->payload, data->cvpMetadata.payload, data->cvpMetadata.size);
-            cvpMetadata->capture_frame_rate = data->cvpMetadata.capture_frame_rate;
-            cvpMetadata->cvp_frame_rate = data->cvpMetadata.cvp_frame_rate;
-            cvpMetadata->flags = data->cvpMetadata.flags;
-            memcpy(cvpMetadata->reserved, data->cvpMetadata.reserved, (8 * sizeof(uint32_t)));
-          } else {
-            ret = -EINVAL;
-          }
-          break;
-        }
-        case GET_VIDEO_HISTOGRAM_STATS: {
-          struct VideoHistogramMetadata *vidstats = (struct VideoHistogramMetadata *)param;
-          vidstats->stat_len = 0;
-          if (data->video_histogram_stats.stat_len <= VIDEO_HISTOGRAM_STATS_SIZE) {
-            memcpy(vidstats->stats_info, data->video_histogram_stats.stats_info,
-                   VIDEO_HISTOGRAM_STATS_SIZE);
-            vidstats->stat_len = data->video_histogram_stats.stat_len;
-            vidstats->frame_type = data->video_histogram_stats.frame_type;
-            vidstats->display_width = data->video_histogram_stats.display_width;
-            vidstats->display_height = data->video_histogram_stats.display_height;
-            vidstats->decode_width = data->video_histogram_stats.decode_width;
-            vidstats->decode_height = data->video_histogram_stats.decode_height;
-          } else {
-            ret = -EINVAL;
-          }
-          break;
-        }
-        default:
-            ALOGE("Unknown paramType %d", paramType);
-            ret = -EINVAL;
-            break;
-    }
-    return ret;
-}
-
-int copyMetaData(struct private_handle_t *src, struct private_handle_t *dst) {
-    auto err = validateAndMap(src);
-    if (err != 0)
-        return err;
-
-    err = validateAndMap(dst);
-    if (err != 0)
-        return err;
-
-    MetaData_t *src_data = reinterpret_cast <MetaData_t *>(src->base_metadata);
-    MetaData_t *dst_data = reinterpret_cast <MetaData_t *>(dst->base_metadata);
-    *dst_data = *src_data;
-    return 0;
-}
-
-int copyMetaDataVaToHandle(MetaData_t *src_data, struct private_handle_t *dst) {
-    int err = -EINVAL;
-    if (src_data == nullptr)
-        return err;
-
-    err = validateAndMap(dst);
-    if (err != 0)
-        return err;
-
-    MetaData_t *dst_data = reinterpret_cast <MetaData_t *>(dst->base_metadata);
-    *dst_data = *src_data;
-    return 0;
-}
-
-int copyMetaDataHandleToVa(struct private_handle_t *src, MetaData_t *dst_data) {
-    int err = -EINVAL;
-    if (dst_data == nullptr)
-        return err;
-
-    err = validateAndMap(src);
-    if (err != 0)
-        return err;
-
-    MetaData_t *src_data = reinterpret_cast <MetaData_t *>(src->base_metadata);
-    *dst_data = *src_data;
-    return 0;
-}
-
-int copyMetaDataVaToVa(MetaData_t *src_data, MetaData_t *dst_data) {
-    int err = -EINVAL;
-    if (src_data == nullptr)
-        return err;
-
-    if (dst_data == nullptr)
-        return err;
-
-    *dst_data = *src_data;
-    return 0;
-}
-
-int setMetaDataAndUnmap(struct private_handle_t *handle, enum DispParamType paramType,
-                        void *param) {
-    auto ret = setMetaData(handle, paramType, param);
-    unmapAndReset(handle);
-    return ret;
-}
-
-int getMetaDataAndUnmap(struct private_handle_t *handle,
-                        enum DispFetchParamType paramType,
-                        void *param) {
-    auto ret = getMetaData(handle, paramType, param);
-    unmapAndReset(handle);
-    return ret;
-}
diff --git a/display-commonsys-intf/libqdmetadata/qdMetaData.h b/display-commonsys-intf/libqdmetadata/qdMetaData.h
deleted file mode 100644
index a36d6e7..0000000
--- a/display-commonsys-intf/libqdmetadata/qdMetaData.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2012-2020, 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 _QDMETADATA_H
-#define _QDMETADATA_H
-
-#include <QtiGrallocMetadata.h>
-#include <color_metadata.h>
-
-/* TODO: This conditional include is to prevent breaking video and camera test cases using
- * MetaData_t - camxchinodedewarp.cpp, vtest_EncoderFileSource.cpp
- */
-
-#ifdef __cplusplus
-#include <QtiGrallocPriv.h>
-#endif
-
-#ifndef __QTI_DISPLAY_GRALLOC__
-#pragma message "qdMetaData.h is being deprecated"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct MetaData_t;
-
-enum ColorSpace_t {
-  ITU_R_601,
-  ITU_R_601_FR,
-  ITU_R_709,
-  ITU_R_2020,
-  ITU_R_2020_FR,
-};
-
-struct BufferDim_t {
-  int32_t sliceWidth;
-  int32_t sliceHeight;
-};
-
-enum DispParamType {
-    SET_VT_TIMESTAMP           = 0x0001,
-    COLOR_METADATA             = 0x0002,
-    PP_PARAM_INTERLACED        = 0x0004,
-    SET_VIDEO_PERF_MODE        = 0x0008,
-    SET_GRAPHICS_METADATA      = 0x0010,
-    SET_UNUSED                 = 0x0020,
-    SET_UBWC_CR_STATS_INFO     = 0x0040,
-    UPDATE_BUFFER_GEOMETRY     = 0x0080,
-    UPDATE_REFRESH_RATE        = 0x0100,
-    UPDATE_COLOR_SPACE         = 0x0200,
-    MAP_SECURE_BUFFER          = 0x0400,
-    S3D_FORMAT                 = 0x0800,
-    LINEAR_FORMAT              = 0x1000,
-    SET_IGC                    = 0x2000,
-    SET_SINGLE_BUFFER_MODE     = 0x4000,
-    SET_S3D_COMP               = 0x8000,
-    SET_CVP_METADATA           = 0x00010000,
-    SET_VIDEO_HISTOGRAM_STATS  = 0x00020000
-};
-
-enum DispFetchParamType {
-    GET_VT_TIMESTAMP          = 0x0001,
-    GET_COLOR_METADATA        = 0x0002,
-    GET_PP_PARAM_INTERLACED   = 0x0004,
-    GET_VIDEO_PERF_MODE       = 0x0008,
-    GET_GRAPHICS_METADATA     = 0x0010,
-    GET_UNUSED                = 0X0020,
-    GET_UBWC_CR_STATS_INFO    = 0x0040,
-    GET_BUFFER_GEOMETRY       = 0x0080,
-    GET_REFRESH_RATE          = 0x0100,
-    GET_COLOR_SPACE           = 0x0200,
-    GET_MAP_SECURE_BUFFER     = 0x0400,
-    GET_S3D_FORMAT            = 0x0800,
-    GET_LINEAR_FORMAT         = 0x1000,
-    GET_IGC                   = 0x2000,
-    GET_SINGLE_BUFFER_MODE    = 0x4000,
-    GET_S3D_COMP              = 0x8000,
-    GET_CVP_METADATA          = 0x00010000,
-    GET_VIDEO_HISTOGRAM_STATS = 0x00020000
-};
-
-/* Frame type bit mask */
-#define QD_SYNC_FRAME (0x1 << 0)
-
-struct private_handle_t;
-int setMetaData(struct private_handle_t *handle, enum DispParamType paramType,
-                void *param);
-int setMetaDataVa(struct MetaData_t* data, enum DispParamType paramType,
-                  void *param);
-
-int getMetaData(struct private_handle_t *handle,
-                enum DispFetchParamType paramType,
-                void *param);
-int getMetaDataVa(struct MetaData_t* data, enum DispFetchParamType paramType,
-                  void *param);
-
-int copyMetaData(struct private_handle_t *src, struct private_handle_t *dst);
-int copyMetaDataVaToHandle(struct MetaData_t *src, struct private_handle_t *dst);
-int copyMetaDataHandleToVa(struct private_handle_t* src, struct MetaData_t *dst);
-int copyMetaDataVaToVa(struct MetaData_t *src, struct MetaData_t *dst);
-
-int clearMetaData(struct private_handle_t *handle, enum DispParamType paramType);
-int clearMetaDataVa(struct MetaData_t *data, enum DispParamType paramType);
-
-unsigned long getMetaDataSize();
-
-// Map, access metadata and unmap. Used by clients that do not import/free but
-//  clone and delete native_handle
-int setMetaDataAndUnmap(struct private_handle_t *handle, enum DispParamType paramType,
-                        void *param);
-int getMetaDataAndUnmap(struct private_handle_t *handle,
-                        enum DispFetchParamType paramType,
-                        void *param);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _QDMETADATA_H */
-
diff --git a/display-commonsys-intf/libqdmetadata/qd_utils.cpp b/display-commonsys-intf/libqdmetadata/qd_utils.cpp
deleted file mode 100644
index ac5d094..0000000
--- a/display-commonsys-intf/libqdmetadata/qd_utils.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, 2020 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 <unistd.h>
-#include <gralloc_priv.h>
-#include "qd_utils.h"
-
-static const int kFBNodeMax = 4;
-namespace qdutils {
-
-static int parseLine(char *input, char *tokens[], const uint32_t maxToken, uint32_t *count) {
-    char *tmpToken = NULL;
-    char *tmpPtr;
-    uint32_t index = 0;
-    const char *delim = ", =\n";
-    if (!input) {
-      return -1;
-    }
-    tmpToken = strtok_r(input, delim, &tmpPtr);
-    while (tmpToken && index < maxToken) {
-      tokens[index++] = tmpToken;
-      tmpToken = strtok_r(NULL, delim, &tmpPtr);
-    }
-    *count = index;
-
-    return 0;
-}
-
-static int getExternalNode(const char *type) {
-    FILE *displayDeviceFP = NULL;
-    char fbType[MAX_FRAME_BUFFER_NAME_SIZE];
-    char msmFbTypePath[MAX_FRAME_BUFFER_NAME_SIZE];
-    int j = 0;
-
-    for(j = 0; j < kFBNodeMax; j++) {
-        snprintf (msmFbTypePath, sizeof(msmFbTypePath),
-                  "/sys/devices/virtual/graphics/fb%d/msm_fb_type", j);
-        displayDeviceFP = fopen(msmFbTypePath, "r");
-        if(displayDeviceFP) {
-            fread(fbType, sizeof(char), MAX_FRAME_BUFFER_NAME_SIZE,
-                    displayDeviceFP);
-            if(strncmp(fbType, type, strlen(type)) == 0) {
-                ALOGD("%s: %s is at fb%d", __func__, type, j);
-                fclose(displayDeviceFP);
-                break;
-            }
-            fclose(displayDeviceFP);
-        } else {
-            ALOGE("%s: Failed to open fb node %s", __func__, msmFbTypePath);
-        }
-    }
-
-    if (j < kFBNodeMax)
-        return j;
-    else
-        ALOGE("%s: Failed to find %s node", __func__, type);
-
-    return -1;
-}
-
-int getHDMINode(void) {
-    return getExternalNode("dtv panel");
-}
-
-int getEdidRawData(char *buffer)
-{
-    int size;
-    int edidFile;
-    char msmFbTypePath[MAX_FRAME_BUFFER_NAME_SIZE];
-    int node_id = getHDMINode();
-
-    if (node_id < 0) {
-        ALOGE("%s no HDMI node found", __func__);
-        return 0;
-    }
-
-    snprintf(msmFbTypePath, sizeof(msmFbTypePath),
-                 "/sys/devices/virtual/graphics/fb%d/edid_raw_data", node_id);
-
-    edidFile = open(msmFbTypePath, O_RDONLY, 0);
-
-    if (edidFile < 0) {
-        ALOGE("%s no edid raw data found %s", __func__,msmFbTypePath);
-        return 0;
-    }
-
-    size = (int)read(edidFile, (char*)buffer, EDID_RAW_DATA_SIZE);
-    close(edidFile);
-    return size;
-}
-
-bool isDPConnected() {
-    char connectPath[MAX_FRAME_BUFFER_NAME_SIZE];
-    FILE *connectFile = NULL;
-    size_t len = MAX_STRING_LENGTH;
-    char stringBuffer[MAX_STRING_LENGTH];
-    char *line = stringBuffer;
-
-    int nodeId = getExternalNode("dp panel");
-    if (nodeId < 0) {
-        ALOGE("%s no DP node found", __func__);
-        return false;
-    }
-
-    snprintf(connectPath, sizeof(connectPath),
-             "/sys/devices/virtual/graphics/fb%d/connected", nodeId);
-
-    connectFile = fopen(connectPath, "rb");
-    if (!connectFile) {
-        ALOGW("Failed to open connect node for device node %s", connectPath);
-        return false;
-    }
-
-    if (getline(&line, &len, connectFile) < 0) {
-        fclose(connectFile);
-        return false;
-    }
-
-    fclose(connectFile);
-
-    return atoi(line);
-}
-
-int getDPTestConfig(uint32_t *panelBpp, uint32_t *patternType) {
-    if (!panelBpp || !patternType) {
-        return -1;
-    }
-
-    char configPath[MAX_FRAME_BUFFER_NAME_SIZE];
-    FILE *configFile = NULL;
-    uint32_t tokenCount = 0;
-    const uint32_t maxCount = 10;
-    char *tokens[maxCount] = { NULL };
-    size_t len = MAX_STRING_LENGTH;
-    char stringBuffer[MAX_STRING_LENGTH];
-    char *line = stringBuffer;
-
-    int nodeId = getExternalNode("dp panel");
-    if (nodeId < 0) {
-        ALOGE("%s no DP node found", __func__);
-        return -EINVAL;
-    }
-
-    snprintf(configPath, sizeof(configPath),
-             "/sys/devices/virtual/graphics/fb%d/config", nodeId);
-
-    configFile = fopen(configPath, "rb");
-    if (!configFile) {
-        ALOGW("Failed to open config node for device node %s", configPath);
-        return -EINVAL;
-    }
-
-    while (getline(&line, &len, configFile) != -1) {
-        if (!parseLine(line, tokens, maxCount, &tokenCount)) {
-            if (tokens[0] != NULL) {
-              if (!strncmp(tokens[0], "bpp", strlen("bpp"))) {
-                *panelBpp = static_cast<uint32_t>(atoi(tokens[1]));
-              } else  if (!strncmp(tokens[0], "pattern", strlen("pattern"))) {
-                *patternType = static_cast<uint32_t>(atoi(tokens[1]));
-              }
-            }
-        }
-    }
-
-    fclose(configFile);
-
-    return 0;
-}
-
-DriverType getDriverType() {
-    const char *fb_caps = "/sys/devices/virtual/graphics/fb0/mdp/caps";
-    // 0 - File exists
-    return access(fb_caps, F_OK) ? DriverType::DRM : DriverType::FB;
-}
-
-const char *GetHALPixelFormatString(int format) {
-  switch (format) {
-  case HAL_PIXEL_FORMAT_RGBA_8888:
-    return "RGBA_8888";
-  case HAL_PIXEL_FORMAT_RGBX_8888:
-    return "RGBX_8888";
-  case HAL_PIXEL_FORMAT_RGB_888:
-    return "RGB_888";
-  case HAL_PIXEL_FORMAT_RGB_565:
-    return "RGB_565";
-  case HAL_PIXEL_FORMAT_BGR_565:
-    return "BGR_565";
-  case HAL_PIXEL_FORMAT_BGRA_8888:
-    return "BGRA_8888";
-  case HAL_PIXEL_FORMAT_RGBA_5551:
-    return "RGBA_5551";
-  case HAL_PIXEL_FORMAT_RGBA_4444:
-    return "RGBA_4444";
-  case HAL_PIXEL_FORMAT_YV12:
-    return "YV12";
-  case HAL_PIXEL_FORMAT_YCbCr_422_SP:
-    return "YCbCr_422_SP_NV16";
-  case HAL_PIXEL_FORMAT_YCrCb_420_SP:
-    return "YCrCb_420_SP_NV21";
-  case HAL_PIXEL_FORMAT_YCbCr_422_I:
-    return "YCbCr_422_I_YUY2";
-  case HAL_PIXEL_FORMAT_YCrCb_422_I:
-    return "YCrCb_422_I_YVYU";
-  case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
-    return "NV12_ENCODEABLE";
-  case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
-    return "YCbCr_420_SP_TILED_TILE_4x2";
-  case HAL_PIXEL_FORMAT_YCbCr_420_SP:
-    return "YCbCr_420_SP";
-  case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO:
-    return "YCrCb_420_SP_ADRENO";
-  case HAL_PIXEL_FORMAT_YCrCb_422_SP:
-    return "YCrCb_422_SP";
-  case HAL_PIXEL_FORMAT_R_8:
-    return "R_8";
-  case HAL_PIXEL_FORMAT_RG_88:
-    return "RG_88";
-  case HAL_PIXEL_FORMAT_INTERLACE:
-    return "INTERLACE";
-  case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
-    return "YCbCr_420_SP_VENUS";
-  case HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS:
-    return "YCrCb_420_SP_VENUS";
-  case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
-    return "YCbCr_420_SP_VENUS_UBWC";
-  case HAL_PIXEL_FORMAT_RGBA_1010102:
-    return "RGBA_1010102";
-  case HAL_PIXEL_FORMAT_ARGB_2101010:
-    return "ARGB_2101010";
-  case HAL_PIXEL_FORMAT_RGBX_1010102:
-    return "RGBX_1010102";
-  case HAL_PIXEL_FORMAT_XRGB_2101010:
-    return "XRGB_2101010";
-  case HAL_PIXEL_FORMAT_BGRA_1010102:
-    return "BGRA_1010102";
-  case HAL_PIXEL_FORMAT_ABGR_2101010:
-    return "ABGR_2101010";
-  case HAL_PIXEL_FORMAT_BGRX_1010102:
-    return "BGRX_1010102";
-  case HAL_PIXEL_FORMAT_XBGR_2101010:
-    return "XBGR_2101010";
-  case HAL_PIXEL_FORMAT_YCbCr_420_P010:
-    return "YCbCr_420_P010";
-  case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
-    return "YCbCr_420_TP10_UBWC";
-  case HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS:
-    return "YCbCr_420_P010_VENUS";
-  default:
-    return "Unknown_format";
-  }
-}
-
-}; //namespace qdutils
diff --git a/display-commonsys-intf/libqdmetadata/qd_utils.h b/display-commonsys-intf/libqdmetadata/qd_utils.h
deleted file mode 100644
index 0b0816a..0000000
--- a/display-commonsys-intf/libqdmetadata/qd_utils.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2013, 2017, 2020 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 or 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 _QD_UTIL_MISC_H
-#define _QD_UTIL_MISC_H
-
-#include <utils/threads.h>
-#include <linux/fb.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <utils/Errors.h>
-#include <log/log.h>
-
-#include <linux/fb.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <sys/resource.h>
-#include <cutils/properties.h>
-#include <hardware/hwcomposer.h>
-
-namespace qdutils {
-
-enum HWQueryType {
-    HAS_UBWC = 1,
-    HAS_WB_UBWC = 2
-};
-
-enum {
-    EDID_RAW_DATA_SIZE = 640,
-    MAX_FRAME_BUFFER_NAME_SIZE = 128,
-    MAX_SYSFS_FILE_PATH = 255,
-    MAX_STRING_LENGTH = 1024,
-};
-
-int getEdidRawData(char *buffer);
-int getHDMINode(void);
-bool isDPConnected();
-int getDPTestConfig(uint32_t *panelBpp, uint32_t *patternType);
-
-enum class DriverType {
-    FB = 0,
-    DRM,
-};
-DriverType getDriverType();
-const char *GetHALPixelFormatString(int format);
-
-}; //namespace qdutils
-#endif
diff --git a/display-commonsys-intf/services/config/client_interface.h b/display-commonsys-intf/services/config/client_interface.h
deleted file mode 100644
index faf772a..0000000
--- a/display-commonsys-intf/services/config/client_interface.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2020 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 __CLIENT_INTERFACE_H__
-#define __CLIENT_INTERFACE_H__
-
-#include "config_defs.h"
-
-namespace DisplayConfig {
-
-class ClientInterface : public ConfigInterface  {
- public:
-  static int Create(std::string client_name, ConfigCallback *callback,
-                    ClientInterface **intf);
-  static void Destroy(ClientInterface *intf);
-
- protected:
-  virtual ~ClientInterface() { }
-};
-
-}  // namespace DisplayConfig
-
-#endif  // __CLIENT_INTERFACE_H__
diff --git a/display-commonsys-intf/services/config/config_defs.h b/display-commonsys-intf/services/config/config_defs.h
deleted file mode 100644
index 0009ac8..0000000
--- a/display-commonsys-intf/services/config/config_defs.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
-* Copyright (c) 2020 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 __CONFIG_DEFS_H__
-#define __CONFIG_DEFS_H__
-
-#include <vector>
-#include <string>
-
-// #defines specifying the API level supported
-// Client can use these API level #ifdefs in their implementation to call the
-// corresponding DisplayConfig API independent of the underlying DisplayConfig
-// implementation being present. When this ifdef gets enabled in this header, the
-// client code will automatically get compiled.
-#define DISPLAY_CONFIG_API_LEVEL_0
-
-namespace DisplayConfig {
-
-// enum definitions
-enum class DisplayType : int {
-  kInvalid,
-  kPrimary,
-  kExternal,
-  kVirtual,
-  kBuiltIn2,
-};
-
-enum class ExternalStatus : int {
-  kInvalid,
-  kOffline,
-  kOnline,
-  kPause,
-  kResume,
-};
-
-enum class DynRefreshRateOp : int {
-  kInvalid,
-  kDisableMetadata,
-  kEnableMetadata,
-  kSetBinder,
-};
-
-enum class DisplayPortType : int {
-  kInvalid,
-  kDefault,
-  kDsi,
-  kDtv,
-  kWriteback,
-  kLvds,
-  kEdp,
-  kDp,
-};
-
-enum class PowerMode : int {
-  kOff,
-  kDoze,
-  kOn,
-  kDozeSuspend,
-};
-
-enum class QsyncMode : int {
-  kNone,
-  kWaitForFencesOneFrame,
-  kWaitForFencesEachFrame,
-  kWaitForCommitEachFrame,
-};
-
-enum class TUIEventType : int {
-  kNone,
-  kPrepareTUITransition,
-  kStartTUITransition,
-  kEndTUITransition,
-};
-
-// Input and Output Params structures
-struct Attributes {
-  uint32_t vsync_period = 0;
-  uint32_t x_res = 0;
-  uint32_t y_res = 0;
-  float x_dpi = 0;
-  float y_dpi = 0;
-  DisplayPortType panel_type = DisplayPortType::kDefault;
-  bool is_yuv = 0;
-};
-
-struct HDRCapsParams {
-  std::vector<int> supported_hdr_types = {};
-  float max_luminance = 0;
-  float max_avg_luminance = 0;
-  float min_luminance = 0;
-};
-
-struct StatusParams {
-  DisplayType dpy = DisplayType::kInvalid;
-  ExternalStatus status = ExternalStatus::kInvalid;
-};
-
-struct DynRefreshRateParams {
-  DynRefreshRateOp op = DynRefreshRateOp::kInvalid;
-  uint32_t refresh_rate = 0;
-};
-
-struct ConfigParams {
-  DisplayType dpy = DisplayType::kInvalid;
-  uint32_t config = 0;
-};
-
-struct AttributesParams {
-  uint32_t config_index = 0;
-  DisplayType dpy = DisplayType::kInvalid;
-};
-
-struct MinHdcpEncLevelChangedParams {
-  DisplayType dpy = DisplayType::kInvalid;
-  uint32_t min_enc_level = 0;
-};
-
-struct PartialUpdateParams {
-  DisplayType dpy = DisplayType::kInvalid;
-  bool enable = 0;
-};
-
-struct AnimationParams {
-  uint64_t display_id = 0;
-  bool animating = 0;
-};
-
-struct IdlePcParams {
-  bool enable = 0;
-  bool synchronous = 0;
-};
-
-struct DppsAdRoiParams {
-  uint32_t display_id = 0;
-  uint32_t h_start = 0;
-  uint32_t h_end = 0;
-  uint32_t v_start = 0;
-  uint32_t v_end = 0;
-  uint32_t factor_in = 0;
-  uint32_t factor_out = 0;
-};
-
-struct PowerModeParams {
-  uint32_t disp_id = 0;
-  PowerMode power_mode = PowerMode::kOff;
-};
-
-struct LayerMaskParams {
-  uint32_t disp_id = 0;
-  uint64_t layer_id = 0;
-};
-
-struct PanelLumAttrParams {
-  uint32_t disp_id = 0;
-  float min_lum = 0;
-  float max_lum = 0;
-};
-
-struct Rect {
-  uint32_t left = 0;
-  uint32_t top = 0;
-  uint32_t right = 0;
-  uint32_t bottom = 0;
-};
-
-struct CwbBufferParams {
-  uint32_t disp_id = 0;
-  Rect rect;
-  bool post_processed = 0;
-};
-
-struct DsiClkParams {
-  uint32_t disp_id = 0;
-  uint64_t bit_clk = 0;
-};
-
-struct QsyncModeParams {
-  uint32_t disp_id = 0;
-  QsyncMode mode = QsyncMode::kNone;
-};
-
-struct SmartPanelCfgParams {
-  uint32_t disp_id = 0;
-  uint32_t config_id = 0;
-};
-
-struct VdsParams {
-  uint32_t width = 0;
-  uint32_t height = 0;
-  int format = 0;
-};
-
-struct RotatorFormatParams {
-  int hal_format = 0;
-  bool ubwc = 0;
-};
-
-struct QsyncCallbackParams {
-  bool qsync_enabled = 0;
-  int refresh_rate = 0;
-  int qsync_refresh_rate = 0;
-};
-
-struct TUIEventParams {
-  DisplayType dpy = DisplayType::kInvalid;
-  TUIEventType tui_event_type = TUIEventType::kNone;
-};
-
-/* Callback Interface */
-class ConfigCallback {
- public:
-  virtual void NotifyCWBBufferDone(int error, const native_handle_t *buffer) { }
-  virtual void NotifyQsyncChange(bool qsync_enabled, int refresh_rate, int qsync_refresh_rate) { }
-
- protected:
-  virtual ~ConfigCallback() { }
-};
-
-#define DEFAULT_RET { return -EINVAL; }
-
-/* Config Interface */
-class ConfigInterface {
- public:
-  virtual int IsDisplayConnected(DisplayType dpy, bool *connected) DEFAULT_RET
-  virtual int SetDisplayStatus(DisplayType dpy, ExternalStatus status) DEFAULT_RET
-  virtual int ConfigureDynRefreshRate(DynRefreshRateOp op, uint32_t refresh_rate) DEFAULT_RET
-  virtual int GetConfigCount(DisplayType dpy, uint32_t *count) DEFAULT_RET
-  virtual int GetActiveConfig(DisplayType dpy, uint32_t *config) DEFAULT_RET
-  virtual int SetActiveConfig(DisplayType dpy, uint32_t config) DEFAULT_RET
-  virtual int GetDisplayAttributes(uint32_t config_index, DisplayType dpy,
-                                   Attributes *attributes) DEFAULT_RET
-  virtual int SetPanelBrightness(uint32_t level) DEFAULT_RET
-  virtual int GetPanelBrightness(uint32_t *level) DEFAULT_RET
-  virtual int MinHdcpEncryptionLevelChanged(DisplayType dpy, uint32_t min_enc_level) DEFAULT_RET
-  virtual int RefreshScreen() DEFAULT_RET
-  virtual int ControlPartialUpdate(DisplayType dpy, bool enable) DEFAULT_RET
-  virtual int ToggleScreenUpdate(bool on) DEFAULT_RET
-  virtual int SetIdleTimeout(uint32_t value) DEFAULT_RET
-  virtual int GetHDRCapabilities(DisplayType dpy, HDRCapsParams *caps) DEFAULT_RET
-  virtual int SetCameraLaunchStatus(uint32_t on) DEFAULT_RET
-  virtual int DisplayBWTransactionPending(bool *status) DEFAULT_RET
-  virtual int SetDisplayAnimating(uint64_t display_id, bool animating) DEFAULT_RET
-  virtual int ControlIdlePowerCollapse(bool enable, bool synchronous) DEFAULT_RET
-  virtual int GetWriteBackCapabilities(bool *is_wb_ubwc_supported) DEFAULT_RET
-  virtual int SetDisplayDppsAdROI(uint32_t display_id, uint32_t h_start, uint32_t h_end,
-                                  uint32_t v_start, uint32_t v_end, uint32_t factor_in,
-                                  uint32_t factor_out) DEFAULT_RET
-  virtual int UpdateVSyncSourceOnPowerModeOff() DEFAULT_RET
-  virtual int UpdateVSyncSourceOnPowerModeDoze() DEFAULT_RET
-  virtual int SetPowerMode(uint32_t disp_id, PowerMode power_mode) DEFAULT_RET
-  virtual int IsPowerModeOverrideSupported(uint32_t disp_id, bool *supported) DEFAULT_RET
-  virtual int IsHDRSupported(uint32_t disp_id, bool *supported) DEFAULT_RET
-  virtual int IsWCGSupported(uint32_t disp_id, bool *supported) DEFAULT_RET
-  virtual int SetLayerAsMask(uint32_t disp_id, uint64_t layer_id) DEFAULT_RET
-  virtual int GetDebugProperty(const std::string prop_name, std::string *value) DEFAULT_RET
-  virtual int GetActiveBuiltinDisplayAttributes(Attributes *attr) DEFAULT_RET
-  virtual int SetPanelLuminanceAttributes(uint32_t disp_id, float min_lum,
-                                          float max_lum) DEFAULT_RET
-  virtual int IsBuiltInDisplay(uint32_t disp_id, bool *is_builtin) DEFAULT_RET
-  virtual int IsAsyncVDSCreationSupported(bool *supported) DEFAULT_RET
-  virtual int CreateVirtualDisplay(uint32_t width, uint32_t height, int format) DEFAULT_RET
-  virtual int GetSupportedDSIBitClks(uint32_t disp_id, std::vector<uint64_t> *bit_clks) DEFAULT_RET
-  virtual int GetDSIClk(uint32_t disp_id, uint64_t *bit_clk) DEFAULT_RET
-  virtual int SetDSIClk(uint32_t disp_id, uint64_t bit_clk) DEFAULT_RET
-  virtual int SetCWBOutputBuffer(uint32_t disp_id, const Rect rect, bool post_processed,
-                                 const native_handle_t *buffer) DEFAULT_RET
-  virtual int SetQsyncMode(uint32_t disp_id, QsyncMode mode) DEFAULT_RET
-  virtual int IsSmartPanelConfig(uint32_t disp_id, uint32_t config_id, bool *is_smart) DEFAULT_RET
-  virtual int IsRotatorSupportedFormat(int hal_format, bool ubwc, bool *supported) DEFAULT_RET
-  virtual int ControlQsyncCallback(bool enable) DEFAULT_RET
-  virtual int SendTUIEvent(DisplayType dpy, TUIEventType event_type) DEFAULT_RET
-  virtual int GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id) DEFAULT_RET
-  virtual int GetSupportedDisplayRefreshRates(
-      DisplayType dpy, std::vector<uint32_t> *supported_refresh_rates) DEFAULT_RET
-
-  // deprecated APIs
-  virtual int GetDebugProperty(const std::string prop_name, std::string value) DEFAULT_RET
-  virtual int GetSupportedDSIBitClks(uint32_t disp_id, std::vector<uint64_t> bit_clks) DEFAULT_RET
-
- protected:
-  virtual ~ConfigInterface() { }
-};
-
-}  // namespace DisplayConfig
-
-#endif  // __CONFIG_DEFS_H__
diff --git a/display-commonsys-intf/services/config/device_interface.h b/display-commonsys-intf/services/config/device_interface.h
deleted file mode 100644
index 7d85910..0000000
--- a/display-commonsys-intf/services/config/device_interface.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2020 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_INTERFACE_H__
-#define __DEVICE_INTERFACE_H__
-
-#include "config_defs.h"
-
-namespace DisplayConfig {
-
-class ClientContext {
- public:
-  virtual int RegisterClientContext(std::shared_ptr<ConfigCallback> callback,
-                                    ConfigInterface **intf) { return -EINVAL; }
-  virtual void UnRegisterClientContext(ConfigInterface *intf) { }
-
- protected:
-  virtual ~ClientContext() { }
-};
-
-class DeviceInterface {
- public:
-  static int RegisterDevice(ClientContext *intf);
-
- protected:
-  virtual ~DeviceInterface() { }
-};
-
-}  // namespace DisplayConfig
-
-#endif  // __DEVICE_INTERFACE_H__
diff --git a/display-commonsys-intf/services/config/src/Android.bp b/display-commonsys-intf/services/config/src/Android.bp
deleted file mode 100644
index 27df5b8..0000000
--- a/display-commonsys-intf/services/config/src/Android.bp
+++ /dev/null
@@ -1,24 +0,0 @@
-cc_library_shared {
-    name: "libdisplayconfig.qti",
-    vendor_available: true,
-    system_ext_specific: true,
-    cflags: [
-        "-Wno-sign-conversion",
-        "-Wno-unused-parameter",
-        "-DLOG_TAG=\"libdisplayconfigqti\"",
-    ],
-    shared_libs: [
-        "libhidlbase",
-        "libutils",
-        "vendor.display.config@2.0"
-    ],
-    header_libs: ["libhardware_headers", "display_intf_headers"],
-    srcs: [
-        "client_interface.cpp",
-        "client_impl.cpp",
-        "device_impl.cpp",
-        "device_interface.cpp",
-    ],
-    export_header_lib_headers: ["display_intf_headers"],
-}
-
diff --git a/display-commonsys-intf/services/config/src/client_impl.cpp b/display-commonsys-intf/services/config/src/client_impl.cpp
deleted file mode 100644
index 9790f21..0000000
--- a/display-commonsys-intf/services/config/src/client_impl.cpp
+++ /dev/null
@@ -1,937 +0,0 @@
-/*
-* Copyright (c) 2020 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 <string>
-#include <vector>
-
-#include "client_impl.h"
-
-namespace DisplayConfig {
-
-int ClientImpl::Init(std::string client_name, ConfigCallback *callback) {
-  display_config_ = IDisplayConfig::getService();
-  // Unable to find Display Config 2.0 service. Fail Init.
-  if (!display_config_) {
-    return -1;
-  }
-  int32_t error = 0;
-  uint64_t handle = 0;
-  auto hidl_callback = [&error, &handle] (int32_t err, uint64_t client_handle) {
-    error = err;
-    handle = client_handle;
-  };
-  int pid = getpid();
-  android::sp<ClientCallback> client_cb(new ClientCallback(callback));
-  display_config_->registerClient(client_name + std::to_string(pid), client_cb,
-                                  hidl_callback);
-  client_handle_ = handle;
-
-  return 0;
-}
-
-void ClientImpl::DeInit() {
-  int32_t error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kDestroy, {}, {}, hidl_cb);
-  display_config_.clear();
-  display_config_ = nullptr;
-}
-
-int ClientImpl::IsDisplayConnected(DisplayType dpy, bool *connected) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&dpy), sizeof(DisplayType));
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsDisplayConnected, input_params, {}, hidl_cb);
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *connected = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetDisplayStatus(DisplayType dpy, ExternalStatus status) {
-  struct StatusParams input = {dpy, status};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct StatusParams));
-  int error = 0;
-
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetDisplayStatus, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::ConfigureDynRefreshRate(DynRefreshRateOp op, uint32_t refresh_rate) {
-  struct DynRefreshRateParams input = {op, refresh_rate};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input),
-                             sizeof(struct DynRefreshRateParams));
-  int error = 0;
-
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kConfigureDynRefreshRate, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetConfigCount(DisplayType dpy, uint32_t *count) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&dpy), sizeof(DisplayType));
-  const uint32_t *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetConfigCount, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const uint32_t*>(data);
-  *count = *output;
-
-  return error;
-}
-
-int ClientImpl::GetActiveConfig(DisplayType dpy, uint32_t *config) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&dpy), sizeof(DisplayType));
-  const uint32_t *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetActiveConfig, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const uint32_t*>(data);
-  *config = *output;
-
-  return error;
-}
-
-int ClientImpl::SetActiveConfig(DisplayType dpy, uint32_t config) {
-  struct ConfigParams input = {dpy, config};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct ConfigParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetActiveConfig, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetDisplayAttributes(uint32_t config_index, DisplayType dpy,
-                                     Attributes *attributes) {
-  struct AttributesParams input = {config_index, dpy};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct AttributesParams));
-  const struct Attributes *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetDisplayAttributes, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const Attributes*>(data);
-  if (!error) {
-    *attributes = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetPanelBrightness(uint32_t level) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&level), sizeof(uint32_t));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetPanelBrightness, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetPanelBrightness(uint32_t *level) {
-  const uint32_t *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetPanelBrightness, {}, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const uint32_t*>(data);
-  if (!error) {
-    *level = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::MinHdcpEncryptionLevelChanged(DisplayType dpy, uint32_t min_enc_level) {
-  struct MinHdcpEncLevelChangedParams input = {dpy, min_enc_level};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input),
-                             sizeof(struct MinHdcpEncLevelChangedParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kMinHdcpEncryptionLevelChanged,
-                           input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::RefreshScreen() {
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kRefreshScreen, {}, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::ControlPartialUpdate(DisplayType dpy, bool enable) {
-  struct PartialUpdateParams input = {dpy, enable};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input),
-                             sizeof(struct PartialUpdateParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kControlPartialUpdate, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::ToggleScreenUpdate(bool on) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&on), sizeof(bool));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kToggleScreenUpdate, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::SetIdleTimeout(uint32_t value) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&value), sizeof(uint32_t));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetIdleTimeout, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetHDRCapabilities(DisplayType dpy, HDRCapsParams *caps) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&dpy), sizeof(DisplayType));
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetHdrCapabilities, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-
-  if (!error) {
-    const int32_t *hdr_caps;
-    const float *lum;
-    size_t size = output_params.size();
-    size_t hdr_caps_size = size - 3 * sizeof(float);
-    hdr_caps_size /= sizeof(int32_t);
-    hdr_caps = reinterpret_cast<const int32_t*>(data);
-    for (size_t i = 0; i < hdr_caps_size; i++) {
-      caps->supported_hdr_types.push_back(*hdr_caps);
-      hdr_caps++;
-    }
-    lum = reinterpret_cast<const float *>(hdr_caps);
-    caps->max_luminance = lum[0];
-    caps->max_avg_luminance = lum[1];
-    caps->min_luminance = lum[2];
-  }
-
-  return error;
-}
-
-int ClientImpl::SetCameraLaunchStatus(uint32_t on) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&on), sizeof(uint32_t));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetCameraLaunchStatus, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::DisplayBWTransactionPending(bool *status) {
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kDisplayBwTransactionPending, {}, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-  if (!error) {
-    *status = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetDisplayAnimating(uint64_t display_id, bool animating) {
-  struct AnimationParams input = {display_id, animating};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct AnimationParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetDisplayAnimating, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::ControlIdlePowerCollapse(bool enable, bool synchronous) {
-  struct IdlePcParams input = {enable, synchronous};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct IdlePcParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kControlIdlePowerCollapse, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetWriteBackCapabilities(bool *is_wb_ubwc_supported) {
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetWritebackCapabilities, {}, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-  if (!error) {
-    *is_wb_ubwc_supported = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetDisplayDppsAdROI(uint32_t display_id, uint32_t h_start,
-                                    uint32_t h_end, uint32_t v_start, uint32_t v_end,
-                                    uint32_t factor_in, uint32_t factor_out) {
-  struct DppsAdRoiParams input = {display_id, h_start, h_end, v_start, v_end,
-                                     factor_in, factor_out};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct DppsAdRoiParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetDisplayDppsAdRoi, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::UpdateVSyncSourceOnPowerModeOff() {
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kUpdateVsyncSourceOnPowerModeOff, {}, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::UpdateVSyncSourceOnPowerModeDoze() {
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kUpdateVsyncSourceOnPowerModeDoze, {}, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::SetPowerMode(uint32_t disp_id, PowerMode power_mode) {
-  struct PowerModeParams input = {disp_id, power_mode};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct PowerModeParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetPowerMode, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::IsPowerModeOverrideSupported(uint32_t disp_id, bool *supported) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_id), sizeof(uint32_t));
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsPowerModeOverrideSupported,
-                           input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *supported = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::IsHDRSupported(uint32_t disp_id, bool *supported) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_id), sizeof(uint32_t));
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsHdrSupported, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *supported = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::IsWCGSupported(uint32_t disp_id, bool *supported) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_id), sizeof(int32_t));
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsWcgSupported, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *supported = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetLayerAsMask(uint32_t disp_id, uint64_t layer_id) {
-  struct LayerMaskParams input = {disp_id, layer_id};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct LayerMaskParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetLayerAsMask, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetDebugProperty(const std::string prop_name, std::string *value) {
-  ByteStream input_params;
-  std::string prop(prop_name);
-  prop += '\0';
-  uint8_t *data_input = reinterpret_cast<uint8_t*>(const_cast<char*>(prop.data()));
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(data_input),
-                             prop.size() * sizeof(char));
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetDebugProperty, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  const char *name = reinterpret_cast<const char *>(data);
-  if (!error) {
-    std::string output(name);
-    *value = output;
-  }
-
-  return error;
-}
-
-int ClientImpl::GetActiveBuiltinDisplayAttributes(Attributes *attr) {
-  const struct Attributes *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetActiveBuiltinDisplayAttributes, {}, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const Attributes*>(data);
-  if (!error) {
-    *attr = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetPanelLuminanceAttributes(uint32_t disp_id, float min_lum, float max_lum) {
-  struct PanelLumAttrParams input = {disp_id, min_lum, max_lum};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct PanelLumAttrParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetPanelLuminanceAttributes, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::IsBuiltInDisplay(uint32_t disp_id, bool *is_builtin) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_id), sizeof(uint32_t));
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsBuiltinDisplay, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *is_builtin = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetCWBOutputBuffer(uint32_t disp_id, const Rect rect, bool post_processed,
-                                   const native_handle_t *buffer) {
-  struct CwbBufferParams input = {disp_id, rect, post_processed};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct CwbBufferParams));
-
-  hidl_handle handle = buffer;
-  std::vector<hidl_handle> handle_vector;
-  handle_vector.push_back(buffer);
-  HandleStream input_handles = handle_vector;
-
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetCwbOutputBuffer, input_params,
-                           input_handles, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetSupportedDSIBitClks(uint32_t disp_id, std::vector<uint64_t> *bit_clks) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_id), sizeof(uint32_t));
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetSupportedDsiBitclks, input_params, {}, hidl_cb);
-
-  if (!error) {
-    const uint8_t *data = output_params.data();
-    const uint64_t *bit_clks_data = reinterpret_cast<const uint64_t *>(data);
-    int num_bit_clks = static_cast<int>(output_params.size() / sizeof(uint64_t));
-    for (int i = 0; i < num_bit_clks; i++) {
-      bit_clks->push_back(bit_clks_data[i]);
-    }
-  }
-
-  return error;
-}
-
-int ClientImpl::GetDSIClk(uint32_t disp_id, uint64_t *bit_clk) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_id), sizeof(uint32_t));
-  const uint64_t *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetDsiClk, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const uint64_t*>(data);
-
-  if (!error) {
-    *bit_clk = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::SetDSIClk(uint32_t disp_id, uint64_t bit_clk) {
-  struct DsiClkParams input = {disp_id, bit_clk};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct DsiClkParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetDsiClk, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::SetQsyncMode(uint32_t disp_id, QsyncMode mode) {
-  struct QsyncModeParams input = {disp_id, mode};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct QsyncModeParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSetQsyncMode, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::IsSmartPanelConfig(uint32_t disp_id, uint32_t config_id, bool *is_smart) {
-  struct SmartPanelCfgParams input = {disp_id, config_id};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input),
-                             sizeof(struct SmartPanelCfgParams));
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsSmartPanelConfig, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *is_smart = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::IsAsyncVDSCreationSupported(bool *supported) {
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsAsyncVdsSupported, {}, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *supported = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::CreateVirtualDisplay(uint32_t width, uint32_t height, int32_t format) {
-  struct VdsParams input = {width, height, format};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct VdsParams));
-  int error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kCreateVirtualDisplay, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::IsRotatorSupportedFormat(int hal_format, bool ubwc, bool *supported) {
-  struct RotatorFormatParams input = {hal_format, ubwc};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input),
-                             sizeof(struct RotatorFormatParams));
-  const bool *output;
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kIsRotatorSupportedFormat, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  output = reinterpret_cast<const bool*>(data);
-
-  if (!error) {
-    *supported = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::ControlQsyncCallback(bool enable) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&enable), sizeof(bool));
-  int32_t error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kControlQsyncCallback, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::SendTUIEvent(DisplayType dpy, TUIEventType event_type) {
-  struct TUIEventParams input = {dpy, event_type};
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&input), sizeof(struct TUIEventParams));
-  int32_t error = 0;
-  auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-  };
-
-  display_config_->perform(client_handle_, kSendTUIEvent, input_params, {}, hidl_cb);
-
-  return error;
-}
-
-int ClientImpl::GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_id), sizeof(uint32_t));
-  ByteStream output_params;
-
-  int error = 0;
-  auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetDisplayHwId, input_params, {}, hidl_cb);
-
-  const uint8_t *data = output_params.data();
-  const uint32_t *output = reinterpret_cast<const uint32_t*>(data);
-
-  if (!error) {
-    *display_hw_id = *output;
-  }
-
-  return error;
-}
-
-int ClientImpl::GetSupportedDisplayRefreshRates(DisplayType dpy,
-                                                std::vector<uint32_t> *supported_refresh_rates) {
-  ByteStream input_params;
-  input_params.setToExternal(reinterpret_cast<uint8_t *>(&dpy), sizeof(DisplayType));
-  ByteStream output_params;
-  int error = 0;
-  auto hidl_cb = [&error, &output_params](int32_t err, ByteStream params, HandleStream handles) {
-    error = err;
-    output_params = params;
-  };
-
-  display_config_->perform(client_handle_, kGetSupportedDisplayRefreshRates, input_params, {},
-                           hidl_cb);
-
-  if (!error) {
-    const uint8_t *data = output_params.data();
-    const uint32_t *refresh_rates_data = reinterpret_cast<const uint32_t *>(data);
-    int num_refresh_rates = static_cast<int>(output_params.size() / sizeof(uint32_t));
-    for (int i = 0; i < num_refresh_rates; i++) {
-      supported_refresh_rates->push_back(refresh_rates_data[i]);
-    }
-  }
-
-  return error;
-}
-
-void ClientCallback::ParseNotifyCWBBufferDone(const ByteStream &input_params,
-                                              const HandleStream &input_handles) {
-  const int *error;
-
-  if (callback_ == nullptr || input_params.size() == 0 || input_handles.size() == 0) {
-    return;
-  }
-
-  const uint8_t *data = input_params.data();
-  error = reinterpret_cast<const int*>(data);
-  hidl_handle buffer = input_handles[0];
-  callback_->NotifyCWBBufferDone(*error, buffer.getNativeHandle());
-}
-
-void ClientCallback::ParseNotifyQsyncChange(const ByteStream &input_params) {
-  const struct QsyncCallbackParams *qsync_data;
-
-  if (callback_ == nullptr || input_params.size() == 0) {
-    return;
-  }
-
-  const uint8_t *data = input_params.data();
-  qsync_data = reinterpret_cast<const QsyncCallbackParams*>(data);
-  callback_->NotifyQsyncChange(qsync_data->qsync_enabled, qsync_data->refresh_rate,
-                               qsync_data->qsync_refresh_rate);
-}
-
-Return<void> ClientCallback::perform(uint32_t op_code, const ByteStream &input_params,
-                                     const HandleStream &input_handles) {
-  switch (op_code) {
-    case kSetCwbOutputBuffer:
-      ParseNotifyCWBBufferDone(input_params, input_handles);
-      break;
-    case kControlQsyncCallback:
-      ParseNotifyQsyncChange(input_params);
-      break;
-    default:
-      break;
-  }
-
-  return Void();
-}
-
-}  // namespace DisplayConfig
diff --git a/display-commonsys-intf/services/config/src/client_impl.h b/display-commonsys-intf/services/config/src/client_impl.h
deleted file mode 100644
index 737ea19..0000000
--- a/display-commonsys-intf/services/config/src/client_impl.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-* Copyright (c) 2020 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 __CLIENT_IMPL_H__
-#define __CLIENT_IMPL_H__
-
-#include <vendor/display/config/2.0/IDisplayConfig.h>
-#include <hidl/HidlSupport.h>
-#include <config/client_interface.h>
-#include <string>
-#include <vector>
-
-#include "opcode_types.h"
-
-namespace DisplayConfig {
-
-using vendor::display::config::V2_0::IDisplayConfig;
-using vendor::display::config::V2_0::IDisplayConfigCallback;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::hidl_handle;
-using ::android::hardware::hidl_vec;
-
-typedef hidl_vec<uint8_t> ByteStream;
-typedef hidl_vec<hidl_handle> HandleStream;
-
-class ClientCallback: public IDisplayConfigCallback {
- public:
-  ClientCallback(ConfigCallback *cb) {
-    callback_ = cb;
-  }
-
- private:
-  virtual Return<void> perform(uint32_t op_code, const ByteStream &input_params,
-                               const HandleStream &input_handles);
-  void ParseNotifyCWBBufferDone(const ByteStream &input_params, const HandleStream &input_handles);
-  void ParseNotifyQsyncChange(const ByteStream &input_params);
-  ConfigCallback *callback_ = nullptr;
-};
-
-class ClientImpl : public ClientInterface {
- public:
-  int Init(std::string client_name, ConfigCallback *callback);
-  void DeInit();
-
-  virtual int IsDisplayConnected(DisplayType dpy, bool *connected);
-  virtual int SetDisplayStatus(DisplayType dpy, ExternalStatus status);
-  virtual int ConfigureDynRefreshRate(DynRefreshRateOp op, uint32_t refresh_rate);
-  virtual int GetConfigCount(DisplayType dpy, uint32_t *count);
-  virtual int GetActiveConfig(DisplayType dpy, uint32_t *config);
-  virtual int SetActiveConfig(DisplayType dpy, uint32_t config);
-  virtual int GetDisplayAttributes(uint32_t config_index, DisplayType dpy, Attributes *attributes);
-  virtual int SetPanelBrightness(uint32_t level);
-  virtual int GetPanelBrightness(uint32_t *level);
-  virtual int MinHdcpEncryptionLevelChanged(DisplayType dpy, uint32_t min_enc_level);
-  virtual int RefreshScreen();
-  virtual int ControlPartialUpdate(DisplayType dpy, bool enable);
-  virtual int ToggleScreenUpdate(bool on);
-  virtual int SetIdleTimeout(uint32_t value);
-  virtual int GetHDRCapabilities(DisplayType dpy, HDRCapsParams *caps);
-  virtual int SetCameraLaunchStatus(uint32_t on);
-  virtual int DisplayBWTransactionPending(bool *status);
-  virtual int SetDisplayAnimating(uint64_t display_id, bool animating);
-  virtual int ControlIdlePowerCollapse(bool enable, bool synchronous);
-  virtual int GetWriteBackCapabilities(bool *is_wb_ubwc_supported);
-  virtual int SetDisplayDppsAdROI(uint32_t display_id, uint32_t h_start, uint32_t h_end,
-                                  uint32_t v_start, uint32_t v_end, uint32_t factor_in,
-                                  uint32_t factor_out);
-  virtual int UpdateVSyncSourceOnPowerModeOff();
-  virtual int UpdateVSyncSourceOnPowerModeDoze();
-  virtual int SetPowerMode(uint32_t disp_id, PowerMode power_mode);
-  virtual int IsPowerModeOverrideSupported(uint32_t disp_id, bool *supported);
-  virtual int IsHDRSupported(uint32_t disp_id, bool *supported);
-  virtual int IsWCGSupported(uint32_t disp_id, bool *supported);
-  virtual int SetLayerAsMask(uint32_t disp_id, uint64_t layer_id);
-  virtual int GetDebugProperty(const std::string prop_name, std::string *value);
-  virtual int GetActiveBuiltinDisplayAttributes(Attributes *attr);
-  virtual int SetPanelLuminanceAttributes(uint32_t disp_id, float min_lum, float max_lum);
-  virtual int IsBuiltInDisplay(uint32_t disp_id, bool *is_builtin);
-  virtual int IsAsyncVDSCreationSupported(bool *supported);
-  virtual int CreateVirtualDisplay(uint32_t width, uint32_t height, int format);
-  virtual int GetSupportedDSIBitClks(uint32_t disp_id, std::vector<uint64_t> *bit_clks);
-  virtual int GetDSIClk(uint32_t disp_id, uint64_t *bit_clk);
-  virtual int SetDSIClk(uint32_t disp_id, uint64_t bit_clk);
-  virtual int SetCWBOutputBuffer(uint32_t disp_id, const Rect rect, bool post_processed,
-                                 const native_handle_t *buffer);
-  virtual int SetQsyncMode(uint32_t disp_id, QsyncMode mode);
-  virtual int IsSmartPanelConfig(uint32_t disp_id, uint32_t config_id, bool *is_smart);
-  virtual int IsRotatorSupportedFormat(int hal_format, bool ubwc, bool *supported);
-  virtual int ControlQsyncCallback(bool enable);
-  virtual int SendTUIEvent(DisplayType dpy, TUIEventType event_type);
-  virtual int GetDisplayHwId(uint32_t disp_id, uint32_t *display_hw_id);
-  virtual int GetSupportedDisplayRefreshRates(DisplayType dpy,
-                                              std::vector<uint32_t> *supported_refresh_rates);
-
- private:
-  android::sp<IDisplayConfig> display_config_ = nullptr;
-  uint64_t client_handle_ = 0;
-};
-
-}  // namespace DisplayConfig
-
-#endif  // __CLIENT_IMPL_H__
diff --git a/display-commonsys-intf/services/config/src/client_interface.cpp b/display-commonsys-intf/services/config/src/client_interface.cpp
deleted file mode 100644
index 9c9ecd2..0000000
--- a/display-commonsys-intf/services/config/src/client_interface.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2020 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 <string>
-
-#include "client_impl.h"
-
-namespace DisplayConfig {
-
-int ClientInterface::Create(std::string client_name, ConfigCallback *callback,
-                            ClientInterface **intf) {
-  if (!intf) {
-    return -1;
-  }
-
-  ClientImpl *impl = new ClientImpl();
-  if (!impl) {
-    return -1;
-  }
-
-  int ret = impl->Init(client_name, callback);
-  if (ret) {
-    delete impl;
-    return -1;
-  }
-
-  *intf = impl;
-  return 0;
-}
-
-void ClientInterface::Destroy(ClientInterface *intf) {
-  if (intf) {
-    ClientImpl *impl = static_cast<ClientImpl *>(intf);
-    impl->DeInit();
-    delete impl;
-  }
-}
-
-}  // namespace DisplayConfig
diff --git a/display-commonsys-intf/services/config/src/device_impl.cpp b/display-commonsys-intf/services/config/src/device_impl.cpp
deleted file mode 100644
index 7480194..0000000
--- a/display-commonsys-intf/services/config/src/device_impl.cpp
+++ /dev/null
@@ -1,920 +0,0 @@
-/*
-* Copyright (c) 2020 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 <string>
-#include <vector>
-
-#include "device_impl.h"
-
-namespace DisplayConfig {
-
-DeviceImpl *DeviceImpl::device_obj_ = nullptr;
-std::mutex DeviceImpl::device_lock_;
-
-int DeviceImpl::CreateInstance(ClientContext *intf) {
-  std::lock_guard<std::mutex> lock(device_lock_);
-  if (!device_obj_) {
-    device_obj_ = new DeviceImpl();
-    if (!device_obj_) {
-      return -1;
-    }
-
-    android::status_t status = device_obj_->IDisplayConfig::registerAsService();
-    // Unable to start Display Config 2.0 service. Fail Init.
-    if (status != android::OK) {
-      delete device_obj_;
-      device_obj_ = nullptr;
-      return -1;
-    }
-    device_obj_->intf_ = intf;
-  }
-
-  return 0;
-}
-
-Return<void> DeviceImpl::registerClient(const hidl_string &client_name,
-                                        const sp<IDisplayConfigCallback>& callback,
-                                        registerClient_cb _hidl_cb) {
-  int32_t error = 0;
-  std::string client_name_str = client_name.c_str();
-  if (client_name_str.empty()) {
-    error = -EINVAL;
-    _hidl_cb(error, 0);
-    return Void();
-  }
-
-  uint64_t client_handle = static_cast<uint64_t>(client_id_++);
-  std::shared_ptr<DeviceClientContext> device_client(new DeviceClientContext(callback));
-  if (callback) {
-    callback->linkToDeath(this, client_handle);
-  }
-  ConfigInterface *intf = nullptr;
-  intf_->RegisterClientContext(device_client, &intf);
-  device_client->SetDeviceConfigIntf(intf);
-
-  display_config_map_.emplace(std::make_pair(client_handle, device_client));
-  _hidl_cb(error, client_handle);
-  return Void();
-}
-
-void DeviceImpl::serviceDied(uint64_t client_handle,
-                             const android::wp<::android::hidl::base::V1_0::IBase>& callback) {
-  std::lock_guard<std::mutex> lock(death_service_mutex_);
-  auto itr = display_config_map_.find(client_handle);
-  std::shared_ptr<DeviceClientContext> client = itr->second;
-  if (client != NULL) {
-    ConfigInterface *intf = client->GetDeviceConfigIntf();
-    intf_->UnRegisterClientContext(intf);
-    client.reset();
-    display_config_map_.erase(itr);
-  }
-}
-
-DeviceImpl::DeviceClientContext::DeviceClientContext(
-            const sp<IDisplayConfigCallback> callback) : callback_(callback) { }
-
-sp<IDisplayConfigCallback> DeviceImpl::DeviceClientContext::GetDeviceConfigCallback() {
-  return callback_;
-}
-
-void DeviceImpl::DeviceClientContext::SetDeviceConfigIntf(ConfigInterface *intf) {
-  intf_ = intf;
-}
-
-ConfigInterface* DeviceImpl::DeviceClientContext::GetDeviceConfigIntf() {
-  return intf_;
-}
-
-void DeviceImpl::DeviceClientContext::NotifyCWBBufferDone(int32_t error,
-                                                          const native_handle_t *buffer) {
-  ByteStream output_params;
-  HandleStream output_handles;
-  std::vector<hidl_handle> handles;
-
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&error), sizeof(int));
-  handles.push_back(buffer);
-  output_handles = handles;
-
-  auto status = callback_->perform(kSetCwbOutputBuffer, output_params, output_handles);
-  if (status.isDeadObject()) {
-    return;
-  }
-}
-
-void DeviceImpl::DeviceClientContext::NotifyQsyncChange(bool qsync_enabled, int32_t refresh_rate,
-                                                        int32_t qsync_refresh_rate) {
-  struct QsyncCallbackParams data = {qsync_enabled, refresh_rate, qsync_refresh_rate};
-  ByteStream output_params;
-
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&data), sizeof(data));
-
-  auto status = callback_->perform(kControlQsyncCallback, output_params, {});
-  if (status.isDeadObject()) {
-    return;
-  }
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsDisplayConnected(const ByteStream &input_params,
-                                                              perform_cb _hidl_cb) {
-  const DisplayType *dpy;
-  bool connected = false;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  dpy = reinterpret_cast<const DisplayType*>(data);
-  int32_t error = intf_->IsDisplayConnected(*dpy, &connected);
-
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&connected),
-                              sizeof(connected));
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetDisplayStatus(const ByteStream &input_params,
-                                                            perform_cb _hidl_cb) {
-  const struct StatusParams *display_status;
-  const uint8_t *data = input_params.data();
-  display_status = reinterpret_cast<const StatusParams*>(data);
-  int32_t error = intf_->SetDisplayStatus(display_status->dpy,
-                                          display_status->status);
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseConfigureDynRefreshRate(const ByteStream &input_params,
-                                                                   perform_cb _hidl_cb) {
-  const struct DynRefreshRateParams *dyn_refresh_data;
-  const uint8_t *data = input_params.data();
-  dyn_refresh_data = reinterpret_cast<const DynRefreshRateParams*>(data);
-  int32_t error = intf_->ConfigureDynRefreshRate(dyn_refresh_data->op,
-                                                 dyn_refresh_data->refresh_rate);
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetConfigCount(const ByteStream &input_params,
-                                                          perform_cb _hidl_cb) {
-  const DisplayType *dpy;
-  uint32_t count = 0;
-  ByteStream output_params;
-
-  if (input_params.size() == 0) {
-    _hidl_cb(-ENODATA, {}, {});
-    return;
-  }
-
-  const uint8_t *data = input_params.data();
-  dpy = reinterpret_cast<const DisplayType*>(data);
-  int32_t error = intf_->GetConfigCount(*dpy, &count);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&count),
-                              sizeof(uint32_t));
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetActiveConfig(const ByteStream &input_params,
-                                                           perform_cb _hidl_cb) {
-  const DisplayType *dpy;
-  uint32_t config = 0;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  dpy = reinterpret_cast<const DisplayType*>(data);
-  int32_t error = intf_->GetActiveConfig(*dpy, &config);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&config),
-                              sizeof(uint32_t));
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetActiveConfig(const ByteStream &input_params,
-                                                           perform_cb _hidl_cb) {
-  const struct ConfigParams *set_active_cfg_data;
-
-  const uint8_t *data = input_params.data();
-  set_active_cfg_data = reinterpret_cast<const ConfigParams*>(data);
-  int32_t error = intf_->SetActiveConfig(set_active_cfg_data->dpy,
-                                         set_active_cfg_data->config);
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetDisplayAttributes(const ByteStream &input_params,
-                                                                perform_cb _hidl_cb) {
-  const struct AttributesParams *get_disp_attr_data;
-  struct Attributes attributes = {};
-  ByteStream output_params;
-  int32_t error = -EINVAL;
-
-  const uint8_t *data = input_params.data();
-  get_disp_attr_data = reinterpret_cast<const AttributesParams*>(data);
-  error = intf_->GetDisplayAttributes(get_disp_attr_data->config_index, get_disp_attr_data->dpy,
-                                      &attributes);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&attributes),
-                              sizeof(struct Attributes));
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetPanelBrightness(const ByteStream &input_params,
-                                                              perform_cb _hidl_cb) {
-  const uint32_t *level;
-  int32_t error = 0;
-
-  const uint8_t *data = input_params.data();
-  level = reinterpret_cast<const uint32_t*>(data);
-  error = intf_->SetPanelBrightness(*level);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetPanelBrightness(perform_cb _hidl_cb) {
-  uint32_t level = 0;
-  ByteStream output_params;
-  int32_t error = -EINVAL;
-
-  error = intf_->GetPanelBrightness(&level);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&level),
-                              sizeof(uint32_t));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseMinHdcpEncryptionLevelChanged(
-                                      const ByteStream &input_params,
-                                      perform_cb _hidl_cb) {
-  const struct MinHdcpEncLevelChangedParams *min_hdcp_enc_level_data;
-  int32_t error = 0;
-
-  const uint8_t *data = input_params.data();
-  min_hdcp_enc_level_data = reinterpret_cast<const MinHdcpEncLevelChangedParams*>(data);
-  error = intf_->MinHdcpEncryptionLevelChanged(min_hdcp_enc_level_data->dpy,
-                                               min_hdcp_enc_level_data->min_enc_level);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseRefreshScreen(perform_cb _hidl_cb) {
-  int32_t error = intf_->RefreshScreen();
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseControlPartialUpdate(const ByteStream &input_params,
-                                                                perform_cb _hidl_cb) {
-  const struct PartialUpdateParams *partial_update_data;
-  int32_t error = 0;
-
-  const uint8_t *data = input_params.data();
-  partial_update_data = reinterpret_cast<const PartialUpdateParams*>(data);
-  error = intf_->ControlPartialUpdate(partial_update_data->dpy, partial_update_data->enable);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseToggleScreenUpdate(const ByteStream &input_params,
-                                                              perform_cb _hidl_cb) {
-  const bool *on;
-  int32_t error = 0;
-
-  const uint8_t *data = input_params.data();
-  on = reinterpret_cast<const bool*>(data);
-  error = intf_->ToggleScreenUpdate(on);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetIdleTimeout(const ByteStream &input_params,
-                                                          perform_cb _hidl_cb) {
-  const uint32_t *timeout_value;
-
-  const uint8_t *data = input_params.data();
-  timeout_value = reinterpret_cast<const uint32_t*>(data);
-  int32_t error = intf_->SetIdleTimeout(*timeout_value);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetHdrCapabilities(const ByteStream &input_params,
-                                                              perform_cb _hidl_cb) {
-  const DisplayType *dpy;
-  ByteStream output_params;
-  struct HDRCapsParams hdr_caps;
-  int32_t *data_output;
-  int32_t error = -EINVAL;
-
-  const uint8_t *data = input_params.data();
-  dpy = reinterpret_cast<const DisplayType*>(data);
-  error = intf_->GetHDRCapabilities(*dpy, &hdr_caps);
-
-  data_output = reinterpret_cast<int32_t *>(malloc(sizeof(int32_t) *
-                hdr_caps.supported_hdr_types.size() + 3 * sizeof(float)));
-  if (data_output != NULL) {
-    for (int i = 0; i < hdr_caps.supported_hdr_types.size(); i++) {
-      data_output[i] = hdr_caps.supported_hdr_types[i];
-    }
-    float *lum = reinterpret_cast<float *>(&data_output[hdr_caps.supported_hdr_types.size()]);
-    *lum = hdr_caps.max_luminance;
-    lum++;
-    *lum = hdr_caps.max_avg_luminance;
-    lum++;
-    *lum = hdr_caps.min_luminance;
-    output_params.setToExternal(reinterpret_cast<uint8_t*>(data_output), sizeof(int32_t) *
-                                hdr_caps.supported_hdr_types.size() + 3 * sizeof(float));
-    _hidl_cb(error, output_params, {});
-  }
-  else {
-    _hidl_cb(-EINVAL, {}, {});
-  }
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetCameraLaunchStatus(const ByteStream &input_params,
-                                                                 perform_cb _hidl_cb) {
-  const uint32_t *launch_status_data;
-
-  const uint8_t *data = input_params.data();
-  launch_status_data = reinterpret_cast<const uint32_t*>(data);
-
-  int32_t error = intf_->SetCameraLaunchStatus(*launch_status_data);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseDisplayBwTransactionPending(perform_cb _hidl_cb) {
-  bool status = true;
-  ByteStream output_params;
-
-  int32_t error = intf_->DisplayBWTransactionPending(&status);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&status),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetDisplayAnimating(const ByteStream &input_params,
-                                                               perform_cb _hidl_cb) {
-  const struct AnimationParams *display_animating_data;
-
-  const uint8_t *data = input_params.data();
-  display_animating_data = reinterpret_cast<const AnimationParams*>(data);
-  int32_t error = intf_->SetDisplayAnimating(display_animating_data->display_id,
-                                             display_animating_data->animating);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseControlIdlePowerCollapse(const ByteStream &input_params,
-                                                                    perform_cb _hidl_cb) {
-  const struct IdlePcParams *idle_pc_data;
-
-  const uint8_t *data = input_params.data();
-  idle_pc_data = reinterpret_cast<const IdlePcParams*>(data);
-  int32_t error = intf_->ControlIdlePowerCollapse(idle_pc_data->enable, idle_pc_data->synchronous);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetWritebackCapabilities(perform_cb _hidl_cb) {
-  bool is_wb_ubwc_supported = false;
-  int32_t error = intf_->GetWriteBackCapabilities(&is_wb_ubwc_supported);
-  ByteStream output_params;
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&is_wb_ubwc_supported),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetDisplayDppsAdRoi(const ByteStream &input_params,
-                                                               perform_cb _hidl_cb) {
-  const struct DppsAdRoiParams *ad_roi_data;
-
-  const uint8_t *data = input_params.data();
-  ad_roi_data = reinterpret_cast<const DppsAdRoiParams*>(data);
-
-  int32_t error = intf_->SetDisplayDppsAdROI(ad_roi_data->display_id, ad_roi_data->h_start,
-                                             ad_roi_data->h_end, ad_roi_data->v_start,
-                                             ad_roi_data->v_end, ad_roi_data->factor_in,
-                                             ad_roi_data->factor_out);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseUpdateVsyncSourceOnPowerModeOff(perform_cb _hidl_cb) {
-  int32_t error = intf_->UpdateVSyncSourceOnPowerModeOff();
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseUpdateVsyncSourceOnPowerModeDoze(perform_cb _hidl_cb) {
-  int32_t error = intf_->UpdateVSyncSourceOnPowerModeDoze();
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetPowerMode(const ByteStream &input_params,
-                                                        perform_cb _hidl_cb) {
-  const struct PowerModeParams *set_power_mode_data;
-
-  const uint8_t *data = input_params.data();
-  set_power_mode_data = reinterpret_cast<const PowerModeParams*>(data);
-  int32_t error = intf_->SetPowerMode(set_power_mode_data->disp_id,
-                                      set_power_mode_data->power_mode);
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsPowerModeOverrideSupported(
-                                      const ByteStream &input_params,
-                                      perform_cb _hidl_cb) {
-  const uint8_t *data = input_params.data();
-  const uint32_t *disp_id = reinterpret_cast<const uint32_t*>(data);
-  bool supported = false;
-  int32_t error = intf_->IsPowerModeOverrideSupported(*disp_id, &supported);
-  ByteStream output_params;
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&supported),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsHdrSupported(const ByteStream &input_params,
-                                                          perform_cb _hidl_cb) {
-  const uint8_t *data = input_params.data();
-  const uint32_t *disp_id = reinterpret_cast<const uint32_t*>(data);
-  bool supported = false;
-  int32_t error = intf_->IsHDRSupported(*disp_id, &supported);
-  ByteStream output_params;
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&supported),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsWcgSupported(const ByteStream &input_params,
-                                                          perform_cb _hidl_cb) {
-  const uint8_t *data = input_params.data();
-  const int32_t *disp_id = reinterpret_cast<const int32_t*>(data);
-  bool supported = false;
-  int32_t error = intf_->IsWCGSupported(*disp_id, &supported);
-  ByteStream output_params;
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&supported),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetLayerAsMask(const ByteStream &input_params,
-                                                          perform_cb _hidl_cb) {
-  const struct LayerMaskParams *layer_mask_data;
-
-  const uint8_t *data = input_params.data();
-  layer_mask_data = reinterpret_cast<const LayerMaskParams*>(data);
-  int32_t error = intf_->SetLayerAsMask(layer_mask_data->disp_id, layer_mask_data->layer_id);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetDebugProperty(const ByteStream &input_params,
-                                                            perform_cb _hidl_cb) {
-  std::string value;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  const char *name = reinterpret_cast<const char *>(data);
-  std::string prop_name(name);
-  int32_t error = intf_->GetDebugProperty(prop_name, &value);
-  value += '\0';
-  uint8_t *data_output = reinterpret_cast<uint8_t*>(value.data());
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(data_output),
-                              value.size() * sizeof(char));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetActiveBuiltinDisplayAttributes(perform_cb _hidl_cb) {
-  struct Attributes attr;
-  ByteStream output_params;
-
-  int32_t error = intf_->GetActiveBuiltinDisplayAttributes(&attr);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&attr), sizeof(Attributes));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetPanelLuminanceAttributes(
-                                      const ByteStream &input_params,
-                                      perform_cb _hidl_cb) {
-  const struct PanelLumAttrParams *panel_lum_attr_data;
-
-  const uint8_t *data = input_params.data();
-  panel_lum_attr_data = reinterpret_cast<const PanelLumAttrParams*>(data);
-  int32_t error = intf_->SetPanelLuminanceAttributes(panel_lum_attr_data->disp_id,
-                                                     panel_lum_attr_data->min_lum,
-                                                     panel_lum_attr_data->max_lum);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsBuiltinDisplay(const ByteStream &input_params,
-                                                            perform_cb _hidl_cb) {
-  const uint32_t *disp_id;
-  bool is_builtin = false;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  disp_id = reinterpret_cast<const uint32_t*>(data);
-  int32_t error = intf_->IsBuiltInDisplay(*disp_id, &is_builtin);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&is_builtin),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetCwbOutputBuffer(uint64_t clientHandle,
-                                                              const ByteStream &input_params,
-                                                              const HandleStream &input_handles,
-                                                              perform_cb _hidl_cb) {
-  const struct CwbBufferParams *cwb_buffer_data;
-
-  const uint8_t *data = input_params.data();
-  cwb_buffer_data = reinterpret_cast<const CwbBufferParams*>(data);
-  hidl_handle buffer = input_handles[0];
-
-  if (!callback_ || !buffer.getNativeHandle()) {
-    _hidl_cb(-1, {}, {});
-    return;
-  }
-
-  int32_t error = intf_->SetCWBOutputBuffer(cwb_buffer_data->disp_id , cwb_buffer_data->rect,
-                                            cwb_buffer_data->post_processed,
-                                            buffer.getNativeHandle());
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetSupportedDsiBitclks(const ByteStream &input_params,
-                                                                  perform_cb _hidl_cb) {
-  const uint32_t *disp_id;
-  ByteStream output_params;
-  std::vector<uint64_t> bit_clks;
-  uint64_t *bit_clks_data;
-
-  const uint8_t *data = input_params.data();
-  disp_id = reinterpret_cast<const uint32_t*>(data);
-  int32_t error = intf_->GetSupportedDSIBitClks(*disp_id, &bit_clks);
-
-  bit_clks_data = reinterpret_cast<uint64_t *>(malloc(sizeof(uint64_t) * bit_clks.size()));
-  if (bit_clks_data == NULL) {
-    _hidl_cb(-EINVAL, {}, {});
-    return;
-  }
-  for (int i = 0; i < bit_clks.size(); i++) {
-    bit_clks_data[i] = bit_clks[i];
-  }
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(bit_clks_data),
-                              sizeof(uint64_t) * bit_clks.size());
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetDsiClk(const ByteStream &input_params,
-                                                     perform_cb _hidl_cb) {
-  const uint32_t *disp_id;
-  uint64_t bit_clk = 0;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  disp_id = reinterpret_cast<const uint32_t*>(data);
-  int32_t error = intf_->GetDSIClk(*disp_id, &bit_clk);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&bit_clk),
-                              sizeof(uint64_t));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetDsiClk(const ByteStream &input_params,
-                                                     perform_cb _hidl_cb) {
-  const struct DsiClkParams *set_dsi_clk_data;
-
-  const uint8_t *data = input_params.data();
-  set_dsi_clk_data = reinterpret_cast<const DsiClkParams*>(data);
-  int32_t error = intf_->SetDSIClk(set_dsi_clk_data->disp_id, set_dsi_clk_data->bit_clk);
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSetQsyncMode(const ByteStream &input_params,
-                                                        perform_cb _hidl_cb) {
-  const struct QsyncModeParams *set_qsync_mode_data;
-
-  const uint8_t *data = input_params.data();
-  set_qsync_mode_data = reinterpret_cast<const QsyncModeParams*>(data);
-  int32_t error = intf_->SetQsyncMode(set_qsync_mode_data->disp_id, set_qsync_mode_data->mode);
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsSmartPanelConfig(const ByteStream &input_params,
-                                                              perform_cb _hidl_cb) {
-  const struct SmartPanelCfgParams *smart_panel_cfg_data;
-  bool is_smart = false;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  smart_panel_cfg_data = reinterpret_cast<const SmartPanelCfgParams*>(data);
-  int32_t error = intf_->IsSmartPanelConfig(smart_panel_cfg_data->disp_id,
-                                            smart_panel_cfg_data->config_id, &is_smart);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&is_smart),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsAsyncVdsSupported(perform_cb _hidl_cb) {
-  bool is_supported = false;
-  int32_t error = intf_->IsAsyncVDSCreationSupported(&is_supported);
-  ByteStream output_params;
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&is_supported),
-                             sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseCreateVirtualDisplay(const ByteStream &input_params,
-                                                                perform_cb _hidl_cb) {
-  const struct VdsParams *vds_input_data;
-
-  const uint8_t *data = input_params.data();
-  vds_input_data = reinterpret_cast<const VdsParams*>(data);
-
-  int32_t error = intf_->CreateVirtualDisplay(vds_input_data->width, vds_input_data->height,
-                                              vds_input_data->format);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseIsRotatorSupportedFormat(const ByteStream &input_params,
-                                                                    perform_cb _hidl_cb) {
-  const struct RotatorFormatParams *input_data;
-  bool supported = false;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  input_data = reinterpret_cast<const RotatorFormatParams*>(data);
-  int32_t error = intf_->IsRotatorSupportedFormat(input_data->hal_format, input_data->ubwc,
-                                                  &supported);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&supported),
-                              sizeof(bool));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseControlQsyncCallback(uint64_t client_handle,
-                                                                const ByteStream &input_params,
-                                                                perform_cb _hidl_cb) {
-  const bool *enable;
-
-  const uint8_t *data = input_params.data();
-  enable = reinterpret_cast<const bool*>(data);
-
-  int32_t error = intf_->ControlQsyncCallback(*enable);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseSendTUIEvent(const ByteStream &input_params,
-                                                        perform_cb _hidl_cb) {
-  const struct TUIEventParams *input_data =
-               reinterpret_cast<const TUIEventParams*>(input_params.data());
-
-  int32_t error = intf_->SendTUIEvent(input_data->dpy, input_data->tui_event_type);
-
-  _hidl_cb(error, {}, {});
-}
-
-void DeviceImpl::ParseDestroy(uint64_t client_handle, perform_cb _hidl_cb) {
-  auto itr = display_config_map_.find(client_handle);
-  if (itr == display_config_map_.end()) {
-    _hidl_cb(-EINVAL, {}, {});
-    return;
-  }
-
-  std::shared_ptr<DeviceClientContext> client = itr->second;
-  if (client != NULL) {
-    sp<IDisplayConfigCallback> callback = client->GetDeviceConfigCallback();
-    callback->unlinkToDeath(this);
-    ConfigInterface *intf = client->GetDeviceConfigIntf();
-    intf_->UnRegisterClientContext(intf);
-    client.reset();
-    display_config_map_.erase(itr);
-  }
-
-  _hidl_cb(0, {}, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetDisplayHwId(const ByteStream &input_params,
-                                                          perform_cb _hidl_cb) {
-  uint32_t disp_hw_id = 0;
-  ByteStream output_params;
-
-  const uint8_t *data = input_params.data();
-  const uint32_t *disp_id = reinterpret_cast<const uint32_t*>(data);
-  int32_t error = intf_->GetDisplayHwId(*disp_id, &disp_hw_id);
-  output_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_hw_id), sizeof(uint32_t));
-
-  _hidl_cb(error, output_params, {});
-}
-
-void DeviceImpl::DeviceClientContext::ParseGetSupportedDisplayRefreshRates(
-    const ByteStream &input_params, perform_cb _hidl_cb) {
-  ByteStream output_params;
-  std::vector<uint32_t> refresh_rates;
-
-  const uint8_t *data = input_params.data();
-  const DisplayType *dpy = reinterpret_cast<const DisplayType *>(data);
-  int32_t error = intf_->GetSupportedDisplayRefreshRates(*dpy, &refresh_rates);
-
-  uint32_t *refresh_rates_data =
-      reinterpret_cast<uint32_t *>(malloc(sizeof(uint32_t) * refresh_rates.size()));
-  for (int i = 0; i < refresh_rates.size(); i++) {
-    refresh_rates_data[i] = refresh_rates[i];
-  }
-  output_params.setToExternal(reinterpret_cast<uint8_t *>(refresh_rates_data),
-                              sizeof(uint32_t) * refresh_rates.size());
-  _hidl_cb(error, output_params, {});
-}
-
-Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
-                                 const ByteStream &input_params, const HandleStream &input_handles,
-                                 perform_cb _hidl_cb) {
-  int32_t error = 0;
-  auto itr = display_config_map_.find(client_handle);
-  if (itr == display_config_map_.end()) {
-    error = -EINVAL;
-    _hidl_cb(error, {}, {});
-    return Void();
-  }
-
-  std::shared_ptr<DeviceClientContext> client = itr->second;
-  if (!client) {
-    error = -EINVAL;
-    _hidl_cb(error, {}, {});
-     return Void();
-  }
-  switch (op_code) {
-    case kIsDisplayConnected:
-      client->ParseIsDisplayConnected(input_params, _hidl_cb);
-      break;
-    case kSetDisplayStatus:
-      client->ParseSetDisplayStatus(input_params, _hidl_cb);
-      break;
-    case kConfigureDynRefreshRate:
-      client->ParseConfigureDynRefreshRate(input_params, _hidl_cb);
-      break;
-    case kGetConfigCount:
-      client->ParseGetConfigCount(input_params, _hidl_cb);
-      break;
-    case kGetActiveConfig:
-      client->ParseGetActiveConfig(input_params, _hidl_cb);
-      break;
-    case kSetActiveConfig:
-      client->ParseSetActiveConfig(input_params, _hidl_cb);
-      break;
-    case kGetDisplayAttributes:
-      client->ParseGetDisplayAttributes(input_params, _hidl_cb);
-      break;
-    case kSetPanelBrightness:
-      client->ParseSetPanelBrightness(input_params, _hidl_cb);
-      break;
-    case kGetPanelBrightness:
-      client->ParseGetPanelBrightness(_hidl_cb);
-      break;
-    case kMinHdcpEncryptionLevelChanged:
-      client->ParseMinHdcpEncryptionLevelChanged(input_params, _hidl_cb);
-      break;
-    case kRefreshScreen:
-      client->ParseRefreshScreen(_hidl_cb);
-      break;
-    case kControlPartialUpdate:
-      client->ParseControlPartialUpdate(input_params, _hidl_cb);
-      break;
-    case kToggleScreenUpdate:
-      client->ParseToggleScreenUpdate(input_params, _hidl_cb);
-      break;
-    case kSetIdleTimeout:
-      client->ParseSetIdleTimeout(input_params, _hidl_cb);
-      break;
-    case kGetHdrCapabilities:
-      client->ParseGetHdrCapabilities(input_params, _hidl_cb);
-      break;
-    case kSetCameraLaunchStatus:
-      client->ParseSetCameraLaunchStatus(input_params, _hidl_cb);
-      break;
-    case kDisplayBwTransactionPending:
-      client->ParseDisplayBwTransactionPending(_hidl_cb);
-      break;
-    case kSetDisplayAnimating:
-      client->ParseSetDisplayAnimating(input_params, _hidl_cb);
-      break;
-    case kControlIdlePowerCollapse:
-      client->ParseControlIdlePowerCollapse(input_params, _hidl_cb);
-      break;
-    case kGetWritebackCapabilities:
-      client->ParseGetWritebackCapabilities(_hidl_cb);
-      break;
-    case kSetDisplayDppsAdRoi:
-      client->ParseSetDisplayDppsAdRoi(input_params, _hidl_cb);
-      break;
-    case kUpdateVsyncSourceOnPowerModeOff:
-      client->ParseUpdateVsyncSourceOnPowerModeOff(_hidl_cb);
-      break;
-    case kUpdateVsyncSourceOnPowerModeDoze:
-      client->ParseUpdateVsyncSourceOnPowerModeDoze(_hidl_cb);
-      break;
-    case kSetPowerMode:
-      client->ParseSetPowerMode(input_params, _hidl_cb);
-      break;
-    case kIsPowerModeOverrideSupported:
-      client->ParseIsPowerModeOverrideSupported(input_params, _hidl_cb);
-      break;
-    case kIsHdrSupported:
-      client->ParseIsHdrSupported(input_params, _hidl_cb);
-      break;
-    case kIsWcgSupported:
-      client->ParseIsWcgSupported(input_params, _hidl_cb);
-      break;
-    case kSetLayerAsMask:
-      client->ParseSetLayerAsMask(input_params, _hidl_cb);
-      break;
-    case kGetDebugProperty:
-      client->ParseGetDebugProperty(input_params, _hidl_cb);
-      break;
-    case kGetActiveBuiltinDisplayAttributes:
-      client->ParseGetActiveBuiltinDisplayAttributes(_hidl_cb);
-      break;
-    case kSetPanelLuminanceAttributes:
-      client->ParseSetPanelLuminanceAttributes(input_params, _hidl_cb);
-      break;
-    case kIsBuiltinDisplay:
-      client->ParseIsBuiltinDisplay(input_params, _hidl_cb);
-      break;
-    case kSetCwbOutputBuffer:
-      client->ParseSetCwbOutputBuffer(client_handle, input_params, input_handles, _hidl_cb);
-      break;
-    case kGetSupportedDsiBitclks:
-      client->ParseGetSupportedDsiBitclks(input_params, _hidl_cb);
-      break;
-    case kGetDsiClk:
-      client->ParseGetDsiClk(input_params, _hidl_cb);
-      break;
-    case kSetDsiClk:
-      client->ParseSetDsiClk(input_params, _hidl_cb);
-      break;
-    case kSetQsyncMode:
-      client->ParseSetQsyncMode(input_params, _hidl_cb);
-      break;
-    case kIsSmartPanelConfig:
-      client->ParseIsSmartPanelConfig(input_params, _hidl_cb);
-      break;
-    case kIsAsyncVdsSupported:
-      client->ParseIsAsyncVdsSupported(_hidl_cb);
-      break;
-    case kCreateVirtualDisplay:
-      client->ParseCreateVirtualDisplay(input_params, _hidl_cb);
-      break;
-    case kIsRotatorSupportedFormat:
-      client->ParseIsRotatorSupportedFormat(input_params, _hidl_cb);
-      break;
-    case kControlQsyncCallback:
-      client->ParseControlQsyncCallback(client_handle, input_params, _hidl_cb);
-      break;
-    case kSendTUIEvent:
-      client->ParseSendTUIEvent(input_params, _hidl_cb);
-      break;
-    case kDestroy:
-      ParseDestroy(client_handle, _hidl_cb);
-      break;
-    case kGetDisplayHwId:
-      client->ParseGetDisplayHwId(input_params, _hidl_cb);
-      break;
-    case kGetSupportedDisplayRefreshRates:
-      client->ParseGetSupportedDisplayRefreshRates(input_params, _hidl_cb);
-      break;
-    default:
-      break;
-  }
-  return Void();
-}
-
-}  // namespace DisplayConfig
diff --git a/display-commonsys-intf/services/config/src/device_impl.h b/display-commonsys-intf/services/config/src/device_impl.h
deleted file mode 100644
index a116f30..0000000
--- a/display-commonsys-intf/services/config/src/device_impl.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-* Copyright (c) 2020 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_IMPL_H__
-#define __DEVICE_IMPL_H__
-
-#include <vendor/display/config/2.0/IDisplayConfig.h>
-#include <hidl/HidlSupport.h>
-
-#include <config/device_interface.h>
-#include <map>
-#include <utility>
-#include <string>
-#include <vector>
-
-#include "opcode_types.h"
-
-namespace DisplayConfig {
-
-using vendor::display::config::V2_0::IDisplayConfig;
-using vendor::display::config::V2_0::IDisplayConfigCallback;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::hidl_handle;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::sp;
-
-typedef hidl_vec<uint8_t> ByteStream;
-typedef hidl_vec<hidl_handle> HandleStream;
-
-class DeviceImpl : public IDisplayConfig, public android::hardware::hidl_death_recipient {
- public:
-  static int CreateInstance(ClientContext *intf);
-
- private:
-  class DeviceClientContext : public ConfigCallback {
-   public:
-    explicit DeviceClientContext(const sp<IDisplayConfigCallback> callback);
-
-    void SetDeviceConfigIntf(ConfigInterface *intf);
-    ConfigInterface* GetDeviceConfigIntf();
-    sp<IDisplayConfigCallback> GetDeviceConfigCallback();
-
-    virtual void NotifyCWBBufferDone(int32_t error, const native_handle_t *buffer);
-    virtual void NotifyQsyncChange(bool qsync_enabled, int32_t refresh_rate,
-                                   int32_t qsync_refresh_rate);
-
-    void ParseIsDisplayConnected(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetDisplayStatus(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseConfigureDynRefreshRate(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetConfigCount(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetActiveConfig(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetActiveConfig(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetDisplayAttributes(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetPanelBrightness(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetPanelBrightness(perform_cb _hidl_cb);
-    void ParseMinHdcpEncryptionLevelChanged(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseRefreshScreen(perform_cb _hidl_cb);
-    void ParseControlPartialUpdate(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseToggleScreenUpdate(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetIdleTimeout(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetHdrCapabilities(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetCameraLaunchStatus(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseDisplayBwTransactionPending(perform_cb _hidl_cb);
-    void ParseSetDisplayAnimating(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseControlIdlePowerCollapse(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetWritebackCapabilities(perform_cb _hidl_cb);
-    void ParseSetDisplayDppsAdRoi(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseUpdateVsyncSourceOnPowerModeOff(perform_cb _hidl_cb);
-    void ParseUpdateVsyncSourceOnPowerModeDoze(perform_cb _hidl_cb);
-    void ParseSetPowerMode(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseIsPowerModeOverrideSupported(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseIsHdrSupported(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseIsWcgSupported(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetLayerAsMask(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetDebugProperty(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetActiveBuiltinDisplayAttributes(perform_cb _hidl_cb);
-    void ParseSetPanelLuminanceAttributes(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseIsBuiltinDisplay(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetCwbOutputBuffer(uint64_t clientHandle, const ByteStream &input_params,
-                                 const HandleStream &inputHandles, perform_cb _hidl_cb);
-    void ParseGetSupportedDsiBitclks(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetDsiClk(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetDsiClk(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseSetQsyncMode(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseIsSmartPanelConfig(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseIsAsyncVdsSupported(perform_cb _hidl_cb);
-    void ParseCreateVirtualDisplay(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseIsRotatorSupportedFormat(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseControlQsyncCallback(uint64_t client_handle, const ByteStream &input_params,
-                                   perform_cb _hidl_cb);
-    void ParseSendTUIEvent(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetDisplayHwId(const ByteStream &input_params, perform_cb _hidl_cb);
-    void ParseGetSupportedDisplayRefreshRates(const ByteStream &input_params, perform_cb _hidl_cb);
-
-   private:
-    ConfigInterface *intf_ = nullptr;
-    const sp<IDisplayConfigCallback> callback_;
-  };
-
-  Return<void> registerClient(const hidl_string &client_name, const sp<IDisplayConfigCallback>& cb,
-                              registerClient_cb _hidl_cb) override;
-  Return<void> perform(uint64_t client_handle, uint32_t op_code, const ByteStream &input_params,
-                       const HandleStream &input_handles, perform_cb _hidl_cb) override;
-  void serviceDied(uint64_t client_handle,
-                   const android::wp<::android::hidl::base::V1_0::IBase>& callback);
-  void ParseDestroy(uint64_t client_handle, perform_cb _hidl_cb);
-
-  ClientContext *intf_ = nullptr;
-  std::map<uint64_t, std::shared_ptr<DeviceClientContext>> display_config_map_;
-  uint64_t client_id_ = 0;
-  std::mutex death_service_mutex_;
-  static DeviceImpl *device_obj_;
-  static std::mutex device_lock_;
-};
-
-}  // namespace DisplayConfig
-
-#endif  // __DEVICE_IMPL_H__
diff --git a/display-commonsys-intf/services/config/src/device_interface.cpp b/display-commonsys-intf/services/config/src/device_interface.cpp
deleted file mode 100644
index 0c2d6b7..0000000
--- a/display-commonsys-intf/services/config/src/device_interface.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2020 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 "device_impl.h"
-
-namespace DisplayConfig {
-
-int DeviceInterface::RegisterDevice(ClientContext *intf) {
-  if (!intf) {
-    return -1;
-  }
-
-  return DeviceImpl::CreateInstance(intf);
-}
-
-}  // namespace DisplayConfig
diff --git a/display-commonsys-intf/services/config/src/opcode_types.h b/display-commonsys-intf/services/config/src/opcode_types.h
deleted file mode 100644
index 6386cae..0000000
--- a/display-commonsys-intf/services/config/src/opcode_types.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-* Copyright (c) 2020 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 __OPCODE_TYPES_H__
-#define __OPCODE_TYPES_H__
-
-namespace DisplayConfig {
-
-enum OpCode {
-  kIsDisplayConnected = 0,
-  kSetDisplayStatus = 1,
-  kConfigureDynRefreshRate = 2,
-  kGetConfigCount = 3,
-  kGetActiveConfig = 4,
-  kSetActiveConfig = 5,
-  kGetDisplayAttributes = 6,
-  kSetPanelBrightness = 7,
-  kGetPanelBrightness =  8,
-  kMinHdcpEncryptionLevelChanged = 9,
-  kRefreshScreen = 10,
-  kControlPartialUpdate = 11,
-  kToggleScreenUpdate = 12,
-  kSetIdleTimeout = 13,
-  kGetHdrCapabilities = 14,
-  kSetCameraLaunchStatus = 15,
-  kDisplayBwTransactionPending = 16,
-  kSetDisplayAnimating = 17,
-  kControlIdlePowerCollapse = 18,
-  kGetWritebackCapabilities = 19,
-  kSetDisplayDppsAdRoi = 20,
-  kUpdateVsyncSourceOnPowerModeOff = 21,
-  kUpdateVsyncSourceOnPowerModeDoze = 22,
-  kSetPowerMode = 23,
-  kIsPowerModeOverrideSupported = 24,
-  kIsHdrSupported = 25,
-  kIsWcgSupported = 26,
-  kSetLayerAsMask = 27,
-  kGetDebugProperty = 28,
-  kGetActiveBuiltinDisplayAttributes = 29,
-  kSetPanelLuminanceAttributes = 30,
-  kIsBuiltinDisplay = 31,
-  kSetCwbOutputBuffer = 32,
-  kGetSupportedDsiBitclks = 33,
-  kGetDsiClk = 34,
-  kSetDsiClk = 35,
-  kSetQsyncMode = 36,
-  kIsSmartPanelConfig = 37,
-  kIsAsyncVdsSupported = 38,
-  kCreateVirtualDisplay = 39,
-  kIsRotatorSupportedFormat = 40,
-  kControlQsyncCallback = 41,
-  kSendTUIEvent = 42,
-  kGetDisplayHwId = 43,
-  kGetSupportedDisplayRefreshRates = 44,
-
-  kDestroy = 0xFFFF, // Destroy sequence execution
-};
-
-}  // namespace DisplayConfig
-
-#endif  // __OPCODE_TYPES_H__
