display: Add support for HW Cursor

- Retrieve cursor pipe info from driver
- Configure the layer marked with flag HWC_IS_CURSOR_LAYER to the
  HWCursor using the fb_cursor ioctl.
- The config happens only when it satisfies the hw limitions of
  cursor
- HWCursor is supported on primary display
- Since cursor configuration happens first, make use of drop
  layer/count to handle other composition strategies
- Add support for hwc_setCursorPositionAsync as per HWC 1.4

Change-Id: I8663b6da89b0c2dd9b48af96d64a433b2b8a302c
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index af43514..7502310 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -165,6 +165,8 @@
     uint32_t refreshRateRequest;
     // Flag related to windowboxing feature
     bool mAIVVideoMode;
+    // curser layer info
+    bool cursorLayerPresent;
 };
 
 //PTOR Comp info
@@ -414,6 +416,9 @@
 void updateSource(ovutils::eTransform& orient, ovutils::Whf& whf,
         hwc_rect_t& crop, overlay::Rotator *rot);
 
+bool configHwCursor(const int fd, int dpy, hwc_layer_1_t* layer);
+void freeHwCursor(const int fd, int dpy);
+
 bool isZoomModeEnabled(hwc_rect_t crop);
 void updateCropAIVVideoMode(hwc_context_t *ctx, hwc_rect_t& crop, int dpy);
 void updateDestAIVVideoMode(hwc_context_t *ctx, hwc_rect_t& dst, int dpy);
@@ -497,6 +502,11 @@
     return (UNLIKELY(l && (l->flags & HWC_AIV_CC)));
 }
 
+static inline bool isCursorLayer(const hwc_layer_1_t* l) {
+    return (UNLIKELY(l && (l->flags & HWC_IS_CURSOR_LAYER)));
+}
+
+
 // Returns true if the buffer is yuv
 static inline bool isYuvBuffer(const private_handle_t* hnd) {
     return (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO));
@@ -718,6 +728,10 @@
     return ctx->listStats[dpy].isSecurePresent;
 }
 
+static inline bool isCursorPresent (hwc_context_t *ctx, int dpy) {
+    return  ctx->listStats[dpy].cursorLayerPresent;
+}
+
 static inline bool isSecondaryConfiguring(hwc_context_t* ctx) {
     return (ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isConfiguring ||
             ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isConfiguring);