Merge "Improve stub hal read and write timing" into nyc-mr1-dev
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index a51efd7..6973603 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -86,6 +86,12 @@
      * (such as position, size, etc.) need to be performed through the
      * validate/present cycle. */
     HWC2_CAPABILITY_SIDEBAND_STREAM = 1,
+
+    /* Specifies that the device will apply a color transform even when either
+     * the client or the device has chosen that all layers should be composed by
+     * the client. This will prevent the client from applying the color
+     * transform during its composition step. */
+    HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM = 2,
 } hwc2_capability_t;
 
 /* Possible composition types for a given layer */
@@ -325,6 +331,8 @@
     switch (capability) {
         case HWC2_CAPABILITY_INVALID: return "Invalid";
         case HWC2_CAPABILITY_SIDEBAND_STREAM: return "SidebandStream";
+        case HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM:
+                return "SkipClientColorTransform";
         default: return "Unknown";
     }
 }
@@ -540,6 +548,7 @@
 enum class Capability : int32_t {
     Invalid = HWC2_CAPABILITY_INVALID,
     SidebandStream = HWC2_CAPABILITY_SIDEBAND_STREAM,
+    SkipClientColorTransform = HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM,
 };
 TO_STRING(hwc2_capability_t, Capability, getCapabilityName)
 
@@ -1328,7 +1337,7 @@
         hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumElements,
         hwc2_layer_t* outLayers, int32_t* outFences);
 
-/* presentDisplay(..., outRetireFence)
+/* presentDisplay(..., outPresentFence)
  * Descriptor: HWC2_FUNCTION_PRESENT_DISPLAY
  * Must be provided by all HWC2 devices
  *
@@ -1342,15 +1351,16 @@
  * setLayerBuffer), then it is safe to call this function without first
  * validating the display.
  *
- * If this call succeeds, outRetireFence will be populated with a file
- * descriptor referring to a retire sync fence object. For physical displays,
- * this fence will be signaled when the result of composition of the prior frame
- * is no longer necessary (because it has been copied or replaced by this
- * frame). For virtual displays, this fence will be signaled when writes to the
- * output buffer have completed and it is safe to read from it.
+ * If this call succeeds, outPresentFence will be populated with a file
+ * descriptor referring to a present sync fence object. For physical displays,
+ * this fence will be signaled at the vsync when the result of composition of
+ * this frame starts to appear (for video-mode panels) or starts to transfer to
+ * panel memory (for command-mode panels). For virtual displays, this fence will
+ * be signaled when writes to the output buffer have completed and it is safe to
+ * read from it.
  *
  * Parameters:
- *   outRetireFence - a sync fence file descriptor as described above; pointer
+ *   outPresentFence - a sync fence file descriptor as described above; pointer
  *       will be non-NULL
  *
  * Returns HWC2_ERROR_NONE or one of the following errors:
@@ -1361,7 +1371,8 @@
  *       for this display
  */
 typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_PRESENT_DISPLAY)(
-        hwc2_device_t* device, hwc2_display_t display, int32_t* outRetireFence);
+        hwc2_device_t* device, hwc2_display_t display,
+        int32_t* outPresentFence);
 
 /* setActiveConfig(..., config)
  * Descriptor: HWC2_FUNCTION_SET_ACTIVE_CONFIG
@@ -1466,6 +1477,10 @@
  * the desired color transform, it should force all layers to client composition
  * during validateDisplay.
  *
+ * If HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is present, then the client
+ * will never apply the color transform during client composition, even if all
+ * layers are being composed by the client.
+ *
  * The matrix provided is an affine color transformation of the following form:
  *
  * |r.r r.g r.b 0|