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

2019-11-13  本文已影响0人  c枫_撸码的日子

系列文章
【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页

举个例子:
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        "<MCT   >", "persist.vendor.camera.mct.debug"        }, /* CAM_MCT_MODULE    */
85    {CAM_GLBL_DBG_ERR, 1,
86        "<SENSOR>", "persist.vendor.camera.sensor.debug"     }, /* CAM_SENSOR_MODULE */
87    {CAM_GLBL_DBG_WARN, 1,
88        "<IFACE >", "persist.vendor.camera.iface.logs"       }, /* CAM_IFACE_MODULE  */
89    {CAM_GLBL_DBG_ERR, 1,
90        "<ISP   >", "persist.vendor.camera.isp.debug"        }, /* CAM_ISP_MODULE    */
91    {CAM_GLBL_DBG_ERR, 1,
92        "<PPROC >", "persist.vendor.camera.pproc.debug.mask" }, /* CAM_PPROC_MODULE  */
93    {CAM_GLBL_DBG_WARN, 1,
94        "<IMGLIB>", "persist.vendor.camera.imglib.logs"      }, /* CAM_IMGLIB_MODULE */
95    {CAM_GLBL_DBG_WARN, 1,
96        "<CPP   >", "persist.vendor.camera.cpp.debug.mask"   }, /* CAM_CPP_MODULE    */
97    {CAM_GLBL_DBG_ERR, 1,
98        "<HAL   >", "persist.vendor.camera.hal.debug"        }, /* CAM_HAL_MODULE    */
99    {CAM_GLBL_DBG_ERR, 1,
100        "<JPEG  >", "persist.vendor.camera.mmstill.logs"     }, /* CAM_JPEG_MODULE   */
101    {CAM_GLBL_DBG_WARN, 1,
102        "<C2D   >", "persist.vendor.camera.c2d.debug.mask"   }, /* CAM_C2D_MODULE    */
103    {CAM_GLBL_DBG_ERR, 1,
104        "<STATS >", "persist.vendor.camera.stats.debug" }, /* CAM_STATS_MODULE  */
105    {CAM_GLBL_DBG_ERR, 1,
106        "<STATS_AF >", "persist.vendor.camera.stats.af.debug"    }, /* CAM_STATS_AF_MODULE   */
107    {CAM_GLBL_DBG_ERR, 1,
108        "<STATS_AEC >", "persist.vendor.camera.stats.aec.debug"  }, /* CAM_STATS_AEC_MODULE  */
109    {CAM_GLBL_DBG_ERR, 1,
110        "<STATS_AWB >", "persist.vendor.camera.stats.awb.debug"  }, /* CAM_STATS_AWB_MODULE  */
111    {CAM_GLBL_DBG_ERR, 1,
112        "<STATS_ASD >", "persist.vendor.camera.stats.asd.debug"  }, /* CAM_STATS_ASD_MODULE  */
113    {CAM_GLBL_DBG_ERR, 1,
114        "<STATS_AFD >", "persist.vendor.camera.stats.afd.debug"  }, /* CAM_STATS_AFD_MODULE  */
115    {CAM_GLBL_DBG_ERR, 1,
116        "<STATS_Q3A >", "persist.vendor.camera.stats.q3a.debug"  }, /* CAM_STATS_Q3A_MODULE  */
117    {CAM_GLBL_DBG_ERR, 1,
118        "<STATS_AIS >", "persist.vendor.camera.stats.is.debug"   }, /* CAM_STATS_IS_MODULE   */
119    {CAM_GLBL_DBG_ERR, 1,
120        "<STATS_HAF >", "persist.vendor.camera.stats.haf.debug"  }, /* CAM_STATS_HAF_MODULE  */
121    {CAM_GLBL_DBG_ERR, 1,
122        "<STATS_CAFSCAN >", "persist.vendor.camera.stats.cafscan"  }, /* CAM_STATS_CAFSCAN_MODULE  */
123    {CAM_GLBL_DBG_ERR, 1,
124        "<SHIM  >", "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      "<HAL>", "persist.vendor.camera.hal.debug"        }, /* CAM_HAL_MODULE    */
2580  {CAM_GLBL_DBG_ERR, 1,
2581      "<MCI>", "persist.vendor.camera.mci.debug"        }, /* CAM_MCI_MODULE    */
2582  {CAM_GLBL_DBG_ERR, 1,
2583      "<JPEG>", "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.在系统中定义一个宏变量

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: <STATS_HAF >< 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 和高通是相反的
即:

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.骁龙相机安装失败


经过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 : <HAL><INFO> pre_take_picture: 916: [KPI Perf]: X
mm-camera: <SENSOR><ERROR> 762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera: <SENSOR><ERROR> 762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera: <SENSOR><ERROR> 762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera: <SENSOR><ERROR> 762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera: <SENSOR><ERROR> 762: sensor_pick_resolution: pick_res: 0,app_out(4608,3456),sensor_out(4608,3456)
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[0] = ov16a1q_qtech_snapshot
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[1] = ov16a1q_qtech_snapshot
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[2] = ov16a1q_qtech_common
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[3] = ov16a1q_qtech_cpp_preview
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[4] = ov16a1q_qtech_cpp_snapshot
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[5] = ov16a1q_qtech_cpp_snapshot
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[6] = ov16a1q_qtech_cpp_snapshot
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[7] = ov16a1q_qtech_cpp_us_chromatix
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[8] = ov16a1q_qtech_cpp_ds_chromatix
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[9] = ov16a1q_qtech_cpp_ds_chromatix
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[10] = ov16a1q_qtech_cpp_us_chromatix
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[11] = ov16a1q_qtech_cpp_video
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[12] = ov16a1q_qtech_postproc
mm-camera: <SENSOR>< LOW> 3442: sensor_get_cur_chromatix_name: res_idx = 0 chromatix_lib_name[13] = ov16a1q_qtech_zsl_preview_3a
QCamera : <HAL><INFO> take_picture: 1043: [KPI Perf]: X ret = 0
mm-camera: <SENSOR><ERROR> 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: <STATS_AF >< HIGH> 2590: af_util_adjust_roi: Input ROI - x: 0 y: 0 dx: 0 dy: 0 weight 0 pd enable
mm-camera: <STATS_AF >< HIGH> 2591: af_util_adjust_roi: CAMIF size: 3264 x 2448
mm-camera: <STATS_AF >< HIGH> 2594: af_util_adjust_roi: ROI adjustment 1 ROI_TYPE: 0
mm-camera: <STATS_AF >< LOW> 2628: af_util_adjust_roi: lighting_cond_chgd: 0 spot_light_flag: 0
mm-camera: <STATS_AF >< LOW> 2650: af_util_adjust_roi: roi_updated: 1 need_to_configure_filter: 0
mm-camera: <STATS_AF >< LOW> 2659: af_util_adjust_roi: ROI needs to be updated!
mm-camera: <STATS_AF >< HIGH> 2668: af_util_adjust_roi: Input Zoom factor: 1.666667
mm-camera: <STATS_AF >< LOW> 689: af_util_update_def_roi_ratios: Default ROI ratios:
mm-camera: <STATS_AF >< LOW> 2677: af_util_adjust_roi: ROI limit check failed. Using Center ROI!
mm-camera: <STATS_AF >< LOW> 1191: af_util_check_if_input_is_default_roi: CAMIF size: 3264x2448 FOV ctr: 1632x1224 ROI ctr: 1632x1224
mm-camera: <STATS_AF >< LOW> 1196: af_util_check_if_input_is_default_roi: Distance between two ctr: 0
mm-camera: <STATS_AF >< LOW> 2787: af_util_adjust_roi: Default ROI
mm-camera: <STATS_AF >< LOW> 2793: af_util_adjust_roi: zoom_ratio = 0.600000, mw_zoom_threshold = 0.000000
mm-camera: <STATS_AF >< LOW> 2798: af_util_adjust_roi: PD MW is disabled!
mm-camera: <STATS_AF >< HIGH> 2328: af_util_get_roi_default: Input Zoom factor: 1.666667
mm-camera: <STATS_AF >< LOW> 2380: af_util_get_roi_default: Default ROI type: -1 index: 0 x: 1088 y: 816 dx: 1088 dy: 816
mm-camera: <STATS_AF >< HIGH> 2880: af_util_adjust_roi: Calculated new ROI: (1088, 816, 1088 816)
mm-camera: <STATS_AF >< 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



4.打开sdm429-spyro-qrd-evt.dtsi
image.png

20.打印进程调用栈

adb shell debuggerd -b <camera process PID>

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的计算

24.ae收敛帧数计算

aec_settle

25.ISO计算

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


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

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

adb shell dumpsys media.camera

28.使能HAL3

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

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

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"
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


这里找不到littlemock_intermediates,我们可以去搜源码,找到littlemock

先编译
mmm external/littlemock/

再编译 mmm packages/apps/Camera2

31. wear设备属性

<uses-feature android:name="android.hardware.type.watch" />

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> client = nullptr;
    ret = connectHelper<ICameraClient,Client>(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中添加你要的调用的路径

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: <SENSOR><ERROR> 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 : <HAL><INFO> start_preview: 395: [KPI Perf]: X ret = 0
141960 11-06 16:13:44.912   535 11502 E mm-camera: <MCT   ><ERROR> 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: <MCT   ><ERROR> 57: server_debug_dump_data_for_sof_freeze: opendir clk fails
141966 11-06 16:13:47.412   535 11502 E mm-camera: <MCT   ><ERROR> 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: <MCT   ><ERROR> 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:扫描点扫描完一帧后,要从图像的右下角返回到图像的左上角,开始新一帧的扫描,这一时间间隔;

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

Stay Hungry,Stay Foolish!

上一篇下一篇

猜你喜欢

热点阅读