hwc: Use intermediate buffers for copybit

The earlier copybit solution involved blitting directly into
the SurfaceFlinger's framebuffer target. That solution involved
unnecessary framework changes and caused issues when the
framebuffer was being written to both by GL and copybit.
Update hwc_copybit to use our own buffers for this purpose.
We also make sure we display only the region we're interested in
so that unnecessary artifacts from previous blits do not show up
on the display. This way, we can avoid clearing the intermediate
buffers every frame.

Change-Id: I713b3fc606e0768444c621af76853ece41964da1
diff --git a/libhwcomposer/hwc_fbupdate.h b/libhwcomposer/hwc_fbupdate.h
index a30a3af..5fc7708 100644
--- a/libhwcomposer/hwc_fbupdate.h
+++ b/libhwcomposer/hwc_fbupdate.h
@@ -34,9 +34,9 @@
     explicit IFBUpdate(const int& dpy) : mDpy(dpy) {}
     virtual ~IFBUpdate() {};
     // Sets up members and prepares overlay if conditions are met
-    virtual bool prepare(hwc_context_t *ctx, hwc_layer_1_t *fblayer) = 0;
+    virtual bool prepare(hwc_context_t *ctx, hwc_display_contents_1 *list) = 0;
     // Draws layer
-    virtual bool draw(hwc_context_t *ctx, hwc_layer_1_t *fblayer) = 0;
+    virtual bool draw(hwc_context_t *ctx, private_handle_t *hnd) = 0;
     //Reset values
     virtual void reset();
     //Factory method that returns a low-res or high-res version
@@ -52,11 +52,12 @@
 public:
     explicit FBUpdateLowRes(const int& dpy);
     virtual ~FBUpdateLowRes() {};
-    bool prepare(hwc_context_t *ctx, hwc_layer_1_t *fblayer);
-    bool draw(hwc_context_t *ctx, hwc_layer_1_t *fblayer);
+    bool prepare(hwc_context_t *ctx, hwc_display_contents_1 *list);
+
+    bool draw(hwc_context_t *ctx, private_handle_t *hnd);
     void reset();
 private:
-    bool configure(hwc_context_t *ctx, hwc_layer_1_t *fblayer);
+    bool configure(hwc_context_t *ctx, hwc_display_contents_1 *list);
     ovutils::eDest mDest; //pipe to draw on
 };
 
@@ -65,11 +66,11 @@
 public:
     explicit FBUpdateHighRes(const int& dpy);
     virtual ~FBUpdateHighRes() {};
-    bool prepare(hwc_context_t *ctx, hwc_layer_1_t *fblayer);
-    bool draw(hwc_context_t *ctx, hwc_layer_1_t *fblayer);
+    bool prepare(hwc_context_t *ctx, hwc_display_contents_1 *list);
+    bool draw(hwc_context_t *ctx, private_handle_t *hnd);
     void reset();
 private:
-    bool configure(hwc_context_t *ctx, hwc_layer_1_t *fblayer);
+    bool configure(hwc_context_t *ctx, hwc_display_contents_1 *list);
     ovutils::eDest mDestLeft; //left pipe to draw on
     ovutils::eDest mDestRight; //right pipe to draw on
 };