display: Cleanup unused code

CRs-Fixed: 2048735
Change-Id: Ief7f8ae4006ab211272191b66bd4bd854d9098b2
diff --git a/sdm/libs/hwc/blit_engine.h b/sdm/libs/hwc/blit_engine.h
deleted file mode 100644
index 6fa9733..0000000
--- a/sdm/libs/hwc/blit_engine.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*  * Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  * Redistributions in binary form must reproduce the above
-*    copyright notice, this list of conditions and the following
-*    disclaimer in the documentation and/or other materials provided
-*    with the distribution.
-*  * Neither the name of The Linux Foundation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*! @file blit_engine.h
-  @brief Interface file for Blit based compositior.
-
-  @details The client can use this interface to get the blit composition done
-
-*/
-
-#ifndef __BLIT_ENGINE_H__
-#define __BLIT_ENGINE_H__
-
-namespace sdm {
-
-/*! @brief Blit Engine implemented by the client
-
-  @details This class declares prototype for BlitEngine Interface which must be
-  implemented by the client. HWC will use this interface to use a Blit engine to get the
-  composition done.
-
-*/
-class BlitEngine {
- public:
-  BlitEngine() { }
-  virtual ~BlitEngine() { }
-
-  virtual int Init() = 0;
-  virtual void DeInit() = 0;
-  virtual int Prepare(LayerStack *layer_stack) = 0;
-  virtual int PreCommit(hwc_display_contents_1_t *content_list, LayerStack *layer_stack) = 0;
-  virtual int Commit(hwc_display_contents_1_t *content_list, LayerStack *layer_stack) = 0;
-  virtual void PostCommit(LayerStack *layer_stack) = 0;
-  virtual bool BlitActive() = 0;
-  virtual void SetFrameDumpConfig(uint32_t count) = 0;
-};
-
-}  // namespace sdm
-
-#endif  // __BLIT_ENGINE_H__
diff --git a/sdm/libs/hwc/blit_engine_c2d.cpp b/sdm/libs/hwc/blit_engine_c2d.cpp
deleted file mode 100644
index 4efe2f1..0000000
--- a/sdm/libs/hwc/blit_engine_c2d.cpp
+++ /dev/null
@@ -1,608 +0,0 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*  * Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  * Redistributions in binary form must reproduce the above
-*    copyright notice, this list of conditions and the following
-*    disclaimer in the documentation and/or other materials provided
-*    with the distribution.
-*  * Neither the name of The Linux Foundation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-* Portions formerly licensed under Apache License, Version 2.0, are re licensed
-* under section 4 of Apache License, Version 2.0.
-
-* Copyright (C) 2010 The Android Open Source Project
-
-* Not a Contribution.
-
-* 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.
-*/
-
-#include <hardware/hardware.h>
-#include <sync/sync.h>
-#include <copybit.h>
-#include <memalloc.h>
-#include <alloc_controller.h>
-#include <gr.h>
-
-#include <utils/constants.h>
-#include <utils/rect.h>
-#include <utils/formats.h>
-#include <algorithm>
-
-#include "blit_engine_c2d.h"
-#include "hwc_debugger.h"
-
-#define __CLASS__ "BlitEngineC2D"
-
-// TODO(user): Remove pragma after fixing sign conversion errors
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wsign-conversion"
-#endif
-
-namespace sdm {
-
-
-BlitEngineC2d::RegionIterator::RegionIterator(LayerRectArray rect) {
-  rect_array = rect;
-  r.end = INT(rect.count);
-  r.current = 0;
-  this->next = iterate;
-}
-
-int BlitEngineC2d::RegionIterator::iterate(copybit_region_t const *self, copybit_rect_t *rect) {
-  if (!self || !rect) {
-    DLOGE("iterate invalid parameters");
-    return 0;
-  }
-
-  RegionIterator const *me = static_cast<RegionIterator const*>(self);
-  if (me->r.current != me->r.end) {
-    rect->l = INT(me->rect_array.rect[me->r.current].left);
-    rect->t = INT(me->rect_array.rect[me->r.current].top);
-    rect->r = INT(me->rect_array.rect[me->r.current].right);
-    rect->b = INT(me->rect_array.rect[me->r.current].bottom);
-    me->r.current++;
-    return 1;
-  }
-  return 0;
-}
-
-BlitEngineC2d::BlitEngineC2d() {
-  for (uint32_t i = 0; i < kNumBlitTargetBuffers; i++) {
-    blit_target_buffer_[i] = NULL;
-    release_fence_fd_[i] = -1;
-  }
-}
-
-BlitEngineC2d::~BlitEngineC2d() {
-  if (blit_engine_c2d_) {
-    copybit_close(blit_engine_c2d_);
-    blit_engine_c2d_ = NULL;
-  }
-  FreeBlitTargetBuffers();
-}
-
-int BlitEngineC2d::Init() {
-  hw_module_t const *module;
-  if (hw_get_module("copybit", &module) == 0) {
-    if (copybit_open(module, &blit_engine_c2d_) < 0) {
-      DLOGI("CopyBitC2D Open failed.");
-      return -1;
-    }
-    DLOGI("Opened Copybit Module");
-  } else {
-    DLOGI("Copybit HW Module not found");
-    return -1;
-  }
-
-  return 0;
-}
-
-void BlitEngineC2d::DeInit() {
-  FreeBlitTargetBuffers();
-  if (blit_engine_c2d_) {
-    copybit_close(blit_engine_c2d_);
-    blit_engine_c2d_ = NULL;
-  }
-}
-
-int BlitEngineC2d::AllocateBlitTargetBuffers(uint32_t width, uint32_t height, uint32_t format,
-                                             uint32_t usage) {
-  int status = 0;
-  if (width <= 0 || height <= 0) {
-    return false;
-  }
-
-  if (blit_target_buffer_[0]) {
-    // Free and reallocate the buffers if the w/h changes
-    if (INT(width) != blit_target_buffer_[0]->width ||
-        INT(height) != blit_target_buffer_[0]->height) {
-      FreeBlitTargetBuffers();
-    }
-  }
-
-  for (uint32_t i = 0; i < kNumBlitTargetBuffers; i++) {
-    if (blit_target_buffer_[i] == NULL) {
-      status = alloc_buffer(&blit_target_buffer_[i], width, height, format, usage);
-    }
-    if (status < 0) {
-      DLOGE("Allocation of Blit target Buffer failed");
-      FreeBlitTargetBuffers();
-      break;
-    }
-  }
-
-  return status;
-}
-
-void BlitEngineC2d::FreeBlitTargetBuffers() {
-  for (uint32_t i = 0; i < kNumBlitTargetBuffers; i++) {
-    private_handle_t **target_buffer = &blit_target_buffer_[i];
-    if (*target_buffer) {
-      // Free the valid fence
-      if (release_fence_fd_[i] >= 0) {
-        close(release_fence_fd_[i]);
-        release_fence_fd_[i] = -1;
-      }
-      free_buffer(*target_buffer);
-      *target_buffer = NULL;
-    }
-  }
-}
-
-int BlitEngineC2d::ClearTargetBuffer(private_handle_t* hnd, const LayerRect& rect) {
-  int status = 0;
-  copybit_rect_t clear_rect = {INT(rect.left), INT(rect.top), INT(rect.right), INT(rect.bottom)};
-
-  copybit_image_t buffer;
-  buffer.w = ALIGN((hnd->width), 32);
-  buffer.h = hnd->height;
-  buffer.format = hnd->format;
-  buffer.base = reinterpret_cast<void *>(hnd->base);
-  buffer.handle = reinterpret_cast<native_handle_t *>(hnd);
-  int dst_format_mode = COPYBIT_LINEAR;
-  if (hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
-    dst_format_mode = COPYBIT_UBWC_COMPRESSED;
-  }
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_DST_FORMAT_MODE, dst_format_mode);
-
-  status = blit_engine_c2d_->clear(blit_engine_c2d_, &buffer, &clear_rect);
-  return status;
-}
-
-void BlitEngineC2d::PostCommit(LayerStack *layer_stack) {
-  int fence_fd = -1;
-  uint32_t count = 0;
-  int fd = -1;
-
-  for (uint32_t i = blit_target_start_index_-2; (i > 0) && (count < num_blit_target_); i--) {
-    Layer *layer = layer_stack->layers.at(i);
-    LayerBuffer &layer_buffer = layer->input_buffer;
-    if (layer->composition == kCompositionBlit) {
-      int index = blit_target_start_index_ + count;
-      layer_buffer.release_fence_fd =
-        layer_stack->layers.at(index)->input_buffer.release_fence_fd;
-      fence_fd = layer_buffer.release_fence_fd;
-      close(layer_buffer.acquire_fence_fd);
-      layer_buffer.acquire_fence_fd = -1;
-      layer_stack->layers.at(index)->input_buffer.release_fence_fd = -1;
-      fd = layer_stack->layers.at(index)->input_buffer.acquire_fence_fd;
-      layer_stack->layers.at(index)->input_buffer.acquire_fence_fd = -1;
-      count++;
-    }
-  }
-
-  if (fd >= 0) {
-    // Close the C2D fence FD
-    close(fd);
-  }
-  SetReleaseFence(fence_fd);
-}
-
-// Sync wait to close the previous fd
-void BlitEngineC2d::SetReleaseFence(int fd) {
-  if (release_fence_fd_[current_blit_target_index_] >= 0) {
-    int ret = -1;
-    ret = sync_wait(release_fence_fd_[current_blit_target_index_], 1000);
-    if (ret < 0) {
-      DLOGE("sync_wait error! errno = %d, err str = %s", errno, strerror(errno));
-    }
-    close(release_fence_fd_[current_blit_target_index_]);
-  }
-  release_fence_fd_[current_blit_target_index_] = dup(fd);
-}
-
-bool BlitEngineC2d::BlitActive() {
-  return blit_active_;
-}
-
-void BlitEngineC2d::SetFrameDumpConfig(uint32_t count) {
-  dump_frame_count_ = count;
-  dump_frame_index_ = 0;
-}
-
-int BlitEngineC2d::Prepare(LayerStack *layer_stack) {
-  blit_target_start_index_ = 0;
-
-  uint32_t layer_count = UINT32(layer_stack->layers.size());
-  uint32_t gpu_target_index = layer_count - 1;  // default assumption
-  uint32_t i = 0;
-
-  for (; i < layer_count; i++) {
-    Layer *layer = layer_stack->layers.at(i);
-
-    // No 10 bit support for C2D
-    if (Is10BitFormat(layer->input_buffer.format)) {
-      return -1;
-    }
-
-    if (layer->composition == kCompositionGPUTarget) {
-      // Need FBT size for allocating buffers
-      gpu_target_index = i;
-      break;
-    }
-  }
-
-  if ((layer_count - 1) == gpu_target_index) {
-    // No blit target layer
-    return -1;
-  }
-
-  blit_target_start_index_ = ++i;
-  num_blit_target_ = layer_count - blit_target_start_index_;
-
-  LayerBuffer &layer_buffer = layer_stack->layers.at(gpu_target_index)->input_buffer;
-  int fbwidth = INT(layer_buffer.unaligned_width);
-  int fbheight = INT(layer_buffer.unaligned_height);
-  if ((fbwidth < 0) || (fbheight < 0)) {
-    return -1;
-  }
-
-  current_blit_target_index_ = (current_blit_target_index_ + 1) % kNumBlitTargetBuffers;
-  int k = blit_target_start_index_;
-
-  for (uint32_t j = 0; j < num_blit_target_; j++, k++) {
-    Layer *layer = layer_stack->layers.at(k);
-    LayerBuffer &layer_buffer = layer->input_buffer;
-    int aligned_w = 0;
-    int aligned_h = 0;
-
-    // Set the buffer height and width
-    AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(fbwidth, fbheight/3,
-                   INT(HAL_PIXEL_FORMAT_RGBA_8888), 0, aligned_w, aligned_h);
-    layer_buffer.width = aligned_w;
-    layer_buffer.height = aligned_h;
-    layer_buffer.unaligned_width = fbwidth;
-    layer_buffer.unaligned_height = fbheight/3;
-
-    layer->plane_alpha = 0xFF;
-    layer->blending = kBlendingOpaque;
-    layer->composition = kCompositionBlitTarget;
-    layer->frame_rate = layer_stack->layers.at(gpu_target_index)->frame_rate;
-  }
-
-  return 0;
-}
-
-int BlitEngineC2d::PreCommit(hwc_display_contents_1_t *content_list, LayerStack *layer_stack) {
-  int status = 0;
-  uint32_t num_app_layers = (uint32_t) content_list->numHwLayers-1;
-  int target_width = 0;
-  int target_height = 0;
-  int target_aligned_width = 0;
-  int target_aligned_height = 0;
-  uint32_t processed_blit = 0;
-  LayerRect dst_rects[kMaxBlitTargetLayers];
-  bool blit_needed = false;
-  uint32_t usage = 0;
-
-  if (!num_app_layers) {
-    return -1;
-  }
-
-  for (uint32_t i = num_app_layers-1; (i > 0) && (processed_blit < num_blit_target_); i--) {
-    Layer *layer = layer_stack->layers.at(i);
-    if (layer->composition != kCompositionBlit) {
-      continue;
-    }
-    blit_needed = true;
-    layer_stack->flags.attributes_changed = true;
-
-    Layer *blit_layer = layer_stack->layers.at(blit_target_start_index_ + processed_blit);
-    LayerRect &blit_src_rect = blit_layer->src_rect;
-    int width = INT(layer->dst_rect.right - layer->dst_rect.left);
-    int height = INT(layer->dst_rect.bottom - layer->dst_rect.top);
-    int aligned_w = 0;
-    int aligned_h = 0;
-    usage = GRALLOC_USAGE_PRIVATE_IOMMU_HEAP | GRALLOC_USAGE_HW_TEXTURE;
-    if (blit_engine_c2d_->get(blit_engine_c2d_, COPYBIT_UBWC_SUPPORT) > 0) {
-      usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
-    }
-    // TODO(user): FrameBuffer is assumed to be RGBA
-    target_width = std::max(target_width, width);
-    target_height += height;
-
-    AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width, height,
-                                 INT(HAL_PIXEL_FORMAT_RGBA_8888), usage, aligned_w, aligned_h);
-
-    target_aligned_width = std::max(target_aligned_width, aligned_w);
-    target_aligned_height += aligned_h;
-
-    // Left will be zero always
-    dst_rects[processed_blit].top = FLOAT(target_aligned_height - aligned_h);
-    dst_rects[processed_blit].right = dst_rects[processed_blit].left +
-                                      (layer->dst_rect.right - layer->dst_rect.left);
-    dst_rects[processed_blit].bottom = (dst_rects[processed_blit].top +
-                                      (layer->dst_rect.bottom - layer->dst_rect.top));
-    blit_src_rect = dst_rects[processed_blit];
-    processed_blit++;
-  }
-
-  // Allocate a single buffer of RGBA8888 format
-  if (blit_needed && (AllocateBlitTargetBuffers(target_width, target_height,
-                                                HAL_PIXEL_FORMAT_RGBA_8888, usage) < 0)) {
-      status = -1;
-      return status;
-  }
-
-  if (blit_needed) {
-    for (uint32_t j = 0; j < num_blit_target_; j++) {
-      Layer *layer = layer_stack->layers.at(j + content_list->numHwLayers);
-      private_handle_t *target_buffer = blit_target_buffer_[current_blit_target_index_];
-      // Set the fd information
-        layer->input_buffer.width = target_aligned_width;
-        layer->input_buffer.height = target_aligned_height;
-        layer->input_buffer.unaligned_width = target_width;
-        layer->input_buffer.unaligned_height = target_height;
-      if (target_buffer->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
-          layer->input_buffer.format = kFormatRGBA8888Ubwc;
-      }
-      layer->input_buffer.planes[0].fd = target_buffer->fd;
-      layer->input_buffer.planes[0].offset = 0;
-      layer->input_buffer.planes[0].stride = target_buffer->width;
-    }
-  }
-
-  return status;
-}
-
-int BlitEngineC2d::Commit(hwc_display_contents_1_t *content_list, LayerStack *layer_stack) {
-  int fd = -1;
-  int status = 0;
-  bool hybrid_present = false;
-  uint32_t num_app_layers = (uint32_t) content_list->numHwLayers-1;
-  private_handle_t *target_buffer = blit_target_buffer_[current_blit_target_index_];
-  blit_active_ = false;
-
-  if (!num_app_layers) {
-    return -1;
-  }
-
-  // if not Blit Targets return
-  for (uint32_t i = 0; i < num_app_layers; i++) {
-    Layer *layer = layer_stack->layers.at(i);
-    if (layer->composition == kCompositionHybrid || layer->composition == kCompositionBlit) {
-      hybrid_present = true;
-    }
-  }
-
-  if (!hybrid_present) {
-    return status;
-  }
-
-  // Clear blit target buffer
-  LayerRect clear_rect;
-  clear_rect.left =  0;
-  clear_rect.top = 0;
-  clear_rect.right = FLOAT(target_buffer->width);
-  clear_rect.bottom = FLOAT(target_buffer->height);
-  ClearTargetBuffer(target_buffer, clear_rect);
-
-  int copybit_layer_count = 0;
-  uint32_t processed_blit = 0;
-  for (uint32_t i = num_app_layers-1; (i > 0) && (processed_blit < num_blit_target_) &&
-      (status == 0); i--) {
-    Layer *layer = layer_stack->layers.at(i);
-    if (layer->composition != kCompositionBlit) {
-      continue;
-    }
-
-    for (uint32_t k = 0; k <= i; k++) {
-      Layer *bottom_layer = layer_stack->layers.at(k);
-      LayerBuffer &layer_buffer = bottom_layer->input_buffer;
-      // if layer below the blit layer does not intersect, ignore that layer
-      LayerRect inter_sect = Intersection(layer->dst_rect, bottom_layer->dst_rect);
-      if (bottom_layer->composition != kCompositionHybrid && !IsValid(inter_sect)) {
-        continue;
-      }
-      if (bottom_layer->composition == kCompositionGPU ||
-          bottom_layer->composition == kCompositionSDE ||
-          bottom_layer->composition == kCompositionGPUTarget) {
-        continue;
-      }
-
-      // For each layer marked as Hybrid, wait for acquire fence and then blit using the C2D
-      if (layer_buffer.acquire_fence_fd >= 0) {
-        // Wait for acquire fence on the App buffers.
-        if (sync_wait(layer_buffer.acquire_fence_fd, 1000) < 0) {
-          DLOGE("sync_wait error!! error no = %d err str = %s", errno, strerror(errno));
-        }
-        layer_buffer.acquire_fence_fd = -1;
-      }
-      hwc_layer_1_t *hwc_layer = &content_list->hwLayers[k];
-      LayerRect &src_rect = bottom_layer->blit_regions.at(processed_blit);
-      Layer *blit_layer = layer_stack->layers.at(blit_target_start_index_ + processed_blit);
-      LayerRect dest_rect = blit_layer->src_rect;
-      int ret_val = DrawRectUsingCopybit(hwc_layer, bottom_layer, src_rect, dest_rect);
-      copybit_layer_count++;
-      if (ret_val < 0) {
-        copybit_layer_count = 0;
-        DLOGE("DrawRectUsingCopyBit failed");
-        status = -1;
-        break;
-      }
-    }
-    processed_blit++;
-  }
-
-  if (copybit_layer_count) {
-    blit_active_ = true;
-    blit_engine_c2d_->flush_get_fence(blit_engine_c2d_, &fd);
-  }
-
-  if (blit_active_) {
-    // dump the render buffer
-    DumpBlitTargetBuffer(fd);
-
-    // Set the fd to the LayerStack BlitTargets fd
-    uint32_t layer_count = UINT32(layer_stack->layers.size());
-    for (uint32_t k = blit_target_start_index_; k < layer_count; k++) {
-      Layer *layer = layer_stack->layers.at(k);
-      LayerBuffer &layer_buffer = layer->input_buffer;
-      layer_buffer.acquire_fence_fd = fd;
-    }
-  }
-
-  return status;
-}
-
-int BlitEngineC2d::DrawRectUsingCopybit(hwc_layer_1_t *hwc_layer, Layer *layer,
-                                        LayerRect blit_rect, LayerRect blit_dest_Rect) {
-  private_handle_t *target_buffer = blit_target_buffer_[current_blit_target_index_];
-  const private_handle_t *hnd = static_cast<const private_handle_t *>(hwc_layer->handle);
-  LayerBuffer &layer_buffer = layer->input_buffer;
-
-  // Set the Copybit Source
-  copybit_image_t src;
-  src.handle = const_cast<native_handle_t *>(hwc_layer->handle);
-  src.w = hnd->width;
-  src.h = hnd->height;
-  src.base = reinterpret_cast<void *>(hnd->base);
-  src.format = hnd->format;
-  src.horiz_padding = 0;
-  src.vert_padding = 0;
-
-  // Copybit source rect
-  copybit_rect_t src_rect = {INT(blit_rect.left), INT(blit_rect.top), INT(blit_rect.right),
-                            INT(blit_rect.bottom)};
-
-  // Copybit destination rect
-  copybit_rect_t dst_rect = {INT(blit_dest_Rect.left), INT(blit_dest_Rect.top),
-                            INT(blit_dest_Rect.right), INT(blit_dest_Rect.bottom)};
-
-  // Copybit destination buffer
-  copybit_image_t dst;
-  dst.handle = static_cast<native_handle_t *>(target_buffer);
-  dst.w = ALIGN(target_buffer->width, 32);
-  dst.h = ALIGN((target_buffer->height), 32);
-  dst.base = reinterpret_cast<void *>(target_buffer->base);
-  dst.format = target_buffer->format;
-
-  // Copybit region is the destRect
-  LayerRect region_rect;
-  region_rect.left = FLOAT(dst_rect.l);
-  region_rect.top = FLOAT(dst_rect.t);
-  region_rect.right = FLOAT(dst_rect.r);
-  region_rect.bottom = FLOAT(dst_rect.b);
-
-  LayerRectArray region;
-  region.count = 1;
-  region.rect  = &region_rect;
-  RegionIterator copybitRegion(region);
-  int acquireFd = layer_buffer.acquire_fence_fd;
-
-  // FRAMEBUFFER_WIDTH/HEIGHT for c2d is the target buffer w/h
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_FRAMEBUFFER_WIDTH,
-                                  target_buffer->width);
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_FRAMEBUFFER_HEIGHT,
-                                  target_buffer->height);
-  int transform = 0;
-  if (layer->transform.rotation != 0.0f) transform |= COPYBIT_TRANSFORM_ROT_90;
-  if (layer->transform.flip_horizontal) transform |= COPYBIT_TRANSFORM_FLIP_H;
-  if (layer->transform.flip_vertical) transform |= COPYBIT_TRANSFORM_FLIP_V;
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_TRANSFORM, transform);
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_PLANE_ALPHA, hwc_layer->planeAlpha);
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_BLEND_MODE, hwc_layer->blending);
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_DITHER,
-    (dst.format == HAL_PIXEL_FORMAT_RGB_565) ? COPYBIT_ENABLE : COPYBIT_DISABLE);
-
-  int src_format_mode = COPYBIT_LINEAR;
-  if (hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
-    src_format_mode = COPYBIT_UBWC_COMPRESSED;
-  }
-  blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_SRC_FORMAT_MODE, src_format_mode);
-
-  blit_engine_c2d_->set_sync(blit_engine_c2d_, acquireFd);
-  int err = blit_engine_c2d_->stretch(blit_engine_c2d_, &dst, &src, &dst_rect, &src_rect,
-                                      &copybitRegion);
-
-  if (err < 0) {
-    DLOGE("copybit stretch failed");
-  }
-
-  return err;
-}
-
-void BlitEngineC2d::DumpBlitTargetBuffer(int fd) {
-  if (!dump_frame_count_) {
-    return;
-  }
-
-  private_handle_t *target_buffer = blit_target_buffer_[current_blit_target_index_];
-
-  if (fd >= 0) {
-    int error = sync_wait(fd, 1000);
-    if (error < 0) {
-      DLOGW("sync_wait error errno = %d, desc = %s", errno, strerror(errno));
-      return;
-    }
-  }
-
-  char dump_file_name[PATH_MAX];
-  size_t result = 0;
-  snprintf(dump_file_name, sizeof(dump_file_name), "/data/misc/display/frame_dump_primary"
-           "/blit_target_%d.raw", (dump_frame_index_));
-  FILE* fp = fopen(dump_file_name, "w+");
-  if (fp) {
-    result = fwrite(reinterpret_cast<void *>(target_buffer->base), target_buffer->size, 1, fp);
-    fclose(fp);
-  }
-  dump_frame_count_--;
-  dump_frame_index_++;
-}
-
-}  // namespace sdm
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
diff --git a/sdm/libs/hwc/blit_engine_c2d.h b/sdm/libs/hwc/blit_engine_c2d.h
deleted file mode 100644
index 6536d44..0000000
--- a/sdm/libs/hwc/blit_engine_c2d.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Copyright (c) 2012 - 2016, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*  * Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  * Redistributions in binary form must reproduce the above
-*    copyright notice, this list of conditions and the following
-*    disclaimer in the documentation and/or other materials provided
-*    with the distribution.
-*  * Neither the name of The Linux Foundation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-* Portions formerly licensed under Apache License, Version 2.0, are re licensed
-* under section 4 of Apache License, Version 2.0.
-
-* Copyright (C) 2010 The Android Open Source Project
-
-* Not a Contribution.
-
-* 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.
-*/
-
-/*! @file blit_engine.h
-  @brief Interface file for Blit based compositior.
-
-  @details The client can use this interface to get the blit composition done
-
-*/
-
-#include <hardware/hwcomposer.h>
-#include <core/layer_stack.h>
-#include <copybit.h>
-#include "blit_engine.h"
-
-#ifndef __BLIT_ENGINE_C2D_H__
-#define __BLIT_ENGINE_C2D_H__
-
-namespace sdm {
-
-// C2D Blit implemented by the client
-// This class implements the BlitEngine Interface which is used to get the
-// Blit composition using C2D
-class BlitEngineC2d : public BlitEngine {
- public:
-  BlitEngineC2d();
-  virtual ~BlitEngineC2d();
-
-  virtual int Init();
-  virtual void DeInit();
-  virtual int Prepare(LayerStack *layer_stack);
-  virtual int PreCommit(hwc_display_contents_1_t *content_list, LayerStack *layer_stack);
-  virtual int Commit(hwc_display_contents_1_t *content_list, LayerStack *layer_stack);
-  virtual void PostCommit(LayerStack *layer_stack);
-  virtual bool BlitActive();
-  virtual void SetFrameDumpConfig(uint32_t count);
-
-
- private:
-  static const uint32_t kNumBlitTargetBuffers = 3;
-
-  struct Range {
-    int current;
-    int end;
-  };
-
-  struct RegionIterator : public copybit_region_t {
-    explicit RegionIterator(LayerRectArray rect);
-   private:
-    static int iterate(copybit_region_t const *self, copybit_rect_t *rect);
-    LayerRectArray rect_array;
-    mutable Range r;
-  };
-
-  int AllocateBlitTargetBuffers(uint32_t width, uint32_t height, uint32_t format, uint32_t usage);
-  void FreeBlitTargetBuffers();
-  int ClearTargetBuffer(private_handle_t* hnd, const LayerRect& rect);
-  int DrawRectUsingCopybit(hwc_layer_1_t *hwc_layer, Layer *layer, LayerRect blit_rect,
-                           LayerRect blit_dest_Rect);
-  void SetReleaseFence(int fence_fd);
-  void DumpBlitTargetBuffer(int fd);
-
-  copybit_device_t *blit_engine_c2d_ = NULL;
-  private_handle_t *blit_target_buffer_[kNumBlitTargetBuffers];
-  uint32_t current_blit_target_index_ = 0;
-  int release_fence_fd_[kNumBlitTargetBuffers];
-  uint32_t num_blit_target_ = 0;
-  int blit_target_start_index_ = 0;
-  bool blit_active_ = false;
-  uint32_t dump_frame_count_ = 0;
-  uint32_t dump_frame_index_ = 0;
-};
-
-}  // namespace sdm
-
-#endif  // __BLIT_ENGINE_C2D_H__
diff --git a/sdm/libs/hwc/hwc_color_manager.cpp b/sdm/libs/hwc/hwc_color_manager.cpp
deleted file mode 100644
index 471ca49..0000000
--- a/sdm/libs/hwc/hwc_color_manager.cpp
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
-* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*     * Redistributions of source code must retain the above copyright
-*       notice, this list of conditions and the following disclaimer.
-*     * Redistributions in binary form must reproduce the above
-*       copyright notice, this list of conditions and the following
-*       disclaimer in the documentation and/or other materials provided
-*       with the distribution.
-*     * Neither the name of The Linux Foundation nor the names of its
-*       contributors may be used to endorse or promote products derived
-*       from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <dlfcn.h>
-#include <powermanager/IPowerManager.h>
-#include <cutils/sockets.h>
-#include <cutils/native_handle.h>
-#include <utils/String16.h>
-#include <binder/Parcel.h>
-#include <gralloc_priv.h>
-#include <hardware/hwcomposer.h>
-#include <hardware/hwcomposer_defs.h>
-#include <QService.h>
-
-#include <core/dump_interface.h>
-#include <utils/constants.h>
-#include <utils/debug.h>
-#include <core/buffer_allocator.h>
-#include <private/color_params.h>
-#include "hwc_buffer_allocator.h"
-#include "hwc_buffer_sync_handler.h"
-#include "hwc_session.h"
-#include "hwc_debugger.h"
-
-#define __CLASS__ "HWCColorManager"
-
-namespace sdm {
-
-uint32_t HWCColorManager::Get8BitsARGBColorValue(const PPColorFillParams &params) {
-  uint32_t argb_color = ((params.color.r << 16) & 0xff0000) | ((params.color.g << 8) & 0xff00) |
-                        ((params.color.b) & 0xff);
-  return argb_color;
-}
-
-int HWCColorManager::CreatePayloadFromParcel(const android::Parcel &in, uint32_t *disp_id,
-                                             PPDisplayAPIPayload *sink) {
-  int ret = 0;
-  uint32_t id(0);
-  uint32_t size(0);
-
-  id = UINT32(in.readInt32());
-  size = UINT32(in.readInt32());
-  if (size > 0 && size == in.dataAvail()) {
-    const void *data = in.readInplace(size);
-    const uint8_t *temp = reinterpret_cast<const uint8_t *>(data);
-
-    sink->size = size;
-    sink->payload = const_cast<uint8_t *>(temp);
-    *disp_id = id;
-  } else {
-    DLOGW("Failing size checking, size = %d", size);
-    ret = -EINVAL;
-  }
-
-  return ret;
-}
-
-void HWCColorManager::MarshallStructIntoParcel(const PPDisplayAPIPayload &data,
-                                               android::Parcel *out_parcel) {
-  out_parcel->writeInt32(INT32(data.size));
-  if (data.payload)
-    out_parcel->write(data.payload, data.size);
-}
-
-HWCColorManager *HWCColorManager::CreateColorManager() {
-  HWCColorManager *color_mgr = new HWCColorManager();
-
-  if (color_mgr) {
-    // Load display API interface library. And retrieve color API function tables.
-    DynLib &color_apis_lib = color_mgr->color_apis_lib_;
-    if (color_apis_lib.Open(DISPLAY_API_INTERFACE_LIBRARY_NAME)) {
-      if (!color_apis_lib.Sym(DISPLAY_API_FUNC_TABLES, &color_mgr->color_apis_)) {
-        DLOGE("Fail to retrieve = %s from %s", DISPLAY_API_FUNC_TABLES,
-              DISPLAY_API_INTERFACE_LIBRARY_NAME);
-        delete color_mgr;
-        return NULL;
-      }
-    } else {
-      DLOGW("Unable to load = %s", DISPLAY_API_INTERFACE_LIBRARY_NAME);
-      delete color_mgr;
-      return NULL;
-    }
-    DLOGI("Successfully loaded %s", DISPLAY_API_INTERFACE_LIBRARY_NAME);
-
-    // Load diagclient library and invokes its entry point to pass in display APIs.
-    DynLib &diag_client_lib = color_mgr->diag_client_lib_;
-    if (diag_client_lib.Open(QDCM_DIAG_CLIENT_LIBRARY_NAME)) {
-      if (!diag_client_lib.Sym(INIT_QDCM_DIAG_CLIENT_NAME,
-                               reinterpret_cast<void **>(&color_mgr->qdcm_diag_init_)) ||
-        !diag_client_lib.Sym(DEINIT_QDCM_DIAG_CLIENT_NAME,
-                               reinterpret_cast<void **>(&color_mgr->qdcm_diag_deinit_))) {
-        DLOGE("Fail to retrieve = %s from %s", INIT_QDCM_DIAG_CLIENT_NAME,
-              QDCM_DIAG_CLIENT_LIBRARY_NAME);
-      } else {
-        // invoke Diag Client entry point to initialize.
-        color_mgr->qdcm_diag_init_(color_mgr->color_apis_);
-        DLOGI("Successfully loaded %s and %s and diag_init'ed", DISPLAY_API_INTERFACE_LIBRARY_NAME,
-              QDCM_DIAG_CLIENT_LIBRARY_NAME);
-      }
-    } else {
-      DLOGW("Unable to load = %s", QDCM_DIAG_CLIENT_LIBRARY_NAME);
-      // only QDCM Diag client failed to be loaded and system still should function.
-    }
-  } else {
-    DLOGE("Unable to create HWCColorManager");
-    return NULL;
-  }
-
-  return color_mgr;
-}
-
-HWCColorManager::~HWCColorManager() {
-}
-
-void HWCColorManager::DestroyColorManager() {
-  if (qdcm_mode_mgr_) {
-    delete qdcm_mode_mgr_;
-  }
-  if (qdcm_diag_deinit_) {
-    qdcm_diag_deinit_();
-  }
-  delete this;
-}
-
-int HWCColorManager::EnableQDCMMode(bool enable, HWCDisplay *hwc_display) {
-  int ret = 0;
-
-  if (!qdcm_mode_mgr_) {
-    qdcm_mode_mgr_ = HWCQDCMModeManager::CreateQDCMModeMgr();
-    if (!qdcm_mode_mgr_) {
-      DLOGE("Unable to create QDCM operating mode manager.");
-      ret = -EFAULT;
-    }
-  }
-
-  if (qdcm_mode_mgr_) {
-    ret = qdcm_mode_mgr_->EnableQDCMMode(enable, hwc_display);
-  }
-
-  return ret;
-}
-
-bool HWCColorManager::SolidFillLayersPrepare(hwc_display_contents_1_t **displays,
-                                             HWCDisplay *hwc_display) {
-  SCOPE_LOCK(locker_);
-
-  // Query HWCColorManager if QDCM tool requesting SOLID_FILL mode.
-  uint32_t solid_fill_color = Get8BitsARGBColorValue(solid_fill_params_);
-  hwc_display_contents_1_t *layer_list = displays[HWC_DISPLAY_PRIMARY];
-
-  if (solid_fill_enable_ && solid_fill_layers_ && layer_list) {
-    // 1. shallow copy HWC_FRAMEBUFFER_TARGET layer info solid fill layer list.
-    solid_fill_layers_->hwLayers[1] = layer_list->hwLayers[layer_list->numHwLayers - 1];
-
-    // 2. continue the prepare<> on solid_fill_layers.
-    hwc_display->Perform(HWCDisplayPrimary::SET_QDCM_SOLID_FILL_INFO, solid_fill_color);
-    hwc_display->Prepare(solid_fill_layers_);  // RECT info included.
-
-    // 3. Set HWC_OVERLAY to all SF layers before returning to framework.
-    for (size_t i = 0; i < (layer_list->numHwLayers - 1); i++) {
-      hwc_layer_1_t *layer = &layer_list->hwLayers[i];
-      layer->compositionType = HWC_OVERLAY;
-    }
-
-    return true;
-  } else if (!solid_fill_enable_) {
-    hwc_display->Perform(HWCDisplayPrimary::UNSET_QDCM_SOLID_FILL_INFO, 0);
-  }
-
-  return false;
-}
-
-bool HWCColorManager::SolidFillLayersSet(hwc_display_contents_1_t **displays,
-                                         HWCDisplay *hwc_display) {
-  // Query HWCColorManager if QDCM tool requesting SOLID_FILL mode.
-  SCOPE_LOCK(locker_);
-  hwc_display_contents_1_t *layer_list = displays[HWC_DISPLAY_PRIMARY];
-  if (solid_fill_enable_ && solid_fill_layers_ && layer_list) {
-    hwc_display->Commit(solid_fill_layers_);
-
-    // SurfaceFlinger layer stack is dropped in solid fill case and replaced with local layer stack
-    // Close acquire fence fds associated with SF layer stack
-    // Close release/retire fence fds returned along with local layer stack
-    for (size_t i = 0; i < (layer_list->numHwLayers - 1); i++) {
-      int &fence_fd = layer_list->hwLayers[i].acquireFenceFd;
-      if (fence_fd >= 0) {
-        close(fence_fd);
-        fence_fd = -1;
-      }
-    }
-
-    for (size_t i = 0; i < (solid_fill_layers_->numHwLayers - 1); i++) {
-      int &fence_fd = solid_fill_layers_->hwLayers[i].releaseFenceFd;
-      if (fence_fd >= 0) {
-        close(fence_fd);
-        fence_fd = -1;
-      }
-    }
-    if (solid_fill_layers_->retireFenceFd >= 0) {
-      close(solid_fill_layers_->retireFenceFd);
-      solid_fill_layers_->retireFenceFd = -1;
-    }
-
-    return true;
-  }
-
-  return false;
-}
-
-int HWCColorManager::CreateSolidFillLayers(HWCDisplay *hwc_display) {
-  int ret = 0;
-
-  if (!solid_fill_layers_) {
-    uint32_t size = sizeof(hwc_display_contents_1) + kNumSolidFillLayers * sizeof(hwc_layer_1_t);
-    uint32_t primary_width = 0;
-    uint32_t primary_height = 0;
-
-    hwc_display->GetMixerResolution(&primary_width, &primary_height);
-    uint8_t *buf = new uint8_t[size]();
-    // handle for solid fill layer with fd = -1.
-    private_handle_t *handle =
-        new private_handle_t(-1, 0, private_handle_t::PRIV_FLAGS_FRAMEBUFFER, BUFFER_TYPE_UI,
-                             HAL_PIXEL_FORMAT_RGBA_8888, INT32(primary_width),
-                             INT32(primary_height));
-
-    if (!buf || !handle) {
-      DLOGE("Failed to allocate memory.");
-      if (buf)
-        delete[] buf;
-      if (handle)
-        delete handle;
-
-      return -ENOMEM;
-    }
-
-    solid_fill_layers_ = reinterpret_cast<hwc_display_contents_1 *>(buf);
-    hwc_layer_1_t &layer = solid_fill_layers_->hwLayers[0];
-    layer.handle = handle;
-  }
-
-  solid_fill_layers_->flags = HWC_GEOMETRY_CHANGED;
-  solid_fill_layers_->numHwLayers = kNumSolidFillLayers;
-  solid_fill_layers_->retireFenceFd = -1;
-  solid_fill_layers_->outbuf = NULL;
-  solid_fill_layers_->outbufAcquireFenceFd = -1;
-
-  hwc_layer_1_t &layer = solid_fill_layers_->hwLayers[0];
-  hwc_rect_t solid_fill_rect = {
-      INT(solid_fill_params_.rect.x),
-      INT(solid_fill_params_.rect.y),
-      solid_fill_params_.rect.x + INT(solid_fill_params_.rect.width),
-      solid_fill_params_.rect.y + INT(solid_fill_params_.rect.height),
-  };
-
-  layer.compositionType = HWC_FRAMEBUFFER;
-  layer.blending = HWC_BLENDING_PREMULT;
-  layer.sourceCropf.left = solid_fill_params_.rect.x;
-  layer.sourceCropf.top = solid_fill_params_.rect.y;
-  layer.sourceCropf.right = UINT32(solid_fill_params_.rect.x) + solid_fill_params_.rect.width;
-  layer.sourceCropf.bottom = UINT32(solid_fill_params_.rect.y) + solid_fill_params_.rect.height;
-  layer.acquireFenceFd = -1;
-  layer.releaseFenceFd = -1;
-  layer.flags = 0;
-  layer.transform = 0;
-  layer.hints = 0;
-  layer.planeAlpha = 0xff;
-  layer.displayFrame = solid_fill_rect;
-  layer.visibleRegionScreen.numRects = 1;
-  layer.visibleRegionScreen.rects = &layer.displayFrame;
-  layer.surfaceDamage.numRects = 0;
-
-  return ret;
-}
-
-void HWCColorManager::DestroySolidFillLayers() {
-  if (solid_fill_layers_) {
-    hwc_layer_1_t &layer = solid_fill_layers_->hwLayers[0];
-    uint8_t *buf = reinterpret_cast<uint8_t *>(solid_fill_layers_);
-    private_handle_t const *hnd = reinterpret_cast<private_handle_t const *>(layer.handle);
-
-    if (hnd)
-        delete hnd;
-
-    if (buf)
-        delete[] buf;
-
-    solid_fill_layers_ = NULL;
-  }
-}
-
-int HWCColorManager::SetSolidFill(const void *params, bool enable, HWCDisplay *hwc_display) {
-  SCOPE_LOCK(locker_);
-  int ret = 0;
-
-  if (params) {
-    solid_fill_params_ = *reinterpret_cast<const PPColorFillParams *>(params);
-  } else {
-    solid_fill_params_ = PPColorFillParams();
-  }
-
-  if (enable) {
-    // will create solid fill layers for rendering if not present.
-    ret = CreateSolidFillLayers(hwc_display);
-  } else {
-    DestroySolidFillLayers();
-  }
-  solid_fill_enable_ = enable;
-
-  return ret;
-}
-
-int HWCColorManager::SetFrameCapture(void *params, bool enable, HWCDisplay *hwc_display) {
-  SCOPE_LOCK(locker_);
-  int ret = 0;
-
-  PPFrameCaptureData *frame_capture_data = reinterpret_cast<PPFrameCaptureData*>(params);
-
-  if (enable) {
-    std::memset(&buffer_info, 0x00, sizeof(buffer_info));
-    hwc_display->GetPanelResolution(&buffer_info.buffer_config.width,
-                                    &buffer_info.buffer_config.height);
-    if (frame_capture_data->input_params.out_pix_format == PP_PIXEL_FORMAT_RGB_888) {
-      buffer_info.buffer_config.format = kFormatRGB888;
-    } else if (frame_capture_data->input_params.out_pix_format == PP_PIXEL_FORMAT_RGB_2101010) {
-      buffer_info.buffer_config.format = kFormatRGBA1010102;
-    } else {
-      DLOGE("Pixel-format: %d NOT support.", frame_capture_data->input_params.out_pix_format);
-      return -EFAULT;
-    }
-
-    buffer_info.buffer_config.buffer_count = 1;
-    buffer_info.alloc_buffer_info.fd = -1;
-    buffer_info.alloc_buffer_info.stride = 0;
-    buffer_info.alloc_buffer_info.size = 0;
-
-    buffer_allocator_ = new HWCBufferAllocator();
-    if (buffer_allocator_ == NULL) {
-      DLOGE("Memory allocation for buffer_allocator_ FAILED");
-      return -ENOMEM;
-    }
-
-    ret = buffer_allocator_->AllocateBuffer(&buffer_info);
-    if (ret != 0) {
-      DLOGE("Buffer allocation failed. ret: %d", ret);
-      delete buffer_allocator_;
-      buffer_allocator_ = NULL;
-      return -ENOMEM;
-    } else {
-      void *buffer = mmap(NULL, buffer_info.alloc_buffer_info.size,
-                          PROT_READ|PROT_WRITE,
-                          MAP_SHARED, buffer_info.alloc_buffer_info.fd, 0);
-
-      if (buffer == MAP_FAILED) {
-        DLOGE("mmap failed. err = %d", errno);
-        frame_capture_data->buffer = NULL;
-        ret = buffer_allocator_->FreeBuffer(&buffer_info);
-        delete buffer_allocator_;
-        buffer_allocator_ = NULL;
-        return -EFAULT;
-      } else {
-        frame_capture_data->buffer = reinterpret_cast<uint8_t *>(buffer);
-        frame_capture_data->buffer_stride = buffer_info.alloc_buffer_info.aligned_width;
-        frame_capture_data->buffer_size = buffer_info.alloc_buffer_info.size;
-      }
-      ret = hwc_display->FrameCaptureAsync(buffer_info, 1);
-      if (ret < 0) {
-        DLOGE("FrameCaptureAsync failed. ret = %d", ret);
-      }
-    }
-  } else {
-    ret = hwc_display->GetFrameCaptureStatus();
-    if (!ret) {
-      if (frame_capture_data->buffer != NULL) {
-        if (munmap(frame_capture_data->buffer, buffer_info.alloc_buffer_info.size) != 0) {
-          DLOGE("munmap failed. err = %d", errno);
-        }
-      }
-      if (buffer_allocator_ != NULL) {
-        std::memset(frame_capture_data, 0x00, sizeof(PPFrameCaptureData));
-        ret = buffer_allocator_->FreeBuffer(&buffer_info);
-        if (ret != 0) {
-          DLOGE("FreeBuffer failed. ret = %d", ret);
-        }
-        delete buffer_allocator_;
-        buffer_allocator_ = NULL;
-      }
-    } else {
-      DLOGE("GetFrameCaptureStatus failed. ret = %d", ret);
-    }
-  }
-  return ret;
-}
-
-int HWCColorManager::SetHWDetailedEnhancerConfig(void *params, HWCDisplay *hwc_display) {
-  int err = -1;
-  DisplayDetailEnhancerData de_data;
-
-  PPDETuningCfgData *de_tuning_cfg_data = reinterpret_cast<PPDETuningCfgData*>(params);
-  if (de_tuning_cfg_data->cfg_pending == true) {
-    if (!de_tuning_cfg_data->cfg_en) {
-      de_data.override_flags = kOverrideDEEnable;
-      de_data.enable = 0;
-    } else {
-      de_data.override_flags = kOverrideDEEnable;
-      de_data.enable = 1;
-
-      if (de_tuning_cfg_data->params.flags & kDeTuningFlagSharpFactor) {
-        de_data.override_flags |= kOverrideDESharpen1;
-        de_data.sharp_factor = de_tuning_cfg_data->params.sharp_factor;
-      }
-
-      if (de_tuning_cfg_data->params.flags & kDeTuningFlagClip) {
-        de_data.override_flags |= kOverrideDEClip;
-        de_data.clip = de_tuning_cfg_data->params.clip;
-      }
-
-      if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrQuiet) {
-        de_data.override_flags |= kOverrideDEThrQuiet;
-        de_data.thr_quiet = de_tuning_cfg_data->params.thr_quiet;
-      }
-
-      if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrDieout) {
-        de_data.override_flags |= kOverrideDEThrDieout;
-        de_data.thr_dieout = de_tuning_cfg_data->params.thr_dieout;
-      }
-
-      if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrLow) {
-        de_data.override_flags |= kOverrideDEThrLow;
-        de_data.thr_low = de_tuning_cfg_data->params.thr_low;
-      }
-
-      if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrHigh) {
-        de_data.override_flags |= kOverrideDEThrHigh;
-        de_data.thr_high = de_tuning_cfg_data->params.thr_high;
-      }
-
-      if (de_tuning_cfg_data->params.flags & kDeTuningFlagContentQualLevel) {
-        switch (de_tuning_cfg_data->params.quality) {
-          case kDeContentQualLow:
-            de_data.quality_level = kContentQualityLow;
-            break;
-          case kDeContentQualMedium:
-            de_data.quality_level = kContentQualityMedium;
-            break;
-          case kDeContentQualHigh:
-            de_data.quality_level = kContentQualityHigh;
-            break;
-          case kDeContentQualUnknown:
-          default:
-            de_data.quality_level = kContentQualityUnknown;
-            break;
-        }
-      }
-    }
-    err = hwc_display->SetDetailEnhancerConfig(de_data);
-    if (err) {
-      DLOGW("SetDetailEnhancerConfig failed. err = %d", err);
-    }
-    de_tuning_cfg_data->cfg_pending = false;
-  }
-  return err;
-}
-
-void HWCColorManager::SetColorModeDetailEnhancer(HWCDisplay *hwc_display) {
-  SCOPE_LOCK(locker_);
-  int err = -1;
-  PPPendingParams pending_action;
-  PPDisplayAPIPayload req_payload;
-
-  pending_action.action = kGetDetailedEnhancerData;
-  pending_action.params = NULL;
-
-  if (hwc_display) {
-    err = hwc_display->ColorSVCRequestRoute(req_payload, NULL, &pending_action);
-    if (!err && pending_action.action == kConfigureDetailedEnhancer) {
-      err = SetHWDetailedEnhancerConfig(pending_action.params, hwc_display);
-    }
-  }
-  return;
-}
-
-int HWCColorManager::SetDetailedEnhancer(void *params, HWCDisplay *hwc_display) {
-  SCOPE_LOCK(locker_);
-  int err = -1;
-  err = SetHWDetailedEnhancerConfig(params, hwc_display);
-  return err;
-}
-
-const HWCQDCMModeManager::ActiveFeatureCMD HWCQDCMModeManager::kActiveFeatureCMD[] = {
-    HWCQDCMModeManager::ActiveFeatureCMD("cabl:on", "cabl:off", "cabl:status", "running"),
-    HWCQDCMModeManager::ActiveFeatureCMD("ad:on", "ad:off", "ad:query:status", "running"),
-    HWCQDCMModeManager::ActiveFeatureCMD("svi:on", "svi:off", "svi:status", "running"),
-};
-
-const char *const HWCQDCMModeManager::kSocketName = "pps";
-const char *const HWCQDCMModeManager::kTagName = "surfaceflinger";
-const char *const HWCQDCMModeManager::kPackageName = "colormanager";
-
-HWCQDCMModeManager *HWCQDCMModeManager::CreateQDCMModeMgr() {
-  HWCQDCMModeManager *mode_mgr = new HWCQDCMModeManager();
-
-  if (!mode_mgr) {
-    DLOGW("No memory to create HWCQDCMModeManager.");
-    return NULL;
-  } else {
-    mode_mgr->socket_fd_ =
-        ::socket_local_client(kSocketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM);
-    if (mode_mgr->socket_fd_ < 0) {
-      // it should not be disastrous and we still can grab wakelock in QDCM mode.
-      DLOGW("Unable to connect to dpps socket!");
-    }
-
-    // retrieve system GPU idle timeout value for later to recover.
-    mode_mgr->entry_timeout_ = UINT32(HWCDebugHandler::GetIdleTimeoutMs());
-
-    // acquire the binder handle to Android system PowerManager for later use.
-    android::sp<android::IBinder> binder =
-        android::defaultServiceManager()->checkService(android::String16("power"));
-    if (binder == NULL) {
-      DLOGW("Application can't connect to  power manager service");
-      delete mode_mgr;
-      mode_mgr = NULL;
-    } else {
-      mode_mgr->power_mgr_ = android::interface_cast<android::IPowerManager>(binder);
-    }
-  }
-
-  return mode_mgr;
-}
-
-HWCQDCMModeManager::~HWCQDCMModeManager() {
-  if (socket_fd_ >= 0)
-    ::close(socket_fd_);
-}
-
-int HWCQDCMModeManager::AcquireAndroidWakeLock(bool enable) {
-  int ret = 0;
-
-  if (enable) {
-    if (wakelock_token_ == NULL) {
-      android::sp<android::IBinder> binder = new android::BBinder();
-      android::status_t status = power_mgr_->acquireWakeLock(
-          (kFullWakeLock | kAcquireCauseWakeup | kONAfterRelease), binder,
-          android::String16(kTagName), android::String16(kPackageName));
-      if (status == android::NO_ERROR) {
-        wakelock_token_ = binder;
-      }
-    }
-  } else {
-    if (wakelock_token_ != NULL && power_mgr_ != NULL) {
-      power_mgr_->releaseWakeLock(wakelock_token_, 0);
-      wakelock_token_.clear();
-      wakelock_token_ = NULL;
-    }
-  }
-
-  return ret;
-}
-
-int HWCQDCMModeManager::EnableActiveFeatures(bool enable,
-                                             const HWCQDCMModeManager::ActiveFeatureCMD &cmds,
-                                             bool *was_running) {
-  int ret = 0;
-  ssize_t size = 0;
-  char response[kSocketCMDMaxLength] = {
-      0,
-  };
-
-  if (socket_fd_ < 0) {
-    DLOGW("No socket connection available!");
-    return -EFAULT;
-  }
-
-  if (!enable) {  // if client requesting to disable it.
-    // query CABL status, if off, no action. keep the status.
-    size = ::write(socket_fd_, cmds.cmd_query_status, strlen(cmds.cmd_query_status));
-    if (size < 0) {
-      DLOGW("Unable to send data over socket %s", ::strerror(errno));
-      ret = -EFAULT;
-    } else {
-      size = ::read(socket_fd_, response, kSocketCMDMaxLength);
-      if (size < 0) {
-        DLOGW("Unable to read data over socket %s", ::strerror(errno));
-        ret = -EFAULT;
-      } else if (!strncmp(response, cmds.running, strlen(cmds.running))) {
-        *was_running = true;
-      }
-    }
-
-    if (*was_running) {  // if was running, it's requested to disable it.
-      size = ::write(socket_fd_, cmds.cmd_off, strlen(cmds.cmd_off));
-      if (size < 0) {
-        DLOGW("Unable to send data over socket %s", ::strerror(errno));
-        ret = -EFAULT;
-      }
-    }
-  } else {  // if was running, need enable it back.
-    if (*was_running) {
-      size = ::write(socket_fd_, cmds.cmd_on, strlen(cmds.cmd_on));
-      if (size < 0) {
-        DLOGW("Unable to send data over socket %s", ::strerror(errno));
-        ret = -EFAULT;
-      }
-    }
-  }
-
-  return ret;
-}
-
-int HWCQDCMModeManager::EnableQDCMMode(bool enable, HWCDisplay *hwc_display) {
-  int ret = 0;
-
-  ret = EnableActiveFeatures((enable ? false : true), kActiveFeatureCMD[kCABLFeature],
-                             &cabl_was_running_);
-  ret = AcquireAndroidWakeLock(enable);
-
-  // if enter QDCM mode, disable GPU fallback idle timeout.
-  if (hwc_display) {
-    uint32_t timeout = enable ? 0 : entry_timeout_;
-    hwc_display->SetIdleTimeoutMs(timeout);
-  }
-
-  return ret;
-}
-
-}  // namespace sdm
diff --git a/sdm/libs/hwc/hwc_color_manager.h b/sdm/libs/hwc/hwc_color_manager.h
deleted file mode 100644
index 20d2b39..0000000
--- a/sdm/libs/hwc/hwc_color_manager.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Copyright (c) 2015-2017, The Linux Foundataion. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*     * Redistributions of source code must retain the above copyright
-*       notice, this list of conditions and the following disclaimer.
-*     * Redistributions in binary form must reproduce the above
-*       copyright notice, this list of conditions and the following
-*       disclaimer in the documentation and/or other materials provided
-*       with the distribution.
-*     * Neither the name of The Linux Foundation nor the names of its
-*       contributors may be used to endorse or promote products derived
-*       from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-#ifndef __HWC_COLOR_MANAGER_H__
-#define __HWC_COLOR_MANAGER_H__
-
-#include <stdlib.h>
-#include <binder/Parcel.h>
-#include <powermanager/IPowerManager.h>
-#include <binder/BinderService.h>
-#include <core/sdm_types.h>
-#include <utils/locker.h>
-#include <utils/sys.h>
-
-namespace sdm {
-
-// This macro defines name for display APIs interface wrapper library.
-// This macro shall be used to load library using dlopen().
-#define DISPLAY_API_INTERFACE_LIBRARY_NAME "libsdm-disp-vndapis.so"
-
-// This macro defines variable name of display color APIs function tables
-// This macro shall be used to specify name of the variable in dlsym().
-#define DISPLAY_API_FUNC_TABLES "display_color_apis_ftables"
-#define QDCM_DIAG_CLIENT_LIBRARY_NAME "libsdm-diag.so"
-#define INIT_QDCM_DIAG_CLIENT_NAME "QDCMDiagInit"
-#define DEINIT_QDCM_DIAG_CLIENT_NAME "QDCMDiagDeInit"
-
-typedef int (*QDCMDiagInit)(void *ftables);
-
-typedef int (*QDCMDiagDeInit)(void);
-
-// Class to encapsulte all details of managing QDCM operating mode.
-class HWCQDCMModeManager {
- public:
-  static const uint32_t kSocketCMDMaxLength = 4096;
-  static const uint32_t kFullWakeLock = 0x0000001a;
-  static const uint32_t kAcquireCauseWakeup = 0x10000000;
-  static const uint32_t kONAfterRelease = 0x20000000;
-  enum ActiveFeatureID {
-    kCABLFeature,
-    kADFeature,
-    kSVIFeature,
-    kMaxNumActiveFeature,
-  };
-
-  struct ActiveFeatureCMD {
-    const char *cmd_on = NULL;
-    const char *cmd_off = NULL;
-    const char *cmd_query_status = NULL;
-    const char *running = NULL;
-    ActiveFeatureCMD(const char *arg1, const char *arg2, const char *arg3, const char *arg4)
-        : cmd_on(arg1), cmd_off(arg2), cmd_query_status(arg3), running(arg4) {}
-  };
-
-  static const ActiveFeatureCMD kActiveFeatureCMD[kMaxNumActiveFeature];
-
- public:
-  static HWCQDCMModeManager *CreateQDCMModeMgr();
-  ~HWCQDCMModeManager();
-  int EnableQDCMMode(bool enable, HWCDisplay *hwc_display);
-
- protected:
-  bool SendSocketCmd();
-  int AcquireAndroidWakeLock(bool enable);
-  int EnableActiveFeatures(bool enable);
-  int EnableActiveFeatures(bool enable, const ActiveFeatureCMD &cmds, bool *was_running);
-
- private:
-  bool cabl_was_running_ = false;
-  int socket_fd_ = -1;
-  android::sp<android::IBinder> wakelock_token_ = NULL;
-  android::sp<android::IPowerManager> power_mgr_ = NULL;
-  uint32_t entry_timeout_ = 0;
-  static const char *const kSocketName;
-  static const char *const kTagName;
-  static const char *const kPackageName;
-};
-
-// Class to encapsulte all HWC/OS specific behaviours for ColorManager.
-class HWCColorManager {
- public:
-  static const int kNumSolidFillLayers = 2;
-  static HWCColorManager *CreateColorManager();
-  static int CreatePayloadFromParcel(const android::Parcel &in, uint32_t *disp_id,
-                                     PPDisplayAPIPayload *sink);
-  static void MarshallStructIntoParcel(const PPDisplayAPIPayload &data,
-                                       android::Parcel *out_parcel);
-
-  ~HWCColorManager();
-  void DestroyColorManager();
-  int EnableQDCMMode(bool enable, HWCDisplay *hwc_display);
-  int SetSolidFill(const void *params, bool enable, HWCDisplay *hwc_display);
-  bool SolidFillLayersPrepare(hwc_display_contents_1_t **displays, HWCDisplay *hwc_display);
-  bool SolidFillLayersSet(hwc_display_contents_1_t **displays, HWCDisplay *hwc_display);
-  int SetFrameCapture(void *params, bool enable, HWCDisplay *hwc_display);
-  int SetDetailedEnhancer(void *params, HWCDisplay *hwc_display);
-  void SetColorModeDetailEnhancer(HWCDisplay *hwc_display);
-  int SetHWDetailedEnhancerConfig(void *params, HWCDisplay *hwc_display);
-
- protected:
-  int CreateSolidFillLayers(HWCDisplay *hwc_display);
-  void DestroySolidFillLayers();
-  static uint32_t Get8BitsARGBColorValue(const PPColorFillParams &params);
-
- private:
-  DynLib color_apis_lib_;
-  DynLib diag_client_lib_;
-  void *color_apis_ = NULL;
-  QDCMDiagInit qdcm_diag_init_ = NULL;
-  QDCMDiagDeInit qdcm_diag_deinit_ = NULL;
-  HWCQDCMModeManager *qdcm_mode_mgr_ = NULL;
-
-  bool solid_fill_enable_ = false;
-  PPColorFillParams solid_fill_params_;
-  hwc_display_contents_1_t *solid_fill_layers_ = NULL;
-  HWCBufferAllocator *buffer_allocator_ = NULL;
-  BufferInfo buffer_info;
-  Locker locker_;
-};
-
-}  // namespace sdm
-
-#endif  // __HWC_COLOR_MANAGER_H__
diff --git a/sdm/libs/hwc/hwc_display.h b/sdm/libs/hwc/hwc_display.h
deleted file mode 100644
index b0a40d5..0000000
--- a/sdm/libs/hwc/hwc_display.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted
-* provided that the following conditions are met:
-*    * Redistributions of source code must retain the above copyright notice, this list of
-*      conditions and the following disclaimer.
-*    * Redistributions in binary form must reproduce the above copyright notice, this list of
-*      conditions and the following disclaimer in the documentation and/or other materials provided
-*      with the distribution.
-*    * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-*      endorse or promote products derived from this software without specific prior written
-*      permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __HWC_DISPLAY_H__
-#define __HWC_DISPLAY_H__
-
-#include <hardware/hwcomposer.h>
-#include <core/core_interface.h>
-#include <qdMetaData.h>
-#include <QService.h>
-#include <private/color_params.h>
-#include <map>
-#include <vector>
-#include <string>
-
-namespace sdm {
-
-class BlitEngine;
-class HWCToneMapper;
-
-// Subclasses set this to their type. This has to be different from DisplayType.
-// This is to avoid RTTI and dynamic_cast
-enum DisplayClass {
-  DISPLAY_CLASS_PRIMARY,
-  DISPLAY_CLASS_EXTERNAL,
-  DISPLAY_CLASS_VIRTUAL,
-  DISPLAY_CLASS_NULL
-};
-
-class HWCColorMode {
- public:
-  explicit HWCColorMode(DisplayInterface *display_intf) : display_intf_(display_intf) {}
-  ~HWCColorMode() {}
-  void Init();
-  void DeInit() {}
-  int SetColorMode(const std::string &color_mode);
-  const std::vector<std::string> &GetColorModes();
-  int SetColorTransform(uint32_t matrix_count, const float *matrix);
-
- private:
-  static const uint32_t kColorTransformMatrixCount = 16;
-  template <class T>
-  void CopyColorTransformMatrix(const T *input_matrix, double *output_matrix) {
-    for (uint32_t i = 0; i < kColorTransformMatrixCount; i++) {
-      output_matrix[i] = static_cast<double>(input_matrix[i]);
-    }
-  }
-  int PopulateColorModes();
-  DisplayInterface *display_intf_ = NULL;
-  std::vector<std::string> color_modes_ = {};
-  std::string current_color_mode_ = {};
-};
-
-class HWCDisplay : public DisplayEventHandler {
- public:
-  enum {
-    SET_METADATA_DYN_REFRESH_RATE,
-    SET_BINDER_DYN_REFRESH_RATE,
-    SET_DISPLAY_MODE,
-    SET_QDCM_SOLID_FILL_INFO,
-    UNSET_QDCM_SOLID_FILL_INFO,
-  };
-
-  virtual ~HWCDisplay() { }
-  virtual int Init();
-  virtual int Deinit();
-  virtual int Prepare(hwc_display_contents_1_t *content_list) = 0;
-  virtual int Commit(hwc_display_contents_1_t *content_list) = 0;
-  virtual int EventControl(int event, int enable);
-  virtual int SetPowerMode(int mode);
-
-  // Framebuffer configurations
-  virtual int GetDisplayConfigs(uint32_t *configs, size_t *num_configs);
-  virtual int GetDisplayAttributes(uint32_t config, const uint32_t *display_attributes,
-                                   int32_t *values);
-  virtual int GetActiveConfig();
-  virtual int SetActiveConfig(int index);
-
-  virtual void SetIdleTimeoutMs(uint32_t timeout_ms);
-  virtual void SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type);
-  virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages);
-  virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) {
-    return kErrorNotSupported;
-  }
-  virtual uint32_t GetLastPowerMode();
-  virtual int SetFrameBufferResolution(uint32_t x_pixels, uint32_t y_pixels);
-  virtual void GetFrameBufferResolution(uint32_t *x_pixels, uint32_t *y_pixels);
-  virtual int SetDisplayStatus(uint32_t display_status);
-  virtual int OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
-  virtual int Perform(uint32_t operation, ...);
-  virtual int SetCursorPosition(int x, int y);
-  virtual void SetSecureDisplay(bool secure_display_active, bool force_flush);
-  virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height);
-  virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height);
-  virtual void GetPanelResolution(uint32_t *width, uint32_t *height);
-
-  // Captures frame output in the buffer specified by output_buffer_info. The API is
-  // non-blocking and the client is expected to check operation status later on.
-  // Returns -1 if the input is invalid.
-  virtual int FrameCaptureAsync(const BufferInfo& output_buffer_info, bool post_processed) {
-    return -1;
-  }
-  // Returns the status of frame capture operation requested with FrameCaptureAsync().
-  // -EAGAIN : No status obtain yet, call API again after another frame.
-  // < 0 : Operation happened but failed.
-  // 0 : Success.
-  virtual int GetFrameCaptureStatus() { return -EAGAIN; }
-
-  virtual DisplayError SetDetailEnhancerConfig(const DisplayDetailEnhancerData &de_data) {
-    return kErrorNotSupported;
-  }
-
-  // Display Configurations
-  virtual int SetActiveDisplayConfig(int config);
-  virtual int GetActiveDisplayConfig(uint32_t *config);
-  virtual int GetDisplayConfigCount(uint32_t *count);
-  virtual int GetDisplayAttributesForConfig(int config,
-                                            DisplayConfigVariableInfo *display_attributes);
-  virtual int GetDisplayFixedConfig(DisplayConfigFixedInfo *fixed_info);
-
-  int SetPanelBrightness(int level);
-  int GetPanelBrightness(int *level);
-  int CachePanelBrightness(int level);
-  int ToggleScreenUpdates(bool enable);
-  int ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload,
-                           PPDisplayAPIPayload *out_payload,
-                           PPPendingParams *pending_action);
-  int GetVisibleDisplayRect(hwc_rect_t* rect);
-  DisplayClass GetDisplayClass();
-  int GetDisplayPort(DisplayPort *port);
-
- protected:
-  enum DisplayStatus {
-    kDisplayStatusOffline = 0,
-    kDisplayStatusOnline,
-    kDisplayStatusPause,
-    kDisplayStatusResume,
-  };
-
-  // Dim layer flag set by SurfaceFlinger service.
-  static const uint32_t kDimLayer = 0x80000000;
-
-  // Maximum number of layers supported by display manager.
-  static const uint32_t kMaxLayerCount = 32;
-
-  HWCDisplay(CoreInterface *core_intf, hwc_procs_t const **hwc_procs, DisplayType type, int id,
-             bool needs_blit, qService::QService *qservice, DisplayClass display_class);
-
-  // DisplayEventHandler methods
-  virtual DisplayError VSync(const DisplayEventVSync &vsync);
-  virtual DisplayError Refresh();
-  virtual DisplayError CECMessage(char *message);
-
-  int AllocateLayerStack(hwc_display_contents_1_t *content_list);
-  void FreeLayerStack();
-  virtual int PrePrepareLayerStack(hwc_display_contents_1_t *content_list);
-  virtual int PrepareLayerStack(hwc_display_contents_1_t *content_list);
-  virtual int CommitLayerStack(hwc_display_contents_1_t *content_list);
-  virtual int PostCommitLayerStack(hwc_display_contents_1_t *content_list);
-  virtual void DumpOutputBuffer(const BufferInfo& buffer_info, void *base, int fence);
-  virtual uint32_t RoundToStandardFPS(float fps);
-  virtual uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate);
-  virtual void PrepareDynamicRefreshRate(Layer *layer);
-  virtual DisplayError DisablePartialUpdateOneFrame() {
-    return kErrorNotSupported;
-  }
-  inline void SetRect(const hwc_rect_t &source, LayerRect *target);
-  inline void SetRect(const hwc_frect_t &source, LayerRect *target);
-  inline void SetComposition(const int32_t &source, LayerComposition *target);
-  inline void SetComposition(const LayerComposition &source, int32_t *target);
-  inline void SetBlending(const int32_t &source, LayerBlending *target);
-  int SetFormat(const int32_t &source, const int flags, LayerBufferFormat *target);
-  void SetLayerS3DMode(const LayerBufferS3DFormat &source, uint32_t *target);
-  LayerBufferFormat GetSDMFormat(const int32_t &source, const int flags);
-  const char *GetDisplayString();
-  void MarkLayersForGPUBypass(hwc_display_contents_1_t *content_list);
-  virtual void ApplyScanAdjustment(hwc_rect_t *display_frame);
-  DisplayError SetCSC(const MetaData_t *meta_data, ColorMetaData *color_metadata);
-  DisplayError SetIGC(IGC_t source, LayerIGC *target);
-  DisplayError SetMetaData(const private_handle_t *pvt_handle, Layer *layer);
-  bool NeedsFrameBufferRefresh(hwc_display_contents_1_t *content_list);
-  bool IsLayerUpdating(hwc_display_contents_1_t *content_list, const Layer *layer);
-  bool IsNonIntegralSourceCrop(const hwc_frect_t &source);
-  uint32_t GetUpdatingLayersCount(uint32_t app_layer_count);
-  bool SingleVideoLayerUpdating(uint32_t app_layer_count);
-  bool IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions);
-
-  enum {
-    INPUT_LAYER_DUMP,
-    OUTPUT_LAYER_DUMP,
-  };
-
-  CoreInterface *core_intf_;
-  hwc_procs_t const **hwc_procs_;
-  DisplayType type_;
-  int id_;
-  bool needs_blit_ = false;
-  DisplayInterface *display_intf_ = NULL;
-  LayerStack layer_stack_;
-  bool flush_on_error_ = false;
-  bool flush_ = false;
-  uint32_t dump_frame_count_ = 0;
-  uint32_t dump_frame_index_ = 0;
-  bool dump_input_layers_ = false;
-  uint32_t last_power_mode_;
-  bool swap_interval_zero_ = false;
-  bool display_paused_ = false;
-  uint32_t min_refresh_rate_ = 0;
-  uint32_t max_refresh_rate_ = 0;
-  uint32_t current_refresh_rate_ = 0;
-  bool use_metadata_refresh_rate_ = false;
-  uint32_t metadata_refresh_rate_ = 0;
-  uint32_t force_refresh_rate_ = 0;
-  bool boot_animation_completed_ = false;
-  bool shutdown_pending_ = false;
-  bool use_blit_comp_ = false;
-  bool secure_display_active_ = false;
-  uint32_t skip_prepare_cnt = 0;
-  bool solid_fill_enable_ = false;
-  bool disable_animation_ = false;
-  uint32_t solid_fill_color_ = 0;
-  LayerRect display_rect_;
-  std::map<int, LayerBufferS3DFormat> s3d_format_hwc_to_sdm_;
-  bool animating_ = false;
-  HWCToneMapper *tone_mapper_ = NULL;
-  HWCColorMode *color_mode_ = NULL;
-  int disable_hdr_handling_ = 0;  // disables HDR handling.
-
- private:
-  void DumpInputBuffers(hwc_display_contents_1_t *content_list);
-  int PrepareLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer);
-  void CommitLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer);
-  BlitEngine *blit_engine_ = NULL;
-  qService::QService *qservice_ = NULL;
-  DisplayClass display_class_;
-};
-
-inline int HWCDisplay::Perform(uint32_t operation, ...) {
-  return 0;
-}
-
-}  // namespace sdm
-
-#endif  // __HWC_DISPLAY_H__
-
diff --git a/sdm/libs/hwc/hwc_display_external.h b/sdm/libs/hwc/hwc_display_external.h
deleted file mode 100644
index c5ac3d7..0000000
--- a/sdm/libs/hwc/hwc_display_external.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* Copyright (c) 2014, 2016, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted
-* provided that the following conditions are met:
-*    * Redistributions of source code must retain the above copyright notice, this list of
-*      conditions and the following disclaimer.
-*    * Redistributions in binary form must reproduce the above copyright notice, this list of
-*      conditions and the following disclaimer in the documentation and/or other materials provided
-*      with the distribution.
-*    * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-*      endorse or promote products derived from this software without specific prior written
-*      permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __HWC_DISPLAY_EXTERNAL_H__
-#define __HWC_DISPLAY_EXTERNAL_H__
-
-#include "hwc_display.h"
-
-namespace sdm {
-
-class HWCDisplayExternal : public HWCDisplay {
- public:
-  static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs, uint32_t primary_width,
-                    uint32_t primary_height, qService::QService *qservice, bool use_primary_res,
-                    HWCDisplay **hwc_display);
-  static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                    qService::QService *qservice, HWCDisplay **hwc_display);
-  static void Destroy(HWCDisplay *hwc_display);
-  virtual int Prepare(hwc_display_contents_1_t *content_list);
-  virtual int Commit(hwc_display_contents_1_t *content_list);
-  virtual void SetSecureDisplay(bool secure_display_active, bool force_flush);
-  virtual int Perform(uint32_t operation, ...);
-
- protected:
-  virtual uint32_t RoundToStandardFPS(float fps);
-  virtual void PrepareDynamicRefreshRate(Layer *layer);
-  int drc_enabled_ = 0;
-  int drc_reset_fps_enabled_ = 0;
-
- private:
-  HWCDisplayExternal(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                     qService::QService *qservice);
-  void ApplyScanAdjustment(hwc_rect_t *display_frame);
-  static void GetDownscaleResolution(uint32_t primary_width, uint32_t primary_height,
-                                     uint32_t *virtual_width, uint32_t *virtual_height);
-  void ForceRefreshRate(uint32_t refresh_rate);
-  uint32_t GetOptimalRefreshRate(bool one_updating_layer);
-};
-
-}  // namespace sdm
-
-#endif  // __HWC_DISPLAY_EXTERNAL_H__
-
diff --git a/sdm/libs/hwc/hwc_display_external_test.h b/sdm/libs/hwc/hwc_display_external_test.h
deleted file mode 100644
index 050823e..0000000
--- a/sdm/libs/hwc/hwc_display_external_test.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted
-* provided that the following conditions are met:
-*    * Redistributions of source code must retain the above copyright notice, this list of
-*      conditions and the following disclaimer.
-*    * Redistributions in binary form must reproduce the above copyright notice, this list of
-*      conditions and the following disclaimer in the documentation and/or other materials provided
-*      with the distribution.
-*    * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-*      endorse or promote products derived from this software without specific prior written
-*      permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __HWC_DISPLAY_EXTERNAL_TEST_H__
-#define __HWC_DISPLAY_EXTERNAL_TEST_H__
-
-#include<bitset>
-
-#include "hwc_display.h"
-#include "hwc_buffer_allocator.h"
-
-namespace sdm {
-
-class HWCDisplayExternalTest : public HWCDisplay {
- public:
-  static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                     qService::QService *qservice,  uint32_t panel_bpp, uint32_t pattern_type,
-                     HWCDisplay **hwc_display);
-  static void Destroy(HWCDisplay *hwc_display);
-  virtual int Prepare(hwc_display_contents_1_t *content_list);
-  virtual int Commit(hwc_display_contents_1_t *content_list);
-  virtual void SetSecureDisplay(bool secure_display_active, bool force_flush);
-  virtual int Perform(uint32_t operation, ...);
-
- protected:
-  HWCBufferAllocator *buffer_allocator_ = NULL;
-  BufferInfo buffer_info_ = {};
-  uint32_t panel_bpp_ = 0;
-  uint32_t pattern_type_ = 0;
-
-  enum ColorPatternType {
-    kPatternNone = 0,
-    kPatternColorRamp,
-    kPatternBWVertical,
-    kPatternColorSquare,
-  };
-
-  enum DisplayBpp {
-    kDisplayBpp18 = 18,
-    kDisplayBpp24 = 24,
-    kDisplayBpp30 = 30,
-  };
-
-  enum ColorRamp {
-    kColorRedRamp = 0,
-    kColorGreenRamp = 1,
-    kColorBlueRamp = 2,
-    kColorWhiteRamp = 3,
-  };
-
-  enum Colors {
-    kColorBlack = 0,
-    kColorWhite = 1,
-  };
-
- private:
-  HWCDisplayExternalTest(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                         qService::QService *qservice, uint32_t panel_bpp, uint32_t pattern_type);
-  int Init();
-  int Deinit();
-  void DumpInputBuffer();
-  void CalcCRC(uint32_t color_value, std::bitset<16> *crc_data);
-  int FillBuffer();
-  int GetStride(LayerBufferFormat format, uint32_t width, uint32_t *stride);
-  void PixelCopy(uint32_t red, uint32_t green, uint32_t blue, uint32_t alpha, uint8_t **buffer);
-  void GenerateColorRamp(uint8_t *buffer);
-  void GenerateBWVertical(uint8_t *buffer);
-  void GenerateColorSquare(uint8_t *buffer);
-  int InitLayer(Layer *layer);
-  int DeinitLayer(Layer *layer);
-  int CreateLayerStack();
-  int DestroyLayerStack();
-  int PostCommit(hwc_display_contents_1_t *content_list);
-
-  static const uint32_t kTestLayerCnt = 1;
-};
-
-}  // namespace sdm
-
-#endif  // __HWC_DISPLAY_EXTERNAL_TEST_H__
-
diff --git a/sdm/libs/hwc/hwc_display_null.cpp b/sdm/libs/hwc/hwc_display_null.cpp
deleted file mode 100644
index 649f40c..0000000
--- a/sdm/libs/hwc/hwc_display_null.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-* Copyright (c) 2016, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted
-* provided that the following conditions are met:
-*    * Redistributions of source code must retain the above copyright notice, this list of
-*      conditions and the following disclaimer.
-*    * Redistributions in binary form must reproduce the above copyright notice, this list of
-*      conditions and the following disclaimer in the documentation and/or other materials provided
-*      with the distribution.
-*    * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-*      endorse or promote products derived from this software without specific prior written
-*      permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <hardware/hwcomposer_defs.h>
-#include <utils/constants.h>
-#include <utils/debug.h>
-#include "hwc_display_null.h"
-
-#define __CLASS__ "HWCDisplayNull"
-
-namespace sdm {
-
-int HWCDisplayNull::Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                           HWCDisplay **hwc_display) {
-  int status;
-
-  DLOGI("Null display is being created");
-  HWCDisplayNull *hwc_display_null = new HWCDisplayNull(core_intf, hwc_procs);
-
-  status = hwc_display_null->Init();
-  if (status) {
-    delete hwc_display_null;
-    return status;
-  }
-
-  *hwc_display = hwc_display_null;
-
-  return 0;
-}
-
-void HWCDisplayNull::Destroy(HWCDisplay *hwc_display) {
-  DLOGI("Null display is being destroyed");
-  hwc_display->Deinit();
-  delete hwc_display;
-}
-
-// We pass the display type as HWC_DISPLAY_PRIMARY to HWCDisplay, but since we override
-// and don't chain to HWCDisplay::Init(), that type does not actually get used.
-HWCDisplayNull::HWCDisplayNull(CoreInterface *core_intf, hwc_procs_t const **hwc_procs)
-  : HWCDisplay(core_intf, hwc_procs, kPrimary, HWC_DISPLAY_PRIMARY, false, NULL,
-               DISPLAY_CLASS_NULL) {
-}
-
-int HWCDisplayNull::Init() {
-  // Don't call HWCDisplay::Init() for null display, we don't want the chain of
-  // DisplayPrimary / HWPrimary etc objects to be created.
-  return 0;
-}
-
-int HWCDisplayNull::Deinit() {
-  return 0;
-}
-
-int HWCDisplayNull::Prepare(hwc_display_contents_1_t *content_list) {
-  for (size_t i = 0; i < content_list->numHwLayers; i++) {
-    if (content_list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET ||
-        content_list->hwLayers[i].compositionType == HWC_BACKGROUND) {
-      continue;
-    }
-
-    content_list->hwLayers[i].compositionType = HWC_OVERLAY;
-  }
-
-  return 0;
-}
-
-int HWCDisplayNull::Commit(hwc_display_contents_1_t *content_list) {
-  // HWCSession::Commit (from where this is called) already closes all the acquire
-  // fences once we return from here. So no need to close acquire fences here.
-  for (size_t i = 0; i < content_list->numHwLayers; i++) {
-    content_list->hwLayers[i].releaseFenceFd = -1;
-  }
-
-  return 0;
-}
-
-#define NULL_DISPLAY_FPS 60
-
-int HWCDisplayNull::GetDisplayAttributes(uint32_t config, const uint32_t *display_attributes,
-                                         int32_t *values) {
-  for (int i = 0; display_attributes[i] != HWC_DISPLAY_NO_ATTRIBUTE; i++) {
-    // We fake display resolution as 1080P by default, though it can be overriden through a call to
-    // SetResolution(), and DPI as 160, though what the DPI value does is not clear
-    switch (display_attributes[i]) {
-    case HWC_DISPLAY_VSYNC_PERIOD:
-      values[i] = INT32(1000000000L / NULL_DISPLAY_FPS);
-      break;
-    case HWC_DISPLAY_WIDTH:
-      values[i] = static_cast<int32_t>(x_res_);
-      break;
-    case HWC_DISPLAY_HEIGHT:
-      values[i] = static_cast<int32_t>(y_res_);
-      break;
-    }
-  }
-  return 0;
-}
-
-}  // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display_null.h b/sdm/libs/hwc/hwc_display_null.h
deleted file mode 100644
index f1e0e5e..0000000
--- a/sdm/libs/hwc/hwc_display_null.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-* Copyright (c) 2016, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted
-* provided that the following conditions are met:
-*    * Redistributions of source code must retain the above copyright notice, this list of
-*      conditions and the following disclaimer.
-*    * Redistributions in binary form must reproduce the above copyright notice, this list of
-*      conditions and the following disclaimer in the documentation and/or other materials provided
-*      with the distribution.
-*    * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-*      endorse or promote products derived from this software without specific prior written
-*      permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __HWC_DISPLAY_NULL_H__
-#define __HWC_DISPLAY_NULL_H__
-
-#include <qdMetaData.h>
-#include <gralloc_priv.h>
-#include "hwc_display.h"
-
-namespace sdm {
-
-class HWCDisplayNull : public HWCDisplay {
- public:
-  static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                    HWCDisplay **hwc_display);
-  static void Destroy(HWCDisplay *hwc_display);
-  virtual int Init();
-  virtual int Deinit();
-  virtual int Prepare(hwc_display_contents_1_t *content_list);
-  virtual int Commit(hwc_display_contents_1_t *content_list);
-  virtual int EventControl(int event, int enable) { return 0; }
-  virtual int SetPowerMode(int mode) { return 0; }
-
-  // Framebuffer configurations
-  virtual int GetDisplayConfigs(uint32_t *configs, size_t *num_configs) {
-    return HWCDisplay::GetDisplayConfigs(configs, num_configs);
-  }
-
-  virtual int GetDisplayAttributes(uint32_t config, const uint32_t *display_attributes,
-                                   int32_t *values);
-  virtual int GetActiveConfig() { return 0; }
-  virtual int SetActiveConfig(int index) { return -1; }
-
-  virtual void SetIdleTimeoutMs(uint32_t timeout_ms) { return; }
-  virtual void SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type) { return; }
-  virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages) { return kErrorNone; }
-  virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) { return kErrorNone; }
-  virtual uint32_t GetLastPowerMode() { return 0; }
-  virtual int SetFrameBufferResolution(uint32_t x_pixels, uint32_t y_pixels) { return 0; }
-
-  virtual void GetFrameBufferResolution(uint32_t *x_pixels, uint32_t *y_pixels) {
-    *x_pixels = x_res_;
-    *y_pixels = y_res_;
-  }
-
-  virtual void GetPanelResolution(uint32_t *x_pixels, uint32_t *y_pixels) {
-    *x_pixels = x_res_;
-    *y_pixels = y_res_;
-  }
-
-  virtual int SetDisplayStatus(uint32_t display_status) { return 0; }
-  virtual int OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) { return 0; }
-  virtual int Perform(uint32_t operation, ...) { return 0; }
-  virtual int SetCursorPosition(int x, int y) { return 0; }
-  virtual void SetSecureDisplay(bool secure_display_active, bool force_flush) { return; }
-
-  // Display Configurations
-  virtual int SetActiveDisplayConfig(int config) { return 0; }
-  virtual int GetActiveDisplayConfig(uint32_t *config) { return -1; }
-  virtual int GetDisplayConfigCount(uint32_t *count) { return -1; }
-  virtual int GetDisplayAttributesForConfig(int config,
-                                            DisplayConfigVariableInfo *display_attributes) {
-    return -1;
-  }
-  virtual bool IsValidContentList(hwc_display_contents_1_t *content_list) {
-    return true;
-  }
-
-  void SetResolution(uint32_t x_res, uint32_t y_res) {
-    x_res_ = x_res;
-    y_res_ = y_res;
-  }
-
-
- private:
-  HWCDisplayNull(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
-  uint32_t x_res_ = 1920;
-  uint32_t y_res_ = 1080;
-};
-
-}  // namespace sdm
-
-#endif  // __HWC_DISPLAY_NULL_H__
-
diff --git a/sdm/libs/hwc/hwc_display_virtual.cpp b/sdm/libs/hwc/hwc_display_virtual.cpp
deleted file mode 100644
index 0279fc2..0000000
--- a/sdm/libs/hwc/hwc_display_virtual.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
-* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*     * Redistributions of source code must retain the above copyright
-*       notice, this list of conditions and the following disclaimer.
-*     * Redistributions in binary form must reproduce the above
-*       copyright notice, this list of conditions and the following
-*       disclaimer in the documentation and/or other materials provided
-*       with the distribution.
-*     * Neither the name of The Linux Foundation nor the names of its
-*       contributors may be used to endorse or promote products derived
-*       from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <utils/constants.h>
-#include <utils/debug.h>
-#include <sync/sync.h>
-#include <stdarg.h>
-#include <gr.h>
-
-#include "hwc_display_virtual.h"
-#include "hwc_debugger.h"
-
-#define __CLASS__ "HWCDisplayVirtual"
-
-namespace sdm {
-
-int HWCDisplayVirtual::Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                              uint32_t primary_width, uint32_t primary_height,
-                              hwc_display_contents_1_t *content_list,
-                              HWCDisplay **hwc_display) {
-  int status = 0;
-  HWCDisplayVirtual *hwc_display_virtual = new HWCDisplayVirtual(core_intf, hwc_procs);
-  uint32_t virtual_width = 0, virtual_height = 0;
-
-  status = hwc_display_virtual->Init();
-  if (status) {
-    delete hwc_display_virtual;
-    return status;
-  }
-
-  status = hwc_display_virtual->SetPowerMode(HWC_POWER_MODE_NORMAL);
-  if (status) {
-    Destroy(hwc_display_virtual);
-    return status;
-  }
-
-  // TODO(user): Need to update resolution(and not aligned resolution) on writeback.
-  status = hwc_display_virtual->SetOutputSliceFromMetadata(content_list);
-  if (status) {
-    Destroy(hwc_display_virtual);
-    return status;
-  }
-
-  hwc_display_virtual->GetMixerResolution(&virtual_width, &virtual_height);
-
-  if (content_list->numHwLayers < 1) {
-    Destroy(hwc_display_virtual);
-    return -1;
-  }
-
-  hwc_layer_1_t &fb_layer = content_list->hwLayers[content_list->numHwLayers-1];
-  int fb_width = fb_layer.displayFrame.right - fb_layer.displayFrame.left;
-  int fb_height = fb_layer.displayFrame.bottom - fb_layer.displayFrame.top;
-
-  status = hwc_display_virtual->SetFrameBufferResolution(UINT32(fb_width), UINT32(fb_height));
-
-  if (status) {
-    Destroy(hwc_display_virtual);
-    return status;
-  }
-
-  *hwc_display = static_cast<HWCDisplay *>(hwc_display_virtual);
-
-  return 0;
-}
-
-void HWCDisplayVirtual::Destroy(HWCDisplay *hwc_display) {
-  hwc_display->Deinit();
-  delete hwc_display;
-}
-
-HWCDisplayVirtual::HWCDisplayVirtual(CoreInterface *core_intf, hwc_procs_t const **hwc_procs)
-  : HWCDisplay(core_intf, hwc_procs, kVirtual, HWC_DISPLAY_VIRTUAL, false, NULL,
-               DISPLAY_CLASS_VIRTUAL) {
-}
-
-int HWCDisplayVirtual::Init() {
-  output_buffer_ = new LayerBuffer();
-  if (!output_buffer_) {
-    return -ENOMEM;
-  }
-
-  return HWCDisplay::Init();
-}
-
-int HWCDisplayVirtual::Deinit() {
-  int status = 0;
-
-  status = HWCDisplay::Deinit();
-  if (status) {
-    return status;
-  }
-
-  if (output_buffer_) {
-    delete output_buffer_;
-    output_buffer_ = NULL;
-  }
-
-  return status;
-}
-
-int HWCDisplayVirtual::Prepare(hwc_display_contents_1_t *content_list) {
-  int status = 0;
-
-  status = SetOutputSliceFromMetadata(content_list);
-  if (status) {
-    return status;
-  }
-
-  if (display_paused_) {
-    MarkLayersForGPUBypass(content_list);
-    return status;
-  }
-
-  status = AllocateLayerStack(content_list);
-  if (status) {
-    return status;
-  }
-
-  status = SetOutputBuffer(content_list);
-  if (status) {
-    return status;
-  }
-
-  status = PrePrepareLayerStack(content_list);
-  if (status) {
-    return status;
-  }
-
-  status = PrepareLayerStack(content_list);
-  if (status) {
-    return status;
-  }
-
-  return 0;
-}
-
-int HWCDisplayVirtual::Commit(hwc_display_contents_1_t *content_list) {
-  int status = 0;
-  if (display_paused_) {
-    DisplayError error = display_intf_->Flush();
-    if (error != kErrorNone) {
-      DLOGE("Flush failed. Error = %d", error);
-    }
-    return status;
-  }
-
-  CommitOutputBufferParams(content_list);
-
-  status = HWCDisplay::CommitLayerStack(content_list);
-  if (status) {
-    return status;
-  }
-
-  if (dump_frame_count_ && !flush_ && dump_output_layer_) {
-    const private_handle_t *output_handle = (const private_handle_t *)(content_list->outbuf);
-    if (output_handle && output_handle->base) {
-      BufferInfo buffer_info;
-      buffer_info.buffer_config.width = static_cast<uint32_t>(output_handle->width);
-      buffer_info.buffer_config.height = static_cast<uint32_t>(output_handle->height);
-      buffer_info.buffer_config.format = GetSDMFormat(output_handle->format, output_handle->flags);
-      buffer_info.alloc_buffer_info.size = static_cast<uint32_t>(output_handle->size);
-      DumpOutputBuffer(buffer_info, reinterpret_cast<void *>(output_handle->base),
-                       layer_stack_.retire_fence_fd);
-    }
-  }
-
-  status = HWCDisplay::PostCommitLayerStack(content_list);
-  if (status) {
-    return status;
-  }
-
-  return 0;
-}
-
-int HWCDisplayVirtual::SetOutputSliceFromMetadata(hwc_display_contents_1_t *content_list) {
-  const private_handle_t *output_handle =
-        static_cast<const private_handle_t *>(content_list->outbuf);
-  DisplayError error = kErrorNone;
-  int status = 0;
-
-  if (output_handle) {
-    int output_handle_format = output_handle->format;
-    if (output_handle_format == HAL_PIXEL_FORMAT_RGBA_8888) {
-      output_handle_format = HAL_PIXEL_FORMAT_RGBX_8888;
-    }
-
-    LayerBufferFormat format = GetSDMFormat(output_handle_format, output_handle->flags);
-    if (format == kFormatInvalid) {
-      return -EINVAL;
-    }
-
-    int active_width;
-    int active_height;
-
-    AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, active_width,
-                                                          active_height);
-
-    if ((active_width != INT(output_buffer_->width)) ||
-        (active_height!= INT(output_buffer_->height)) ||
-        (format != output_buffer_->format)) {
-      // Populate virtual display attributes based on displayFrame of FBT.
-      // For DRC, use width and height populated in metadata (unaligned values)
-      // for setting attributes of virtual display. This is needed because if
-      // we use aligned width and height, scaling will be required for FBT layer.
-      DisplayConfigVariableInfo variable_info;
-      hwc_layer_1_t &fbt_layer = content_list->hwLayers[content_list->numHwLayers-1];
-      hwc_rect_t &frame = fbt_layer.displayFrame;
-      int fbt_width = frame.right - frame.left;
-      int fbt_height = frame.bottom - frame.top;
-      const MetaData_t *meta_data = reinterpret_cast<MetaData_t *>(output_handle->base_metadata);
-      if (meta_data && meta_data->operation & UPDATE_BUFFER_GEOMETRY) {
-        variable_info.x_pixels = UINT32(meta_data->bufferDim.sliceWidth);
-        variable_info.y_pixels = UINT32(meta_data->bufferDim.sliceHeight);
-      } else {
-        variable_info.x_pixels = UINT32(fbt_width);
-        variable_info.y_pixels = UINT32(fbt_height);
-      }
-      // TODO(user): Need to get the framerate of primary display and update it.
-      variable_info.fps = 60;
-
-      error = display_intf_->SetActiveConfig(&variable_info);
-      if (error != kErrorNone) {
-        return -EINVAL;
-      }
-
-      status = SetOutputBuffer(content_list);
-      if (status) {
-        return status;
-      }
-    }
-  }
-
-  return 0;
-}
-
-int HWCDisplayVirtual::SetOutputBuffer(hwc_display_contents_1_t *content_list) {
-  const private_handle_t *output_handle =
-        static_cast<const private_handle_t *>(content_list->outbuf);
-
-  if (output_handle) {
-    int output_handle_format = output_handle->format;
-
-    if (output_handle_format == HAL_PIXEL_FORMAT_RGBA_8888) {
-      output_handle_format = HAL_PIXEL_FORMAT_RGBX_8888;
-    }
-
-    output_buffer_->format = GetSDMFormat(output_handle_format, output_handle->flags);
-
-    if (output_buffer_->format == kFormatInvalid) {
-      return -EINVAL;
-    }
-
-    int aligned_width, aligned_height;
-    int unaligned_width, unaligned_height;
-
-    AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, aligned_width,
-                                                          aligned_height);
-    AdrenoMemInfo::getInstance().getUnalignedWidthAndHeight(output_handle, unaligned_width,
-                                                            unaligned_height);
-
-    output_buffer_->width = UINT32(aligned_width);
-    output_buffer_->height = UINT32(aligned_height);
-    output_buffer_->unaligned_width = UINT32(unaligned_width);
-    output_buffer_->unaligned_height = UINT32(unaligned_height);
-    output_buffer_->flags.secure = 0;
-    output_buffer_->flags.video = 0;
-
-    const MetaData_t *meta_data = reinterpret_cast<MetaData_t *>(output_handle->base_metadata);
-    if (meta_data && SetCSC(meta_data, &output_buffer_->color_metadata) != kErrorNone) {
-      return kErrorNotSupported;
-    }
-
-    // TZ Protected Buffer - L1
-    if (output_handle->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER) {
-      output_buffer_->flags.secure = 1;
-    }
-  }
-
-  layer_stack_.output_buffer = output_buffer_;
-
-  return 0;
-}
-
-void HWCDisplayVirtual::CommitOutputBufferParams(hwc_display_contents_1_t *content_list) {
-  const private_handle_t *output_handle =
-        static_cast<const private_handle_t *>(content_list->outbuf);
-
-  // Fill output buffer parameters (width, height, format, plane information, fence)
-  output_buffer_->acquire_fence_fd = content_list->outbufAcquireFenceFd;
-
-  if (output_handle) {
-    // ToDo: Need to extend for non-RGB formats
-    output_buffer_->planes[0].fd = output_handle->fd;
-    output_buffer_->planes[0].offset = output_handle->offset;
-    output_buffer_->planes[0].stride = UINT32(output_handle->width);
-  }
-}
-
-void HWCDisplayVirtual::SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type) {
-  HWCDisplay::SetFrameDumpConfig(count, bit_mask_layer_type);
-  dump_output_layer_ = ((bit_mask_layer_type & (1 << OUTPUT_LAYER_DUMP)) != 0);
-
-  DLOGI("output_layer_dump_enable %d", dump_output_layer_);
-}
-
-}  // namespace sdm
-
diff --git a/sdm/libs/hwc/hwc_display_virtual.h b/sdm/libs/hwc/hwc_display_virtual.h
deleted file mode 100644
index 77e16d5..0000000
--- a/sdm/libs/hwc/hwc_display_virtual.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* Copyright (c) 2014,2016 The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without modification, are permitted
-* provided that the following conditions are met:
-*    * Redistributions of source code must retain the above copyright notice, this list of
-*      conditions and the following disclaimer.
-*    * Redistributions in binary form must reproduce the above copyright notice, this list of
-*      conditions and the following disclaimer in the documentation and/or other materials provided
-*      with the distribution.
-*    * Neither the name of The Linux Foundation nor the names of its contributors may be used to
-*      endorse or promote products derived from this software without specific prior written
-*      permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __HWC_DISPLAY_VIRTUAL_H__
-#define __HWC_DISPLAY_VIRTUAL_H__
-
-#include <qdMetaData.h>
-#include <gralloc_priv.h>
-#include "hwc_display.h"
-
-namespace sdm {
-
-class HWCDisplayVirtual : public HWCDisplay {
- public:
-  static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
-                    uint32_t primary_width, uint32_t primary_height,
-                    hwc_display_contents_1_t *content_list, HWCDisplay **hwc_display);
-  static void Destroy(HWCDisplay *hwc_display);
-  static bool IsValidContentList(hwc_display_contents_1_t *content_list);
-  virtual int Init();
-  virtual int Deinit();
-  virtual int Prepare(hwc_display_contents_1_t *content_list);
-  virtual int Commit(hwc_display_contents_1_t *content_list);
-  virtual void SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type);
-
- private:
-  HWCDisplayVirtual(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
-  int SetOutputBuffer(hwc_display_contents_1_t *content_list);
-  int SetOutputSliceFromMetadata(hwc_display_contents_1_t *content_list);
-  void CommitOutputBufferParams(hwc_display_contents_1_t *content_list);
-
-  bool dump_output_layer_ = false;
-  LayerBuffer *output_buffer_ = NULL;
-};
-
-inline bool HWCDisplayVirtual::IsValidContentList(hwc_display_contents_1_t *content_list) {
-  return (content_list && content_list->numHwLayers > 0 && content_list->outbuf);
-}
-
-}  // namespace sdm
-
-#endif  // __HWC_DISPLAY_VIRTUAL_H__
-
diff --git a/sdm/libs/hwc/hwc_tonemapper.cpp b/sdm/libs/hwc/hwc_tonemapper.cpp
deleted file mode 100644
index c09ff9e..0000000
--- a/sdm/libs/hwc/hwc_tonemapper.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
-* Copyright (c) 2016 - 2017, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*  * Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  * Redistributions in binary form must reproduce the above
-*    copyright notice, this list of conditions and the following
-*    disclaimer in the documentation and/or other materials provided
-*    with the distribution.
-*  * Neither the name of The Linux Foundation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <alloc_controller.h>
-#include <gr.h>
-#include <gralloc_priv.h>
-#include <memalloc.h>
-#include <sync/sync.h>
-
-#include <TonemapFactory.h>
-
-#include <core/buffer_allocator.h>
-
-#include <utils/constants.h>
-#include <utils/debug.h>
-#include <utils/formats.h>
-#include <utils/rect.h>
-#include <utils/utils.h>
-
-#include <vector>
-
-#include "hwc_debugger.h"
-#include "hwc_tonemapper.h"
-
-#define __CLASS__ "HWCToneMapper"
-
-namespace sdm {
-
-ToneMapSession::~ToneMapSession() {
-  delete gpu_tone_mapper_;
-  gpu_tone_mapper_ = NULL;
-  FreeIntermediateBuffers();
-}
-
-DisplayError ToneMapSession::AllocateIntermediateBuffers(int w, int h, int format, int usage) {
-  for (uint8_t i = 0; i < kNumIntermediateBuffers; i++) {
-    int status = alloc_buffer(&intermediate_buffer_[i], w, h, format, usage);
-    if (status < 0) {
-      FreeIntermediateBuffers();
-      return kErrorMemory;
-    }
-  }
-
-  return kErrorNone;
-}
-
-void ToneMapSession::FreeIntermediateBuffers() {
-  for (uint8_t i = 0; i < kNumIntermediateBuffers; i++) {
-    private_handle_t *buffer = intermediate_buffer_[i];
-    if (buffer) {
-      // Free the valid fence
-      if (release_fence_fd_[i] >= 0) {
-        CloseFd(&release_fence_fd_[i]);
-      }
-      free_buffer(buffer);
-      intermediate_buffer_[i] = NULL;
-    }
-  }
-}
-
-void ToneMapSession::UpdateBuffer(int acquire_fence, LayerBuffer *buffer) {
-  // Acquire fence will be closed by HWC Display.
-  // Fence returned by GPU will be closed in PostCommit.
-  buffer->acquire_fence_fd = acquire_fence;
-  buffer->size = intermediate_buffer_[current_buffer_index_]->size;
-  buffer->planes[0].fd = intermediate_buffer_[current_buffer_index_]->fd;
-}
-
-void ToneMapSession::SetReleaseFence(int fd) {
-  CloseFd(&release_fence_fd_[current_buffer_index_]);
-  // Used to give to GPU tonemapper along with input layer fd
-  release_fence_fd_[current_buffer_index_] = dup(fd);
-}
-
-void ToneMapSession::SetToneMapConfig(Layer *layer) {
-  // HDR -> SDR is FORWARD and SDR - > HDR is INVERSE
-  tone_map_config_.type = layer->input_buffer.flags.hdr ? TONEMAP_FORWARD : TONEMAP_INVERSE;
-  tone_map_config_.colorPrimaries = layer->input_buffer.color_metadata.colorPrimaries;
-  tone_map_config_.transfer = layer->input_buffer.color_metadata.transfer;
-  tone_map_config_.secure = layer->request.flags.secure;
-  tone_map_config_.format = layer->request.format;
-}
-
-bool ToneMapSession::IsSameToneMapConfig(Layer *layer) {
-  LayerBuffer& buffer = layer->input_buffer;
-  private_handle_t *handle = intermediate_buffer_[0];
-  int tonemap_type = buffer.flags.hdr ? TONEMAP_FORWARD : TONEMAP_INVERSE;
-
-  return ((tonemap_type == tone_map_config_.type) &&
-          (buffer.color_metadata.colorPrimaries == tone_map_config_.colorPrimaries) &&
-          (buffer.color_metadata.transfer == tone_map_config_.transfer) &&
-          (layer->request.flags.secure == tone_map_config_.secure) &&
-          (layer->request.format == tone_map_config_.format) &&
-          (layer->request.width == UINT32(handle->unaligned_width)) &&
-          (layer->request.height == UINT32(handle->unaligned_height)));
-}
-
-int HWCToneMapper::HandleToneMap(hwc_display_contents_1_t *content_list, LayerStack *layer_stack) {
-  uint32_t gpu_count = 0;
-  DisplayError error = kErrorNone;
-
-  for (uint32_t i = 0; i < layer_stack->layers.size(); i++) {
-    uint32_t session_index = 0;
-    Layer *layer = layer_stack->layers.at(i);
-    if (layer->composition == kCompositionGPU) {
-      gpu_count++;
-    }
-
-    if (layer->request.flags.tone_map) {
-      switch (layer->composition) {
-      case kCompositionGPUTarget:
-        if (!gpu_count) {
-          // When all layers are on FrameBuffer and if they do not update in the next draw cycle,
-          // then SDM marks them for SDE Composition because the cached FB layer gets displayed.
-          // GPU count will be 0 in this case. Try to use the existing tone-mapped frame buffer.
-          // No ToneMap/Blit is required. Just update the buffer & acquire fence fd of FB layer.
-          if (!tone_map_sessions_.empty()) {
-            ToneMapSession *fb_tone_map_session = tone_map_sessions_.at(fb_session_index_);
-            fb_tone_map_session->UpdateBuffer(-1 /* acquire_fence */, &layer->input_buffer);
-            fb_tone_map_session->layer_index_ = INT(i);
-            fb_tone_map_session->acquired_ = true;
-            return 0;
-          }
-        }
-        error = AcquireToneMapSession(layer, &session_index);
-        fb_session_index_ = session_index;
-        break;
-      default:
-        error = AcquireToneMapSession(layer, &session_index);
-        break;
-      }
-
-      if (error != kErrorNone) {
-        Terminate();
-        return -1;
-      }
-
-      ToneMapSession *session = tone_map_sessions_.at(session_index);
-      ToneMap(&content_list->hwLayers[i], layer, session);
-      session->layer_index_ = INT(i);
-    }
-  }
-
-  return 0;
-}
-
-void HWCToneMapper::ToneMap(hwc_layer_1_t *hwc_layer, Layer* layer, ToneMapSession *session) {
-  int fence_fd = -1;
-  int acquire_fd = -1;
-  int merged_fd = -1;
-
-  uint8_t buffer_index = session->current_buffer_index_;
-  const private_handle_t *dst_hnd = session->intermediate_buffer_[buffer_index];
-  const private_handle_t *src_hnd = static_cast<const private_handle_t *>(hwc_layer->handle);
-
-  acquire_fd = dup(layer->input_buffer.acquire_fence_fd);
-  buffer_sync_handler_.SyncMerge(session->release_fence_fd_[buffer_index], acquire_fd, &merged_fd);
-
-  if (acquire_fd >= 0) {
-    CloseFd(&acquire_fd);
-  }
-
-  if (session->release_fence_fd_[buffer_index] >= 0) {
-    CloseFd(&session->release_fence_fd_[buffer_index]);
-  }
-
-  DTRACE_BEGIN("GPU_TM_BLIT");
-  fence_fd = session->gpu_tone_mapper_->blit(reinterpret_cast<const void *>(dst_hnd),
-                                             reinterpret_cast<const void *>(src_hnd), merged_fd);
-  DTRACE_END();
-
-  DumpToneMapOutput(session, &fence_fd);
-  session->UpdateBuffer(fence_fd, &layer->input_buffer);
-}
-
-void HWCToneMapper::PostCommit(LayerStack *layer_stack) {
-  auto it = tone_map_sessions_.begin();
-  while (it != tone_map_sessions_.end()) {
-    uint32_t session_index = UINT32(std::distance(tone_map_sessions_.begin(), it));
-    ToneMapSession *session = tone_map_sessions_.at(session_index);
-    Layer *layer = layer_stack->layers.at(UINT32(session->layer_index_));
-    if (session->acquired_) {
-      // Close the fd returned by GPU ToneMapper and set release fence.
-      LayerBuffer &layer_buffer = layer->input_buffer;
-      CloseFd(&layer_buffer.acquire_fence_fd);
-      session->SetReleaseFence(layer_buffer.release_fence_fd);
-      session->acquired_ = false;
-      it++;
-    } else {
-      delete session;
-      it = tone_map_sessions_.erase(it);
-    }
-  }
-}
-
-void HWCToneMapper::Terminate() {
-  if (tone_map_sessions_.size()) {
-    while (!tone_map_sessions_.empty()) {
-      delete tone_map_sessions_.back();
-      tone_map_sessions_.pop_back();
-    }
-    fb_session_index_ = 0;
-  }
-}
-
-void HWCToneMapper::SetFrameDumpConfig(uint32_t count) {
-  DLOGI("Dump FrameConfig count = %d", count);
-  dump_frame_count_ = count;
-  dump_frame_index_ = 0;
-}
-
-void HWCToneMapper::DumpToneMapOutput(ToneMapSession *session, int *acquire_fd) {
-  if (!dump_frame_count_) {
-    return;
-  }
-
-  private_handle_t *target_buffer = session->intermediate_buffer_[session->current_buffer_index_];
-
-  if (*acquire_fd >= 0) {
-    int error = sync_wait(*acquire_fd, 1000);
-    if (error < 0) {
-      DLOGW("sync_wait error errno = %d, desc = %s", errno, strerror(errno));
-      return;
-    }
-  }
-
-  size_t result = 0;
-  char dump_file_name[PATH_MAX];
-  snprintf(dump_file_name, sizeof(dump_file_name), "/data/misc/display/frame_dump_primary"
-           "/tonemap_%dx%d_frame%d.raw", target_buffer->width, target_buffer->height,
-           dump_frame_index_);
-
-  FILE* fp = fopen(dump_file_name, "w+");
-  if (fp) {
-    DLOGI("base addr = %x", target_buffer->base);
-    result = fwrite(reinterpret_cast<void *>(target_buffer->base), target_buffer->size, 1, fp);
-    fclose(fp);
-  }
-  dump_frame_count_--;
-  dump_frame_index_++;
-  CloseFd(acquire_fd);
-}
-
-DisplayError HWCToneMapper::AcquireToneMapSession(Layer *layer, uint32_t *session_index) {
-  Color10Bit *grid_entries = NULL;
-  int grid_size = 0;
-
-  if (layer->lut_3d.validGridEntries) {
-    grid_entries = layer->lut_3d.gridEntries;
-    grid_size = INT(layer->lut_3d.gridSize);
-  }
-
-  // When the property sdm.disable_hdr_lut_gen is set, the lutEntries and gridEntries in
-  // the Lut3d will be NULL, clients needs to allocate the memory and set correct 3D Lut
-  // for Tonemapping.
-  if (!layer->lut_3d.lutEntries || !layer->lut_3d.dim) {
-    // Atleast lutEntries must be valid for GPU Tonemapper.
-    DLOGE("Invalid Lut Entries or lut dimension = %d", layer->lut_3d.dim);
-    return kErrorParameters;
-  }
-
-  // Check if we can re-use an existing tone map session.
-  for (uint32_t i = 0; i < tone_map_sessions_.size(); i++) {
-    ToneMapSession *tonemap_session = tone_map_sessions_.at(i);
-    if (!tonemap_session->acquired_ && tonemap_session->IsSameToneMapConfig(layer)) {
-      tonemap_session->current_buffer_index_ = (tonemap_session->current_buffer_index_ + 1) %
-                                                ToneMapSession::kNumIntermediateBuffers;
-      tonemap_session->acquired_ = true;
-      *session_index = i;
-      return kErrorNone;
-    }
-  }
-
-  ToneMapSession *session = new ToneMapSession();
-
-  session->SetToneMapConfig(layer);
-  session->gpu_tone_mapper_ = TonemapperFactory_GetInstance(session->tone_map_config_.type,
-                                                            layer->lut_3d.lutEntries,
-                                                            layer->lut_3d.dim,
-                                                            grid_entries, grid_size,
-                                                            session->tone_map_config_.secure);
-
-  if (session->gpu_tone_mapper_ == NULL) {
-    DLOGE("Get Tonemapper failed!");
-    delete session;
-    return kErrorNotSupported;
-  }
-
-  int status, format;
-  DisplayError error = kErrorNone;
-  int usage = INT(GRALLOC_USAGE_PRIVATE_IOMMU_HEAP | GRALLOC_USAGE_HW_TEXTURE);
-
-  if (layer->request.flags.secure) {
-    usage = INT(GRALLOC_USAGE_PRIVATE_MM_HEAP);
-    usage |= INT(GRALLOC_USAGE_PROTECTED);
-  }
-
-  status = buffer_allocator_.SetBufferInfo(layer->request.format, &format, &usage);
-  error = session->AllocateIntermediateBuffers(INT(layer->request.width),
-                                               INT(layer->request.height), format, usage);
-
-  if (error != kErrorNone) {
-    DLOGE("Allocation of Intermediate Buffers failed!");
-    delete session;
-    return error;
-  }
-
-  session->acquired_ = true;
-  tone_map_sessions_.push_back(session);
-  *session_index = UINT32(tone_map_sessions_.size() - 1);
-
-  return kErrorNone;
-}
-
-}  // namespace sdm
diff --git a/sdm/libs/hwc/hwc_tonemapper.h b/sdm/libs/hwc/hwc_tonemapper.h
deleted file mode 100644
index 0a463fe..0000000
--- a/sdm/libs/hwc/hwc_tonemapper.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-* Copyright (c) 2016 - 2017, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*  * Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  * Redistributions in binary form must reproduce the above
-*    copyright notice, this list of conditions and the following
-*    disclaimer in the documentation and/or other materials provided
-*    with the distribution.
-*  * Neither the name of The Linux Foundation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __HWC_TONEMAPPER_H__
-#define __HWC_TONEMAPPER_H__
-
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include <hardware/hwcomposer.h>
-
-#include <core/layer_stack.h>
-#include <utils/sys.h>
-#include <vector>
-#include "hwc_buffer_sync_handler.h"
-#include "hwc_buffer_allocator.h"
-
-class Tonemapper;
-
-namespace sdm {
-
-struct ToneMapConfig {
-  int type = 0;
-  ColorPrimaries colorPrimaries = ColorPrimaries_Max;
-  GammaTransfer transfer = Transfer_Max;
-  LayerBufferFormat format = kFormatRGBA8888;
-  bool secure = false;
-};
-
-class ToneMapSession {
- public:
-  ~ToneMapSession();
-  DisplayError AllocateIntermediateBuffers(int width, int height, int format, int usage);
-  void FreeIntermediateBuffers();
-  void UpdateBuffer(int acquire_fence, LayerBuffer *buffer);
-  void SetReleaseFence(int fd);
-  void SetToneMapConfig(Layer *layer);
-  bool IsSameToneMapConfig(Layer *layer);
-
-  static const uint8_t kNumIntermediateBuffers = 2;
-  Tonemapper *gpu_tone_mapper_ = NULL;
-  ToneMapConfig tone_map_config_ = {};
-  uint8_t current_buffer_index_ = 0;
-  private_handle_t *intermediate_buffer_[kNumIntermediateBuffers] = {NULL, NULL};
-  int release_fence_fd_[kNumIntermediateBuffers] = {-1, -1};
-  bool acquired_ = false;
-  int layer_index_ = -1;
-};
-
-class HWCToneMapper {
- public:
-  HWCToneMapper() {}
-  ~HWCToneMapper() {}
-
-  int HandleToneMap(hwc_display_contents_1_t *content_list, LayerStack *layer_stack);
-  bool IsActive() { return !tone_map_sessions_.empty(); }
-  void PostCommit(LayerStack *layer_stack);
-  void SetFrameDumpConfig(uint32_t count);
-  void Terminate();
-
- private:
-  void ToneMap(hwc_layer_1_t *hwc_layer, Layer *layer, ToneMapSession *session);
-  DisplayError AcquireToneMapSession(Layer *layer, uint32_t *session_index);
-  void DumpToneMapOutput(ToneMapSession *session, int *acquire_fence);
-
-  std::vector<ToneMapSession*> tone_map_sessions_;
-  HWCBufferSyncHandler buffer_sync_handler_ = {};
-  HWCBufferAllocator buffer_allocator_ = {};
-  uint32_t dump_frame_count_ = 0;
-  uint32_t dump_frame_index_ = 0;
-  uint32_t fb_session_index_ = 0;
-};
-
-}  // namespace sdm
-#endif  // __HWC_TONEMAPPER_H__
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index 9f1f3c7..782263d 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -13,8 +13,7 @@
 
 LOCAL_CFLAGS                  := -Wno-missing-field-initializers -Wno-unused-parameter \
                                  -std=c++11 -fcolor-diagnostics\
-                                 -DLOG_TAG=\"SDM\" $(common_flags) \
-                                 -I $(display_top)/sdm/libs/hwc
+                                 -DLOG_TAG=\"SDM\" $(common_flags)
 LOCAL_CLANG                   := true
 
 LOCAL_SHARED_LIBRARIES        := libsdmcore libqservice libbinder libhardware libhardware_legacy \
@@ -22,31 +21,22 @@
                                  libsdmutils libc++ liblog libgrallocutils libui libgpu_tonemapper \
                                  libhidlbase libhidltransport vendor.display.config@1.0
 
-ifneq ($(TARGET_USES_GRALLOC1), true)
-    LOCAL_SHARED_LIBRARIES += libmemalloc
-endif
-
 LOCAL_SRC_FILES               := hwc_session.cpp \
                                  hwc_session_services.cpp \
                                  hwc_display.cpp \
                                  hwc_display_primary.cpp \
                                  hwc_display_external.cpp \
                                  hwc_display_virtual.cpp \
-                                 ../hwc/hwc_debugger.cpp \
-                                 ../hwc/hwc_buffer_sync_handler.cpp \
+                                 hwc_debugger.cpp \
+                                 hwc_buffer_sync_handler.cpp \
                                  hwc_color_manager.cpp \
                                  hwc_layers.cpp \
                                  hwc_callbacks.cpp \
-                                 ../hwc/cpuhint.cpp \
-                                 ../hwc/hwc_socket_handler.cpp \
+                                 cpuhint.cpp \
                                  hwc_tonemapper.cpp \
-                                 display_null.cpp
-
-ifneq ($(TARGET_USES_GRALLOC1), true)
-    LOCAL_SRC_FILES += ../hwc/hwc_buffer_allocator.cpp
-else
-    LOCAL_SRC_FILES += hwc_buffer_allocator.cpp
-endif
+                                 display_null.cpp \
+                                 hwc_socket_handler.cpp \
+                                 hwc_buffer_allocator.cpp
 
 ifeq ($(TARGET_HAS_WIDE_COLOR_DISPLAY), true)
     LOCAL_CFLAGS += -DFEATURE_WIDE_COLOR
diff --git a/sdm/libs/hwc/cpuhint.cpp b/sdm/libs/hwc2/cpuhint.cpp
similarity index 100%
rename from sdm/libs/hwc/cpuhint.cpp
rename to sdm/libs/hwc2/cpuhint.cpp
diff --git a/sdm/libs/hwc/cpuhint.h b/sdm/libs/hwc2/cpuhint.h
similarity index 100%
rename from sdm/libs/hwc/cpuhint.h
rename to sdm/libs/hwc2/cpuhint.h
diff --git a/sdm/libs/hwc/hwc_buffer_sync_handler.cpp b/sdm/libs/hwc2/hwc_buffer_sync_handler.cpp
similarity index 100%
rename from sdm/libs/hwc/hwc_buffer_sync_handler.cpp
rename to sdm/libs/hwc2/hwc_buffer_sync_handler.cpp
diff --git a/sdm/libs/hwc/hwc_buffer_sync_handler.h b/sdm/libs/hwc2/hwc_buffer_sync_handler.h
similarity index 100%
rename from sdm/libs/hwc/hwc_buffer_sync_handler.h
rename to sdm/libs/hwc2/hwc_buffer_sync_handler.h
diff --git a/sdm/libs/hwc/hwc_debugger.cpp b/sdm/libs/hwc2/hwc_debugger.cpp
similarity index 100%
rename from sdm/libs/hwc/hwc_debugger.cpp
rename to sdm/libs/hwc2/hwc_debugger.cpp
diff --git a/sdm/libs/hwc/hwc_debugger.h b/sdm/libs/hwc2/hwc_debugger.h
similarity index 100%
rename from sdm/libs/hwc/hwc_debugger.h
rename to sdm/libs/hwc2/hwc_debugger.h
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 0331464..0887fbe 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -39,7 +39,6 @@
 
 #include "hwc_display.h"
 #include "hwc_debugger.h"
-#include "blit_engine_c2d.h"
 #include "hwc_tonemapper.h"
 
 #ifndef USE_GRALLOC1
diff --git a/sdm/libs/hwc/hwc_socket_handler.cpp b/sdm/libs/hwc2/hwc_socket_handler.cpp
similarity index 100%
rename from sdm/libs/hwc/hwc_socket_handler.cpp
rename to sdm/libs/hwc2/hwc_socket_handler.cpp
diff --git a/sdm/libs/hwc/hwc_socket_handler.h b/sdm/libs/hwc2/hwc_socket_handler.h
similarity index 100%
rename from sdm/libs/hwc/hwc_socket_handler.h
rename to sdm/libs/hwc2/hwc_socket_handler.h