composer: Remove DisplayNullExternal class implementation

Change-Id: Ie9cf1d32b6bff05c68bb3c3d2bf24b995f525cf7
CRs-Fixed: 3409314
diff --git a/composer/display_null.cpp b/composer/display_null.cpp
index 2c746ee..930749f 100644
--- a/composer/display_null.cpp
+++ b/composer/display_null.cpp
@@ -28,40 +28,11 @@
 */
 
 /*
-* Changes from Qualcomm Innovation Center are provided under the following license:
-*
-* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted (subject to the limitations in the
-* disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its
-*      contributors may be used to endorse or promote products derived
-*      from this software without specific prior written permission.
-*
-* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
-* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
-* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-* IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
-*/
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ */
 
 #include <algorithm>
 #include <cstring>
@@ -183,58 +154,4 @@
   return kErrorNone;
 }
 
-DisplayError DisplayNullExternal::Commit(LayerStack *layer_stack) {
-  if (!layer_stack) {
-    return kErrorParameters;
-  }
-
-  for (Layer *layer : layer_stack->layers) {
-    if (layer->composition != kCompositionGPUTarget) {
-      layer->composition = kCompositionSDE;
-      layer->input_buffer.release_fence = nullptr;
-    }
-  }
-
-  return kErrorNone;
-}
-
-DisplayError DisplayNullExternal::GetDisplayState(DisplayState *state) {
-  if (!state) {
-    return kErrorParameters;
-  }
-
-  *state = state_;
-  return kErrorNone;
-}
-
-DisplayError DisplayNullExternal::SetDisplayState(DisplayState state, bool teardown,
-                                                  shared_ptr<Fence> *release_fence) {
-  state_ = state;
-  return kErrorNone;
-}
-
-DisplayError DisplayNullExternal::SetFrameBufferConfig(const DisplayConfigVariableInfo
-                                                       &variable_info) {
-  fb_config_ = variable_info;
-  return kErrorNone;
-}
-
-DisplayError DisplayNullExternal::GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info) {
-  if (!variable_info) {
-    return kErrorParameters;
-  }
-
-  *variable_info = fb_config_;
-  return kErrorNone;
-}
-
-DisplayError DisplayNullExternal::GetDisplayIdentificationData(uint8_t *out_port,
-                                                               uint32_t *out_data_size,
-                                                               uint8_t *out_data) {
-  DisplayNull::GetDisplayIdentificationData(out_port, out_data_size, out_data);
-  *out_port = 4;  // TMDS Encoder Index
-
-  return kErrorNone;
-}
-
 }  // namespace sdm
diff --git a/composer/display_null.h b/composer/display_null.h
index aadc04d..4df3db9 100644
--- a/composer/display_null.h
+++ b/composer/display_null.h
@@ -30,7 +30,7 @@
 /*
  * Changes from Qualcomm Innovation Center are provided under the following license:
  *
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
@@ -180,25 +180,6 @@
   };
 };
 
-class DisplayNullExternal : public DisplayNull {
- public:
-  virtual DisplayError Commit(LayerStack *layer_stack);
-  virtual DisplayError GetDisplayState(DisplayState *state);
-  virtual DisplayError SetDisplayState(DisplayState state, bool teardown,
-                                       shared_ptr<Fence> *release_fence);
-  virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info);
-  virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info);
-  virtual DisplayError GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size,
-                                                    uint8_t *out_data);
-  void SetActive(bool active) { active_ = active; }
-  bool IsActive() { return active_; }
-
- private:
-  bool active_ = false;
-  DisplayState state_ = kStateOff;
-  DisplayConfigVariableInfo fb_config_ = {};
-};
-
 }  // namespace sdm
 
 #endif  // __DISPLAY_NULL_H__
diff --git a/composer/hwc_display.h b/composer/hwc_display.h
index 4cedee7..e5e40b5 100644
--- a/composer/hwc_display.h
+++ b/composer/hwc_display.h
@@ -287,9 +287,6 @@
   virtual int GetSupportedDisplayRefreshRates(std::vector<uint32_t> *supported_refresh_rates);
   bool IsModeSwitchAllowed(uint32_t config);
 
-  virtual int SetState(bool connected) {
-    return kErrorNotSupported;
-  }
   virtual DisplayError Flush() {
     return kErrorNotSupported;
   }
diff --git a/composer/hwc_display_pluggable.cpp b/composer/hwc_display_pluggable.cpp
index 25e6b95..53efc3c 100644
--- a/composer/hwc_display_pluggable.cpp
+++ b/composer/hwc_display_pluggable.cpp
@@ -265,68 +265,6 @@
   }
 }
 
-int HWCDisplayPluggable::SetState(bool connected) {
-  DisplayError error = kErrorNone;
-  DisplayState state = kStateOff;
-  DisplayConfigVariableInfo fb_config = {};
-
-  if (connected) {
-    if (display_null_.IsActive()) {
-      error = core_intf_->CreateDisplay(type_, this, &display_intf_);
-      if (error != kErrorNone) {
-        DLOGE("Display create failed. Error = %d display_type %d event_handler %p disp_intf %p",
-              error, type_, this, &display_intf_);
-        return -EINVAL;
-      }
-
-      // Restore HDMI attributes when display is reconnected.
-      // This is to ensure that surfaceflinger & sdm are in sync.
-      display_null_.GetFrameBufferConfig(&fb_config);
-      int status = SetFrameBufferResolution(fb_config.x_pixels, fb_config.y_pixels);
-      if (status) {
-        DLOGW("Set frame buffer config failed. Error = %d", error);
-        return -1;
-      }
-      shared_ptr<Fence> release_fence = nullptr;
-      display_null_.GetDisplayState(&state);
-      display_intf_->SetDisplayState(state, false /* teardown */, &release_fence);
-
-      SetVsyncEnabled(HWC2::Vsync::Enable);
-
-      display_null_.SetActive(false);
-      DLOGI("Display is connected successfully.");
-    } else {
-      DLOGI("Display is already connected.");
-    }
-  } else {
-    if (!display_null_.IsActive()) {
-      shared_ptr<Fence> release_fence = nullptr;
-      // Preserve required attributes of HDMI display that surfaceflinger sees.
-      // Restore HDMI attributes when display is reconnected.
-      display_intf_->GetDisplayState(&state);
-      display_null_.SetDisplayState(state, false /* teardown */, &release_fence);
-
-      error = display_intf_->GetFrameBufferConfig(&fb_config);
-      if (error != kErrorNone) {
-        DLOGW("Get frame buffer config failed. Error = %d", error);
-        return -1;
-      }
-      display_null_.SetFrameBufferConfig(fb_config);
-
-      SetVsyncEnabled(HWC2::Vsync::Disable);
-      core_intf_->DestroyDisplay(display_intf_);
-      display_intf_ = &display_null_;
-
-      display_null_.SetActive(true);
-      DLOGI("Display is disconnected successfully.");
-    } else {
-      DLOGI("Display is already disconnected.");
-    }
-  }
-
-  return 0;
-}
-
 void HWCDisplayPluggable::GetUnderScanConfig() {
   if (!display_intf_->IsUnderscanSupported()) {
     // Read user defined underscan width and height
diff --git a/composer/hwc_display_pluggable.h b/composer/hwc_display_pluggable.h
index b46bdd1..53a2413 100644
--- a/composer/hwc_display_pluggable.h
+++ b/composer/hwc_display_pluggable.h
@@ -38,7 +38,6 @@
 #define __HWC_DISPLAY_PLUGGABLE_H__
 
 #include "hwc_display.h"
-#include "display_null.h"
 #include "hwc_display_event_handler.h"
 
 namespace sdm {
@@ -54,7 +53,6 @@
   virtual int Init();
   virtual HWC2::Error Validate(uint32_t *out_num_types, uint32_t *out_num_requests);
   virtual HWC2::Error Present(shared_ptr<Fence> *out_retire_fence);
-  virtual int SetState(bool connected);
   virtual DisplayError Flush();
   virtual HWC2::Error GetColorModes(uint32_t *out_num_modes, ColorMode *out_modes);
   virtual HWC2::Error GetRenderIntents(ColorMode mode, uint32_t *out_num_intents,
@@ -74,7 +72,6 @@
   static void GetDownscaleResolution(uint32_t primary_width, uint32_t primary_height,
                                      uint32_t *virtual_width, uint32_t *virtual_height);
 
-  DisplayNullExternal display_null_;
   int underscan_width_ = 0;
   int underscan_height_ = 0;
   bool has_color_tranform_ = false;