xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/hwi/isp32/CamHwIsp32.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (c) 2021-2022 Rockchip Eletronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include "CamHwIsp32.h"
17 
18 #ifdef ANDROID_OS
19 #include <cutils/properties.h>
20 #endif
21 
22 namespace RkCam {
23 
CamHwIsp32()24 CamHwIsp32::CamHwIsp32() : CamHwIsp3x() { mVicapIspPhyLinkSupported = true; }
25 
~CamHwIsp32()26 CamHwIsp32::~CamHwIsp32() {}
27 
init(const char * sns_ent_name)28 XCamReturn CamHwIsp32::init(const char* sns_ent_name) {
29     XCamReturn ret = CamHwIsp3x::init(sns_ent_name);
30     return ret;
31 }
32 
stop()33 XCamReturn CamHwIsp32::stop() {
34     XCamReturn ret = CamHwIsp3x::stop();
35     return ret;
36 }
37 
38 void
updateEffParams(void * params,void * ori_params)39 CamHwIsp32::updateEffParams(void* params, void* ori_params)
40 {
41 #if defined(ISP_HW_V32) || defined(ISP_HW_V32_LITE)
42     struct isp32_isp_params_cfg* isp_params = (struct isp32_isp_params_cfg*)params;
43     uint32_t effFrmId = isp_params->frame_id;
44 
45     SmartLock locker(_isp_params_cfg_mutex);
46 
47     if (getParamsForEffMap(effFrmId)) {
48         if (mAwbParams) {
49             RkAiqIspAwbParamsProxyV32* awbParams =
50                 dynamic_cast<RkAiqIspAwbParamsProxyV32*>(mAwbParams);
51             _effecting_ispparam_map[effFrmId]->data()->result.awb_cfg_v32 = awbParams->data()->result;
52         }
53         _effecting_ispparam_map[effFrmId]->data()->result.meas = mLatestMeasCfg;
54         _effecting_ispparam_map[effFrmId]->data()->result.bls_cfg = mLatestBlsCfg;
55         _effecting_ispparam_map[effFrmId]->data()->result.awb_gain_cfg = mLatestWbGainCfg;
56     }
57 #endif
58 }
59 
60 bool
processTb(void * params)61 CamHwIsp32::processTb(void* params)
62 {
63 #if defined(ISP_HW_V32) || defined(ISP_HW_V32_LITE)
64     struct isp32_isp_params_cfg* isp_params = (struct isp32_isp_params_cfg*)params;
65     if (mTbInfo.is_pre_aiq) {
66         if (isp_params->frame_id == 0 && _not_skip_first) {
67             _not_skip_first = false;
68             _first_awb_cfg = isp_params->meas.rawawb;
69             LOGE_ANALYZER("<TB> Skip config id(%d)'s isp params", isp_params->frame_id);
70             return true;
71         } else if (!_not_skip_first) {
72             _first_awb_cfg.pre_wbgain_inv_r = isp_params->meas.rawawb.pre_wbgain_inv_r;
73             _first_awb_cfg.pre_wbgain_inv_g = isp_params->meas.rawawb.pre_wbgain_inv_g;
74             _first_awb_cfg.pre_wbgain_inv_b = isp_params->meas.rawawb.pre_wbgain_inv_b;
75             isp_params->meas.rawawb = _first_awb_cfg;
76         }
77         LOGE_ANALYZER("<TB> Config id(%u)'s isp params, ens 0x%llx ens_up 0x%llx, cfg_up 0x%llx", isp_params->frame_id,
78                       isp_params->module_ens,
79                       isp_params->module_en_update,
80                       isp_params->module_cfg_update);
81         return false;
82     } else if (isp_params->frame_id == 0) {
83         return true;
84     } else {
85         return false;
86     }
87 #else
88     return false;
89 #endif
90 }
91 
92 }  // namespace RkCam
93