Camera 开发常用的调试笔记

7806aa2967e48a6f43295afc034884b6.gif

和你一起终身学习,这里是程序员Android

经典好文推荐,通过阅读本文,您将收获以下知识点

1. camx trace 基本log开关

camx trace log

adb wait-for-device
adb root
adb remount
::log tag CSL HAL Sensor CHI
adb shell setprop persist.vendor.camera.logInfoMask 0x40482
adb shell setprop persist.vendor.camera.logVerboseMask 0x40482
::trace tag 
adb shell setprop persist.vendor.camera.traceGroupsEnable 0x40482
pause

手机抓取并pull trace

adb wait-for-device
adb root
adb remount
adb pull /data/local/traces/ .
pause

2. Camx log

  1. /vendor/etc/camera/camxoverridesettings.txt
    设置完需要重启后才可以生效
  2. adb shell setprop <key> <value>
NameDefault ValueSetprop
logVerboseMaskVerbose log mask.Default: 0persist.vendor.camera.logVerboseMask
logEntryExitMaskEntry/exit log mask.Default: 0persist.vendor.camera.logEntryExitMask
logInfoMaskLog mask information.Default: 0xFFFFFFFFpersist.vendor.camera.logInfoMask
logWarningMaskWarning log mask.Default: 0xFFFFFFFFpersist.vendor.camera.logWarningMask
systemLogEnableEnables the system log.Default: TRUEpersist.vendor.camera.systemLogEnable

Camx UMD Log Group 举例如下:

typedef UINT32 CamxLogGroup;
static const CamxLogGroup CamxLogGroupNone          = (1 << 0);     /0x1        //< Generic group   
static const CamxLogGroup CamxLogGroupSensor        = (1 << 1);     /0x2        //< Sensor
static const CamxLogGroup CamxLogGroupIFace         = (1 << 2);     /0x4        //< IFace
static const CamxLogGroup CamxLogGroupISP           = (1 << 3);     /0x8        //< ISP
static const CamxLogGroup CamxLogGroupPProc         = (1 << 4);     /0x10       //< Post Processor
static const CamxLogGroup CamxLogGroupImgLib        = (1 << 5);     /0x20       //< Image Lib
static const CamxLogGroup CamxLogGroupCPP           = (1 << 6);     /0x40       //< CPP
static const CamxLogGroup CamxLogGroupHAL           = (1 << 7);     /0x80       //< HAL
static const CamxLogGroup CamxLogGroupJPEG          = (1 << 8);     /0x100      //< JPEG
static const CamxLogGroup CamxLogGroupStats         = (1 << 9);     /0x200      //< Stats
static const CamxLogGroup CamxLogGroupCSL           = (1 << 10);    /0x400      //< CSL
static const CamxLogGroup CamxLogGroupApp           = (1 << 11);    /0x800      //< Application
static const CamxLogGroup CamxLogGroupUtils         = (1 << 12);    /0x1000     //< Utilities
static const CamxLogGroup CamxLogGroupSync          = (1 << 13);    /0x2000     //< Sync
static const CamxLogGroup CamxLogGroupMemSpy        = (1 << 14);    /0x4000     //< MemSpy
static const CamxLogGroup CamxLogGroupAssert        = (1 << 15);    /0x8000     //< Asserts
static const CamxLogGroup CamxLogGroupCore          = (1 << 16);    /0x10000    //< Core
static const CamxLogGroup CamxLogGroupHWL           = (1 << 17);    /0x20000    //< HWL
static const CamxLogGroup CamxLogGroupChi           = (1 << 18);    /0x40000    //< CHI
static const CamxLogGroup CamxLogGroupDRQ           = (1 << 19);    /0x80000    //< DRQ
static const CamxLogGroup CamxLogGroupFD            = (1 << 20);    /0x100000   //< FD
static const CamxLogGroup CamxLogGroupIQMod         = (1 << 21);    /0x200000   //< IQ module
static const CamxLogGroup CamxLogGroupLRME          = (1 << 22);    /0x400000   //< LRME
static const CamxLogGroup CamxLogGroupNCS           = (1 << 23);    /0x800000   //< NCS
static const CamxLogGroup CamxLogGroupMeta          = (1 << 24);    /0x1000000  //< Metadata
static const CamxLogGroup CamxLogGroupAEC           = (1 << 25);    /0x2000000  //< AEC
static const CamxLogGroup CamxLogGroupAWB           = (1 << 26);    /0x4000000  //< AWB
static const CamxLogGroup CamxLogGroupAF            = (1 << 27);    /0x8000000  //< AF

如果打开不同group 的log,那么修改对应的值即可。
比如:
单独打开 CSL HAL Sensor CHI 三组Info Log Mask

CHI       CSL  HAL  Sensor  
 0    0    0    4    0    4    8    2  =0x40482
0000 0000 0000 0100 0000 0100 1000 0010

logInfoMask=0x00040482
logWarningMask=0x40482
此时log mask 可以使用上面两种,注意,前面的0可以省略,后面的0不可以省略。

比如:
打开所有的 Verbose Log Mask
0xFFFFFFFF 打开所有的log
logVerboseMask=0xFFFFFFFF

3. kill Camera HAL Camera FWK 脚本

adb wait-for-device
adb root
adb remount
adb shell ps | findstr camera

for /f "delims=" %%i in ('adb shell pidof android.hardware.camera.provider@2.4-service_64') do (set CameraHalProcess=%%i)
adb shell kill %CameraHalProcess%

for /f "delims=" %%i in ('adb shell pidof cameraserver') do (set CameraServerProcess=%%i)
adb shell kill %CameraServerProcess%

adb shell ps | findstr camera

pause

5. Offline log开关

设置log开关

// Camx log 
 adb shell "echo overrideLogLevels=0xFF >  /vendor/etc/camera/camxoverridesettings.txt"
 adb shell "echo logVerboseMask=0x100>>  /vendor/etc/camera/camxoverridesettings.txt"
 adb shell "echo logInfoMask=0x10198>>  /vendor/etc/camera/camxoverridesettings.txt"
 // 允许adb  获取camx chi log
 adb shell echo “systemLogEnable=TRUE >> /vendor/etc/camera/camxoverridesettings.txt”
 //离线log
adb shell " echo enableAsciiLogging=1 >>  /vendor/etc/camera/camxoverridesettings.txt "
// 删除之前保存的log
adb shell rm /data/vendor/camera/*.txt

pull && merge log

// 导出log
adb pull /data/vendor/camera .
//merge log
python merge_text_logs.py -o merge_locat.txt -d “path_of_the_log”

python merge_text_logs.py 脚本目录:
chi-cdk\tools\binary_log\merge_text_logs.py

6. Disable All log

//logD logcat
adb shell stop logd 
adb shell stop logcat 
 //camx 
logVerboseMask=0x00000 
logInfoMask=0x00000
logEntryExitMask=0x00000  
//trace
traceGroupsEnable=0x00000 
//camx chi adb  log 
systemLogEnable=FALSE 
adb shell "echo 0x0> /sys/module/cam_debug_util/parameters/debug_mdl"

7. odex 抽取

  • odex 抽取目的:

通过命令在后台抽取 apk 内部压缩的odex 方法。
类似windows 的解压缩包,避免解压过程影响app调用。
主要是为了避免测试机刚刷机后odex在后台抽取,而对比机已使用很久,odex 已后台完成 ,排除测试机、对比机后台差异带来的影响,测试机,对比机可以都执行这个命令。

  • odex trace查看:

trace 中可以查看Jit thread pool 是否在不停的占用CPU 资源进行后台odex抽取。

::odex 抽取
adb shell cmd package bg-dexopt-job
::查看app 抽取后是否是speed 模式
adb shell dumpsys package com.android.camera|adb shell grep "reason="
  • 确认 app speedmode
C:\Users\>adb shell dumpsys package com.android.camera|adb shell grep "reason="
     arm64: [status=speed-profile] [reason=start-app] [primary-abi]
C:\Users\>

7. Top 进程前30

adb shell top -b -m 30

8. ISO Range ,Max Gain

adb shell "dumpsys media.camera |grep  'android.sensor.info.sensitivityRange|android.sensor.maxAnalogSensitivity| static information' -iE  -A 1"

举例如下:

C:\Users\>adb shell "dumpsys media.camera |grep  'android.sensor.info.sensitivityRange|android.sensor.maxAnalogSensitivity| static information' -iE  -A 1"
== Camera HAL device device@3.7/legacy/0 (v3.7) static information: ==
  Resource cost: 33
--
      android.sensor.info.sensitivityRange (f0001): int32[2]
        [100 6400 ]
--
      android.sensor.maxAnalogSensitivity (e000d): int32[1]
        [6400 ]
--
== Camera HAL device device@3.7/legacy/1 (v3.7) static information: ==
  Resource cost: 33
--
      android.sensor.info.sensitivityRange (f0001): int32[2]
        [100 1600 ]
--
      android.sensor.maxAnalogSensitivity (e000d): int32[1]
        [1600 ]
--
== Camera HAL device device@3.7/legacy/2 (v3.7) static information: ==
  Resource cost: 33
--
      android.sensor.info.sensitivityRange (f0001): int32[2]
        [100 1550 ]
--
      android.sensor.maxAnalogSensitivity (e000d): int32[1]
        [1550 ]

C:\Users\>

9. pidof 获取进程 pid 方法

adb wait-for-device
adb root
adb remount

echo meminfo cameraprovider 
for /f "delims=" %%i in ('adb shell pidof android.hardware.camera.provider@2.4-service_64') do (set pidnum=%%i)
echo %pidnum%
adb shell ps | findstr camera
adb shell dumpsys meminfo %pidnum%  

pause

11. repo && Git 命令

放弃本地所有修改

repo forall -vc "git reset --hard"

repo 初始化

repo init

repo 更新代码

repo sync -c

12. 内存相关命令

dumpsys 10次 app 预览 meminfo

::@echo off
adb wait-for-device
adb root
adb remount
:: dump 10 次 camera app 内存
for /L %%i in (1,1,10) do (

adb shell am start -n com.android.camera/.Camera
timeout /T 10
echo  -------------------dumpsys camera app memmory  %%i ---------------- >>  %cd%\meminfo_camera_app.txt
adb  shell  dumpsys meminfo  -p com.android.camera  >>  %cd%\meminfo_camera_app.txt
:: 返回桌面
adb shell input keyevent 3
timeout /T 5

)
pause

13. 拍照脚本

::@echo off
adb wait-for-device
adb root
adb remount
:: 10 次拍照
for /L %%i in (1,1,2) do (

adb shell am start -n com.android.camera/.Camera
timeout /T 20
adb shell input keyevent 27
timeout /T 10
:: 返回桌面
adb shell input keyevent 3
timeout /T 5

)

pause

14. 跳过开机向导的方法

adb wait-for-device
adb root
adb remount
adb shell settings put global device_provisioned 1
adb shell settings put secure user_setup_complete 1
adb reboot

15. Qcom Dump RAW 图 YUV图方法

log开关

camxoverridesettings.txt 打开如下开关后,重启复现问题

autoimageDump = TRUE
autoimageDumpMask=0x2
autoinputimageDumpMask=0x2
dumpinputatOutput=TRUE

RAW YUV 图保存位置

使用adb 命令将保存的RAW 图以及YUV 图 pull 出来,注意复现问题尽量时间短一点,不然会保存大量的图

/data/vendor/camera

16 . Android 常用编译方法

1.frameworks/av/camera/目录:

make cameraserver -j32

cameraserver目录下:编译module是 ---> make cameraserver -j32

ndk目录下:编译module是 ---> make libcamera2ndk -j32

2.frameworks/av/services/camera/目录:

make libcameraservice -j32

libcameraservice目录下:编译module是 ---> make libcameraservice -j32

编译生成的文件是:out/target/product/lavender/system/lib/libcameraservice.so

3.基础编译 mm mmm

执行source ./build/envsetup.sh
lunch 对应的项目
然后就可以执行 模块 的mm 编译

4.vendorimage.img 镜像编译

make vendorimage

17. CPU

1. 获取 CPU 最小、最大频率、当前频率、在线状态

C:\Users\ >adb shell cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq
2000000
2000000
2000000
2000000
2000000
2000000
2400000
2400000

C:\Users\ >adb shell cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_min_freq
650000
650000
650000
650000
650000
650000
700000
700000

C:\Users\ > adb shell cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
650000
650000
650000
650000
650000
650000
1400000
1400000

C:\Users\ >adb shell cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
1900800
1900800
1900800
1900800
2208000
2208000
2208000
2208000

C:\Users\ >adb shell cat /sys/devices/system/cpu/cpu*/online
1
1
1
1
1
1
1
1
C:\Users\>adb shell cat /sys/devices/system/cpu/cpu*/hotplug/state
232
232
232
232
232
232
232
232
C:\Users\>adb shell cat /sys/devices/system/cpu/hotplug/states
  0: offline
  1: threads:prepare
  2: perf:prepare
 11: slub:dead
 13: mm/writeback:dead
 14: mm/demotion:offline
 15: mm/vmstat:dead
... ...
227: sched:active
232: online

C:\Users\>

2. 设置CPU 性能模式

C:\Users\ >adb shell "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

C:\Users\ >adb shell cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
performance
performance
performance
performance
sugov_ext
sugov_ext

C:\Users\ >adb shell "echo performance > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor"

C:\Users\ >adb shell cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
performance
performance
performance
performance
performance
performance

//Qcom
C:\Users >adb shell "echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor"

C:\Users\ >adb shell "echo performance > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor"

C:\Users\ >adb shell cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
performance
performance
performance
performance
performance
performance

3. 每隔1s 查看当前CPU频率

D:\heapprofile>adb shell "while true; do cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq ; sleep 1;echo ------------; done;"

1804800
1804800
1804800
1804800
691200
691200
691200
691200
------------
1804800
1804800
1804800
1804800
691200
691200
691200
691200
^C
D:\heapprofile>

18.GPU

19. sentest

MTK 查看手机sensor list

test:/ # sentest
[main]sizeof long : 8

[show_Sensors]sensorNum 4
[show_Sensors]name: S5KJN1  type:0
[show_Sensors]index:0, SensorDevIdx:1
[show_Sensors]name: GC13A0  type:0
... ...
[main]Param: 1 <sensorDev> <scenario> <fps>
[main]<sensorDev> : main(1), Sub(2), Main2(4), sub2(8), Main3(16)
[main]<scenario>  : Pre(0), Cap(1), VD(2), slim1(3), slim2(4)

20. 如何确认是预览流还是拍照流

1. 预览流常见的格式:

35, HAL_PIXEL_FORMAT_YCbCr_420_888

08-13 16:35:00.372  1492  2611 D CamX    : [MOTO ][HAL    ] camxhal3.cpp:2175 configure_streams()             format       : 35, HAL_PIXEL_FORMAT_YCbCr_420_888
08-13 16:35:00.372  1492  2611 D CamX    : [MOTO ][HAL    ] camxhal3.cpp:2177 configure_streams()             width        : 1440
08-13 16:35:00.372  1492  2611 D CamX    : [MOTO ][HAL    ] camxhal3.cpp:2179 configure_streams()             height       : 1080

2. 拍照流常见的格式:

33, HAL_PIXEL_FORMAT_BLOB

08-13 16:35:00.372  1492  2611 D CamX    : [MOTO ][HAL    ] camxhal3.cpp:2175 configure_streams()             format       : 33, HAL_PIXEL_FORMAT_BLOB
08-13 16:35:00.372  1492  2611 D CamX    : [MOTO ][HAL    ] camxhal3.cpp:2177 configure_streams()             width        : 4096
08-13 16:35:00.372  1492  2611 D CamX    : [MOTO ][HAL    ] camxhal3.cpp:2179 configure_streams()             height       : 3072

21.Cam_isp TFE PP_overflow

1. Cam_isp TFE PP_overflow log

08-18 20:31:35.254  7679  7679 I CAM_INFO: CAM-SENSOR: cam_sensor_driver_cmd: 1423 20:31:35.222 CAM_START_DEV Success for  S5kjn1 sensor_id:0x847,sensor_slave_addr:0x20
08-18 20:31:35.254  7679  7679 I CAM_INFO: CAM-FLASH: cam_flash_driver_cmd: 205 CAM_START_DEV for dev_hdl: 0x680108
 
08-18 20:31:35.415     0     0 I [    C1] CAM_INFO: CAM-ISP: __cam_isp_ctx_sof_in_epoch: 3112 First SOF in EPCR ctx:2 frame_id:1 next substate EPOCH
08-18 20:31:36.381     0     0 I [    C1] CAM_ERR: CAM-ISP: cam_tfe_irq_err_top_half: 797 Encountered Error: tfe:2: Irq_status0=0x30000 status2=0x0
08-18 20:31:36.381     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3868 CSID 2 irq status TOP: 0x0 RX: 0x1000033 IPP: 0x129ff8
08-18 20:31:36.381     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3874 RDI0: 0x129ff8 RDI1: 0x0 RDI2: 0x0 CSID clk:192600016
08-18 20:31:36.381     0     0 I [    C1] CAM_ERR: CAM-ISP: cam_tfe_irq_err_top_half: 800 Encountered Error: tfe:2:BUS Irq_status0=0x0
08-18 20:31:36.381     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_evt_bottom_half_handler: 3342 CSID 2 err 1 phy 1 irq status TOP: 0x0 RX: 0x1000033 IPP: 0x129ff8 RDI0: 0x129ff8 RDI1: 0x0 RDI2: 0x0
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 333 current monotonic time stamp seconds 622:429851
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 343 ERROR time 622:429825 SOF 622:389520 EPOCH 622:365018 EOF 622:380642
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 347 TOP IRQ[0]:0x30000 IRQ[1]:0xc8 IRQ[2]:0x0
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [0]:0x0
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [1]:0x11111111
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [2]:0x11115511
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [3]:0x11551111
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [4]:0x11111111
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [5]:0x51111111
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [6]:0x11111555
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [7]:0x1111
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [8]:0x0
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 352 Top debug [9]:0x2
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_hw_dump_camnoc_buff_fill_info: 543 CAMNOC Fill level [Queued Pending]  TFE_BAYER:[2 6] TFE_RDI_RAW:[2 11]
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 372 Top perf cnt [0] pix:0x79ec00 line:0x990 stall:0x0 always:0xce1d04
08-18 20:31:36.381     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 372 Top perf cnt [1] pix:0x0 line:0x0 stall:0x0 always:0x0
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_tfe_in_debug_status: 261 camif debug1:0xa35a0008 Height:0x990, width:0xcc0
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_tfe_in_debug_status: 266 Acquired sync mode:0 left start pxl:0x0 end_pixel:0xcbf
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_tfe_in_debug_status: 278 Acquired line start:0x0 line end:0x98f
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_tfe_in_debug_status: 281 vbi_value:0x0 hbi_value:0x0
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_tfe_in_debug_status: 297 RDI res id:1 debug1:0xb5a0008 Height:0x990, width:0xff
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_tfe_in_debug_status: 302 sync mode:0 left start pxl:0x0 end_pixel:0xcbf
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_tfe_in_debug_status: 307 sync mode:0 line start:0x0 line end:0x98f
////-------------  PP_OVERFLOW
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 404 PP_OVERFLOW
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 407 RDI0_OVERFLOW
////-----
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_bus_error_bottom_half: 1899 BUS IRQ[0]:0x0 BUS IRQ[1]:0x0
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_bus_error_bottom_half: 1915 ccif violation status:0x0 image size violation:0x0 overflow status:0x0
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-ISP: cam_tfe_log_error_irq_status: 447 TFE clock rate:432000000 TFE total bw applied:423464520
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_log_vote: 2220 i=0, FE[offset=0x4, value=0x52970066] BE[offset=0x800, value=0x66066]
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_log_vote: 2220 i=4, FE[offset=0x14, value=0x484f0022] BE[offset=0x810, value=0x22022]
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_log_vote: 2232 [cam_hf_0] ab_bw[423464520] ib_bw[423464520] additional_bw[3072] applied_ab[423464520] applied_ib[423464520]
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_log_vote: 2232 [cam_sf_0] ab_bw[57230895] ib_bw[57230895] additional_bw[3072] applied_ab[57230895] applied_ib[0]
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_log_vote: 2232 [cam_sf_icp] ab_bw[40000000] ib_bw[40000000] additional_bw[3072] applied_ab[40000000] applied_ib[0]
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_log_vote: 2237 applied camnoc axi clk[93750000]
08-18 20:31:36.382     0     0 I [    C1] CAM_INFO: CAM-CPAS: cam_cpas_log_vote: 2252 ahb client curr vote level[3]
08-18 20:31:36.386     0     0 I [    C1] CAM_ERR: CAM-ISP: __cam_isp_ctx_notify_error_util: 765 Notify CRM about fatal error: 2 req: 23 frame: 24 in ctx: 2 on link: 0xb50309
08-18 20:31:36.390  1726  1726 I CAM_ERR : CAM-MEM: cam_mem_put_cpu_buf: 1509 Unbalanced release Called buf_handle: 10092686, idx: 142
08-18 20:31:36.390  1726  1726 I CAM_INFO: CAM-REQ: cam_req_mgr_dump_request: 4705 req 23, offset 0
08-18 20:31:36.394   266   266 I CAM_INFO: CAM-CRM: cam_req_mgr_process_flush_req: 2721 Last request id to flush is 27
08-18 20:31:36.394   266   266 I CAM_INFO: CAM-ISP: __cam_isp_ctx_flush_req_in_top_state: 4862 Last request id to flush is 27, ctx_id:2
08-18 20:31:36.394   266   266 I CAM_INFO: CAM-ISP: __cam_isp_ctx_flush_req_in_top_state: 4878 Stop HW complete. Reset HW next.
08-18 20:31:36.394     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3868 CSID 2 irq status TOP: 0x0 RX: 0x33 IPP: 0xcc2
08-18 20:31:36.394     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3874 RDI0: 0xcc0 RDI1: 0x0 RDI2: 0x0 CSID clk:192600016
08-18 20:31:36.394     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3868 CSID 2 irq status TOP: 0x0 RX: 0x33 IPP: 0xc00
08-18 20:31:36.394     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3874 RDI0: 0xc02 RDI1: 0x0 RDI2: 0x0 CSID clk:192600016
08-18 20:31:36.394     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_evt_bottom_half_handler: 3342 CSID 2 err 1 phy 1 irq status TOP: 0x0 RX: 0x33 IPP: 0xcc2 RDI0: 0xcc0 RDI1: 0x0 RDI2: 0x0
08-18 20:31:36.394     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_evt_bottom_half_handler: 3342 CSID 2 err 1 phy 1 irq status TOP: 0x0 RX: 0x33 IPP: 0xc00 RDI0: 0xc02 RDI1: 0x0 RDI2: 0x0
08-18 20:31:36.400   266   266 I CAM_INFO: CAM-CRM: cam_req_mgr_process_flush_req: 2721 Last request id to flush is 27
08-18 20:31:36.400   266   266 I CAM_INFO: CAM-CRM: cam_req_mgr_process_flush_req: 2721 Last request id to flush is 27
08-18 20:31:36.402     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3868 CSID 2 irq status TOP: 0x1 RX: 0x0 IPP: 0x0
08-18 20:31:36.402     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_irq: 3874 RDI0: 0x0 RDI1: 0x0 RDI2: 0x0 CSID clk:192600016
08-18 20:31:36.402     0     0 I [    C2] CAM_ERR: CAM-ISP: cam_tfe_csid_evt_bottom_half_handler: 3342 CSID 2 err 1 phy 1 irq status TOP: 0x1 RX: 0x0 IPP: 0x0 RDI0: 0x0 RDI1: 0x0 RDI2: 0x0
08-18 20:31:36.406  7655  7655 I CAM_INFO: CAM-SENSOR: cam_sensor_driver_cmd: 1459 20:31:36.375 CAM_STOP_DEV Success for S5kjn1 sensor_id:0x847,sensor_slave_addr:0x20
08-18 20:31:36.407  7655  7655 I CAM_INFO: CAM-CSIPHY: cam_csiphy_core_cfg: 2160 CAM_STOP_PHYDEV: 0, Type: DPHY, slot: 0, Datarate: 1440000000, Settletime: 3400000000
08-18 20:31:36.407  7655  7655 I CAM_INFO: CAM-FLASH: cam_flash_driver_cmd: 221 CAM_STOP_DEV ENTER for dev_hdl: 0x680108

2.Cam_isp TFE PP_overflow 建议脚本

提高带宽 + clock 频率

adb wait-for-device
adb root
adb remount
adb shell touch /vendor/etc/camera/camxoverridesettings.txt
adb shell "echo tfeClockFrequencyMHz=0xFFFFFFFF > /vendor/etc/camera/camxoverridesettings.txt
adb shell "echo csidClockFrequencyMHz=0xFFFFFFFF >> /vendor/etc/camera/camxoverridesettings.txt
adb shell "echo tfeCamnocBandwidthMBytes=0xFFFFFFFF >> /vendor/etc/camera/camxoverridesettings.txt
adb shell "echo tfeExternalBandwidthMBytes=0xFFFFFFFF >> /vendor/etc/camera/camxoverridesettings.txt
adb shell cat   /vendor/etc/camera/camxoverridesettings.txt
pause

22. CCI

I2C串行总线一般有两根信号线,一根是双向的数据线SDA,另一根是时钟线SCL。所有接到I2C总线设备上的串行数据SDA都接到总线的SDA上,各设备的时钟线SCL接到总线的SCL上

IIC :Inter-Integrated Circuit 内部集成电路
SCL:"Serial Clock Line 时钟线
SDA:Serial Data Line 双向的数据线

CCI 通信异常

1. CCI 通信异常log

08-12 22:42:15.308  2765  2765 I CAM_INFO: CAM-SENSOR: cam_sensor_driver_cmd: 1297 CAM_ACQUIRE_DEV Success for s5kjn1 sensor_id:0x3109,sensor_slave_addr:0x20
08-12 22:42:15.308     0     0 I [    C1] CAM_ERR: CAM-CCI: cam_cci_irq: 294 Base:0000000000000000,cci: 0, M0_Q0 NACK ERROR: 0x8000000
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 229 **** CCI0_I2C_M0_Q0 register dump ****
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 232 **** CCI TOP Registers ****
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 237 offset = 0x0 value = 0x10070000
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 237 offset = 0x4 value = 0x1
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 237 offset = 0x8 value = 0x1
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 237 offset = 0xC value = 0x0
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 237 offset = 0x10 value = 0x0
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 237 offset = 0x14 value = 0x0
... ...
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 270 offset = 0xC04 value = 0x7FFF7FF7
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 270 offset = 0xC08 value = 0x8000000
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 270 offset = 0xC0C value = 0x0
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 270 offset = 0xC10 value = 0x110000
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 270 offset = 0xC14 value = 0x0
08-12 22:42:15.308     0     0 I [    C1] CAM_INFO: CAM-CCI: cam_cci_dump_registers: 270 offset = 0xC18 value = 0x0
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-CCI: cam_cci_wait: 306 CCI0_I2C_M0_Q 0s in error state
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-CCI: cam_cci_transfer_end: 394 CCI0_I2C_M0_Q0 Failed for wait_report_cmd for rc: -22
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-CCI: cam_cci_data_queue: 999 CCI0_I2C_M0_Q0 Slave: 0x20 failed rc -22
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-CCI: cam_cci_i2c_write: 1554 CCI0_I2C_M0_Q0 Failed in queueing the data for rc: -22
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-SENSOR: cam_cci_i2c_write_table_cmd: 123 Failed rc = -22
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-SENSOR: cam_sensor_i2c_modes_util: 435 Failed to random write I2C settings: -22
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-SENSOR: cam_sensor_apply_settings: 1899 Failed to apply settings: -22
// init  settings  写失败
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-SENSOR: cam_sensor_driver_cmd: 1494 s5kjn1: cannot apply init settings rc= -22
08-12 22:42:15.308  2765  2765 I CAM_ERR : CAM-SENSOR: cam_sensor_subdev_ioctl: 56 Failed in Driver cmd: -22

2. 修改建议

降低CCI 频率,power up,power down 添加delay延迟

23 Session dump(Stuck on)

Camera 卡住的时候会触发session dump, Session Dump 主要包含信息

  1. session
  2. pipeline
  3. node
  4. DRQ

Session Dump 主要分4类
1 连续丢帧
2 Node 主动触发Session Dump
3 Flush 异常
4 KMD 异常

1. 连续丢帧Debug

  1. Session Dump 找到是哪个 pipeline/node/request 卡住了,node 卡在什么状态
  2. 如果node是卡在submit 状态,这种一般是IFE/IPE node 的fence 没有及时回来,可以做以下检查:
    2.1 UMD的package 有没有及时发下去
    2.2 kernel 有没有及时收到UMD的package
    2.3 收到 package 以后有没有正常apply
    2.4 kernel 有没有把fence 回到UMD
    2.5 UMD有没有正常收到kernel的fence 回调
  3. 如果node 卡在deferred 状态,确认一下是哪个dependency 没有满足,再找为什么这个dependency 一直没有满足
  4. 如果是某些低概率触发的 consecutive frame with invalid requestid ,可以同步抓取atrace 分享是不是有可能performce 引入的。
需要打开的kernel log
adb shell "echo 0x1000038 > /sys/module/camera/parameters/debug_mdl"
需要打开 offline log
adb wait-for-device
adb root
adb remount
adb shell mkdir  /vendor/etc/camera
 
:: session dump
adb shell "echo overrideLogLevels=0xcc  >    /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo logVerboseMask=0xd0000  >>   /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo logInfoMask=0xd0008     >>   /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo logConfigMask=0xd0008 >>   /vendor/etc/camera/camxoverridesettings.txt"


::  允许adb  获取camx chi log
 adb shell echo "systemLogEnable=TRUE >> /vendor/etc/camera/camxoverridesettings.txt"
:: 离线log
adb shell " echo enableAsciiLogging=1 >>  /vendor/etc/camera/camxoverridesettings.txt "
::  删除之前保存的log
adb shell rm /data/vendor/camera/*.txt

:: RAW YUV 图 dump
:: adb shell "echo autoimageDump = TRUE        >>  /vendor/etc/camera/camxoverridesettings.txt"
:: adb shell "echo autoimageDumpMask=0x2       >>  /vendor/etc/camera/camxoverridesettings.txt"
:: adb shell "echo autoinputimageDumpMask=0x2  >>  /vendor/etc/camera/camxoverridesettings.txt"
:: adb shell "echo dumpinputatOutput=TRUE      >>  /vendor/etc/camera/camxoverridesettings.txt"

pause
adb reboot

log分析:

// 连续丢帧  CSLMessageHandler() frameMessage:requestID=0 
08-21 02:48:22.884 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:3567 CSLMessageHandler() frameMessage:requestID=0, linkhdl:0x6e00370106, frameCount=27337, timestamp=401262243889895, monoTimestamp=401262243889895
08-21 02:48:22.917 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:3567 CSLMessageHandler() frameMessage:requestID=0, linkhdl:0x6e00370106, frameCount=27338, timestamp=401262277219062, monoTimestamp=401262277219062
08-21 02:48:22.950 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:3567 CSLMessageHandler() frameMessage:requestID=0, linkhdl:0x6e00370106, frameCount=27339, timestamp=401262310548229, monoTimestamp=401262310548229
08-21 02:48:22.984 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:3567 CSLMessageHandler() frameMessage:requestID=0, linkhdl:0x6e00370106, frameCount=27340, timestamp=401262343877395, monoTimestamp=401262343877395
08-21 02:48:23.017 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:3567 CSLMessageHandler() frameMessage:requestID=0, linkhdl:0x6e00370106, frameCount=27341, timestamp=401262377206562, monoTimestamp=401262377206562
08-21 02:48:23.050 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:3567 CSLMessageHandler() frameMessage:requestID=0, linkhdl:0x6e00370106, frameCount=27342, timestamp=401262410535729, monoTimestamp=401262410535729
... ...
08-21 02:48:23.084 23889 23893 I CamX    : [ INFO][CORE  ] camxpipeline.cpp:3567 CSLMessageHandler() frameMessage:requestID=0, linkhdl:0x6e00370106, frameCount=27343, timestamp=401262443864895, monoTimestamp=401262443864895

// 连续丢 47帧 heckForRecovery() Hit SOF threshold of [47]
08-21 02:48:23.084 23889 23893 E CamX   : [ERROR][CORE  ] camxpipeline.cpp:3449 CheckForRecovery() Hit SOF threshold of [47] consecutive frames with invalidrequestId; triggering watchdog recovery for pipeline VideoEIS3PreviewEIS2_0

08-21 02:48:23.084 23889 23893 I CamX    : [CONFIG][CORE   ] camxsession.cpp:4525 HandleErrorCb() Sending recovery for frameworkFrameNum=27056
08-21 02:48:23.084 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6315 DumpDebugInfo() +----------------------------------------------------------+
08-21 02:48:23.084 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6332 DumpDebugInfo() +      CALLING SESSION DUMP 0xb400006e5308d040 FOR RESET-Recovery     +
08-21 02:48:23.085 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6339 DumpDebugInfo() + numPipelines:             1
08-21 02:48:23.085 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6340 DumpDebugInfo() + livePendingRequests:      15
08-21 02:48:23.085 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6341 DumpDebugInfo() + maxLivePendingRequests:   23
08-21 02:48:23.085 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6342 DumpDebugInfo() + requestQueueDepth:        23
08-21 02:48:23.085 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6348 DumpDebugInfo() + Pipeline[0] Flush Status: 0
08-21 02:48:23.085 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6351 DumpDebugInfo() + usecaseNumBatchedFrames:  1
08-21 02:48:23.085 23889 23893 I CamX    : [ DUMP][CORE   ] camxsession.cpp:6366 DumpDebugInfo() +------------------------------------------------------------------+

//  Stuck on   Request Id: 27279 
08-21 02:48:23.093 23889 23893 I CamX  : [ DUMP][CORE  ] camxsession.cpp:6373 DumpDebugInfo() + Stuck on Sequence Id: 27278 Request Id: 27279
// 卡住的地方为 VideoEIS3PreviewEIS2_0
08-21 02:48:23.093 23889 23893 I CamX    : [ DUMP][CORE   ] camxpipeline.cpp:4263 DumpDebugInfo() +----------------------------------------------------------+
08-21 02:48:23.093 23889 23893 I CamX    : [ DUMP][CORE   ] camxpipeline.cpp:4264 DumpDebugInfo() +    PIPELINE DEBUG INFO     +
08-21 02:48:23.094 23889 23893 I CamX    : [ DUMP][CORE   ] camxpipeline.cpp:4269 DumpDebugInfo() +  Pipeline Name: VideoEIS3PreviewEIS2_0, Pipeline ID: 0, 0xb400007013247a00, CurrentRequestId: 27293
08-21 02:48:23.094 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:4866 LogPendingNodes() +    Session 0xb400006e5308d040 - Pipeline VideoEIS3PreviewEIS2_0 Pending Nodes
08-21 02:48:23.094 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:4867 LogPendingNodes() +------------------------------------------------------------------+
08-21 02:48:23.095 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:4870 LogPendingNodes() |      Requests Range - lastInOrderCompletedRequestId: 27278 currentRequest : 27293
// 卡住的node  com.qti.node.eisv30 com.qti.node.dewarp1 com.qti.node.swmctf2 com.qti.node.memcpy4  
08-21 02:48:23.095 23889 23893 I CamX    : [ INFO][CORE   ] camxpipeline.cpp:4897 LogPendingNodes() +        Request 27279 Nodes: com.qti.node.eisv30 com.qti.node.dewarp1 com.qti.node.swmctf2 com.qti.node.memcpy4 

// Request Id: 27279  卡住的状态 status: DEFERRED, 
08-21 02:48:23.101 23889 23893 I CamX  : [ DUMP][CORE  ] camxnode.cpp:5113 DumpDebugInfo() + Request: 27279 Unsuccessful. metaComplete: 1, reqComplete: 0, numUnsigFences: 2, numUnprocFences: 2, status: DEFERRED, currTime 02:48:23:101 statusTransitionTime: 02:48:21:60 
08-21 02:48:23.101 23889 23893 I CamX  : [ DUMP][CORE  ] camxnode.cpp:5160 DumpDebugInfo() +    Fence: 152; Output port id: 0; isDelayedBufferFence?: 0; isFenceSignaled?: 0; fenceResult: 0; ImgRefCount=3; maxImageBuffers=28

// 卡主的原因 com.qti.node.eisv3.PerspectiveGridTransform on Pipeline = 0 is not published
08-21 02:48:23.123 23889 23893 I CamX  : [ DUMP][DRQ  ] camxdeferredrequestqueue.cpp:1310 DumpDebugInfo() +----------------------------+

08-21 02:48:23.123 23889 23893 I CamX  : [ DUMP][DRQ  ] camxdeferredrequestqueue.cpp:1311 DumpDebugInfo() +  DRQ - req 00027279   +

08-21 02:48:23.123 23889 23893 I CamX  : [ DUMP][DRQ  ] camxdeferredrequestqueue.cpp:1319 DumpDebugInfo() +  Node: VideoEIS3PreviewEIS2_com.qti.node.eisv30, Request: 27279, SeqId: 3, signaledCount: 0, publishedCount: 0 bindIOBuffers: 0

08-21 02:48:23.125 23889 23893 I CamX  : [ DUMP][DRQ  ] camxdeferredrequestqueue.cpp:1348 DumpDebugInfo() +  Property[0] = 0x80750000 com.qti.node.eisv3.PerspectiveGridTransform on Pipeline = 0 is not published

08-21 02:48:23.126 23889 23893 I CamX  : [ DUMP][DRQ  ] camxdeferredrequestqueue.cpp:1310 DumpDebugInfo() +----------------------------+

24. monkey 测试命令

adb shell "monkey -p com.android.camera --ignore-crashes --ignore-timeouts --ignore-security-exceptions --monitor-native-crashes --throttle 1000 -v -v -v -s 800 450000 2>/sdcard/error.aaa 2>/sdcard/error.txt 1>/sdcard/monkeyInfo.log"

至此,本篇已结束。转载网络的文章,小编觉得很优秀,欢迎点击阅读原文,支持原创作者,如有侵权,恳请联系小编删除,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!

5d4733f8f516406f2313582fac00d443.jpeg

点个在看,为大佬点赞!

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员Android

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值