hwcomposer2: add seamlessPossible callback

Add a callback to notify the client it should retry a
setActiveConfigWithConstraints call in case of SEAMLESS_NOT_POSSIBLE error.

Test: rev up composer to 2.4
Bug: 141329414
Change-Id: I102bedc9cb89f9d1886a431f8804897bb838eb8f
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index 6400a7c..21672f5 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -80,6 +80,7 @@
     HWC2_CALLBACK_VSYNC = 3,
     HWC2_CALLBACK_VSYNC_2_4 = 4,
     HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED = 5,
+    HWC2_CALLBACK_SEAMLESS_POSSIBLE = 6,
 } hwc2_callback_descriptor_t;
 
 /* Optional capabilities which may be supported by some devices. The particular
@@ -472,6 +473,7 @@
         case HWC2_CALLBACK_VSYNC: return "Vsync";
         case HWC2_CALLBACK_VSYNC_2_4: return "Vsync2.4";
         case HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED: return "VsyncPeriodTimingChanged";
+        case HWC2_CALLBACK_SEAMLESS_POSSIBLE: return "SeamlessPossible";
         default: return "Unknown";
     }
 }
@@ -766,6 +768,7 @@
     Vsync = HWC2_CALLBACK_VSYNC,
     Vsync_2_4 = HWC2_CALLBACK_VSYNC_2_4,
     VsyncPeriodTimingChanged = HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED,
+    SeamlessPossible = HWC2_CALLBACK_SEAMLESS_POSSIBLE,
 };
 TO_STRING(hwc2_callback_descriptor_t, Callback, getCallbackDescriptorName)
 
@@ -1128,6 +1131,22 @@
 typedef void (*HWC2_PFN_VSYNC_PERIOD_TIMING_CHANGED)(hwc2_callback_data_t callbackData,
         hwc2_display_t display, hwc_vsync_period_change_timeline_t* updated_timeline);
 
+/* SeamlessPossible(..., display)
+ * Descriptor: HWC2_CALLBACK_SEAMLESS_POSSIBLE
+ * Optional for HWC2 devices for composer 2.4
+ *
+ * Notifies the client that the conditions which previously led to returning SEAMLESS_NOT_POSSIBLE
+ * from setActiveConfigWithConstraints have changed and now seamless may be possible. Client should
+ * retry calling setActiveConfigWithConstraints.
+ *
+ *
+ * Parameters:
+ *   display - a display setActiveConfigWithConstraints previously failed with
+ *             SEAMLESS_NOT_POSSIBLE.
+ */
+typedef void (*HWC2_PFN_SEAMLESS_POSSIBLE)(hwc2_callback_data_t callbackData,
+        hwc2_display_t display);
+
 /*
  * Device Functions
  *
@@ -2887,6 +2906,11 @@
  *                                    seamlessRequired - if true, requires that the vsync period
  *                                                       change must happen seamlessly without
  *                                                       a noticeable visual artifact.
+ *                                                       When the conditions change and it may be
+ *                                                       possible to change the vsync period
+ *                                                       seamlessly, HWC2_CALLBACK_SEAMLESS_POSSIBLE
+ *                                                       callback must be called to indicate that
+ *                                                       caller should retry.
  *     outTimeline - the timeline for the vsync period change.
  *
  * Returns HWC2_ERROR_NONE or one of the following errors: