问题描述
cts测试中遇到testFlashTurnOff fail .
err log:
java.lang.Exception: There were 4 errors: java.lang.Throwable(Test failed for camera 0: Invalid state 3 not in expected list[4, 2] (expected = -1, actual = -1) ) java.lang.Throwable(Test failed for camera 0: state 3 index -1 is expected to be >= 0: (expected = 0 was not greater than actual = -1) )
该项测试要求:
flash从on->off的状态是[4,2],
从off->on(flash_mode_torch下发之前),flash的状态要求是[2,4]
从off->on的状态是[4,3]
而在测试过程中因为开关灯延迟的原因,导致AP 拿到的flash state 不符合预期。
解决方案
1.在handlebadpic中调整flash state的状态。
以ISP5.0为例;合入如下的修改:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
diff --git a/aaa/source/common/hal3a/v1.0/Hal3AFlowCtrl.cpp b/aaa/source/common/hal3a/v1.0/Hal3AFlowCtrl.cpp index 0c61c2fba1c..2ce1cca9dac 100644 --- a/aaa/source/common/hal3a/v1.0/Hal3AFlowCtrl.cpp +++ b/aaa/source/common/hal3a/v1.0/Hal3AFlowCtrl.cpp @@ -1288,7 +1288,7 @@ notifyP1Done(MINT32 i4MagicNum, MVOID* /*pvArg*/) MY_LOGD_IF(m_fgLogEn, "[%s] i4MagicNum(%d), m_u4FlashOnIdx(%d), bMagicNum(%d), bMainFlash(%d), bPre(%d), m_fgFlashOn(%d)", __FUNCTION__, i4MagicNum, m_u4FlashOnIdx, bMagicNum, bMainFlash, bPre, m_fgFlashOn); if ( bMagicNum && !bMainFlash && !bPre && m_fgFlashOn) { - m_p3AWrap->setFlashLightOnOff(0, 1); // don't care main or pre + m_p3AWrap->setFlashLightOnOff(0, 1, i4MagicNum); // don't care main or pre m_u4FlashOnIdx = -1; m_fgFlashOn = 0; } diff --git a/aaa/source/common/hal3a/v1.0/wrapper/Dft3AImp.cpp b/aaa/source/common/hal3a/v1.0/wrapper/Dft3AImp.cpp index b1568df5e18..8f997b7eab5 100644 --- a/aaa/source/common/hal3a/v1.0/wrapper/Dft3AImp.cpp +++ b/aaa/source/common/hal3a/v1.0/wrapper/Dft3AImp.cpp @@ -121,7 +121,7 @@ public: virtual MVOID setFDEnable(MBOOL fgEnable); virtual MBOOL setFDInfo(MVOID* prFaces, MVOID* prAFFaces); virtual MBOOL setOTInfo(MVOID* prOT, MVOID* prAFOT); - virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/); + virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/, MINT32 /*i4P1DoneSttNum*/); virtual MBOOL setPreFlashOnOff(MBOOL bOnOff/*1=on; 0=off*/); virtual MBOOL isNeedTurnOnPreFlash() const; virtual MBOOL chkMainFlashOnCond() const; @@ -608,7 +608,7 @@ setOTInfo(MVOID* /*prOT*/, MVOID* /*prAFOT*/) MBOOL Dft3AImp:: -setFlashLightOnOff(MBOOL /*bOnOff*/, MBOOL /*bMainPre*/) +setFlashLightOnOff(MBOOL /*bOnOff*/, MBOOL /*bMainPre*/, MINT32 /*i4P1DoneSttNum*/) { CAM_LOGD("[%s]", __FUNCTION__); return MTRUE; diff --git a/aaa/source/common/hal3a/v1.0/wrapper/I3AWrapper.h b/aaa/source/common/hal3a/v1.0/wrapper/I3AWrapper.h index 54c82e4ee1f..cd2e71a3c37 100644 --- a/aaa/source/common/hal3a/v1.0/wrapper/I3AWrapper.h +++ b/aaa/source/common/hal3a/v1.0/wrapper/I3AWrapper.h @@ -104,7 +104,7 @@ public: virtual MBOOL setFDInfo(MVOID* prFaces, MVOID* prAFFaces) = 0; virtual MBOOL setOTInfo(MVOID* prOT, MVOID* prAFOT) = 0; virtual MVOID setIspSensorInfo2AF(MINT32 MagicNum) = 0; - virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/) = 0; + virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/, MINT32 i4P1DoneSttNum = -1) = 0; virtual MBOOL setPreFlashOnOff(MBOOL bOnOff/*1=on; 0=off*/) = 0; virtual MBOOL isNeedTurnOnPreFlash() const = 0; virtual MBOOL chkMainFlashOnCond() const = 0; diff --git a/aaa/source/isp_50/wrapper/Hal3ARawImp.cpp b/aaa/source/isp_50/wrapper/Hal3ARawImp.cpp index 6488e237122..f50ce3ec264 100755 --- a/aaa/source/isp_50/wrapper/Hal3ARawImp.cpp +++ b/aaa/source/isp_50/wrapper/Hal3ARawImp.cpp @@ -280,7 +280,7 @@ public: virtual MVOID setFDEnable(MBOOL fgEnable); virtual MBOOL setFDInfo(MVOID* prFaces, MVOID* prAFFaces); virtual MBOOL setOTInfo(MVOID* prOT, MVOID* prAFOT); - virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/); + virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/, MINT32 i4P1DoneSttNum = -1); virtual MBOOL setPreFlashOnOff(MBOOL bOnOff/*1=on; 0=off*/); virtual MBOOL isNeedTurnOnPreFlash() const; virtual MBOOL chkMainFlashOnCond() const; @@ -1979,7 +1979,7 @@ getNvramIndex(const CAM_IDX_QRY_COMB& info, EModule_T module, MUINT32& index) MBOOL Hal3ARawImp:: -setFlashLightOnOff(MBOOL bOnOff, MBOOL bMainPre) +setFlashLightOnOff(MBOOL bOnOff, MBOOL bMainPre, MINT32 i4P1DoneSttNum /* = -1 */ __unused) { #if CAM3_FLASH_FEATURE_EN MY_LOGD_IF(m_3ALogEnable, "[%s] bOnOff(%d) bMainPre(%d) + ", __FUNCTION__, bOnOff, bMainPre); @@ -4881,7 +4881,7 @@ Hal3ARawImp::handleBadPicture(MINT32 i4ReqMagic) MINT32 rHistoryReqMagic[HistorySize]; ::memset(&rHistoryReqMagic, 0, sizeof(MINT32)*HistorySize); MINT32 i4Ret = m_pResultPoolObj->getHistory(rHistoryReqMagic); - + MINT32 MagicNum = i4ReqMagic; if(i4Ret) { // 2. get the magic of partial frame @@ -4895,6 +4895,13 @@ Hal3ARawImp::handleBadPicture(MINT32 i4ReqMagic) rHistoryReqMagic[1], rHistoryReqMagic[2]); + if(i4P1DoneSttNum >= 0) + { + i4MagicOfPartialFrame = i4P1DoneSttNum + 1; // Flash off will let the next stt frame be partial + i4ReqMagic = i4P1DoneSttNum + 2; // The next two frame should be ready + MY_LOGD("[%s] New i4MagicOfPartialFrame(%d), New ReqMagic(%d), use i4P1DoneSttNum(%d) to refine", __FUNCTION__, i4MagicOfPartialFrame, i4ReqMagic, i4P1DoneSttNum); + } + // 3. handle the partial flashlight on/off frame HALResultToMeta_T* pHalResult = (HALResultToMeta_T*)m_pResultPoolObj->getResult(i4MagicOfPartialFrame,E_HAL_RESULTTOMETA); FLASHResultToMeta_T* pFLASHResult = (FLASHResultToMeta_T*)m_pResultPoolObj->getResult(i4MagicOfPartialFrame,E_FLASH_RESULTTOMETA); @@ -4927,6 +4934,13 @@ Hal3ARawImp::handleBadPicture(MINT32 i4ReqMagic) pFLASHResult->u1FlashState = MTK_FLASH_STATE_READY; } m_pResultPoolObj->updateResult(LOG_TAG,i4ReqMagic,E_FLASH_RESULTTOMETA,pFLASHResult); + ////debug for flashstate + if(MagicNum-i4P1DoneSttNum >= 3){ + for(int i=1, i<= MagicNum-i4ReqMagic,i++){ + m_pResultPoolObj->updateResult(LOG_TAG,(i4ReqMagic+i),E_FLASH_RESULTTOMETA,pFLASHResult); + MY_LOGD("[%s] reqNum:%d ;u1FlashState:%d", __FUNCTION__, i4ReqMagic+i, pFLASHResult->u1FlashState); + } + } } } diff --git a/aaa/source/isp_50/wrapper/Hal3ARawSMVRImp.cpp b/aaa/source/isp_50/wrapper/Hal3ARawSMVRImp.cpp index 05cfe729767..62bcc39775f 100644 --- a/aaa/source/isp_50/wrapper/Hal3ARawSMVRImp.cpp +++ b/aaa/source/isp_50/wrapper/Hal3ARawSMVRImp.cpp @@ -197,7 +197,7 @@ public: virtual MVOID setFDEnable(MBOOL fgEnable); virtual MBOOL setFDInfo(MVOID* prFaces, MVOID* prAFFaces); virtual MBOOL setOTInfo(MVOID* prOT, MVOID* prAFOT); - virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/); + virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/, MINT32 i4P1DoneSttNum = -1); virtual MBOOL setPreFlashOnOff(MBOOL bOnOff/*1=on; 0=off*/); virtual MBOOL isNeedTurnOnPreFlash() const; virtual MBOOL chkMainFlashOnCond() const; @@ -1220,7 +1220,7 @@ getNvramIndex(const CAM_IDX_QRY_COMB& info, EModule_T module, MUINT32& index) MBOOL Hal3ARawSMVRImp:: -setFlashLightOnOff(MBOOL bOnOff, MBOOL bMainPre) +setFlashLightOnOff(MBOOL bOnOff, MBOOL bMainPre, MINT32 i4P1DoneSttNum /* = -1 */ __unused) { #if CAM3_FLASH_FEATURE_EN m_bIsFlashOpened = bOnOff; diff --git a/aaa/source/isp_50/wrapper/Hal3AYuvImp.cpp b/aaa/source/isp_50/wrapper/Hal3AYuvImp.cpp index 11e9a03dc6f..5c55940deb2 100644 --- a/aaa/source/isp_50/wrapper/Hal3AYuvImp.cpp +++ b/aaa/source/isp_50/wrapper/Hal3AYuvImp.cpp @@ -184,7 +184,7 @@ public: virtual MBOOL setFDInfo(MVOID* prFaces, MVOID* prAFFaces); virtual MBOOL setOTInfo(MVOID* prOT, MVOID* prAFOT); virtual MVOID setIspSensorInfo2AF(MINT32 MagicNum); - virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/); + virtual MBOOL setFlashLightOnOff(MBOOL bOnOff/*1=on; 0=off*/, MBOOL bMainPre/*1=main; 0=pre*/, MINT32 i4P1DoneSttNum = -1); virtual MBOOL setPreFlashOnOff(MBOOL bOnOff/*1=on; 0=off*/); virtual MBOOL isNeedTurnOnPreFlash() const; virtual MBOOL chkMainFlashOnCond() const; @@ -1183,7 +1183,7 @@ setIspSensorInfo2AF(MINT32) MBOOL Hal3AYuvImp:: -setFlashLightOnOff(MBOOL bOnOff, MBOOL /*bMainPre*/) +setFlashLightOnOff(MBOOL bOnOff, MBOOL /*bMainPre*/, MINT32 i4P1DoneSttNum /* = -1 */) { MY_LOG_IF(m_3ALogEnable, "[%s] bOnOff(%d) + ", __FUNCTION__, bOnOff); |
PS :该修改已经合入到ISP3/4/5/6中,如果近期有升级,该问题应该可用修复。
2. 对于合入了相关的修改,但是还是fail,log中如果有如下的log :
1 2 3 4 5 |
191157 02-17 11:21:53.109467 5760 6113 D Hal3ARaw: [handleBadPicture] ReqMagic(#569), i4MagicOfPartialFrame(568), History(#567,#568,#569) 191159 02-17 11:21:53.109541 5760 6113 D Hal3ARaw: [handleBadPicture] i4ReqMagic(569), <span style="color: #ff0000;">i4P1DoneSttNum(-1)</span>, u1FlashState(3) 191161 02-17 11:21:53.109586 5760 6113 D Hal3ARaw: [handleBadPicture] i4ReqMagic(569), <span style="color: #ff0000;">i4P1DoneSttNum(-1)</span>, u1FlashState(3) 191163 02-17 11:21:53.109630 5760 6113 D Hal3ARaw: [handleBadPicture] i4ReqMagic(569), <span style="color: #ff0000;">i4P1DoneSttNum(-1)</span>, u1FlashState(3) 191165 02-17 11:21:53.109673 5760 6113 D Hal3ARaw: [handleBadPicture] i4ReqMagic(569),<span style="color: #ff0000;"> i4P1DoneSttNum(-1)</span>, u1FlashState(3) |
请check vendor/mediatek/proprietary/hardware/mtkcam/aaa/source/isp_50/wrapper/Hal3ARawImp.cpp
1 |
Hal3ARawImp::handleBadPicture(MINT32 i4ReqMagic, MINT32 i4P1DoneSttNum /* = -1 */)
4949 // work around for worse performance
4950 if(i4ReqMagic-i4P1DoneSttNum >= 3) {
4951 for(int i=1; i<i4ReqMagic-i4P1DoneSttNum; i++) {
4952 m_pResultPoolObj->updateResult(LOG_TAG,i4ReqMagic+i,E_FLASH_RESULTTOMETA,pFLASHResult);
4953 MY_LOGD("[%s] i4ReqMagic(%d), i4P1DoneSttNum(%d), u1FlashState(%d)", __FUNCTION__, i4ReqMagic, i4P1DoneSttNum, pFLASHResult->u1FlashState);
4954 }
4955 }
请将标黄的code做如下修改:
Hal3ARawImp::handleBadPicture(MINT32 i4ReqMagic, MINT32 i4P1DoneSttNum /* = -1 */)
{
MY_LOGD("[%s]+ ReqMagic(#%d)", __FUNCTION__, i4ReqMagic);
// 1. get History
MINT32 rHistoryReqMagic[HistorySize];
::memset(&rHistoryReqMagic, 0, sizeof(MINT32)*HistorySize);
MINT32 i4Ret = m_pResultPoolObj->getHistory(rHistoryReqMagic);
MINT32 MagicNum = i4ReqMagic;//////////////
......
// work around for worse performance
// if(i4ReqMagic-i4P1DoneSttNum >= 3 ) {
// for(int i=1; i<i4ReqMagic-i4P1DoneSttNum; i++) {
// m_pResultPoolObj->updateResult(LOG_TAG,i4ReqMagic+i,E_FLASH_RESULTTOMETA,pFLASHResult);
// MY_LOGD("[%s] i4ReqMagic(%d), i4P1DoneSttNum(%d), u1FlashState(%d)", __FUNCTION__, i4ReqMagic, i4P1DoneSttNum, pFLASHResult->u1FlashState);
//}
///}
+ if(MagicNum-i4P1DoneSttNum >= 3 && i4P1DoneSttNum >= 0){
+ for(int i=1; i<= MagicNum-i4ReqMagic; i++){
+ m_pResultPoolObj->updateResult(LOG_TAG,(i4ReqMagic+i),E_FLASH_RESULTTOMETA,pFLASHResult);
+ MY_LOGD("[%s] reqNum:%d ;u1FlashState:%d", __FUNCTION__, i4ReqMagic+i, pFLASHResult->u1FlashState);
+ }
+ }
4949 // work around for worse performance
4950 if(i4ReqMagic-i4P1DoneSttNum >= 3) {
4951 for(int i=1; i<i4ReqMagic-i4P1DoneSttNum; i++) {
4952 m_pResultPoolObj->updateResult(LOG_TAG,i4ReqMagic+i,E_FLASH_RESULTTOMETA,pFLASHResult);
4953 MY_LOGD("[%s] i4ReqMagic(%d), i4P1DoneSttNum(%d), u1FlashState(%d)", __FUNCTION__, i4ReqMagic, i4P1DoneSttNum, pFLASHResult->u1FlashState);
4954 }
4955 }
请将标黄的code做如下修改:
Hal3ARawImp::handleBadPicture(MINT32 i4ReqMagic, MINT32 i4P1DoneSttNum /* = -1 */)
{
MY_LOGD("[%s]+ ReqMagic(#%d)", __FUNCTION__, i4ReqMagic);
// 1. get History
MINT32 rHistoryReqMagic[HistorySize];
::memset(&rHistoryReqMagic, 0, sizeof(MINT32)*HistorySize);
MINT32 i4Ret = m_pResultPoolObj->getHistory(rHistoryReqMagic);
MINT32 MagicNum = i4ReqMagic;//////////////
......
// work around for worse performance
// if(i4ReqMagic-i4P1DoneSttNum >= 3 ) {
// for(int i=1; i<i4ReqMagic-i4P1DoneSttNum; i++) {
// m_pResultPoolObj->updateResult(LOG_TAG,i4ReqMagic+i,E_FLASH_RESULTTOMETA,pFLASHResult);
// MY_LOGD("[%s] i4ReqMagic(%d), i4P1DoneSttNum(%d), u1FlashState(%d)", __FUNCTION__, i4ReqMagic, i4P1DoneSttNum, pFLASHResult->u1FlashState);
//}
///}
+ if(MagicNum-i4P1DoneSttNum >= 3 && i4P1DoneSttNum >= 0){
+ for(int i=1; i<= MagicNum-i4ReqMagic; i++){
+ m_pResultPoolObj->updateResult(LOG_TAG,(i4ReqMagic+i),E_FLASH_RESULTTOMETA,pFLASHResult);
+ MY_LOGD("[%s] reqNum:%d ;u1FlashState:%d", __FUNCTION__, i4ReqMagic+i, pFLASHResult->u1FlashState);
+ }
+ }
3. 针对ISP6.0,因为存在CCU回写resultpool的原因,会导致handleBadPicture中resultpool中新写入的flashstate 没有在get函数中再次更新到metadata。
需要check :vendor/mediatek/proprietary/hardware/mtkcam/aaa/source/common/hal3a/v2.0/Hal3AAdapter3.cpp中的get函数是否有合入如下的code:
1 2 3 4 5 6 7 |
<span id="scope_id_263cafa3_fold" class="scope-body"><span class="c">// update FLASH_STATE for the case where convertToMetadata is done prior to flash result update.</span> <span class="c">// such as calling handleBadPicture when turning off flash at p1Done.</span> FLASHResultToMeta_T* <a class="xl" name="pFLASHResult"></a>pFLASHResult = (FLASHResultToMeta_T*)mpResultPoolObj->getResult(frmId,E_FLASH_RESULTTOMETA); <strong>if</strong>(pFLASHResult != NULL) { UPDATE_ENTRY_SINGLE(pMetaResult->rMetaResult.appMeta, MTK_FLASH_STATE, pFLASHResult->u1FlashState); }</span> |
4. 如果以上修改全部验证后,问题还是存在:
请在vendor/mediatek/proprietary/hardware/mtkcam/aaa/source/common/hal3a/v1.0/Hal3AAdapter3.cpp中get函数添加如下的log :
1 |
3385 MBOOL ret = QUERY_ENTRY_SINGLE(result.appMeta, MTK_CONTROL_CAPTURE_INTENT, u1CaptureIntent);
3386 QUERY_ENTRY_SINGLE(result.appMeta, MTK_CONTROL_AWB_STATE, u1AwbState);
3387 QUERY_ENTRY_SINGLE(result.appMeta, MTK_CONTROL_AE_STATE, u1AeState);
3388 QUERY_ENTRY_SINGLE(result.appMeta, MTK_FLASH_STATE, u1FlashState);
3389 QUERY_ENTRY_SINGLE(result.appMeta, MTK_CONTROL_AF_STATE, u1AfState);
MY_LOGW("[%s] frmId(%d), ret(%d), u1CaptureIntent(%d), count(%d, %d), AwbState(%d) AeState(%d) FlashState(%d) AfState(%d)", __FUNCTION__,
frmId, ret, u1CaptureIntent, result.appMeta.count(), result.halMeta.count(),
u1AwbState, u1AeState, u1FlashState, u1AfState);
3386 QUERY_ENTRY_SINGLE(result.appMeta, MTK_CONTROL_AWB_STATE, u1AwbState);
3387 QUERY_ENTRY_SINGLE(result.appMeta, MTK_CONTROL_AE_STATE, u1AeState);
3388 QUERY_ENTRY_SINGLE(result.appMeta, MTK_FLASH_STATE, u1FlashState);
3389 QUERY_ENTRY_SINGLE(result.appMeta, MTK_CONTROL_AF_STATE, u1AfState);
MY_LOGW("[%s] frmId(%d), ret(%d), u1CaptureIntent(%d), count(%d, %d), AwbState(%d) AeState(%d) FlashState(%d) AfState(%d)", __FUNCTION__,
frmId, ret, u1CaptureIntent, result.appMeta.count(), result.halMeta.count(),
u1AwbState, u1AeState, u1FlashState, u1AfState);
然后开启如下的log ,单跑该cts fail的测试项,上传MTKlog。
adb root
adb shell setenforce 0
adb shell setprop persist.vendor.mtk.camera.log_level 3
adb shell setprop vendor.debug.camera.log 3
adb shell setprop vendor.debug.hal3av3.log 263
adb shell setprop vendor.debug.3a.log 1
adb shell setprop vendor.debug.hal3a.task 1
adb shell setenforce 0
adb shell setprop persist.vendor.mtk.camera.log_level 3
adb shell setprop vendor.debug.camera.log 3
adb shell setprop vendor.debug.hal3av3.log 263
adb shell setprop vendor.debug.3a.log 1
adb shell setprop vendor.debug.hal3a.task 1
adb shell setprop vendor.debug.resultpool.log 1
adb shell setprop vendor.debug.camera.log.p1node 2
adb shell pkill cameraserver
adb shell pkill camerahalserver
adb shell pkill cameraserver
adb shell pkill camerahalserver