Camera3: Send stream info to daemon at configure

Send the stream info (number of streams, stream size) to the daemon
at the time of config streams so that modules can decide which stream
to put on which port based on size.

Change-Id: Ie6350b686ce208a7f723ebd4633abda0d34f8f85
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 11f1ac5..be54c37 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -472,6 +472,8 @@
 
     camera3_stream_t *inputStream = NULL;
     camera3_stream_t *jpegStream = NULL;
+    cam_stream_size_info_t stream_config_info;
+
     /* first invalidate all the steams in the mStreamList
      * if they appear again, they will be validated */
     for (List<stream_info_t*>::iterator it=mStreamInfo.begin();
@@ -544,6 +546,14 @@
     /* Allocate channel objects for the requested streams */
     for (size_t i = 0; i < streamList->num_streams; i++) {
         camera3_stream_t *newStream = streamList->streams[i];
+        stream_config_info.stream_sizes[i].width = newStream->width;
+        stream_config_info.stream_sizes[i].height = newStream->height;
+        if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL &&
+            newStream->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED && jpegStream){
+            //for zsl stream the size is jpeg size
+            stream_config_info.stream_sizes[i].width = jpegStream->width;
+            stream_config_info.stream_sizes[i].height = jpegStream->height;
+        }
         if (newStream->priv == NULL) {
             //New stream, construct channel
             switch (newStream->stream_type) {
@@ -662,9 +672,21 @@
             m = mStoredMetadataList.erase(m);
         }
     }
+    int32_t hal_version = CAM_HAL_V3;
+    stream_config_info.num_streams = streamList->num_streams;
 
     //settings/parameters don't carry over for new configureStreams
     memset(mParameters, 0, sizeof(parm_buffer_t));
+
+    mParameters->first_flagged_entry = CAM_INTF_PARM_MAX;
+    AddSetParmEntryToBatch(mParameters, CAM_INTF_PARM_HAL_VERSION,
+                sizeof(hal_version), &hal_version);
+
+    AddSetParmEntryToBatch(mParameters, CAM_INTF_META_STREAM_INFO,
+                sizeof(stream_config_info), &stream_config_info);
+
+    mCameraHandle->ops->set_parms(mCameraHandle->camera_handle, mParameters);
+
     mFirstRequest = true;
 
     //Get min frame duration for this streams configuration
diff --git a/camera/QCamera2/stack/common/cam_intf.h b/camera/QCamera2/stack/common/cam_intf.h
index 7b10ca5..ed23038 100644
--- a/camera/QCamera2/stack/common/cam_intf.h
+++ b/camera/QCamera2/stack/common/cam_intf.h
@@ -434,6 +434,7 @@
 
     /* HAL3 sepcific */
     INCLUDE(CAM_INTF_META_FRAME_NUMBER,             uint32_t,                    1);
+    INCLUDE(CAM_INTF_META_STREAM_INFO,              cam_stream_size_info_t,      1);
     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,       uint8_t,                     1);
     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,  cam_color_correct_matrix_t,  1);
     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,      cam_color_correct_gains_t,   1);
diff --git a/camera/QCamera2/stack/common/cam_types.h b/camera/QCamera2/stack/common/cam_types.h
index ae78c55..2451203 100644
--- a/camera/QCamera2/stack/common/cam_types.h
+++ b/camera/QCamera2/stack/common/cam_types.h
@@ -759,6 +759,11 @@
     uint32_t max_frame_idx;
 } cam_frame_idx_range_t;
 
+typedef struct {
+    cam_dimension_t stream_sizes[MAX_NUM_STREAMS];
+    uint32_t num_streams;
+} cam_stream_size_info_t;
+
 typedef  struct {
     uint8_t is_stats_valid;               /* if histgram data is valid */
     cam_hist_stats_t stats_data;          /* histogram data */
@@ -872,6 +877,8 @@
     /* A frame counter set by the framework. Must be maintained unchanged in
      * output frame. */
     CAM_INTF_META_FRAME_NUMBER,
+    /*Number of streams and size of streams in current configuration*/
+    CAM_INTF_META_STREAM_INFO,
     /* Whether AE is currently updating the sensor exposure and sensitivity
      * fields */
     CAM_INTF_META_AEC_MODE,