liboverlay: Refactor, bug-fixes, upgrade.

* Fix memory leak during copying pipe objects.
* Remove unused / unnecessary code.
* setMemoryId API is merged with queueBuffer.
* setParameter API is setTransform now.
* Rotator upgraded to:
  --Allow different rotator hardware types.
  --Remove dependency on MDP code.
  --Allocate memory only during first playback,
  close when the associated pipe is closed.
* Have single commit implementation.
* Include new format types.
* Remove WAIT and CHANNEL enums and usage. Replace BypassPipe with
  GenericPipe. Client expected to set alignments and parameters.
  Add transform combination enums.
* Allow APIs to be called in any order. Do transform calcs in commit.
  Move ext type setter and getter functions.
* Add calculations for 180 transform.
* Add secure session support in rotator
* Implement all rotations in terms of H flip, V flip and 90 rotation.

Change-Id: I34a9a2a0f1255b3467a0abbaa254d0b584e901ce
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 94a4edb..b664260 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -47,10 +47,12 @@
 // Utility functions - implemented in hwc_utils.cpp
 void dumpLayer(hwc_layer_t const* l);
 void getLayerStats(hwc_context_t *ctx, const hwc_layer_list_t *list);
-void handleYUV(hwc_context_t *ctx, hwc_layer_t *layer);
 void initContext(hwc_context_t *ctx);
 void closeContext(hwc_context_t *ctx);
 void openFramebufferDevice(hwc_context_t *ctx);
+//Crops source buffer against destination and FB boundaries
+void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
+        const int fbWidth, const int fbHeight);
 
 // Inline utility functions
 static inline bool isSkipLayer(const hwc_layer_t* l) {
@@ -67,27 +69,7 @@
     return (hnd && (private_handle_t::PRIV_FLAGS_HWC_LOCK & hnd->flags));
 }
 
-// -----------------------------------------------------------------------------
-// Overlay specific functions - inline or implemented in hwc_overlay.cpp
-bool prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer);
-//XXX: Refine draw functions
-bool drawLayerUsingOverlay(hwc_context_t *ctx, hwc_layer_t *layer);
-//XXX: Refine
-void cleanOverlays(hwc_context_t *ctx );
-void setOverlayState(hwc_context_t* ctx, ovutils::eOverlayState state);
-
-// -----------------------------------------------------------------------------
-// Copybit specific functions - inline or implemented in hwc_copybit.cpp
-
-
-
-// -----------------------------------------------------------------------------
-// HDMI specific functions - inline or implemented in hwc_hdmi.cpp
-
-
-
-} //qhwc namespace
-
+}; //qhwc namespace
 
 
 // -----------------------------------------------------------------------------
@@ -95,13 +77,11 @@
 // This structure contains overall state
 struct hwc_context_t {
     hwc_composer_device_t device;
-    // Layer variables
-    int yuvBufferCount;
     int hdmiEnabled;
     int numHwLayers;
     int mdpVersion;
     bool hasOverlay;
-    bool skipComposition;
+    int overlayInUse;
 
     //Framebuffer device
     framebuffer_device_t *fbDev;
@@ -113,7 +93,4 @@
     qhwc::QueuedBufferStore *qbuf;
 };
 
-
-
-
 #endif //HWC_UTILS_H