display: hardware recovery

Implements HW Recovery feature. If hw enters an unstable state due
to lack of validation, userspace bugs, driver bugs, or hw programming
error, driver attempts to recover the hardware and informs userspace to
capture register dumps on-target. In extreme case, driver will request a power reset.

Change-Id: Id0069696433b8cb49f67b6d2f37eb2d05f8e5953
CRs-Fixed: 2196904
diff --git a/sdm/libs/hwc2/hwc_display_primary.cpp b/sdm/libs/hwc2/hwc_display_primary.cpp
index 21c958d..26dac45 100644
--- a/sdm/libs/hwc2/hwc_display_primary.cpp
+++ b/sdm/libs/hwc2/hwc_display_primary.cpp
@@ -46,14 +46,14 @@
 namespace sdm {
 
 int HWCDisplayPrimary::Create(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
-                              HWCCallbacks *callbacks, qService::QService *qservice,
-                              HWCDisplay **hwc_display) {
+                              HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler,
+                              qService::QService *qservice, HWCDisplay **hwc_display) {
   int status = 0;
   uint32_t primary_width = 0;
   uint32_t primary_height = 0;
 
   HWCDisplay *hwc_display_primary =
-      new HWCDisplayPrimary(core_intf, buffer_allocator, callbacks, qservice);
+      new HWCDisplayPrimary(core_intf, buffer_allocator, callbacks, event_handler, qservice);
   status = hwc_display_primary->Init();
   if (status) {
     delete hwc_display_primary;
@@ -86,11 +86,11 @@
 }
 
 HWCDisplayPrimary::HWCDisplayPrimary(CoreInterface *core_intf, BufferAllocator *buffer_allocator,
-                                     HWCCallbacks *callbacks, qService::QService *qservice)
-    : HWCDisplay(core_intf, callbacks, kPrimary, HWC_DISPLAY_PRIMARY, true, qservice,
-                 DISPLAY_CLASS_PRIMARY, buffer_allocator),
-      buffer_allocator_(buffer_allocator),
-      cpu_hint_(NULL) {
+                                     HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler,
+                                     qService::QService *qservice)
+  : HWCDisplay(core_intf, callbacks, event_handler, kPrimary, HWC_DISPLAY_PRIMARY, true,
+               qservice, DISPLAY_CLASS_PRIMARY, buffer_allocator),
+               buffer_allocator_(buffer_allocator), cpu_hint_(NULL) {
 }
 
 int HWCDisplayPrimary::Init() {
@@ -221,9 +221,6 @@
 HWC2::Error HWCDisplayPrimary::Present(int32_t *out_retire_fence) {
   auto status = HWC2::Error::None;
   if (display_paused_) {
-    // TODO(user): From old HWC implementation
-    // If we do not handle the frame set retireFenceFd to outbufAcquireFenceFd
-    // Revisit this when validating display_paused
     DisplayError error = display_intf_->Flush();
     validated_ = false;
     if (error != kErrorNone) {