【Camera专题】Qcom-你应该掌握的Camera调试技巧2

系列文章
【Camera专题】Qcom-你应该掌握的Camera调试技巧1
【Camera专题】Qcom-你应该掌握的Camera调试技巧2

dump isp图像

Preview: adb shell setprop persist.vendor.camera.isp.dump 2
Analysis: adb shell setprop persist.vendor.camera.isp.dump 2048
Snapshot: adb shell setprop persist.vendor.camera.isp.dump 8
Video: adb shell setprop persist.vendor.camera.isp.dump 16

数量:
adb shell setprop persist.vendor.camera.isp.dump_cnt 20

0.APP端增加性能分析log

增加性能日志:Tag:[KPI_CAMERA]
日志打印:

  1. 打开摄像头:CAMERA_OPEN
  2. 第一帧回调:onFirstPreviewFrame
  3. 切换摄像头:SWITCH_CAMERA
  4. 拍照:TAKE_PICTURE
  5. 拍照完成:TAKE_PICTURE_FINISH
  6. 小视频开始录制:START_RECORD
  7. 小视频录制完成:RECORD_COMPLETE

1.dump YUV 数据(添加第三方算法时,dump数据)

//zcf
void dumpFile(void* frame,int w,int h,int size,int base_index)
{
    char buf[128];
    int res=0;
    snprintf(buf, sizeof(buf), "%s%d_%dx%d.yuv","/data/misc/camera/",base_index, w, h);
    int file_fd = open(buf,O_RDWR | O_CREAT,0777);
    if(file_fd == -1){ 
        LOGI("zcf open file failed file_fd=%d",file_fd);
    }    
    res = write(file_fd,frame,size);
    if(res !=size)
        LOGI("zcf dumpFile failed!res=%d",res);
    close(file_fd);
}
//

2.修改I2C速率

kernel/arch/arm/boot/dts/qcom/msm8909.dtsi

i2c_3: i2c@78b7000 { /* BLSP1 QUP3 */
···
- qcom,clk-freq-out = <100000>;
+ qcom,clk-freq-out = <400000>;//修改成400k
  qcom,clk-freq-in  = <19200000>;
  pinctrl-names = "i2c_active", "i2c_sleep";
···
}

3.修改I2C占空比

I2C资料:80-NU767-1,参考68-69页

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第1张图片

举个例子:
i2c速率(I2C_FS_CLK ):400k
I2C_CLK:24M
占空比改成:50%

I2C_FS_CLK = I2C_CLK/(fs_div+hs_div+6)
fs_div + hs_div = 24M/400k - 6 = 60-6=54
如果占空比为50%

fs_div=hs_div=54/2=27

kernel/arch/arm/boot/dts/qcom/msm8909.dtsi

i2c_3: i2c@78b7000 { /* BLSP1 QUP3 */
···
 qcom,clk-freq-out = <400000>;//修改成400k
 //snip
 qcom,fs-clk-div = <27>;
 qcom,high-time-clk-div = <27>;
···
}

I2C节点解释:
kernel/Documentation/devicetree/bindings/i2c/i2c-msm-v2.txt

qcom,high-time-clk-div : 
  high time divider value to configure clk-ctl register. 
  When missing, default to the value given in driver.
qcom,fs-clk-div: 
  fs divider value to configure clk-ctl register. 
  When missing, default to the value given in driver.

4.生成与合入patch

git diff > a.patch
patch -p1 < a.patch

5.新平台开启HAL的log

80  static module_debug_t cam_loginfo[(int)CAM_LAST_MODULE] = {
81    {CAM_GLBL_DBG_ERR, 1,
82        "",         "persist.vendor.camera.global.debug"     }, /* CAM_NO_MODULE     */
83    {CAM_GLBL_DBG_ERR, 1,
84        "", "persist.vendor.camera.mct.debug"        }, /* CAM_MCT_MODULE    */
85    {CAM_GLBL_DBG_ERR, 1,
86        "", "persist.vendor.camera.sensor.debug"     }, /* CAM_SENSOR_MODULE */
87    {CAM_GLBL_DBG_WARN, 1,
88        "", "persist.vendor.camera.iface.logs"       }, /* CAM_IFACE_MODULE  */
89    {CAM_GLBL_DBG_ERR, 1,
90        "", "persist.vendor.camera.isp.debug"        }, /* CAM_ISP_MODULE    */
91    {CAM_GLBL_DBG_ERR, 1,
92        "", "persist.vendor.camera.pproc.debug.mask" }, /* CAM_PPROC_MODULE  */
93    {CAM_GLBL_DBG_WARN, 1,
94        "", "persist.vendor.camera.imglib.logs"      }, /* CAM_IMGLIB_MODULE */
95    {CAM_GLBL_DBG_WARN, 1,
96        "", "persist.vendor.camera.cpp.debug.mask"   }, /* CAM_CPP_MODULE    */
97    {CAM_GLBL_DBG_ERR, 1,
98        "", "persist.vendor.camera.hal.debug"        }, /* CAM_HAL_MODULE    */
99    {CAM_GLBL_DBG_ERR, 1,
100        "", "persist.vendor.camera.mmstill.logs"     }, /* CAM_JPEG_MODULE   */
101    {CAM_GLBL_DBG_WARN, 1,
102        "", "persist.vendor.camera.c2d.debug.mask"   }, /* CAM_C2D_MODULE    */
103    {CAM_GLBL_DBG_ERR, 1,
104        "", "persist.vendor.camera.stats.debug" }, /* CAM_STATS_MODULE  */
105    {CAM_GLBL_DBG_ERR, 1,
106        "", "persist.vendor.camera.stats.af.debug"    }, /* CAM_STATS_AF_MODULE   */
107    {CAM_GLBL_DBG_ERR, 1,
108        "", "persist.vendor.camera.stats.aec.debug"  }, /* CAM_STATS_AEC_MODULE  */
109    {CAM_GLBL_DBG_ERR, 1,
110        "", "persist.vendor.camera.stats.awb.debug"  }, /* CAM_STATS_AWB_MODULE  */
111    {CAM_GLBL_DBG_ERR, 1,
112        "", "persist.vendor.camera.stats.asd.debug"  }, /* CAM_STATS_ASD_MODULE  */
113    {CAM_GLBL_DBG_ERR, 1,
114        "", "persist.vendor.camera.stats.afd.debug"  }, /* CAM_STATS_AFD_MODULE  */
115    {CAM_GLBL_DBG_ERR, 1,
116        "", "persist.vendor.camera.stats.q3a.debug"  }, /* CAM_STATS_Q3A_MODULE  */
117    {CAM_GLBL_DBG_ERR, 1,
118        "", "persist.vendor.camera.stats.is.debug"   }, /* CAM_STATS_IS_MODULE   */
119    {CAM_GLBL_DBG_ERR, 1,
120        "", "persist.vendor.camera.stats.haf.debug"  }, /* CAM_STATS_HAF_MODULE  */
121    {CAM_GLBL_DBG_ERR, 1,
122        "", "persist.vendor.camera.stats.cafscan"  }, /* CAM_STATS_CAFSCAN_MODULE  */
123    {CAM_GLBL_DBG_ERR, 1,
124        "", "persist.vendor.camera.shim.debug"          }, /* CAM_SHIM_LAYER    */
125
126  };


2575static module_debug_t cam_loginfo[(int)CAM_LAST_MODULE] = {
2576  {CAM_GLBL_DBG_ERR, 1,
2577      "",         "persist.vendor.camera.global.debug"     }, /* CAM_NO_MODULE     */
2578  {CAM_GLBL_DBG_ERR, 1,
2579      "", "persist.vendor.camera.hal.debug"        }, /* CAM_HAL_MODULE    */
2580  {CAM_GLBL_DBG_ERR, 1,
2581      "", "persist.vendor.camera.mci.debug"        }, /* CAM_MCI_MODULE    */
2582  {CAM_GLBL_DBG_ERR, 1,
2583      "", "persist.vendor.camera.mmstill.logs"     }, /* CAM_JPEG_MODULE   */
2584};

13966void QCamera3HardwareInterface::getLogLevel()
13967{
13968    char prop[PROPERTY_VALUE_MAX];
13969    uint32_t globalLogLevel = 0;
13970
13971    property_get("persist.vendor.camera.hal.debug", prop, "0");
13972    int val = atoi(prop);
13973    if (0 <= val) {
13974        gCamHal3LogLevel = (uint32_t)val;
13975    }
13976
13977    property_get("persist.vendor.camera.kpi.debug", prop, "0");
13978    gKpiDebugLevel = atoi(prop);
13979
13980    property_get("persist.vendor.camera.global.debug", prop, "0");
13981    val = atoi(prop);
13982    if (0 <= val) {
13983        globalLogLevel = (uint32_t)val;
13984    }
13985
13986    /* Highest log level among hal.logs and global.logs is selected */
13987    if (gCamHal3LogLevel < globalLogLevel)
13988        gCamHal3LogLevel = globalLogLevel;
13989
13990    return;
13991}

6.在系统中定义一个宏变量

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第2张图片

7.查看pdaf版本库 和关键log

查看pd lib库
adb shell setprop persist.vendor.camera.pdaf_logging 1
then reset device. version will be print out like "PDLib Version: Major: %d Minor: %d Revision: %d"

lib库和校准工具对应关系
PD_lib_version Calibration_Version
3.3 J
4.2 J,L3
4.4 J,L3
4.5 J,L3,L4
4.6 J,L3,L4
4.7 J,L3,L4
5.0 L3,L4
5.1 L3,L4
5.2 L3,L4
5.3 L3,L4

关键log

007569 02-22 05:54:51.576  3809  4611 D mm-camera: < HIGH> 3552: af_pdaf_proc_pd_single: roi(0) lens_pos=6 index=18, pd=16.00, defocus(um)=328, conf=1023, is_conf=TRUE, not_conf_cnt=0, is_stable=TRUE

注意,如果pdaf版本库在4.5-5.3之间,OV的sensor left map和right map 和高通是相反的
即:

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第3张图片

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第4张图片

8.op_pixel_clk 的计算公式

op_pixel_clk = (传感器总数据传输速率) / 每个像素的位数
op_pixel_clk = sensor_MIPI_speed*lanes/每个像素的位数

传感器总数据传输速率 = sensor_MIPI_speed*lanes

vt_pixel_clk= HTS(0x380c/0x380d)* VTS(0x380e/0x380f)*FPS
op_pixel_clk=sensor_MIPI_speed*lanes/bits-per-pixel

9.查看当前应用包名

adb shell dumpsys window | findstr mCurrentFocus

10.driver only版本抓取kernel log

adb shell dmesg > kernel.log

11.AF

1.对焦速度 af_haf_util_end_search

12.eis生效log

adb root
adb shell setprop persist.vendor.camera.stats.is.debug 5

关键log: eis2_process

13.骁龙相机安装失败

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第5张图片

经过odex 的apk ,这样apk 是不完整的。
相机 mk 里加上 LOCAL_DEX_PREOPT := false

14.查看平台效果库

module_sensor_load_chromatix_stream_on

Regarding the WNR parameter modification, please modify chromatix_ov16a1q_qtech_cpp_snapshot.h at snapshot mode and chromatix_ov16a1q_qtech_cpp_preview.h at preview mode separately to check the result.

QCamera :  pre_take_picture: 916: [KPI Perf]: X
mm-camera:  762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera:  762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera:  762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera:  762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera:  762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[0] = ov16a1q_qtech_snapshot
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[1] = ov16a1q_qtech_snapshot
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[2] = ov16a1q_qtech_common
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[3] = ov16a1q_qtech_cpp_preview
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[4] = ov16a1q_qtech_cpp_snapshot
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[5] = ov16a1q_qtech_cpp_snapshot
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[6] = ov16a1q_qtech_cpp_snapshot
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[7] = ov16a1q_qtech_cpp_us_chromatix
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[8] = ov16a1q_qtech_cpp_ds_chromatix
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[9] = ov16a1q_qtech_cpp_ds_chromatix
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[10] = ov16a1q_qtech_cpp_us_chromatix
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[11] = ov16a1q_qtech_cpp_video
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[12] = ov16a1q_qtech_postproc
mm-camera: < LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[13] = ov16a1q_qtech_zsl_preview_3a
QCamera :  take_picture: 1043: [KPI Perf]: X ret = 0
mm-camera:  762: sensor_pick_resolution: pick_res: 1,app_out(0,0),sensor_out(2304,1728)

15.AF roi

1.最终的 AF ROI 坐标和大小,如何从 log 中获取?
key word:

af_util_adjust_roi|af_util_update_def_roi_ratios|af_util_check_if_input_is_default_roi|af_util_get_roi_default|Low-light
mm-camera: < HIGH> 2590: af_util_adjust_roi: Input ROI - x: 0 y: 0 dx: 0 dy: 0 weight 0 pd enable
mm-camera: < HIGH> 2591: af_util_adjust_roi: CAMIF size: 3264 x 2448
mm-camera: < HIGH> 2594: af_util_adjust_roi: ROI adjustment 1 ROI_TYPE: 0
mm-camera: < LOW> 2628: af_util_adjust_roi: lighting_cond_chgd: 0 spot_light_flag: 0
mm-camera: < LOW> 2650: af_util_adjust_roi: roi_updated: 1 need_to_configure_filter: 0
mm-camera: < LOW> 2659: af_util_adjust_roi: ROI needs to be updated!
mm-camera: < HIGH> 2668: af_util_adjust_roi: Input Zoom factor: 1.666667
mm-camera: < LOW> 689: af_util_update_def_roi_ratios: Default ROI ratios:
mm-camera: < LOW> 2677: af_util_adjust_roi: ROI limit check failed. Using Center ROI!
mm-camera: < LOW> 1191: af_util_check_if_input_is_default_roi: CAMIF size: 3264x2448 FOV ctr: 1632x1224 ROI ctr: 1632x1224
mm-camera: < LOW> 1196: af_util_check_if_input_is_default_roi: Distance between two ctr: 0
mm-camera: < LOW> 2787: af_util_adjust_roi: Default ROI
mm-camera: < LOW> 2793: af_util_adjust_roi: zoom_ratio = 0.600000, mw_zoom_threshold = 0.000000
mm-camera: < LOW> 2798: af_util_adjust_roi: PD MW is disabled!
mm-camera: < HIGH> 2328: af_util_get_roi_default: Input Zoom factor: 1.666667
mm-camera: < LOW> 2380: af_util_get_roi_default: Default ROI type: -1 index: 0 x: 1088 y: 816 dx: 1088 dy: 816
mm-camera: < HIGH> 2880: af_util_adjust_roi: Calculated new ROI: (1088, 816, 1088 816)
mm-camera: < LOW> 2883: af_util_adjust_roi: Request ISP to configure new ROI

0.200000f, /* H Clip Ratio Normal Light /
0.200000f,/
V Clip Ratio Normal Light /
0.500000f,/
H Clip Ratio Lowlight /
0.500000f, /
V Clip Ratio Lowlight */

1、请问 Calculated new ROI 的大小是怎么计算的?
ctr_x = image_width / 2;
ctr_y = image_height / 2;
dx = image_width * h_ratio * zoom_factor;
dy = image_height * v_ratio * zoom_factor;
x = ctr_x < (roi_out->dx / 2) ? 0 : (ctr_x - (roi_out->dx / 2));
y = ctr_y < (roi_out->dy / 2) ? 0 : (ctr_y - (roi_out->dy / 2));
2、假设 CAF 默认以中心为 ROI,那么 APP 有接口可以修改 ROI 的位置吗?
As you can see from 1(formula), no parameters are passed to change this value.

16.dump OTP 数据

adb shell setprop persist.vendor.camera.cal.dump 1
数据路径:"/data/misc/camera/" 或者"/data/vendor/camera/"

17.dump h264编码前后数据

8909:

echo on
adb wait-for-device
adb root
adb remount

adb shell chmod 777 /data/misc/media
adb shell setenforce 0
adb shell setprop vidc.enc.log.in 1
adb shell setprop vidc.enc.log.out 1
pause

新:

echo on
adb wait-for-device
adb root
adb remount

adb shell chmod 777 /data/vendor/media
adb shell setenforce 0
adb shell setprop vendor.vidc.enc.log.in 1
adb shell setprop vendor.vidc.enc.log.out 1
pause

18.user root

adb root

19.确认dtsi文件

1.开机log里面搜索fdt
OF: fdt:Machine model: Qualcomm Technologies, Inc. SDM429 QRD Spyro DVT Overlay
2.搜索"Qualcomm Technologies, Inc. SDM429 QRD Spyro DVT Overlay"


=

3.打开kernel/msm-4.9/arch/arm64/boot/dts/qcom/sdm429-spyro-qrd-dvt-overlay.dts


【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第6张图片

4.打开sdm429-spyro-qrd-evt.dtsi
【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第7张图片
image.png

20.打印进程调用栈

adb shell debuggerd -b

21.固定帧率

persist.vendor.debug.set.fixedfps

22.抓log的骚姿势

adb logcat -c && adb logcat -G 256M && adb logcat -v threadtime -b main -b crash -b kernel 1 > log.txt

23.VFE clock的计算

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第8张图片

24.ae收敛帧数计算

aec_settle

25.ISO计算

ISO = (analog_gain*100)/ISO_100_gain。
效果参数中 ISO_100_gain =1


【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第9张图片

26.sprd增加一组支持的尺寸

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第10张图片

27.adb命令查看 camera 支持的尺寸

adb shell dumpsys media.camera

28.使能HAL3

adb shell setprop persist.vendor.camera.HAL3.enabled 1

29.如何调出系统原生相机

  • qcom:
    vendor/qcom/proprietary/common/config/device-vendor.mk
MM_CAMERA += SnapdragonCamera

adb uninstall org.codeaurora.snapcam
//高通骁龙相机位置
vendor/qcom/proprietary/common/config/device-vendor.mk
#MM_CAMERA += SnapdragonCamera
packages/apps/SnapdragonCamera/AndroidManifest.xml
android:targetSdkVersion="21"
  • sprd
diff --git a/build/target/product/generic_no_telephony.mk b/build/target/product/generic_no_telephony.mk
index adf8116..d2ad6b0 100755
--- a/build/target/product/generic_no_telephony.mk
+++ b/build/target/product/generic_no_telephony.mk

@@ -21,7 +21,6 @@ PRODUCT_POLICY := android.policy_phone
 
 PRODUCT_PACKAGES := \
     Bluetooth \
-    Camera2 \
     Exchange2 \
     FusedLocation \
     LatinIME \
@@ -45,6 +44,7 @@ PRODUCT_PACKAGES := \
 #InputDevices \
 #Keyguard \
 #Settings \
+#Camera2 \

30.mmm编译的一些小技巧

当我们用mmm编译时,可能找不到某些依赖,又不想又mmma编译。
比如:
mmm packages/apps/Camera2

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第11张图片

这里找不到littlemock_intermediates,我们可以去搜源码,找到littlemock
【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第12张图片

先编译
mmm external/littlemock/

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第13张图片

再编译 mmm packages/apps/Camera2

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第14张图片

31. wear设备属性

32.adb 拍照实现

adb shell input keyevent 27
//拍照键

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_CAMERA:
                // SPRD: Freeze display don't action the key_down event
                if(sFreezeFrameControl != null &&
                        sFreezeFrameControl.mFreezeVisible) {
                    return true;
                }
                if (mCameraState == SNAPSHOT_IN_PROGRESS || mIsTakingPicture) {
                    Log.e(TAG,"Press KEYCODE_CAMERA down,SNAPSHOT_IN_PROGRESS & isCountingDown, So Direct Return.");
                    return true;
                }
                if (mFirstTimeInitialized && event.getRepeatCount() == 0) {
                    onShutterButtonFocus(true);
                }
                return true;

}

33.查看展讯平台AE信息

关键字:alg_status
01-02 09:02:12.920 235 2894 D ae_lib : 2429, ae1_calculateEX: alg_status:146 stab: 0, status: 0, flicker: 0, fps: 1.07, effect-(s 34464(0.935698s), g 128, dmy 0), final to sensor: idx: 271, (3683(0.099993s), 0, 581), cur_lum: 133, bv:520, tar_lum [62, 66]

34.让push的so库生效

adb shell stop media
adb shell start media

adb shell stop cameraserver

adb shell kill -9 进程ID

35.API1 默认使用HAL1

frameworks/av/services/camera/libcameraservice/CameraService.cpp

    String8 id = String8::format("%d", cameraId);
    sp client = nullptr;
    ret = connectHelper(cameraClient, id,
--            CAMERA_HAL_API_VERSION_UNSPECIFIED, clientPackageName, clientUid, clientPid, API_1,
++            CAMERA_DEVICE_API_VERSION_1_0, clientPackageName, clientUid, clientPid, API_1,
            /*legacyMode*/ false, /*shimUpdateOnly*/ false,
            /*out*/client);

36.高通打印预览帧时间戳

hardware/qcom/camera/QCamera2/HAL/QCamera2HWICallbacks.cpp

void QCamera2HardwareInterface::synchronous_stream_cb_routine(···) {
  frameTime = nsecs_t(frame->ts.tv_sec) * 1000000000LL + frame->ts.tv_nsec;
  // Convert Boottime from camera to Monotime for display if needed.
  // Otherwise, mBootToMonoTimestampOffset value will be 0.
  frameTime = frameTime - pme->mBootToMonoTimestampOffset;

   // Enqueue  buffer to gralloc.
   uint32_t idx = frame->buf_idx;
   LOGD("%p Enqueue Buffer to display %d frame Time = %lld Display Time = %lld",
           pme, idx, frameTime, mPreviewTimestamp);
}

typedef int64_t nsecs_t;

36.kernel中一个模块调用另一个模块的方法

例如:
kernel/drivers/misc/sprd_camera/dcam/dcam_if_r4p0/dcam_ioctrl.
要在makefile中添加你要的调用的路径

【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第15张图片
image.png

37.SOF freeze

SOF freeze lead to ANR, please check whether it only happened on a certain resolution.

141910 11-06 16:13:42.368   535 11454 E mm-camera:  764: sensor_pick_resolution: pick_res: 3,app_out(544,480),sensor_out(1296,972)
141947 11-06 16:13:42.412   535  3420 I QCamera :  start_preview: 395: [KPI Perf]: X ret = 0
141960 11-06 16:13:44.912   535 11502 E mm-camera:  94: mct_bus_sof_thread_run: Session 1: Hinting SOF freeze to happen.          Sending event to dump info
141962 11-06 16:13:44.914   535 11507 E mm-camera:  57: server_debug_dump_data_for_sof_freeze: opendir clk fails
141966 11-06 16:13:47.412   535 11502 E mm-camera:  98: mct_bus_sof_thread_run: FATAL Session 1: SOF Freeze! Sending error message
141967 11-06 16:13:47.412   535 11455 E mm-camera:  817: mct_controller_send_cb: FATAL: Sending HW_Error
...
142604 11-06 16:14:05.132  1004  1159 E ActivityManager: ANR in com.xtc.camera.app"

38.sprd 通过寄存器控制dvdd供电

adb root
adb shell
读: lookat -l 1 0x40388D2C
写: lookat -s 0x00000081 0x40388D2C

dts中配置vddcamd-supply = <&vddcamd>;
在对应PMIC的dtsi文件中会有设置的默认电压
kernel/arch/arm/boot/dts/sc2721.dtsi
vddcamd: ldo@17 {
326                     reg = <17>;
327                     regulator-name = "vddcamd";
328                     sprd,default-microvolt = <1100000>;
329                     sprd,step-microvolt = <6250>;
330                     regulator-min-microvolt = <1000000>;
331                     regulator-max-microvolt = <1500000>;
332                     regulator-microvolt-offset = <0>;
333                     sprd,hide-offset = <1000>;
334                 };

其余地方在驱动中设置.dvdd_val = SENSOR_AVDD_1200MV  在power_on中控制 

39.HTS 和VTS

sensor的曝光,在内部寄存器是以曝光行为单位保存的;
hts:行长   可以理解为一行具有多少个pixel
vts:帧长   一帧曝光了多少行   
每行的时间:tline = hts/pclk,1/pclk即为扫描一个pixel所需的时间周期;
sensor会根据曝光量计算曝光时间expo和增益gain的乘积,然后选择一组最佳的expo和gain组合,expo根据tline转换为曝光行,配置给寄存器。
H_Blank:扫描从上一行的结束到下一行的开始的时间差;
V_Blank:扫描点扫描完一帧后,要从图像的右下角返回到图像的左上角,开始新一帧的扫描,这一时间间隔;

40.防抖算法关键key

frameworks/av/camera/CameraParameters.cpp

const char CameraParameters::KEY_VIDEO_STABILIZATION[] = "video-stabilization";
const char CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED[] = "video-stabilization-supported";

41 Android.mk定义字符串

VIDHANCE_CALIBRATION_FILE_PATH = /vendor/etc/camera/vidhance_calibration
LOCAL_CFLAGS += -DVIDHANCE_CALIBRATION_FILE_PATH=\"$(VIDHANCE_CALIBRATION_FILE_PATH)\"

42.手动对焦属性

adb shell setprop debug.camera.mf 2
adb shell setprop debug.camera.mf_pos 100

43.暂时不用某个变量

#define VAR_UNUSED(x) (void)(x)

44.Android.mk报错:missing and no known rule to make it

ninja: error: 'out/target/product/项目/obj/lib/lib某个库.so.toc', 
needed by 'out/target/product/项目/obj/SHARED_LIBRARIES/camera.msm8937_intermediates/LINKED/camera.msm8937.so', 
missing and no known rule to make it
LOCAL_PATH:=$(call my-dir)

include $(CLEAR_VARS)
$(info RK_ALOG_android.mk)
LOCAL_MODULE := libRkNightshot
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so 
LOCAL_MULTILIB := 32
LOCAL_SRC_FILES := lib/libRkNightshot.so
#LOCAL_MODULE_PATH   := $(PRODUCT_OUT)/vendor/lib
LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_PREBUILT)

原因:


【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第16张图片

so后面多了个空格,吐血了!!!
删掉空格后就ok了:


【Camera专题】Qcom-你应该掌握的Camera调试技巧2_第17张图片

继续当一名咸鱼(* ̄︶ ̄)!

Stay Hungry,Stay Foolish!

你可能感兴趣的:(【Camera专题】Qcom-你应该掌握的Camera调试技巧2)