/*=========================================================================== * FUNCTION - hdr_set_params - * * DESCRIPTION: *==========================================================================*/ int hdr_set_params(frame_proc_t *frameCtrl, frame_proc_set_hdr_data_t *data) { int rc = 0; uint32_t index = frameCtrl->handle & 0xFF; hdr_t *hdr = hdrCtrl[index]; switch (data->type) { case FRAME_PROC_HDR_ENABLE: frameCtrl->output.hdr_d.hdr_enable = data->hdr_init_info.hdr_enable; if (frameCtrl->output.hdr_d.hdr_enable) { rc = hdr_init(frameCtrl); //hdr->num_hal_buf = data->hdr_init_info.num_hal_buf; } else rc = hdr_exit(frameCtrl); break; case FRAME_PROC_HDR_HW_INFO: { /* memcpy(&hdr->pGammaTableStruct.gamma_tbl,frameCtrl->input.isp_info.RGB_gamma_table, frameCtrl->input.isp_info.VFE_GAMMA_NUM_ENTRIES*sizeof(int16_t));*/ hdr->pGammaTableStruct.gamma_tbl = frameCtrl->input.isp_info.RGB_gamma_table; hdr->pGammaTableStruct.entry = frameCtrl->input.isp_info.VFE_GAMMA_NUM_ENTRIES; hdr->pGammaTableStruct.gamma_t = GAMMA_TBL_ALL; CDBG_HIGH("%s Gamma Table entries %d",__func__,hdr->pGammaTableStruct.entry ); if (hdr->pGammaTableStruct.entry!=64) { CDBG_HIGH("Error: Invalid gamma table\n"); return -1; } rc = hdr_calculate_gammatbl(frameCtrl,hdr); } break; default: return -1; } return rc; } /* hdr_set_params */
/*=========================================================================== * FUNCTION - release_c2d_buffer - * * DESCRIPTION: unregister C2D buffer with kernel and deallocate. *==========================================================================*/ static int release_c2d_buffer(config_ctrl_t *ctrl, struct msm_pmem_info *info) { C2D_STATUS rc; if (ioctl(ctrl->camfd, MSM_CAM_IOCTL_UNREGISTER_PMEM, info) < 0) { CDBG_HIGH("%s: ioctl MSM_CAM_IOCTL_UNREGISTER_PMEM is failed.\n", __func__); return FALSE; } if (do_munmap(info->fd, (void *)info->vaddr, info->cbcr_off * 3/2)) { CDBG_HIGH("%s: munmap failed\n", __func__); return FALSE; } rc = LINK_c2dDestroySurface(c2d_obj.src_id); if (rc != C2D_STATUS_OK) CDBG_HIGH("%s: LINK_c2dDestroySurface failed\n", __func__); rc = LINK_c2dDestroySurface(c2d_obj.dst_id); if (rc != C2D_STATUS_OK) CDBG_HIGH("%s: LINK_c2dDestroySurface failed\n", __func__); delete_gpu_addr_list(); close(kgsl_fd); return TRUE; } /* release_c2d_buffer */
/** eis2_initialize: * @eis: EIS2 context * @data: initialization parameters * * This function initializes the EIS2 algorithm. * * Returns 0 on success. **/ int eis2_initialize(eis2_context_type *eis, is_init_data_t *data) { int rc = 0; eis_init_type init_param; frame_cfg_t *frame_cfg = &data->frame_cfg; rs_cs_config_t *rs_cs_config = &data->rs_cs_config; init_param.sensor_mount_angle = data->sensor_mount_angle; init_param.camera_position = data->camera_position; init_param.width = frame_cfg->dis_frame_width; init_param.height = frame_cfg->dis_frame_height; init_param.margin_x = (frame_cfg->vfe_output_width - frame_cfg->dis_frame_width) / 2; init_param.margin_y = (frame_cfg->vfe_output_height - frame_cfg->dis_frame_height) / 2; CDBG_HIGH("%s: init_param->margin_x = %u", __func__, init_param.margin_x); CDBG_HIGH("%s: init_param->margin_y = %u", __func__, init_param.margin_y); if (eis2_init(eis, &init_param) > 0) { CDBG_HIGH("%s: eis_init failed \n", __func__); rc = -1; } return rc; }
int start_preview(struct camera_device * device) { CDBG_HIGH("Q%s: E", __func__); int rc = -1; QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ rc = hardware->start_preview(device); } CDBG_HIGH("Q%s: X", __func__); return rc; }
/*=========================================================================== Function : hdr_config_2frame Description : configure 2 frame ============================================================================= */ int hdr_config_2frame(frame_proc_t *frameCtrl,hdr_t *hdrCtrl,image_type type) { hdr_config_t *pIn = &(hdrCtrl->structHdrConfig); struct msm_pp_frame *hdr_frame[MAX_HDR_NUM_FRAMES]; switch (type) { case THUMBNAIL : CDBG_HIGH("%s E thumbnail",__func__); pIn->imageWidth=frameCtrl->input.mctl_info.thumbnail_dim.width; pIn->imageHeight=frameCtrl->input.mctl_info.thumbnail_dim.height; pIn->thumbMainIndicator=1; pIn->calculatedExposureRatioG=0; hdr_frame[0] = &(frameCtrl->input.mctl_info.thumb_img_frame[1]); hdr_frame[1] = &(frameCtrl->input.mctl_info.thumb_img_frame[2]); break; case MAINIMG: CDBG_HIGH("%s main img ratio : %d E",__func__,hdrCtrl->mParamterStruct.mCalculatedExposureRatioG); pIn->imageWidth=frameCtrl->input.mctl_info.picture_dim.width; pIn->imageHeight=frameCtrl->input.mctl_info.picture_dim.height; pIn->thumbMainIndicator=0; pIn->calculatedExposureRatioG=hdrCtrl->mParamterStruct.mCalculatedExposureRatioG; hdr_frame[0] = &(frameCtrl->input.mctl_info.main_img_frame[1]); hdr_frame[1] = &(frameCtrl->input.mctl_info.main_img_frame[2]); break; default: return -1; } //Get the pIn config settings pIn->subSampleFormat=HDR_H2V2; pIn->chromaOrder=YCRCB; pIn->maxLag=200; //Set the gamm tables pIn->pRedGammaInvTable=hdrCtrl->mParamterStruct.mpRedInverseGammatable; pIn->pGreenGammaInvTable=hdrCtrl->mParamterStruct.mpGreenInverseGammatable; pIn->pBlueGammaInvTable=hdrCtrl->mParamterStruct.mpBlueInverseGammatable; pIn->pRedGammaTable=hdrCtrl->mParamterStruct.mpRedNewGammatable; pIn->pGreenGammaTable=hdrCtrl->mParamterStruct.mpGreenNewGammatable; pIn->pBlueGammaTable=hdrCtrl->mParamterStruct.mpBlueNewGammatable; pIn->pHdrBuffer2Y= (uint8_t*)((uint8_t*)hdr_frame[0]->mp[0].vaddr+ hdr_frame[0]->mp[0].data_offset); pIn->pHdrBuffer2C= (uint8_t*)((uint8_t*)hdr_frame[0]->mp[1].vaddr+hdr_frame[0]->mp[1].data_offset); pIn->pHdrBuffer1Y= (uint8_t*)((uint8_t*)hdr_frame[1]->mp[0].vaddr+ hdr_frame[1]->mp[0].data_offset); pIn->pHdrBuffer1C= (uint8_t*)((uint8_t*)hdr_frame[1]->mp[1].vaddr+hdr_frame[1]->mp[1].data_offset); CDBG_HIGH("%s X",__func__); return 0; }
/** color_conversion_config: * * @mod: * @in_params: * @in_param_size: * * configure initial settings * **/ static int color_conversion_config(isp_color_conversion_mod_t *mod, isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size) { int rc = 0; chromatix_parms_type *chromatix_ptr = (chromatix_parms_type *)in_params->chromatix_ptrs.chromatixPtr; chromatix_CV_type *chromatix_CV_ptr = &chromatix_ptr->chromatix_VFE.chromatix_CV; if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) { /* size mismatch */ CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d", __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size); return -1; } ISP_DBG(ISP_MOD_COLOR_CONV, "%s: enter", __func__); if (!mod->enable) { CDBG_HIGH("%s: Mod not Enable.", __func__); return rc; } /* set old cfg to invalid value to trigger the first trigger update */ SET_UNITY_MATRIX(mod->effects_matrix, 2); mod->cv_data = chromatix_CV_ptr->TL84_color_conversion; mod->p_cv = &(chromatix_CV_ptr->TL84_color_conversion); util_color_conversion_cmd_config(mod); mod->hw_update_pending = TRUE; return rc; } /* color_conversion_config */
/*=========================================================================== * FUNCTION - vfe_rolloff_update - * * DESCRIPTION: *==========================================================================*/ vfe_status_t vfe_rolloff_update(int mod_id, void *module, void *vparams) { rolloff_mod_t *rolloff_ctrl = (rolloff_mod_t*)module; vfe_params_t *vfe_params = (vfe_params_t *)vparams; vfe_status_t rc = VFE_SUCCESS; if (rolloff_ctrl->hw_enable_cmd) { if (VFE_SUCCESS != vfe_util_write_hw_cmd(vfe_params->camfd, CMD_GENERAL, (void *)vfe_params->moduleCfg, sizeof(vfe_params->moduleCfg), VFE_CMD_MODULE_CFG)) { CDBG_HIGH("%s: Module config failed\n", __func__); return VFE_ERROR_GENERAL; } rolloff_ctrl->hw_enable_cmd = FALSE; } if (rolloff_ctrl->rolloff_enable) { if (vfe_params->vfe_version == MSM8974) rc = mesh_rolloff_V4_update(&(rolloff_ctrl->mesh_v4_ctrl), vfe_params); else if (USE_PCA(vfe_params->vfe_version)) rc = pca_rolloff_update(&(rolloff_ctrl->pca_ctrl), vfe_params); else rc = mesh_rolloff_update(&(rolloff_ctrl->mesh_ctrl), vfe_params); if (rc != VFE_SUCCESS) CDBG_ERROR("%s: ROLLOFF update failed\n", __func__); } end: return rc; } /* vfe_rolloff_update */
extern "C" int get_number_of_cameras() { /* try to query every time we get the call!*/ CDBG_HIGH("Q%s: E", __func__); return QCamera2Factory::get_number_of_cameras(); }
/*=========================================================================== FUNCTION isp_tintless_stat_config DESCRIPTION Update the stat params for the tintless algo. Should be called after the BG stat config has been called. ===========================================================================*/ static tintless_return_t isp_tintless_stat_config(void * const res, tintless_stats_config_t * cfg) { tintless_return_t rc; tintless_cfg_t c; tintless_lib_t * const tintless_lib = (tintless_lib_t *) res; CDBG_TINTLESS("%s: Enter \n", __func__); CDBG_HIGH("%s: stats : camif hxw %d x %d, ele col,row %d, %d, hxw %d x %d, type %d",__func__, cfg->camif_win_h, cfg->camif_win_w, cfg->num_stat_elem_cols, cfg->num_stat_elem_rows, cfg->stat_elem_h, cfg->stat_elem_w, cfg->stats_type); if (tintless_lib == NULL || tintless_lib->init_func == NULL) { CDBG_ERROR("%s: Tintless lib is NULL\n", __func__); rc = TINTLESS_LIB_NOT_LOADED; } else { CDBG_ERROR("%s: pointer okay \n", __func__); c.stats = cfg; if (tintless_lib->updates & ( 1 << UPDATES_STAT_CONFIG)) { rc = isp_tintless_config(tintless_lib, UPDATES_STAT_CONFIG, c); CDBG_ERROR("%s: lib returned config err=%d", __func__, rc); } else { CDBG_ERROR("%s: Stat cfg updates not needed", __func__); rc = TINTLESS_UPDATES_NOT_SUPPORTED; } } return rc; } /* isp_tintless_stat_config */
/** bpc_action * @mod_ctrl: bpc module control struct * @action_code : action code * @data: not used * @data_size: not used * * processing the hw action like update or reset * * Return: 0 - success and negative value - failure **/ static int bpc_action (void *mod_ctrl, uint32_t action_code, void *data, uint32_t data_size) { int rc = 0; isp_bpc_mod_t *mod = mod_ctrl; switch (action_code) { case ISP_HW_MOD_ACTION_HW_UPDATE: { rc = bpc_do_hw_update(mod); } break; case ISP_HW_MOD_ACTION_RESET: { bpc_reset(mod); } break; default: { /* no op */ CDBG_HIGH("%s: action code = %d is not supported. nop", __func__, action_code); rc = -EAGAIN; } break; } return rc; } /* bpc_action */
/*=========================================================================== * FUNCTION - vfe_chroma_suppression_config - * * DESCRIPTION: *==========================================================================*/ vfe_status_t vfe_chroma_suppression_config(int mod_id, void *mod_csupp, void *parms) { VFE_ChromaSuppress_ConfigCmdType *chroma_supp_cmd; chroma_supp_mod_t *mod = (chroma_supp_mod_t *)mod_csupp; vfe_params_t *p_obj = (vfe_params_t *)parms; if (!mod->chroma_supp_enable) { CDBG("%s: Chroma Suppression not enabled", __func__); return VFE_SUCCESS; } CDBG("%s: mode: %d\n", __func__, p_obj->vfe_op_mode); if(IS_SNAP_MODE(p_obj)) { chroma_supp_cmd = &(mod->chroma_supp_snap_cmd); } else chroma_supp_cmd = &(mod->chroma_supp_video_cmd); vfe_chrom_supp_config_debug(chroma_supp_cmd); if (VFE_SUCCESS != vfe_util_write_hw_cmd(p_obj->camfd, CMD_GENERAL, (void *)chroma_supp_cmd, sizeof(*chroma_supp_cmd), VFE_CMD_CHROMA_SUP_CFG)) { CDBG_HIGH("%s: chroma sup config for op mode = %d failed\n", __func__, p_obj->vfe_op_mode); return VFE_ERROR_GENERAL; } return VFE_SUCCESS; } /* vfe_chroma_suppression_config */
/** demux_action: * @mod_ctrl: demux module instance * @action_code: action id * @data: input parameter data * @data_size: input parameter size * * This function runs in ISP HW thread context. * * This function executes an demux module action * * Return: 0 - Success * Negative - action execution error **/ static int demux_action (void *mod_ctrl, uint32_t action_code, void *data, uint32_t data_size) { int rc = 0; isp_demux_mod_t *demux = mod_ctrl; switch (action_code) { case ISP_HW_MOD_ACTION_HW_UPDATE: rc = demux_do_hw_update(demux); break; case ISP_HW_MOD_ACTION_RESET: demux_reset(demux); break; default: /* no op */ rc = -EAGAIN; CDBG_HIGH("%s: action code = %d is not supported. nop", __func__, action_code); break; } return rc; } /* demux_action */
/*=========================================================================== FUNCTION - vfe_test_gamma_get_hw_table - DESCRIPTION ===========================================================================*/ static vfe_status_t vfe_test_gamma_get_hw_table(vfe_test_vector_t *mod) { vfe_status_t status = VFE_SUCCESS; uint32_t i; uint32_t *data = NULL, *dummy = NULL; vfe_test_module_output_t *tv_params = &(mod->mod_output); vfe_ctrl_info_t *p_vfe_obj = (vfe_ctrl_info_t *)(mod->vfe_obj); vfe_params_t *params = &p_vfe_obj->vfe_params; CDBG("%s: enter", __func__); data = tv_params->gamma_table; if (!data) { if (NULL == (data = malloc(tv_params->gamma_table_len))) { CDBG_HIGH("%s: Not enough memory\n", __func__); return VFE_ERROR_GENERAL; } } status = vfe_util_write_hw_cmd(params->camfd, CMD_GENERAL, data, tv_params->gamma_table_len, VFE_CMD_GET_RGB_G_TABLE); if (VFE_SUCCESS != status) { CDBG_HIGH("%s: VFE_CMD_GET_GAMMA_TABLE failed\n", __func__); return status; } dummy = data; CDBG("%s: Channel 0\n", __func__); for (i = 0; i < VFE_GAMMA_NUM_ENTRIES; i++) { CDBG("%s: %08x \n", __func__, *dummy); dummy++; } CDBG("%s: Channel 1\n", __func__); for (i = 0; i < VFE_GAMMA_NUM_ENTRIES; i++) { CDBG("%s: %08x \n", __func__, *dummy); dummy++; } CDBG("%s: Channel 2\n", __func__); for (i = 0; i < VFE_GAMMA_NUM_ENTRIES; i++) { CDBG("%s: %08x \n", __func__, *dummy); dummy++; } if (data != tv_params->gamma_table) tv_params->gamma_table = data; return status; } /* vfe_test_gamma_get_hw_table */
/*=========================================================================== * FUNCTION - prepare_non_fusible_frame - * * DESCRIPTION: Currrent frame is not fusible so left frame should * be copied into right frame buffer. *==========================================================================*/ static int prepare_non_fusible_frame(config_ctrl_t *ctrl, struct msm_st_frame *ip_frame, struct msm_st_frame *op_frame, stereo_frame_t *pStereoFrame) { uint32_t stride = 0; uint32_t mono_w_scale = 0, mono_h_scale = 0; uint8_t pad_2K_bool = (ctrl->vfeCtrl.vfeMode == VFE_MODE_SNAPSHOT) ? FALSE : TRUE; FIND_STEREO_SIZE_FACTOR(pStereoFrame->packing, FALSE, mono_w_scale, mono_h_scale); CDBG("%s: R.pix_x_off:%d R.pix_y_off:%d", __func__, op_frame->R.pix_x_off, op_frame->R.pix_y_off); c2d_obj.src_addr.vAddr0 = ip_frame->buf_info.buffer; c2d_obj.src_addr.gAddr0 = find_gpu_addr_item(ip_frame->buf_info.fd, c2d_obj.src_addr.vAddr0); if (!c2d_obj.src_addr.gAddr0) { uint32_t buf_gAddr; buf_gAddr = get_gpu_addr(ip_frame->buf_info.fd, PAD_2_2K((dim_t.pad_r_w * mono_w_scale) * (dim_t.pad_l_h * mono_h_scale), pad_2K_bool) * 3/2, ip_frame->buf_info.phy_offset, ip_frame->buf_info.buffer); c2d_obj.src_addr.gAddr0 = buf_gAddr; add_gpu_addr_item(ip_frame->buf_info.fd, c2d_obj.src_addr.vAddr0, c2d_obj.src_addr.gAddr0, buf_gAddr); } c2d_obj.src_addr.vAddr1 = c2d_obj.src_addr.vAddr0 + PAD_2_2K((dim_t.pad_r_w * mono_w_scale) * (dim_t.pad_l_h * mono_h_scale), pad_2K_bool); c2d_obj.src_addr.gAddr1 = c2d_obj.src_addr.gAddr0 + PAD_2_2K((dim_t.pad_r_w * mono_w_scale) * (dim_t.pad_l_h * mono_h_scale), pad_2K_bool); stride = dim_t.pad_r_w * mono_w_scale; /* update C2D source surface. */ update_C2D_surface(&(c2d_obj.srcSurfaceDef), dim_t.pad_r_w, dim_t.pad_r_h, c2d_obj.src_id, &(c2d_obj.src_addr), stride, C2D_SOURCE, c2d_format); if (!stereo_geo_correction(dim_t.pad_r_w, dim_t.pad_r_h, pStereoFrame)) { CDBG_HIGH("%s: stereo_geo_correction failed.\n", __func__); return FALSE; } /* Prepare C2D output buffer for VPE. */ op_frame->R.buf_y_off = 0; op_frame->R.buf_cbcr_off = PAD_2_2K(dim_t.pad_l_w * dim_t.pad_l_h, pad_2K_bool); op_frame->R.buf_y_stride = dim_t.pad_l_w; op_frame->R.buf_cbcr_stride = dim_t.pad_l_w; return TRUE; } /* prepare_non_fusible_frame */
void disable_msg_type(struct camera_device * device, int32_t msg_type) { QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); CDBG_HIGH("Q%s: E", __func__); if(hardware != NULL){ hardware->disable_msg_type(device, msg_type); } }
void stop_recording(struct camera_device * device) { CDBG_HIGH("Q%s: E", __func__); QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ hardware->stop_recording(device); } }
/*=========================================================================== FUNCTION - vfe_test_get_register_dump - DESCRIPTION ===========================================================================*/ static vfe_status_t vfe_test_get_register_dump(vfe_test_vector_t *mod) { vfe_status_t status = VFE_SUCCESS; uint32_t *data = NULL, *dummy = NULL; uint32_t i; vfe_test_module_output_t *tv_params = &(mod->mod_output); vfe_ctrl_info_t *p_vfe_obj = (vfe_ctrl_info_t *)(mod->vfe_obj); vfe_params_t *params = &p_vfe_obj->vfe_params; CDBG("%s: enter", __func__); data = tv_params->reg_dump_data; if (!data) { if (NULL == (data = malloc(tv_params->reg_dump_len))) { CDBG_HIGH("%s: Not enough memory\n", __func__); return VFE_ERROR_GENERAL; } } status = vfe_util_write_hw_cmd(params->camfd, CMD_GENERAL, data, tv_params->reg_dump_len, VFE_CMD_GET_REG_DUMP); if (VFE_SUCCESS != status) { CDBG_HIGH("%s: VFE_CMD_GET_REG_VALUE failed\n", __func__); return status; } dummy = data; for (i = 0; i < (tv_params->register_total/4); i++) { CDBG("%08x: %08x %08x %08x %08x\n", (uint32_t)(i*16), *dummy, *(dummy + 1), *(dummy + 2), *(dummy + 3)); dummy += 4; } if ((tv_params->register_total % 4) == 3) CDBG("%08x: %08x %08x %08x\n", (uint32_t)(i*16), *dummy, *(dummy + 1), *(dummy + 2)); else if ((tv_params->register_total % 4) == 2) CDBG("%08x: %08x %08x\n", (uint32_t)(i*16), *dummy, *(dummy + 1)); else if ((tv_params->register_total % 4) == 1) CDBG("%08x: %08x\n", (uint32_t)(i*16), *dummy); if (data != tv_params->reg_dump_data) tv_params->reg_dump_data = data; return status; } /* vfe_test_get_register_dump */
/*=========================================================================== * FUNCTION - vfe_active_crop_config - * * DESCRIPTION: *==========================================================================*/ vfe_status_t vfe_active_crop_config(active_crop_mod_t *mod, vfe_params_t* p_obj) { uint32_t pixel_skip = 1; uint32_t line_skip = 1; if (!mod->enable) { CDBG("%s: active_crop not enabled", __func__); return VFE_SUCCESS; } mod->active_crop_cfg_cmd.firstColorCompOfActiveRegion = 0; //TODO: need to check if -1 to be subtracted from width mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion = ((p_obj->sensor_parms.lastPixel - p_obj->sensor_parms.firstPixel + 1) / pixel_skip) - 1; mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion += 1; mod->active_crop_cfg_cmd.firstLineOfActiveRegion = 0; mod->active_crop_cfg_cmd.lastLineOfActiveRegion = ((p_obj->sensor_parms.lastLine - p_obj->sensor_parms.firstLine + 1) / line_skip) - 1; CDBG("From CAMIF\n"); vfe_active_crop_debug(&(mod->active_crop_cfg_cmd)); if (IS_BAYER_FORMAT(p_obj)) { /* Bayer Input * The number of components on a line must be even for bayer. */ mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion -= (mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion - mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion + 1) % 2; } else { /* YCbCr input */ /* For YCbCr 422 data, the number of components must be * a multiple of four. */ mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion -= (mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion - mod->active_crop_cfg_cmd.firstColorCompOfActiveRegion + 1) % 4; } p_obj->active_crop_info.firstPixel = mod->active_crop_cfg_cmd.firstColorCompOfActiveRegion; p_obj->active_crop_info.lastPixel = mod->active_crop_cfg_cmd.lastColorCompOfActiveRegion; p_obj->active_crop_info.firstLine = mod->active_crop_cfg_cmd.firstLineOfActiveRegion; p_obj->active_crop_info.lastLine = mod->active_crop_cfg_cmd.lastLineOfActiveRegion; /* enable the command once region is defined */ if (VFE_SUCCESS != vfe_util_write_hw_cmd(p_obj->camfd, CMD_GENERAL, (void *) &(mod->active_crop_cfg_cmd), sizeof(mod->active_crop_cfg_cmd), VFE_CMD_ACTIVE_REGION_CFG)) { CDBG_HIGH("%s: active_crop config for operation mode = %d failed\n", __func__, p_obj->vfe_op_mode); return VFE_ERROR_GENERAL; } vfe_active_crop_debug(&(mod->active_crop_cfg_cmd)); return VFE_SUCCESS; } /* vfe_active_crop_config */
void put_parameters(struct camera_device * device, char *parm) { CDBG_HIGH("Q%s: E", __func__); QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ hardware->put_parameters(device, parm); } }
int store_meta_data_in_buffers(struct camera_device * device, int enable) { CDBG_HIGH("Q%s: E", __func__); int rc = -1; QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ rc = hardware->store_meta_data_in_buffers(device, enable); } return rc; }
void mm_camera_util_profile(const char *str) { #if (MM_CAMERA_PROFILE) struct timespec cur_time; clock_gettime(CLOCK_REALTIME, &cur_time); CDBG_HIGH("PROFILE %s: %ld.%09ld\n", str, cur_time.tv_sec, cur_time.tv_nsec); #endif }
/*=========================================================================== * FUNCTION - hdr_execute - * * DESCRIPTION: *==========================================================================*/ int hdr_execute(frame_proc_t *frameCtrl) { int rc = -1; uint32_t index = frameCtrl->handle & 0xFF; hdr_t *hdr = hdrCtrl[index]; CDBG_HIGH("%s: E", __func__); rc = hdr_process((void *)frameCtrl, hdr); return rc; } /* hdr_execute */
int dump(struct camera_device * device, int fd) { CDBG_HIGH("Q%s: E", __func__); int rc = -1; QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ rc = hardware->dump(device, fd); } return rc; }
void release(struct camera_device * device) { CDBG_HIGH("Q%s: E", __func__); QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ camera_hardware_t *camHal = (camera_hardware_t *)device->priv; hardware->release(device); camHal->camera_released = true; } }
/*=========================================================================== * FUNCTION - init_kgsl - * * DESCRIPTION: Get the device fd of "/dev/kgsl-2d0". *==========================================================================*/ static int init_kgsl() { kgsl_fd = open(KGSL_DEVICE_NAME, O_RDWR | O_SYNC); if (kgsl_fd < 0) { CDBG_HIGH("%s: kgsl_fd open failed", __func__); return FALSE; } return TRUE; } /* init_kgsl */
int take_picture(struct camera_device * device) { CDBG_HIGH("Q%s: E", __func__); int rc = -1; QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ rc = hardware->take_picture(device); } return rc; }
int cancel_auto_focus(struct camera_device * device) { CDBG_HIGH("Q%s: E", __func__); int rc = -1; QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ rc = hardware->cancel_auto_focus(device); } return rc; }
int recording_enabled(struct camera_device * device) { CDBG_HIGH("Q%s: E", __func__); int rc = -1; QCamera2HardwareInterface *hardware = util_get_Hal_obj(device); if(hardware != NULL){ rc = hardware->recording_enabled(device); } return rc; }
/*=========================================================================== FUNCTION sensor_load_chromatix DESCRIPTION ===========================================================================*/ int8_t sensor_load_chromatix(sensor_ctrl_t *sctrl) { void *libchromatix_handle; void (*LINK_load_chromatix)(void *sctrl); char libName[BUFF_SIZE_255] = {0}; CDBG("%s: chromatixType=%d\n", __func__, sctrl->chromatixType); if ((sctrl->chromatixType >= SENSOR_LOAD_CHROMATIX_MAX) || (!sctrl->start->sensor_load_chromatixfile[sctrl->chromatixType])) { CDBG_ERROR("%s failed: %d\n", __func__, __LINE__); goto ERROR; } CDBG_HIGH("%s: %s: %d\n", __func__, sctrl->start->sensor_load_chromatixfile[sctrl->chromatixType], strlen(sctrl->start->sensor_load_chromatixfile[sctrl->chromatixType])); strlcpy(libName, sctrl->start->sensor_load_chromatixfile[sctrl->chromatixType], BUFF_SIZE_255); if (libName == NULL) { CDBG_ERROR("%s:Failed to find out chromatix dynamic load shared object\n", __func__); goto ERROR; } CDBG("%s:%d:chromatix library Name = %s\n", __func__, __LINE__, libName); libchromatix_handle = dlopen(libName, RTLD_NOW); if (!libchromatix_handle) { CDBG_ERROR("Failed to dlopen %s: %s", libName, dlerror()); goto ERROR; } *(void **)&LINK_load_chromatix = dlsym(libchromatix_handle, "load_chromatix"); if (LINK_load_chromatix != NULL) LINK_load_chromatix(sctrl); else { CDBG_ERROR("Failed to find symbol: %s :%s\n", libName, dlerror()); goto ERROR; } sctrl->sensor.out_data.chromatix_ptr = &(sctrl->chromatixData); CDBG("%s:%d: chromatix_version=%d\n", __func__, __LINE__, (int)sctrl->sensor.out_data.chromatix_ptr->chromatix_version); if (libchromatix_handle) { unsigned ref = dlclose(libchromatix_handle); CDBG("%s:%d: dlclose(libchromatix_handle) refcount %d\n", __func__, __LINE__,ref); } return 0; ERROR: return -EINVAL; }
static boolean cpp_port_check_caps_unreserve(mct_port_t *port, uint32_t identity) { if(!port) { CDBG_ERROR("%s:%d, failed\n", __func__, __LINE__); return FALSE; } CDBG_HIGH("%s:%d, identity=0x%x\n", __func__, __LINE__, identity); cpp_port_data_t *port_data = (cpp_port_data_t *) MCT_OBJECT_PRIVATE(port); int i, rc; for(i=0; i<CPP_MAX_STREAMS_PER_PORT; i++) { if(port_data->stream_data[i].port_state == CPP_PORT_STATE_RESERVED && port_data->stream_data[i].identity == identity) { port_data->stream_data[i].port_state = CPP_PORT_STATE_UNRESERVED; port_data->num_streams--; CDBG_HIGH("%s:%d, identity=0x%x, unreserved\n", __func__, __LINE__, identity); if(port_data->num_streams == 0) { port_data->port_type = CPP_PORT_TYPE_INVALID; port_data->session_id = 0x00; } break; } } if(i == CPP_MAX_STREAMS_PER_PORT) { CDBG_ERROR("%s:%d, can't find matching identity, unexpected !!", __func__, __LINE__); return FALSE; } /* notify the parent module about removal of this stream, once for the sink port */ if(port->direction == MCT_PORT_SINK) { mct_module_t* module = (mct_module_t*)(MCT_PORT_PARENT(port)->data); rc = cpp_module_notify_remove_stream(module, identity); if(rc < 0) { CDBG_ERROR("%s:%d, failed, unexpected error!", __func__, __LINE__); return FALSE; } } return TRUE; }