HAL: fix memory leak for preview buffers and add error handling

During camera hardware release, preview buffers hold during taking picture
need to return back to surface if they are not done yet.

Change-Id: I3533d43eb0aa4a9f6c0c8eb222702772eae27d1a
(cherry picked from commit 083cbdda6e88218cd7b8c4583c02ef1bae3e0bc6)
(cherry picked from commit 236c33ac4bf8ae350c4838a5168cdc2e9603d01a)
camera: Clean, write-back, cache for preview and video buffers.

Write-back preview and video buffers to main memory before they
are delivered to display and video encoder respectively.

Change-Id: I748a23a2b1ade1163d6ec09623090ad4d043a441
msm: camera: invalidate cached buffers before sending to hardware

Since the buffers are now allocated in cached mode they
need to be cache-invalidated before hardware writes new
data into them. This prevents the CPU from reading stale data
from the cache. Also, if hardware reads a CPU modified buffer, the
data needs to be cache-cleaned or written back before hardware
reads from it. An example here is gemini reading a post-processed
buffer for JPEG encoding.

Change-Id: I8b4598f7984b8292bcc7ed1cc8d7ac03dd7365a8