Camera: Enable VPE features for 8660 target.

Enable VPE features for 8660 target. Pass the video frame cbcr offset
along with DIS structure for VPE output use.

Change-Id: I333b4038d9bdc94a2a5c11c4959d95eb05756020
diff --git a/QualcommCameraHardware.cpp b/QualcommCameraHardware.cpp
old mode 100755
new mode 100644
index dd0f72a..43ea0ea
--- a/QualcommCameraHardware.cpp
+++ b/QualcommCameraHardware.cpp
@@ -1047,7 +1047,7 @@
     mDimension.main_img_format = CAMERA_YUV_420_NV21;
     mDimension.thumb_format    = CAMERA_YUV_420_NV21;
 
-    if( mCurrentTarget == TARGET_MSM7630 ){
+    if( (mCurrentTarget == TARGET_MSM7630) || (mCurrentTarget == TARGET_MSM8660) ){
         /* DIS is enabled all the time in VPE support targets.
          * No provision for the user to control this.
          */
@@ -3928,16 +3928,22 @@
         CbCrOffset = PAD_TO_WORD(mDimension.video_width  * mDimension.video_height);
         recordBufferSize = (mDimension.video_width  * mDimension.video_height *3)/2;
     }
-    LOGV("initRecord: mDimension.video_width = %d mDimension.video_height = %d", mDimension.video_width, mDimension.video_height);
-    LOGV("mRecordFrameSize = %d", mRecordFrameSize);
+    LOGV("initRecord: mDimension.video_width = %d mDimension.video_height = %d",
+             mDimension.video_width, mDimension.video_height);
 
     /* Buffersize and frameSize will be different when DIS is ON.
      * We need to pass the actual framesize with video heap, as the same
      * is used at camera MIO when negotiating with encoder.
      */
     mRecordFrameSize = recordBufferSize;
-    if(mVpeEnabled && mDisEnabled)
+    if(mVpeEnabled && mDisEnabled){
         mRecordFrameSize = videoWidth * videoHeight * 3 / 2;
+        if(mCurrentTarget == TARGET_MSM8660){
+            mRecordFrameSize = PAD_TO_2K(videoWidth * videoHeight)
+                                + PAD_TO_2K((videoWidth * videoHeight)/2);
+        }
+    }
+    LOGV("mRecordFrameSize = %d", mRecordFrameSize);
 
     mRecordHeap = new PmemPool(pmem_region,
                                MemoryHeapBase::READ_ONLY | MemoryHeapBase::NO_CACHING,
@@ -4008,28 +4014,30 @@
         /* As 5MP sensor, in QTR mode can't output frame of size greater than 1280,
          * don't set DIS to ON.
          */
-        if( (mDimension.video_width == 1280 && mDimension.video_height == 720)
+        int video_frame_cbcroffset;
+        video_frame_cbcroffset = PAD_TO_WORD(videoWidth * videoHeight);
+        if(mCurrentTarget == TARGET_MSM8660)
+            video_frame_cbcroffset = PAD_TO_2K(videoWidth * videoHeight);
+
+        disCtrl.dis_enable = mDisEnabled;
+        disCtrl.video_rec_width = videoWidth;
+        disCtrl.video_rec_height = videoHeight;
+        disCtrl.output_cbcr_offset = video_frame_cbcroffset;
+
+        if( (videoWidth == 1280 && videoHeight == 720)
             && !strcmp(sensorType->name, "5mp") ) {
             LOGI("video resolution (%dx%d) is not supported for sensor (%s) when DIS is ON",
                    mDimension.video_width, mDimension.video_height, sensorType->name);
             disCtrl.dis_enable = 0;
-            disCtrl.video_rec_width = videoWidth;
-            disCtrl.video_rec_height = videoHeight;
-            ret = native_set_parm(CAMERA_SET_VIDEO_DIS_PARAMS,
-                               sizeof(disCtrl), &disCtrl);
-        } else {
-            disCtrl.dis_enable = mDisEnabled;
-            disCtrl.video_rec_width = videoWidth;
-            disCtrl.video_rec_height = videoHeight;
-            ret = native_set_parm(CAMERA_SET_VIDEO_DIS_PARAMS,
-                               sizeof(disCtrl), &disCtrl);
         }
+        ret = native_set_parm(CAMERA_SET_VIDEO_DIS_PARAMS,
+                           sizeof(disCtrl), &disCtrl);
     }
+
     rotCtrl.rotation = (mRotation == 0) ? ROT_NONE :
                        ((mRotation == 90) ? ROT_CLOCKWISE_90 :
                   ((mRotation == 180) ? ROT_CLOCKWISE_180 : ROT_CLOCKWISE_270));
 
-    LOGV("rotCtrl.rotation = %d", rotCtrl.rotation);
     if( ((videoWidth == 1280 && videoHeight == 720) || (videoWidth == 800 && videoHeight == 480))
         && (mRotation == 90 || mRotation == 270) ){
         /* Due to a limitation at video core to support heights greater than 720, adding this check.
@@ -4038,12 +4046,11 @@
         LOGI("video resolution (%dx%d) with rotation (%d) is not supported",
             videoWidth, videoHeight, mRotation);
         rotCtrl.rotation = ROT_NONE;
-        ret = native_set_parm(CAMERA_SET_VIDEO_ROT_PARAMS,
-                               sizeof(rotCtrl), &rotCtrl);
-    } else {
-        ret = native_set_parm(CAMERA_SET_VIDEO_ROT_PARAMS,
-                               sizeof(rotCtrl), &rotCtrl);
     }
+    LOGV("rotCtrl.rotation = %d", rotCtrl.rotation);
+
+    ret = native_set_parm(CAMERA_SET_VIDEO_ROT_PARAMS,
+                           sizeof(rotCtrl), &rotCtrl);
 
     LOGV("setVpeParameters X (%d)", ret);
     return ret ? NO_ERROR : UNKNOWN_ERROR;