hwc: Add support for clearing with c2d

When blending translucent layers or transitioning with c2d,
sometimes the frame is blended with stale framebuffer content.
Clear the frame with C2D fill surface before drawing.

CRs-fixed: 462461
Change-Id: I1dca477fe88d77f4f0fa4846b155404f348e911d
libcopybit: Fix potential memory and surface leaks in c2d

- Check MAX_SURFACES while mapping GPU addr
 --- While mapping gpu address, first check if the request
     is less than the MAX_SURFACES allowed.
 --- Without this check, when the request exceeded MAX_SURFACES,
     there was memory leak as that gpu addr was not unmapped
- Map the destination surface only once
 --- The destination surface for the c2d blit will be the
     FRAME_BUFFER_TARGET per transaction
 --- Map this only once from the copybit_clear which is the first
     call by hwc for a transaction
- Increase MAX_RGB_SURFACES to 12
 --- To handle use cases where there are more than 8 RGB layers

Change-Id: Iffacde30ee88b9c21d0895cb1922aa981bb079e9
CRs-fixed: 475327

Conflicts:
	libcopybit/copybit_c2d.cpp
hwc/copybit: Add check for Max layers support.

Add check in copybit for Max. layers supported by HWC. Increase
max. RGB surfaces to MAX_NUM_LAYERS to support known use cases.

CRs-Fixed: 481226
Change-Id: Ie30ab0ef3047a304133cb547902ae11fecc5db22
libcopybit: Fix GPU page fault on c2d use

On HDMI connect or other use cases where finish_copybit
is called, reset dst_surface_mapped and dst_surface_base
as destination surface is already unmapped.

CRs-fixed: 481685
Change-Id: I0073a46178e6b1ecfdbf0a08d8790af4271bc37b
Merge "hwc: Add support for clearing with c2d"
Merge "libcopybit: Fix potential memory and surface leaks in c2d"
Merge "hwc/copybit: Add check for Max layers support."
Merge "libcopybit: Fix GPU page fault on c2d use"
libexternal: disable HPD during initialization.

- Disable HPD at start, it will be enabled later
  when the display is powered on
- This fixes the issue where the HDMI mirroring
  was not working when there was a framework reboot
  or adb shell stop/start

Change-Id: I56d706ebae281297a8ec6517a4fb8e5cdda27617
CRs-fixed: 533372
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
Merge "libexternal: disable HPD during initialization."
Merge commit 'AU_LINUX_ANDROID_JB_1.9.6.04.03.00.143.037' into cm-10.2