Home | History | Annotate | Download | only in common
      1 /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
      2  *
      3  * Redistribution and use in source and binary forms, with or without
      4  * modification, are permitted provided that the following conditions are
      5  * met:
      6  *     * Redistributions of source code must retain the above copyright
      7  *       notice, this list of conditions and the following disclaimer.
      8  *     * Redistributions in binary form must reproduce the above
      9  *       copyright notice, this list of conditions and the following
     10  *       disclaimer in the documentation and/or other materials provided
     11  *       with the distribution.
     12  *     * Neither the name of The Linux Foundation nor the names of its
     13  *       contributors may be used to endorse or promote products derived
     14  *       from this software without specific prior written permission.
     15  *
     16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27  *
     28  */
     29 
     30 #ifndef __QCAMERA_INTF_H__
     31 #define __QCAMERA_INTF_H__
     32 
     33 // System dependencies
     34 #include <string.h>
     35 #include <media/msmb_isp.h>
     36 
     37 // Camera dependencies
     38 #include "cam_types.h"
     39 
     40 #define CAM_PRIV_IOCTL_BASE (V4L2_CID_PRIVATE_BASE + MSM_CAMERA_PRIV_CMD_MAX)
     41 typedef enum {
     42     /* session based parameters */
     43     CAM_PRIV_PARM = CAM_PRIV_IOCTL_BASE,
     44     /* session based action: do auto focus.*/
     45     CAM_PRIV_DO_AUTO_FOCUS,
     46     /* session based action: cancel auto focus.*/
     47     CAM_PRIV_CANCEL_AUTO_FOCUS,
     48     /* session based action: prepare for snapshot.*/
     49     CAM_PRIV_PREPARE_SNAPSHOT,
     50     /* sync stream info.*/
     51     CAM_PRIV_STREAM_INFO_SYNC,
     52     /* stream based parameters*/
     53     CAM_PRIV_STREAM_PARM,
     54     /* start ZSL snapshot.*/
     55     CAM_PRIV_START_ZSL_SNAPSHOT,
     56     /* stop ZSL snapshot.*/
     57     CAM_PRIV_STOP_ZSL_SNAPSHOT,
     58     /* event for related sensors synchronization. */
     59     CAM_PRIV_SYNC_RELATED_SENSORS,
     60     /* flush */
     61     CAM_PRIV_FLUSH
     62 } cam_private_ioctl_enum_t;
     63 
     64 typedef enum {
     65     /* start syncing for related cameras */
     66     CAM_SYNC_RELATED_SENSORS_ON = 1,
     67     /* stop syncing for related cameras */
     68     CAM_SYNC_RELATED_SENSORS_OFF
     69 } cam_sync_related_sensors_control_t;
     70 
     71 typedef enum {
     72     /* Driving camera of the related camera sub-system */
     73     /* Certain features are enabled only for primary camera
     74        such as display mode for preview, autofocus etc
     75        In certain configurations for eg. when optical zoom
     76        limit is reached, Aux Camera would become
     77        the driving camera and there will be role switch.*/
     78     CAM_MODE_PRIMARY = 0,
     79     /* Non-driving camera of the related camera sub-system
     80        no display mode set for secondary camera */
     81     CAM_MODE_SECONDARY
     82 } cam_sync_mode_t;
     83 
     84 /* Payload for sending bundling info to backend */
     85 typedef struct {
     86     cam_sync_related_sensors_control_t sync_control;
     87     cam_sync_type_t type;
     88     cam_sync_mode_t mode;
     89     /* session Id of the other camera session
     90        Linking will be done with this session in the
     91        backend */
     92     uint32_t related_sensor_session_id;
     93     uint8_t is_frame_sync_enabled;
     94 }cam_sync_related_sensors_event_info_t;
     95 
     96 /* Related camera sensor specific calibration data */
     97 typedef struct {
     98     /* Focal length in pixels @ calibration resolution.*/
     99     float       normalized_focal_length;
    100     /* Native sensor resolution W that was used to capture calibration image */
    101     uint16_t    native_sensor_resolution_width;
    102     /* Native sensor resolution H that was used to capture calibration image */
    103     uint16_t    native_sensor_resolution_height;
    104     /* Image size W used internally by calibration tool */
    105     uint16_t    calibration_sensor_resolution_width;
    106     /* Image size H used internally by calibration tool */
    107     uint16_t    calibration_sensor_resolution_height;
    108     /* Focal length ratio @ Calibration */
    109     float       focal_length_ratio;
    110 }cam_related_sensor_calibration_data_t;
    111 
    112 /* Related Camera System Calibration data
    113    Calibration data for the entire related cam sub-system is
    114    in a shared EEPROM. We have 2 fields which are specific to
    115    each sensor followed by a set of common calibration of the
    116    entire related cam system*/
    117 typedef struct {
    118     /* Version information */
    119     uint32_t    calibration_format_version;
    120     /* Main Camera Sensor specific calibration */
    121     cam_related_sensor_calibration_data_t  main_cam_specific_calibration;
    122     /* Aux Camera Sensor specific calibration */
    123     cam_related_sensor_calibration_data_t  aux_cam_specific_calibration;
    124     /* Relative viewpoint matching matrix w.r.t Main */
    125     float      relative_rotation_matrix[RELCAM_CALIB_ROT_MATRIX_MAX];
    126     /* Relative geometric surface description parameters */
    127     float      relative_geometric_surface_parameters[
    128             RELCAM_CALIB_SURFACE_PARMS_MAX];
    129     /* Relative offset of sensor center from optical axis along horizontal dimension */
    130     float      relative_principle_point_x_offset;
    131     /* Relative offset of sensor center from optical axis along vertical dimension */
    132     float      relative_principle_point_y_offset;
    133     /* 0=Main Camera is on the left of Aux; 1=Main Camera is on the right of Aux */
    134     uint16_t   relative_position_flag;
    135     /* Camera separation in mm */
    136     float      relative_baseline_distance;
    137     /* main sensor setting during cal: 0-none, 1-hor-mirror, 2-ver-flip, 3-both */
    138     uint16_t   main_sensor_mirror_flip_setting;
    139     /* aux sensor setting during cal: 0-none, 1-hor-mirror, 2-ver-flip, 3-both */
    140     uint16_t   aux_sensor_mirror_flip_setting;
    141     /* module orientation during cal: 0-sensors in landscape, 1-sensors in portrait */
    142     uint16_t   module_orientation_during_calibration;
    143     /* cal images required rotation: 0-no, 1-90 degrees right, 2-90 degrees left */
    144     uint16_t   rotation_flag;
    145     /* Reserved for future use */
    146     float      reserved[RELCAM_CALIB_RESERVED_MAX];
    147 } cam_related_system_calibration_data_t;
    148 
    149 typedef struct {
    150   uint32_t default_sensor_flip;
    151   uint32_t sensor_mount_angle;
    152   cam_related_system_calibration_data_t otp_calibration_data;
    153 } cam_jpeg_metadata_t;
    154 
    155 /* capability struct definition for HAL 1*/
    156 typedef struct{
    157     cam_hal_version_t version;
    158 
    159     cam_position_t position;                                /* sensor position: front, back */
    160 
    161     uint8_t auto_hdr_supported;
    162 
    163     uint16_t isWnrSupported;
    164     /* supported iso modes */
    165     size_t supported_iso_modes_cnt;
    166     cam_iso_mode_type supported_iso_modes[CAM_ISO_MODE_MAX];
    167 
    168     /* supported flash modes */
    169     size_t supported_flash_modes_cnt;
    170     cam_flash_mode_t supported_flash_modes[CAM_FLASH_MODE_MAX];
    171 
    172     size_t zoom_ratio_tbl_cnt;                              /* table size for zoom ratios */
    173     uint32_t zoom_ratio_tbl[MAX_ZOOMS_CNT];                 /* zoom ratios table */
    174 
    175     /* supported effect modes */
    176     size_t supported_effects_cnt;
    177     cam_effect_mode_type supported_effects[CAM_EFFECT_MODE_MAX];
    178 
    179     /* supported scene modes */
    180     size_t supported_scene_modes_cnt;
    181     cam_scene_mode_type supported_scene_modes[CAM_SCENE_MODE_MAX];
    182 
    183     /* supported auto exposure modes */
    184     size_t supported_aec_modes_cnt;
    185     cam_auto_exposure_mode_type supported_aec_modes[CAM_AEC_MODE_MAX];
    186 
    187     size_t fps_ranges_tbl_cnt;                              /* fps ranges table size */
    188     cam_fps_range_t fps_ranges_tbl[MAX_SIZES_CNT];          /* fps ranges table */
    189 
    190     /* supported antibanding modes */
    191     size_t supported_antibandings_cnt;
    192     cam_antibanding_mode_type supported_antibandings[CAM_ANTIBANDING_MODE_MAX];
    193 
    194     /* supported white balance modes */
    195     size_t supported_white_balances_cnt;
    196     cam_wb_mode_type supported_white_balances[CAM_WB_MODE_MAX];
    197 
    198     /* Capability list of supported insensor HDR types
    199      * Backend is expected to fill in all the supported types and set appropriate
    200      * count, see cam_sensor_hdr_type_t for valid types
    201     */
    202     size_t supported_sensor_hdr_types_cnt;
    203     cam_sensor_hdr_type_t supported_sensor_hdr_types[CAM_SENSOR_HDR_MAX];
    204 
    205     /* supported manual wb cct */
    206     int32_t min_wb_cct;
    207     int32_t max_wb_cct;
    208 
    209     /* supported manual wb rgb gains */
    210     float min_wb_gain;
    211     float max_wb_gain;
    212 
    213     /* supported focus modes */
    214     size_t supported_focus_modes_cnt;
    215     cam_focus_mode_type supported_focus_modes[CAM_FOCUS_MODE_MAX];
    216 
    217     /* supported manual focus position */
    218     float min_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
    219     float max_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
    220 
    221     int32_t exposure_compensation_min;       /* min value of exposure compensation index */
    222     int32_t exposure_compensation_max;       /* max value of exposure compensation index */
    223     int32_t exposure_compensation_default;   /* default value of exposure compensation index */
    224     float exposure_compensation_step;
    225     cam_rational_type_t exp_compensation_step;    /* exposure compensation step value */
    226 
    227     uint8_t video_stablization_supported; /* flag id video stablization is supported */
    228 
    229     size_t picture_sizes_tbl_cnt;                           /* picture sizes table size */
    230     cam_dimension_t picture_sizes_tbl[MAX_SIZES_CNT];       /* picture sizes table */
    231     /* The minimum frame duration that is supported for each
    232      * resolution in availableProcessedSizes. Should correspond
    233      * to the frame duration when only that processed stream
    234      * is active, with all processing set to FAST */
    235     int64_t picture_min_duration[MAX_SIZES_CNT];
    236 
    237     /* capabilities specific to HAL 1 */
    238 
    239     int32_t modes_supported;                                /* mask of modes supported: 2D, 3D */
    240     uint32_t sensor_mount_angle;                            /* sensor mount angle */
    241 
    242     float focal_length;                                     /* focal length */
    243     float hor_view_angle;                                   /* horizontal view angle */
    244     float ver_view_angle;                                   /* vertical view angle */
    245 
    246     size_t preview_sizes_tbl_cnt;                           /* preview sizes table size */
    247     cam_dimension_t preview_sizes_tbl[MAX_SIZES_CNT];       /* preiew sizes table */
    248 
    249     size_t video_sizes_tbl_cnt;                             /* video sizes table size */
    250     cam_dimension_t video_sizes_tbl[MAX_SIZES_CNT];         /* video sizes table */
    251 
    252 
    253     size_t livesnapshot_sizes_tbl_cnt;                      /* livesnapshot sizes table size */
    254     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
    255 
    256     size_t vhdr_livesnapshot_sizes_tbl_cnt;                 /* vhdr_livesnapshot sizes table size */
    257     cam_dimension_t vhdr_livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* vhdr_livesnapshot sizes table */
    258 
    259     size_t hfr_tbl_cnt;                                     /* table size for HFR */
    260     cam_hfr_info_t hfr_tbl[CAM_HFR_MODE_MAX];               /* HFR table */
    261 
    262     size_t zzhdr_sizes_tbl_cnt;                             /* Number of resolutions in zzHDR mode*/
    263     cam_dimension_t zzhdr_sizes_tbl[MAX_SIZES_CNT];         /* Table for ZZHDR supported sizes */
    264 
    265     /* supported preview formats */
    266     size_t supported_preview_fmt_cnt;
    267     cam_format_t supported_preview_fmts[CAM_FORMAT_MAX];
    268 
    269     /* supported picture formats */
    270     size_t supported_picture_fmt_cnt;
    271     cam_format_t supported_picture_fmts[CAM_FORMAT_MAX];
    272 
    273     uint8_t max_downscale_factor;
    274 
    275     /* dimension and supported output format of raw dump from camif */
    276     size_t supported_raw_dim_cnt;
    277     cam_dimension_t raw_dim[MAX_SIZES_CNT];
    278     size_t supported_raw_fmt_cnt;
    279     cam_format_t supported_raw_fmts[CAM_FORMAT_MAX];
    280     /* The minimum frame duration that is supported for above
    281        raw resolution */
    282     int64_t raw_min_duration[MAX_SIZES_CNT];
    283 
    284     /* 3A version*/
    285     cam_q3a_version_t q3a_version;
    286     /* supported focus algorithms */
    287     size_t supported_focus_algos_cnt;
    288     cam_focus_algorithm_type supported_focus_algos[CAM_FOCUS_ALGO_MAX];
    289 
    290 
    291     uint8_t auto_wb_lock_supported;       /* flag if auto white balance lock is supported */
    292     uint8_t zoom_supported;               /* flag if zoom is supported */
    293     uint8_t smooth_zoom_supported;        /* flag if smooth zoom is supported */
    294     uint8_t auto_exposure_lock_supported; /* flag if auto exposure lock is supported */
    295     uint8_t video_snapshot_supported;     /* flag if video snapshot is supported */
    296 
    297     uint8_t max_num_roi;                  /* max number of roi can be detected */
    298     uint8_t max_num_focus_areas;          /* max num of focus areas */
    299     uint8_t max_num_metering_areas;       /* max num opf metering areas */
    300     uint8_t max_zoom_step;                /* max zoom step value */
    301 
    302     /* QCOM specific control */
    303     cam_control_range_t brightness_ctrl;  /* brightness */
    304     cam_control_range_t sharpness_ctrl;   /* sharpness */
    305     cam_control_range_t contrast_ctrl;    /* contrast */
    306     cam_control_range_t saturation_ctrl;  /* saturation */
    307     cam_control_range_t sce_ctrl;         /* skintone enhancement factor */
    308 
    309     /* QCOM HDR specific control. Indicates number of frames and exposure needs for the frames */
    310     cam_hdr_bracketing_info_t hdr_bracketing_setting;
    311 
    312     cam_feature_mask_t qcom_supported_feature_mask; /* mask of qcom specific features supported:
    313                                                      * such as CAM_QCOM_FEATURE_SUPPORTED_FACE_DETECTION*/
    314     cam_padding_info_t padding_info;      /* padding information from PP */
    315     uint32_t min_num_pp_bufs;             /* minimum number of buffers needed by postproc module */
    316     cam_format_t rdi_mode_stream_fmt;  /* stream format supported in rdi mode */
    317 
    318     /* capabilities specific to HAL 3 */
    319 
    320     float min_focus_distance;
    321     float hyper_focal_distance;
    322 
    323     float focal_lengths[CAM_FOCAL_LENGTHS_MAX];
    324     uint8_t focal_lengths_count;
    325 
    326     /* Needs to be regular f number instead of APEX */
    327     float apertures[CAM_APERTURES_MAX];
    328     uint8_t apertures_count;
    329 
    330     float filter_densities[CAM_FILTER_DENSITIES_MAX];
    331     uint8_t filter_densities_count;
    332 
    333     uint8_t optical_stab_modes[CAM_OPT_STAB_MAX];
    334     uint8_t optical_stab_modes_count;
    335 
    336     cam_dimension_t lens_shading_map_size;
    337 
    338     cam_dimension_t geo_correction_map_size;
    339     float geo_correction_map[2 * 3 * CAM_MAX_MAP_WIDTH *
    340               CAM_MAX_MAP_HEIGHT];
    341 
    342     float lens_position[3];
    343 
    344     /* nano seconds */
    345     int64_t exposure_time_range[EXPOSURE_TIME_RANGE_CNT];
    346 
    347     /* nano seconds */
    348     int64_t max_frame_duration;
    349 
    350     cam_color_filter_arrangement_t color_arrangement;
    351     uint8_t num_color_channels;
    352 
    353     /* parameters required to calculate S and O co-efficients */
    354     double gradient_S;
    355     double offset_S;
    356     double gradient_O;
    357     double offset_O;
    358 
    359     float sensor_physical_size[SENSOR_PHYSICAL_SIZE_CNT];
    360 
    361     /* Dimensions of full pixel array, possibly including
    362        black calibration pixels */
    363     cam_dimension_t pixel_array_size;
    364     /* Area of raw data which corresponds to only active
    365        pixels; smaller or equal to pixelArraySize. */
    366     cam_rect_t active_array_size;
    367 
    368     /* Maximum raw value output by sensor */
    369     int32_t white_level;
    370 
    371     /* A fixed black level offset for each of the Bayer
    372        mosaic channels in RGGB order*/
    373     int32_t black_level_pattern[BLACK_LEVEL_PATTERN_CNT];
    374 
    375     /* Time taken before flash can fire again in nano secs */
    376     int64_t flash_charge_duration;
    377 
    378     /* flash firing power */
    379     size_t supported_flash_firing_level_cnt;
    380     cam_format_t supported_firing_levels[CAM_FLASH_FIRING_LEVEL_MAX];
    381 
    382     /* Flash Firing Time */
    383     int64_t flash_firing_time;
    384 
    385     /* Flash Ciolor Temperature */
    386     uint8_t flash_color_temp;
    387 
    388     /* Flash max Energy */
    389     uint8_t flash_max_energy;
    390 
    391     /* Maximum number of supported points in the tonemap
    392        curve */
    393     int32_t max_tone_map_curve_points;
    394 
    395     /* supported formats */
    396     size_t supported_scalar_format_cnt;
    397     cam_format_t supported_scalar_fmts[CAM_FORMAT_MAX];
    398 
    399     uint32_t max_face_detection_count;
    400 
    401     uint8_t histogram_supported;
    402     /* Number of histogram buckets supported */
    403     int32_t histogram_size;
    404     /* Maximum value possible for a histogram bucket */
    405     int32_t max_histogram_count;
    406 
    407     cam_dimension_t sharpness_map_size;
    408 
    409     /* Maximum value possible for a sharpness map region */
    410     int32_t max_sharpness_map_value;
    411 
    412     /*Autoexposure modes for camera 3 api*/
    413     size_t supported_ae_modes_cnt;
    414     cam_ae_mode_type supported_ae_modes[CAM_AE_MODE_MAX];
    415 
    416 
    417     cam_sensitivity_range_t sensitivity_range;
    418     int32_t max_analog_sensitivity;
    419 
    420     /* ISP digital gain */
    421     cam_sensitivity_range_t isp_sensitivity_range;
    422 
    423     /* picture sizes need scale*/
    424     cam_scene_mode_overrides_t scene_mode_overrides[CAM_SCENE_MODE_MAX];
    425     size_t scale_picture_sizes_cnt;
    426     cam_dimension_t scale_picture_sizes[MAX_SCALE_SIZES_CNT];
    427 
    428     uint8_t flash_available;
    429 
    430     cam_rational_type_t base_gain_factor;    /* sensor base gain factor */
    431     /* AF Bracketing info */
    432     cam_af_bracketing_t  ubifocus_af_bracketing_need;
    433     cam_af_bracketing_t  refocus_af_bracketing_need;
    434     /* opti Zoom info */
    435     cam_opti_zoom_t      opti_zoom_settings_need;
    436     /* still more info */
    437     cam_still_more_t  stillmore_settings_need;
    438     /* chroma flash info */
    439     cam_chroma_flash_t chroma_flash_settings_need;
    440 
    441     cam_rational_type_t forward_matrix[3][3];
    442     cam_rational_type_t color_transform[3][3];
    443 
    444     uint8_t focus_dist_calibrated;
    445     uint8_t supported_test_pattern_modes_cnt;
    446     cam_test_pattern_mode_t supported_test_pattern_modes[MAX_TEST_PATTERN_CNT];
    447 
    448     int64_t stall_durations[MAX_SIZES_CNT];
    449 
    450     cam_illuminat_t reference_illuminant1;
    451     cam_illuminat_t reference_illuminant2;
    452 
    453     int64_t jpeg_stall_durations[MAX_SIZES_CNT];
    454     int64_t raw16_stall_durations[MAX_SIZES_CNT];
    455     cam_rational_type_t forward_matrix1[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
    456     cam_rational_type_t forward_matrix2[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
    457     cam_rational_type_t color_transform1[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
    458     cam_rational_type_t color_transform2[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
    459     cam_rational_type_t calibration_transform1[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
    460     cam_rational_type_t calibration_transform2[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
    461     uint16_t isCacSupported;
    462 
    463     cam_opaque_raw_format_t opaque_raw_fmt;
    464 
    465     /* true Portrait info */
    466     cam_true_portrait_t  true_portrait_settings_need;
    467 
    468     /* Sensor type information */
    469     cam_sensor_type_t sensor_type;
    470 
    471     cam_aberration_mode_t aberration_modes[CAM_COLOR_CORRECTION_ABERRATION_MAX];
    472     uint32_t aberration_modes_count;
    473 
    474     /* Can the sensor timestamp be compared to
    475      * timestamps from other sub-systems (gyro, accelerometer etc.) */
    476     uint8_t isTimestampCalibrated;
    477 
    478     /* Max size supported by ISP viewfinder path */
    479     cam_dimension_t max_viewfinder_size;
    480 
    481     /* Analysis buffer requirements */
    482     cam_analysis_info_t analysis_info[CAM_ANALYSIS_INFO_MAX];
    483 
    484     /* This is set to 'true' if sensor cannot guarantee per frame control */
    485     /* Default value of this capability is 'false' indicating per-frame */
    486     /* control is supported */
    487     uint8_t no_per_frame_control_support;
    488 
    489     /* EIS information */
    490     uint8_t supported_is_types_cnt;
    491     uint32_t supported_is_types[IS_TYPE_MAX];
    492     /*for each type, specify the margin needed. Margin will be
    493       the decimal representation of a percentage
    494       ex: 10% margin = 0.1 */
    495     float supported_is_type_margins[IS_TYPE_MAX];
    496 
    497     /* Max cpp batch size */
    498     uint8_t max_batch_bufs_supported;
    499     uint32_t buf_alignment;
    500     uint32_t min_stride;
    501     uint32_t min_scanline;
    502     uint8_t flash_dev_name[QCAMERA_MAX_FILEPATH_LENGTH];
    503     uint8_t eeprom_version_info[MAX_EEPROM_VERSION_INFO_LEN];
    504 
    505     /* maximum pixel bandwidth shared between cameras */
    506     uint64_t max_pixel_bandwidth;
    507 
    508     /* Array of K integers, where K%4==0,
    509       as a list of rectangles in the pixelArray co-ord system
    510       left, top, right, bottom */
    511     int32_t optical_black_regions[MAX_OPTICAL_BLACK_REGIONS * 4];
    512     /* Count is K/4 */
    513     uint8_t optical_black_region_count;
    514 
    515     /* hot pixel */
    516     uint8_t hotPixel_mode;
    517     uint32_t hotPixel_count;
    518     cam_coordinate_type_t hotPixelMap[512];
    519 
    520     /* supported instant capture/AEC convergence modes */
    521     size_t supported_instant_aec_modes_cnt;
    522     cam_aec_convergence_type supported_instant_aec_modes[CAM_AEC_CONVERGENCE_MAX];
    523 
    524     /* Dual cam calibration data */
    525     cam_related_system_calibration_data_t related_cam_calibration;
    526     /* Whether camera timestamp is calibrated with sensor */
    527     uint8_t timestamp_calibrated;
    528 } cam_capability_t;
    529 
    530 typedef enum {
    531     CAM_STREAM_PARAM_TYPE_DO_REPROCESS = CAM_INTF_PARM_DO_REPROCESS,
    532     CAM_STREAM_PARAM_TYPE_SET_BUNDLE_INFO = CAM_INTF_PARM_SET_BUNDLE,
    533     CAM_STREAM_PARAM_TYPE_SET_FLIP = CAM_INTF_PARM_STREAM_FLIP,
    534     CAM_STREAM_PARAM_TYPE_GET_OUTPUT_CROP = CAM_INTF_PARM_GET_OUTPUT_CROP,
    535     CAM_STREAM_PARAM_TYPE_GET_IMG_PROP = CAM_INTF_PARM_GET_IMG_PROP,
    536     CAM_STREAM_PARAM_TYPE_REQUEST_FRAMES = CAM_INTF_PARM_REQUEST_FRAMES,
    537     CAM_STREAM_PARAM_TYPE_REQUEST_OPS_MODE = CAM_INTF_PARM_REQUEST_OPS_MODE,
    538     CAM_STREAM_PARAM_TYPE_MAX
    539 } cam_stream_param_type_e;
    540 
    541 typedef struct {
    542     uint32_t buf_index;           /* buf index to the source frame buffer that needs reprocess,
    543                                     (assume buffer is already mapped)*/
    544     uint32_t frame_idx;           /* frame id of source frame to be reprocessed */
    545     int32_t ret_val;              /* return value from reprocess. Could have different meanings.
    546                                      i.e., faceID in the case of face registration. */
    547     uint8_t meta_present;         /* if there is meta data associated with this reprocess frame */
    548     uint32_t meta_stream_handle;  /* meta data stream ID. only valid if meta_present != 0 */
    549     uint32_t meta_buf_index;      /* buf index to meta data buffer. only valid if meta_present != 0 */
    550 
    551     /* opaque metadata required for reprocessing */
    552     int32_t private_data[MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES];
    553     cam_rect_t crop_rect;
    554 } cam_reprocess_param;
    555 
    556 typedef struct {
    557     uint32_t flip_mask;
    558 } cam_flip_mode_t;
    559 
    560 #define IMG_NAME_SIZE 32
    561 typedef struct {
    562     cam_rect_t crop;  /* crop info for the image */
    563     cam_dimension_t input; /* input dimension of the image */
    564     cam_dimension_t output; /* output dimension of the image */
    565     char name[IMG_NAME_SIZE]; /* optional name of the ext*/
    566     cam_format_t format; /* image format */
    567 } cam_stream_img_prop_t;
    568 
    569 typedef struct {
    570     uint8_t enableStream; /*0  stop and 1-start */
    571 } cam_request_frames;
    572 
    573 typedef struct {
    574     cam_stream_param_type_e type;
    575     union {
    576         cam_reprocess_param reprocess;  /* do reprocess */
    577         cam_bundle_config_t bundleInfo; /* set bundle info*/
    578         cam_flip_mode_t flipInfo;       /* flip mode */
    579         cam_crop_data_t outputCrop;     /* output crop for current frame */
    580         cam_stream_img_prop_t imgProp;  /* image properties of current frame */
    581         cam_request_frames frameRequest; /*do TNR process*/
    582         cam_perf_mode_t perf_mode;       /*request operational mode*/
    583     };
    584 } cam_stream_parm_buffer_t;
    585 
    586 /* stream info */
    587 typedef struct {
    588     /* stream ID from server */
    589     uint32_t stream_svr_id;
    590 
    591     /* stream type */
    592     cam_stream_type_t stream_type;
    593 
    594     /* image format */
    595     cam_format_t fmt;
    596 
    597     /* image dimension */
    598     cam_dimension_t dim;
    599 
    600     /* buffer plane information, will be calc based on stream_type, fmt,
    601        dim, and padding_info(from stream config). Info including:
    602        offset_x, offset_y, stride, scanline, plane offset */
    603     cam_stream_buf_plane_info_t buf_planes;
    604 
    605     /* number of stream bufs will be allocated */
    606     uint32_t num_bufs;
    607 
    608     /* streaming type */
    609     cam_streaming_mode_t streaming_mode;
    610 
    611     /* num of frames needs to be generated.
    612      * only valid when streaming_mode = CAM_STREAMING_MODE_BURST */
    613     uint8_t num_of_burst;
    614 
    615     /* num of frames in one batch.
    616      * only valid when streaming_mode = CAM_STREAMING_MODE_BATCH */
    617     cam_stream_user_buf_info_t user_buf_info;
    618 
    619     /* stream specific pp config */
    620     cam_pp_feature_config_t pp_config;
    621 
    622     /* this section is valid if offline reprocess type stream */
    623     cam_stream_reproc_config_t reprocess_config;
    624 
    625     cam_stream_parm_buffer_t parm_buf;    /* stream based parameters */
    626 
    627     uint8_t dis_enable;
    628 
    629     /* Image Stabilization type */
    630     cam_is_type_t is_type;
    631 
    632     /* Signifies Secure stream mode */
    633     cam_stream_secure_t is_secure;
    634 
    635     /* Preferred Performance mode */
    636     cam_perf_mode_t perf_mode;
    637 
    638     /* if frames will not be received */
    639     uint8_t noFrameExpected;
    640 
    641     /* Cache ops for this stream */
    642     cam_stream_cache_ops_t cache_ops;
    643 } cam_stream_info_t;
    644 
    645 /*****************************************************************************
    646  *                 Code for Domain Socket Based Parameters                   *
    647  ****************************************************************************/
    648 #define INCLUDE(PARAM_ID,DATATYPE,COUNT)  \
    649         DATATYPE member_variable_##PARAM_ID[ COUNT ]
    650 
    651 #define POINTER_OF_META(META_ID, TABLE_PTR) \
    652         ((NULL != TABLE_PTR) ? \
    653             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : (NULL))
    654 
    655 #define SIZE_OF_PARAM(META_ID, TABLE_PTR) \
    656         sizeof(TABLE_PTR->data.member_variable_##META_ID)
    657 
    658 #define IF_META_AVAILABLE(META_TYPE, META_PTR_NAME, META_ID, TABLE_PTR) \
    659         META_TYPE *META_PTR_NAME = \
    660         (((NULL != TABLE_PTR) && (TABLE_PTR->is_valid[META_ID])) ? \
    661             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : \
    662             (NULL)); \
    663         if (NULL != META_PTR_NAME) \
    664 
    665 #define ADD_SET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID, DATA) \
    666     ((NULL != TABLE_PTR) ? \
    667     ((TABLE_PTR->data.member_variable_##META_ID[ 0 ] = DATA), \
    668     (TABLE_PTR->is_valid[META_ID] = 1), (0)) : \
    669     ((LOGE("Unable to set metadata TABLE_PTR:%p META_ID:%d", \
    670             TABLE_PTR, META_ID)), (-1))) \
    671 
    672 #define ADD_SET_PARAM_ARRAY_TO_BATCH(TABLE_PTR, META_ID, PDATA, COUNT, RCOUNT) \
    673 { \
    674     if ((NULL != TABLE_PTR) && \
    675             (0 < COUNT) && \
    676             ((sizeof(TABLE_PTR->data.member_variable_##META_ID) / \
    677             sizeof(TABLE_PTR->data.member_variable_##META_ID[ 0 ])) \
    678             >= COUNT))  { \
    679         for (size_t _i = 0; _i < COUNT ; _i++) { \
    680             TABLE_PTR->data.member_variable_##META_ID[ _i ] = PDATA [ _i ]; \
    681         } \
    682         TABLE_PTR->is_valid[META_ID] = 1; \
    683         RCOUNT = COUNT; \
    684     } else { \
    685         LOGE("Unable to set metadata TABLE_PTR:%p META_ID:%d COUNT:%zu", \
    686               TABLE_PTR, META_ID, COUNT); \
    687         RCOUNT = 0; \
    688     } \
    689 }
    690 
    691 #define ADD_GET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID) \
    692 { \
    693     if (NULL != TABLE_PTR) { \
    694         TABLE_PTR->is_reqd[META_ID] = 1; \
    695     } else { \
    696         LOGE("Unable to get metadata TABLE_PTR:%p META_ID:%d", \
    697                   TABLE_PTR, META_ID); \
    698     } \
    699 }
    700 
    701 #define READ_PARAM_ENTRY(TABLE_PTR, META_ID, DATA) \
    702 { \
    703     if (NULL != TABLE_PTR) { \
    704         DATA = TABLE_PTR->data.member_variable_##META_ID[ 0 ]; \
    705     } else { \
    706         LOGE("Unable to read metadata TABLE_PTR:%p META_ID:%d", \
    707                   TABLE_PTR, META_ID); \
    708     } \
    709 }
    710 
    711 /************************************
    712 * Custom parameter data definition
    713 *************************************/
    714 typedef struct {
    715     /*CAM_CUSTOM_PARM_EXAMPLE is added to explain custom param procedure*/
    716     INCLUDE(CAM_CUSTOM_PARM_EXAMPLE,            int32_t,           1);
    717 } custom_parm_data_t;
    718 
    719 /************************************
    720 * Custom Parameter buffer definition
    721 *************************************/
    722 typedef struct {
    723     union {
    724         /* Hash table of 'is valid' flags */
    725         uint8_t         is_valid[CAM_CUSTOM_PARM_MAX];
    726 
    727         /* Hash table of 'is required' flags for the GET PARAM */
    728         uint8_t         is_reqd[CAM_CUSTOM_PARM_MAX];
    729     };
    730     custom_parm_data_t data;
    731 } custom_parm_buffer_t;
    732 
    733 
    734 typedef struct {
    735 /**************************************************************************************
    736  *  ID from (cam_intf_metadata_type_t)                DATATYPE                     COUNT
    737  **************************************************************************************/
    738     /* common between HAL1 and HAL3 */
    739     INCLUDE(CAM_INTF_META_HISTOGRAM,                    cam_hist_stats_t,               1);
    740     INCLUDE(CAM_INTF_META_FACE_DETECTION,               cam_face_detection_data_t,      1);
    741     INCLUDE(CAM_INTF_META_FACE_RECOG,                   cam_face_recog_data_t,          1);
    742     INCLUDE(CAM_INTF_META_FACE_BLINK,                   cam_face_blink_data_t,          1);
    743     INCLUDE(CAM_INTF_META_FACE_GAZE,                    cam_face_gaze_data_t,           1);
    744     INCLUDE(CAM_INTF_META_FACE_SMILE,                   cam_face_smile_data_t,          1);
    745     INCLUDE(CAM_INTF_META_FACE_LANDMARK,                cam_face_landmarks_data_t,      1);
    746     INCLUDE(CAM_INTF_META_FACE_CONTOUR,                 cam_face_contour_data_t,        1);
    747     INCLUDE(CAM_INTF_META_AUTOFOCUS_DATA,               cam_auto_focus_data_t,          1);
    748     INCLUDE(CAM_INTF_META_CDS_DATA,                     cam_cds_data_t,                 1);
    749     INCLUDE(CAM_INTF_PARM_UPDATE_DEBUG_LEVEL,           uint32_t,                       1);
    750 
    751     /* Specific to HAl1 */
    752     INCLUDE(CAM_INTF_META_CROP_DATA,                    cam_crop_data_t,                1);
    753     INCLUDE(CAM_INTF_META_PREP_SNAPSHOT_DONE,           int32_t,                        1);
    754     INCLUDE(CAM_INTF_META_GOOD_FRAME_IDX_RANGE,         cam_frame_idx_range_t,          1);
    755     INCLUDE(CAM_INTF_META_ASD_HDR_SCENE_DATA,           cam_asd_hdr_scene_data_t,       1);
    756     INCLUDE(CAM_INTF_META_ASD_SCENE_INFO,               cam_asd_decision_t,             1);
    757     INCLUDE(CAM_INTF_META_CURRENT_SCENE,                cam_scene_mode_type,            1);
    758     INCLUDE(CAM_INTF_META_AWB_INFO,                     cam_awb_params_t,               1);
    759     INCLUDE(CAM_INTF_META_FOCUS_POSITION,               cam_focus_pos_info_t,           1);
    760     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ISP,           cam_chromatix_lite_isp_t,       1);
    761     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_PP,            cam_chromatix_lite_pp_t,        1);
    762     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AE,            cam_chromatix_lite_ae_stats_t,  1);
    763     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AWB,           cam_chromatix_lite_awb_stats_t, 1);
    764     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AF,            cam_chromatix_lite_af_stats_t,  1);
    765     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ASD,           cam_chromatix_lite_asd_stats_t, 1);
    766     INCLUDE(CAM_INTF_BUF_DIVERT_INFO,                   cam_buf_divert_info_t,          1);
    767 
    768     /* Specific to HAL3 */
    769     INCLUDE(CAM_INTF_META_FRAME_NUMBER_VALID,           int32_t,                     1);
    770     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,    int32_t,                     1);
    771     INCLUDE(CAM_INTF_META_FRAME_DROPPED,                cam_stream_ID_t,             1);
    772     INCLUDE(CAM_INTF_META_FRAME_NUMBER,                 uint32_t,                    1);
    773     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER,          uint32_t,                    1);
    774     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,           uint32_t,                    1);
    775     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,      cam_color_correct_matrix_t,  1);
    776     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,          cam_color_correct_gains_t,   1);
    777     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, cam_color_correct_matrix_t,  1);
    778     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,     cam_color_correct_gains_t,   1);
    779     INCLUDE(CAM_INTF_META_AEC_ROI,                      cam_area_t,                  1);
    780     INCLUDE(CAM_INTF_META_AEC_STATE,                    uint32_t,                    1);
    781     INCLUDE(CAM_INTF_PARM_FOCUS_MODE,                   uint32_t,                    1);
    782     INCLUDE(CAM_INTF_PARM_MANUAL_FOCUS_POS,             cam_manual_focus_parm_t,     1);
    783     INCLUDE(CAM_INTF_META_AF_ROI,                       cam_area_t,                  1);
    784     INCLUDE(CAM_INTF_META_AF_STATE,                     uint32_t,                    1);
    785     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,                int32_t,                     1);
    786     INCLUDE(CAM_INTF_META_AWB_REGIONS,                  cam_area_t,                  1);
    787     INCLUDE(CAM_INTF_META_AWB_STATE,                    uint32_t,                    1);
    788     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,             uint32_t,                    1);
    789     INCLUDE(CAM_INTF_META_MODE,                         uint32_t,                    1);
    790     INCLUDE(CAM_INTF_META_EDGE_MODE,                    cam_edge_application_t,      1);
    791     INCLUDE(CAM_INTF_META_FLASH_POWER,                  uint32_t,                    1);
    792     INCLUDE(CAM_INTF_META_FLASH_FIRING_TIME,            int64_t,                     1);
    793     INCLUDE(CAM_INTF_META_FLASH_MODE,                   uint32_t,                    1);
    794     INCLUDE(CAM_INTF_META_FLASH_STATE,                  int32_t,                     1);
    795     INCLUDE(CAM_INTF_META_HOTPIXEL_MODE,                uint32_t,                    1);
    796     INCLUDE(CAM_INTF_META_LENS_APERTURE,                float,                       1);
    797     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,           float,                       1);
    798     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,            float,                       1);
    799     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,          float,                       1);
    800     INCLUDE(CAM_INTF_META_LENS_FOCUS_RANGE,             float,                       2);
    801     INCLUDE(CAM_INTF_META_LENS_STATE,                   cam_af_lens_state_t,         1);
    802     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,           uint32_t,                    1);
    803     INCLUDE(CAM_INTF_META_VIDEO_STAB_MODE,              uint32_t,                    1);
    804     INCLUDE(CAM_INTF_META_LENS_FOCUS_STATE,             uint32_t,                    1);
    805     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_MODE,         uint32_t,                    1);
    806     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_STRENGTH,     uint32_t,                    1);
    807     INCLUDE(CAM_INTF_META_SCALER_CROP_REGION,           cam_crop_region_t,           1);
    808     INCLUDE(CAM_INTF_META_SCENE_FLICKER,                uint32_t,                    1);
    809     INCLUDE(CAM_INTF_META_SENSOR_EXPOSURE_TIME,         int64_t,                     1);
    810     INCLUDE(CAM_INTF_META_SENSOR_FRAME_DURATION,        int64_t,                     1);
    811     INCLUDE(CAM_INTF_META_SENSOR_SENSITIVITY,           int32_t,                     1);
    812     INCLUDE(CAM_INTF_META_ISP_SENSITIVITY ,             int32_t,                     1);
    813     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP,             int64_t,                     1);
    814     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP_AV,          int64_t,                     1);
    815     INCLUDE(CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,  int64_t,                     1);
    816     INCLUDE(CAM_INTF_META_SHADING_MODE,                 uint32_t,                    1);
    817     INCLUDE(CAM_INTF_META_STATS_FACEDETECT_MODE,        uint32_t,                    1);
    818     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_MODE,         uint32_t,                    1);
    819     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,     uint32_t,                    1);
    820     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP,          cam_sharpness_map_t,         3);
    821     INCLUDE(CAM_INTF_META_TONEMAP_CURVES,               cam_rgb_tonemap_curves,      1);
    822     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP,             cam_lens_shading_map_t,      1);
    823     INCLUDE(CAM_INTF_META_AEC_INFO,                     cam_3a_params_t,             1);
    824     INCLUDE(CAM_INTF_META_SENSOR_INFO,                  cam_sensor_params_t,         1);
    825     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AE,                cam_ae_exif_debug_t,         1);
    826     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AWB,               cam_awb_exif_debug_t,        1);
    827     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AF,                cam_af_exif_debug_t,         1);
    828     INCLUDE(CAM_INTF_META_EXIF_DEBUG_ASD,               cam_asd_exif_debug_t,        1);
    829     INCLUDE(CAM_INTF_META_EXIF_DEBUG_STATS,             cam_stats_buffer_exif_debug_t,   1);
    830     INCLUDE(CAM_INTF_META_EXIF_DEBUG_BESTATS,           cam_bestats_buffer_exif_debug_t, 1);
    831     INCLUDE(CAM_INTF_META_EXIF_DEBUG_BHIST,             cam_bhist_buffer_exif_debug_t,   1);
    832     INCLUDE(CAM_INTF_META_EXIF_DEBUG_3A_TUNING,         cam_q3a_tuning_info_t,       1);
    833     INCLUDE(CAM_INTF_META_ASD_SCENE_CAPTURE_TYPE,       cam_auto_scene_t,            1);
    834     INCLUDE(CAM_INTF_PARM_EFFECT,                       uint32_t,                    1);
    835     /* Defining as int32_t so that this array is 4 byte aligned */
    836     INCLUDE(CAM_INTF_META_PRIVATE_DATA,                 int32_t,
    837             MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES / 4);
    838 
    839     /* Following are Params only and not metadata currently */
    840     INCLUDE(CAM_INTF_PARM_HAL_VERSION,                  int32_t,                     1);
    841     /* Shared between HAL1 and HAL3 */
    842     INCLUDE(CAM_INTF_PARM_ANTIBANDING,                  uint32_t,                    1);
    843     INCLUDE(CAM_INTF_PARM_EXPOSURE_COMPENSATION,        int32_t,                     1);
    844     INCLUDE(CAM_INTF_PARM_EV_STEP,                      cam_rational_type_t,         1);
    845     INCLUDE(CAM_INTF_PARM_AEC_LOCK,                     uint32_t,                    1);
    846     INCLUDE(CAM_INTF_PARM_FPS_RANGE,                    cam_fps_range_t,             1);
    847     INCLUDE(CAM_INTF_PARM_AWB_LOCK,                     uint32_t,                    1);
    848     INCLUDE(CAM_INTF_PARM_BESTSHOT_MODE,                uint32_t,                    1);
    849     INCLUDE(CAM_INTF_PARM_DIS_ENABLE,                   int32_t,                     1);
    850     INCLUDE(CAM_INTF_PARM_LED_MODE,                     int32_t,                     1);
    851     INCLUDE(CAM_INTF_META_LED_MODE_OVERRIDE,            uint32_t,                    1);
    852 
    853     /* dual camera specific params */
    854     INCLUDE(CAM_INTF_PARM_RELATED_SENSORS_CALIBRATION,  cam_related_system_calibration_data_t, 1);
    855     INCLUDE(CAM_INTF_META_AF_FOCAL_LENGTH_RATIO,        cam_focal_length_ratio_t, 1);
    856     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_SENSOR,        cam_stream_crop_info_t,   1);
    857     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_CAMIF,         cam_stream_crop_info_t,   1);
    858     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_ISP,           cam_stream_crop_info_t,   1);
    859     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_CPP,           cam_stream_crop_info_t,   1);
    860     INCLUDE(CAM_INTF_META_DCRF,                         cam_dcrf_result_t,        1);
    861 
    862     /* HAL1 specific */
    863     /* read only */
    864     INCLUDE(CAM_INTF_PARM_QUERY_FLASH4SNAP,             int32_t,                     1);
    865     INCLUDE(CAM_INTF_PARM_EXPOSURE,                     int32_t,                     1);
    866     INCLUDE(CAM_INTF_PARM_SHARPNESS,                    int32_t,                     1);
    867     INCLUDE(CAM_INTF_PARM_CONTRAST,                     int32_t,                     1);
    868     INCLUDE(CAM_INTF_PARM_SATURATION,                   int32_t,                     1);
    869     INCLUDE(CAM_INTF_PARM_BRIGHTNESS,                   int32_t,                     1);
    870     INCLUDE(CAM_INTF_PARM_ISO,                          cam_intf_parm_manual_3a_t,   1);
    871     INCLUDE(CAM_INTF_PARM_EXPOSURE_TIME,                cam_intf_parm_manual_3a_t,   1);
    872     INCLUDE(CAM_INTF_PARM_ZOOM,                         int32_t,                     1);
    873     INCLUDE(CAM_INTF_PARM_ROLLOFF,                      int32_t,                     1);
    874     INCLUDE(CAM_INTF_PARM_MODE,                         int32_t,                     1);
    875     INCLUDE(CAM_INTF_PARM_AEC_ALGO_TYPE,                int32_t,                     1);
    876     INCLUDE(CAM_INTF_PARM_FOCUS_ALGO_TYPE,              int32_t,                     1);
    877     INCLUDE(CAM_INTF_PARM_AEC_ROI,                      cam_set_aec_roi_t,           1);
    878     INCLUDE(CAM_INTF_PARM_AF_ROI,                       cam_roi_info_t,              1);
    879     INCLUDE(CAM_INTF_PARM_SCE_FACTOR,                   int32_t,                     1);
    880     INCLUDE(CAM_INTF_PARM_FD,                           cam_fd_set_parm_t,           1);
    881     INCLUDE(CAM_INTF_PARM_MCE,                          int32_t,                     1);
    882     INCLUDE(CAM_INTF_PARM_HFR,                          int32_t,                     1);
    883     INCLUDE(CAM_INTF_PARM_REDEYE_REDUCTION,             int32_t,                     1);
    884     INCLUDE(CAM_INTF_PARM_WAVELET_DENOISE,              cam_denoise_param_t,         1);
    885     INCLUDE(CAM_INTF_PARM_TEMPORAL_DENOISE,             cam_denoise_param_t,         1);
    886     INCLUDE(CAM_INTF_PARM_HISTOGRAM,                    int32_t,                     1);
    887     INCLUDE(CAM_INTF_PARM_ASD_ENABLE,                   int32_t,                     1);
    888     INCLUDE(CAM_INTF_PARM_RECORDING_HINT,               int32_t,                     1);
    889     INCLUDE(CAM_INTF_PARM_HDR,                          cam_exp_bracketing_t,        1);
    890     INCLUDE(CAM_INTF_PARM_FRAMESKIP,                    int32_t,                     1);
    891     INCLUDE(CAM_INTF_PARM_ZSL_MODE,                     int32_t,                     1);
    892     INCLUDE(CAM_INTF_PARM_HDR_NEED_1X,                  int32_t,                     1);
    893     INCLUDE(CAM_INTF_PARM_LOCK_CAF,                     int32_t,                     1);
    894     INCLUDE(CAM_INTF_PARM_VIDEO_HDR,                    int32_t,                     1);
    895     INCLUDE(CAM_INTF_PARM_SENSOR_HDR,                   cam_sensor_hdr_type_t,       1);
    896     INCLUDE(CAM_INTF_PARM_VT,                           int32_t,                     1);
    897     INCLUDE(CAM_INTF_PARM_SET_AUTOFOCUSTUNING,          tune_actuator_t,             1);
    898     INCLUDE(CAM_INTF_PARM_SET_VFE_COMMAND,              tune_cmd_t,                  1);
    899     INCLUDE(CAM_INTF_PARM_SET_PP_COMMAND,               tune_cmd_t,                  1);
    900     INCLUDE(CAM_INTF_PARM_MAX_DIMENSION,                cam_dimension_t,             1);
    901     INCLUDE(CAM_INTF_PARM_RAW_DIMENSION,                cam_dimension_t,             1);
    902     INCLUDE(CAM_INTF_PARM_TINTLESS,                     int32_t,                     1);
    903     INCLUDE(CAM_INTF_PARM_WB_MANUAL,                    cam_manual_wb_parm_t,        1);
    904     INCLUDE(CAM_INTF_PARM_CDS_MODE,                     int32_t,                     1);
    905     INCLUDE(CAM_INTF_PARM_EZTUNE_CMD,                   cam_eztune_cmd_data_t,       1);
    906     INCLUDE(CAM_INTF_PARM_INT_EVT,                      cam_int_evt_params_t,        1);
    907     INCLUDE(CAM_INTF_PARM_RDI_MODE,                     int32_t,                     1);
    908     INCLUDE(CAM_INTF_PARM_BURST_NUM,                    uint32_t,                    1);
    909     INCLUDE(CAM_INTF_PARM_RETRO_BURST_NUM,              uint32_t,                    1);
    910     INCLUDE(CAM_INTF_PARM_BURST_LED_ON_PERIOD,          uint32_t,                    1);
    911     INCLUDE(CAM_INTF_PARM_LONGSHOT_ENABLE,              int8_t,                      1);
    912     INCLUDE(CAM_INTF_PARM_TONE_MAP_MODE,                uint32_t,                    1);
    913     INCLUDE(CAM_INTF_META_TOUCH_AE_RESULT,              int32_t,                     1);
    914     INCLUDE(CAM_INTF_PARM_DUAL_LED_CALIBRATION,         int32_t,                     1);
    915     INCLUDE(CAM_INTF_PARM_ADV_CAPTURE_MODE,             uint8_t,                     1);
    916 
    917     /* HAL3 specific */
    918     INCLUDE(CAM_INTF_META_STREAM_INFO,                  cam_stream_size_info_t,      1);
    919     INCLUDE(CAM_INTF_META_AEC_MODE,                     uint32_t,                    1);
    920     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,       cam_trigger_t,               1);
    921     INCLUDE(CAM_INTF_META_AF_TRIGGER,                   cam_trigger_t,               1);
    922     INCLUDE(CAM_INTF_META_CAPTURE_INTENT,               uint32_t,                    1);
    923     INCLUDE(CAM_INTF_META_DEMOSAIC,                     int32_t,                     1);
    924     INCLUDE(CAM_INTF_META_SHARPNESS_STRENGTH,           int32_t,                     1);
    925     INCLUDE(CAM_INTF_META_GEOMETRIC_MODE,               uint32_t,                    1);
    926     INCLUDE(CAM_INTF_META_GEOMETRIC_STRENGTH,           uint32_t,                    1);
    927     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP_MODE,        uint32_t,                    1);
    928     INCLUDE(CAM_INTF_META_SHADING_STRENGTH,             uint32_t,                    1);
    929     INCLUDE(CAM_INTF_META_TONEMAP_MODE,                 uint32_t,                    1);
    930     INCLUDE(CAM_INTF_META_STREAM_ID,                    cam_stream_ID_t,             1);
    931     INCLUDE(CAM_INTF_PARM_STATS_DEBUG_MASK,             uint32_t,                    1);
    932     INCLUDE(CAM_INTF_PARM_STATS_AF_PAAF,                uint32_t,                    1);
    933     INCLUDE(CAM_INTF_PARM_FOCUS_BRACKETING,             cam_af_bracketing_t,         1);
    934     INCLUDE(CAM_INTF_PARM_FLASH_BRACKETING,             cam_flash_bracketing_t,      1);
    935     INCLUDE(CAM_INTF_META_JPEG_GPS_COORDINATES,         double,                      3);
    936     INCLUDE(CAM_INTF_META_JPEG_GPS_PROC_METHODS,        uint8_t,                     GPS_PROCESSING_METHOD_SIZE);
    937     INCLUDE(CAM_INTF_META_JPEG_GPS_TIMESTAMP,           int64_t,                     1);
    938     INCLUDE(CAM_INTF_META_JPEG_ORIENTATION,             int32_t,                     1);
    939     INCLUDE(CAM_INTF_META_JPEG_QUALITY,                 uint32_t,                    1);
    940     INCLUDE(CAM_INTF_META_JPEG_THUMB_QUALITY,           uint32_t,                    1);
    941     INCLUDE(CAM_INTF_META_JPEG_THUMB_SIZE,              cam_dimension_t,             1);
    942     INCLUDE(CAM_INTF_META_TEST_PATTERN_DATA,            cam_test_pattern_data_t,     1);
    943     INCLUDE(CAM_INTF_META_PROFILE_TONE_CURVE,           cam_profile_tone_curve,      1);
    944     INCLUDE(CAM_INTF_META_OTP_WB_GRGB,                  float,                       1);
    945     INCLUDE(CAM_INTF_META_IMG_HYST_INFO,                cam_img_hysterisis_info_t,   1);
    946     INCLUDE(CAM_INTF_META_CAC_INFO,                     cam_cac_info_t,              1);
    947     INCLUDE(CAM_INTF_PARM_CAC,                          cam_aberration_mode_t,       1);
    948     INCLUDE(CAM_INTF_META_NEUTRAL_COL_POINT,            cam_neutral_col_point_t,     1);
    949     INCLUDE(CAM_INTF_PARM_ROTATION,                     cam_rotation_info_t,         1);
    950     INCLUDE(CAM_INTF_PARM_HW_DATA_OVERWRITE,            cam_hw_data_overwrite_t,     1);
    951     INCLUDE(CAM_INTF_META_IMGLIB,                       cam_intf_meta_imglib_t,      1);
    952     INCLUDE(CAM_INTF_PARM_CAPTURE_FRAME_CONFIG,         cam_capture_frame_config_t,  1);
    953     INCLUDE(CAM_INTF_PARM_CUSTOM,                       custom_parm_buffer_t,        1);
    954     INCLUDE(CAM_INTF_PARM_FLIP,                         int32_t,                     1);
    955     INCLUDE(CAM_INTF_META_USE_AV_TIMER,                 uint8_t,                     1);
    956     INCLUDE(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,    float,                       1);
    957     INCLUDE(CAM_INTF_META_LDAF_EXIF,                    uint32_t,                    2);
    958     INCLUDE(CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN,   cam_black_level_metadata_t,  1);
    959     INCLUDE(CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN,  cam_black_level_metadata_t,  1);
    960     INCLUDE(CAM_INTF_META_LOW_LIGHT,                    cam_low_light_mode_t,        1);
    961     INCLUDE(CAM_INTF_META_IMG_DYN_FEAT,                 cam_dyn_img_data_t,          1);
    962     INCLUDE(CAM_INTF_PARM_MANUAL_CAPTURE_TYPE,          cam_manual_capture_type,     1);
    963     INCLUDE(CAM_INTF_AF_STATE_TRANSITION,               uint8_t,                     1);
    964     INCLUDE(CAM_INTF_PARM_INITIAL_EXPOSURE_INDEX,       uint32_t,                    1);
    965     INCLUDE(CAM_INTF_PARM_INSTANT_AEC,                  uint8_t,                     1);
    966     INCLUDE(CAM_INTF_META_HYBRID_AE,                    uint8_t,                     1);
    967     INCLUDE(CAM_INTF_META_AF_SCENE_CHANGE,              uint8_t,                     1);
    968     /* DevCamDebug metadata CAM_INTF.H */
    969     INCLUDE(CAM_INTF_META_DEV_CAM_ENABLE,               uint8_t,                     1);
    970     /* DevCamDebug metadata CAM_INTF.H AF */
    971     INCLUDE(CAM_INTF_META_DEV_CAM_AF_LENS_POSITION,     int32_t,                     1);
    972     INCLUDE(CAM_INTF_META_DEV_CAM_AF_TOF_CONFIDENCE,    int32_t,                     1);
    973     INCLUDE(CAM_INTF_META_DEV_CAM_AF_TOF_DISTANCE,      int32_t,                     1);
    974     INCLUDE(CAM_INTF_META_DEV_CAM_AF_LUMA,                    int32_t,               1);
    975     INCLUDE(CAM_INTF_META_DEV_CAM_AF_HAF_STATE,               int32_t,               1);
    976     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_TARGET_POS, int32_t,               1);
    977     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_CONFIDENCE, int32_t,               1);
    978     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_REFOCUS,    int32_t,               1);
    979     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_TARGET_POS,  int32_t,               1);
    980     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_CONFIDENCE,  int32_t,               1);
    981     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_REFOCUS,     int32_t,               1);
    982     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TYPE_SELECT,     int32_t,               1);
    983     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_REFOCUS,         int32_t,               1);
    984     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TARGET_POS,      int32_t,               1);
    985     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_TARGET_POS,  int32_t,               1);
    986     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEXT_POS,    int32_t,               1);
    987     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEAR_POS,    int32_t,               1);
    988     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_FAR_POS,     int32_t,               1);
    989     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_CONFIDENCE,  int32_t,               1);
    990     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_TARGET_POS,   int32_t,               1);
    991     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEXT_POS,     int32_t,               1);
    992     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEAR_POS,     int32_t,               1);
    993     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_FAR_POS,      int32_t,               1);
    994     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_CONFIDENCE,   int32_t,               1);
    995     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TYPE_SELECT,      int32_t,               1);
    996     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_NEXT_POS,         int32_t,               1);
    997     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TARGET_POS,       int32_t,               1);
    998     /* DevCamDebug metadata CAM_INTF.H AEC */
    999     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_TARGET_LUMA,      int32_t,                     1);
   1000     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_COMP_LUMA,        int32_t,                     1);
   1001     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_AVG_LUMA,         int32_t,                     1);
   1002     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_CUR_LUMA,         int32_t,                     1);
   1003     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_LINECOUNT,        int32_t,                     1);
   1004     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_REAL_GAIN,        float,                       1);
   1005     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_EXP_INDEX,        int32_t,                     1);
   1006     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_LUX_IDX,          float,                       1);
   1007     /* DevCamDebug metadata CAM_INTF.H AWB */
   1008     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_R_GAIN,           float,                       1);
   1009     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_G_GAIN,           float,                       1);
   1010     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_B_GAIN,           float,                       1);
   1011     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_CCT,              int32_t,                     1);
   1012     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_DECISION,         int32_t,                     1);
   1013     /* DevCamDebug metadata end */
   1014     INCLUDE(CAM_INTF_META_ISP_POST_STATS_SENSITIVITY,   float,                       1);
   1015     INCLUDE(CAM_INTF_META_EARLY_AF_STATE,               uint32_t,                    1);
   1016     INCLUDE(CAM_INTF_META_EIS_CROP_INFO,                cam_eis_crop_info_t,         1);
   1017 
   1018 } metadata_data_t;
   1019 
   1020 /* Update clear_metadata_buffer() function when a new is_xxx_valid is added to
   1021  * or removed from this structure */
   1022 typedef struct {
   1023     union{
   1024         /* Hash table of 'is valid' flags */
   1025         uint8_t         is_valid[CAM_INTF_PARM_MAX];
   1026 
   1027         /* Hash table of 'is required' flags for the GET PARAM */
   1028         uint8_t         is_reqd[CAM_INTF_PARM_MAX];
   1029     };
   1030     metadata_data_t data;
   1031     /*Tuning Data */
   1032     uint8_t is_tuning_params_valid;
   1033     tuning_params_t tuning_params;
   1034 
   1035     /* Mobicat Params */
   1036     uint8_t is_mobicat_aec_params_valid;
   1037     cam_3a_params_t mobicat_aec_params;
   1038 
   1039     /* Stats 3A Debug Params */
   1040     uint8_t is_statsdebug_ae_params_valid;
   1041     cam_ae_exif_debug_t statsdebug_ae_data;
   1042 
   1043     uint8_t is_statsdebug_awb_params_valid;
   1044     cam_awb_exif_debug_t statsdebug_awb_data;
   1045 
   1046     uint8_t is_statsdebug_af_params_valid;
   1047     cam_af_exif_debug_t statsdebug_af_data;
   1048 
   1049     uint8_t is_statsdebug_asd_params_valid;
   1050     cam_asd_exif_debug_t statsdebug_asd_data;
   1051 
   1052     uint8_t is_statsdebug_stats_params_valid;
   1053     cam_stats_buffer_exif_debug_t statsdebug_stats_buffer_data;
   1054 
   1055     uint8_t is_statsdebug_bestats_params_valid;
   1056     cam_bestats_buffer_exif_debug_t statsdebug_bestats_buffer_data;
   1057 
   1058     uint8_t is_statsdebug_bhist_params_valid;
   1059     cam_bhist_buffer_exif_debug_t statsdebug_bhist_data;
   1060 
   1061     uint8_t is_statsdebug_3a_tuning_params_valid;
   1062     cam_q3a_tuning_info_t statsdebug_3a_tuning_data;
   1063 
   1064 } metadata_buffer_t;
   1065 
   1066 typedef metadata_buffer_t parm_buffer_t;
   1067 
   1068 #ifdef  __cplusplus
   1069 extern "C" {
   1070 #endif
   1071 
   1072 /* Update this inline function when a new is_xxx_valid is added to
   1073  * or removed from metadata_buffer_t */
   1074 static inline void clear_metadata_buffer(metadata_buffer_t *meta)
   1075 {
   1076     if (meta) {
   1077       memset(meta->is_valid, 0, CAM_INTF_PARM_MAX);
   1078       meta->is_tuning_params_valid = 0;
   1079       meta->is_mobicat_aec_params_valid = 0;
   1080       meta->is_statsdebug_ae_params_valid = 0;
   1081       meta->is_statsdebug_awb_params_valid = 0;
   1082       meta->is_statsdebug_af_params_valid = 0;
   1083       meta->is_statsdebug_asd_params_valid = 0;
   1084       meta->is_statsdebug_stats_params_valid = 0;
   1085       meta->is_statsdebug_bestats_params_valid = 0;
   1086       meta->is_statsdebug_bhist_params_valid = 0;
   1087       meta->is_statsdebug_3a_tuning_params_valid = 0;
   1088     }
   1089 }
   1090 
   1091 #ifdef  __cplusplus
   1092 }
   1093 #endif
   1094 
   1095 #endif /* __QCAMERA_INTF_H__ */
   1096