如题,log开的好,问题都能搞。
出于调试目的,有两种方法可以覆盖相机驱动程序的默认设置
方法一: Push a configuration file to/vendor/etc/camera/camxoverridesettings.txt
例如:
adb root
adb remount
adb shell "echo logInfoMask=0x2 >> /vendor/etc/camera/camxoverridesettings.txt"
方法二:安卓系统属性设置:
adb shell setprop
例如:
adb shell setprop persist.vendor.camera.logInfoMask 0x2
注意:有的配置需要杀 camera 进程 或者 重启设备 才能生效
所有的camera debug log 遵循下面的格式:
CamX: [
例如:
CamX: [INFO][CORE] camxexamplefile:123 ExampleFunction()This is the message.
camera driver debug log 分割成了很多组,每组对应很多的log,使能这部分log需要设置正确的bitmask,规则如下:
Driver Group Name |
Value |
Description |
CamxLogGroupNone |
(1 << 0) |
Generic default group |
CamxLogGroupSensor |
(1 << 1) |
Sensor |
CamxLogGroupIFace |
(1 << 2) |
IFace |
CamxLogGroupISP |
(1 << 3) |
ISP |
CamxLogGroupPProc |
(1 << 4) |
Post processor |
CamxLogGroupHAL |
(1 << 7) |
HAL |
CamxLogGroupJPEG |
(1 << 8) |
JPEG |
CamxLogGroupStats |
(1 << 9) |
3A algorithms |
CamxLogGroupCSL |
(1 << 10) |
Camera service layer |
CamxLogGroupUtils |
(1 << 12) |
Utilities |
CamxLogGroupSync |
(1 << 13) |
Synchronization/mutex/fences |
CamxLogGroupMemSpy |
(1 << 14) |
Memory tracker |
CamxLogGroupCore |
(1 << 16) |
Core camera system |
CamxLogGroupHWL |
(1 << 17) |
Hardware layer |
CamxLogGroupChi |
(1 << 18) |
Camera HAL interface |
CamxLogGroupDRQ |
(1 << 19) |
Deferred request queue |
CamxLogGroupFD |
(1 << 20) |
Face detection |
备注:一般调试全开即可
adb shell "echo 0xFFFFFFFF > /sys/module/cam_debug_util/parameters/debug_mdl"
KMD Group |
Value |
Description |
CAM_CDM |
(1 << 0) |
Camera data mover |
CAM_CORE |
(1 << 1) |
Camera core |
CAM_CPAS |
(1 << 2) |
Camera peripherals and support |
CAM_ISP |
(1 << 3) |
Image signal processor |
CAM_CRM |
(1 << 4) |
Camera request manager |
CAM_SENSOR |
(1 << 5) |
Sensor |
CAM_SMMU |
(1 << 6) |
Shared memory management unit |
CAM_SYNC |
(1 << 7) |
Synchronization |
CAM_ICP |
(1 << 8) |
Image control processor |
CAM_JPEG |
(1 << 9) |
JPEG |
CAM_FD |
(1 << 10) |
Face detection |
CAM_LRME |
(1 << 11) |
Low resolution motion estimation |
CAM_FLASH |
(1 << 12) |
Flash |
CAM_ACTUATOR |
(1 << 13) |
Actuator |
CAM_CCI |
(1 << 14) |
Camera control interface |
CAM_CSIPHY |
(1 << 15) |
Camera serial interface |
CAM_EEPROM |
(1 << 16) |
Electronically erasable programmable read-Only memory |
CAM_UTIL |
(1 << 17) |
Utilities |
CAM_HFI |
(1 << 18) |
Host-firmware interface |
CAM_CTXT |
(1 << 19) |
Camera context |
CAMX_OIS |
(1 << 20) |
Optical image stabilization |
使能 camera kernel driver log:
例如:
使能 CAM_SENSOR 和 CAM_ICP 在KMD log中,使用命令:
adb root
adb remount
adb shell “echo 0x120 > /sys/module/cam_debug_util/parameters/debug_mdl”
adb shell cat /proc/kmsg > name_of_kmd_logs.txt
要动态启用CSID IRQ日志,使用命令:
adb shell “echo MASKVALUE > /sys/kernel/debug/camera_ife/ife_csid_debug”
例如:
使能 SOF, EOF, SOT, EOT IRQs:
adb shell “echo 0xf > /sys/kernel/debug/camera_ife/ife_csid_debug”
CSID Debug Group |
Value |
Description |
CSID_DEBUG_ENABLE_SOF_IRQ |
(1 << 0) |
Start of frame |
CSID_DEBUG_ENABLE_EOF_IRQ |
(1 << 1) |
End of frame |
CSID_DEBUG_ENABLE_SOT_IRQ |
(1 << 2) |
Start of transmission |
CSID_DEBUG_ENABLE_EOT_IRQ |
(1 << 3) |
End of transmission |
CSID_DEBUG_ENABLE_SHORT_PKT_CAPTURE |
(1 << 4) |
Short packet capture |
CSID_DEBUG_ENABLE_LONG_PKT_CAPTURE |
(1 << 5) |
Long packet capture |
CSID_DEBUG_ENABLE_CPHY_PKT_CAPTURE |
(1 << 6) |
CPHY packet capture |
(TODO: 有时间需整理mipi协议)
2. 使能 CSIPHY log
adb shell “echo 1 > /sys/module/cam_csiphy_core/parameters/csiphy_dump”
adb shell cat /proc/kmsg > name_of_kmd_logs.txt
以 UsecaseJPEGEncodeLiveSnapshot pipeline 为例:
CamX : [ INFO][CORE ] camxhaldevice.cpp:200 SelectUsecase() Topology: Selected Usecase UsecaseJPEGEncodeLiveSnapshot
CamX : [ INFO][CORE ] camxpipeline.cpp:292 CreateNodes() Topology: Creating Pipeline, numNodes 9 isRealTime 1
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId Sensor:0 Type 0 numInputPorts 0 numOutputPorts 1
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId IFE:0 Type 65536 numInputPorts 1 numOutputPorts 5
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId Stats:0 Type 1 numInputPorts 2 numOutputPorts 1
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId AutoFocus:0 Type 5 numInputPorts 1 numOutputPorts 1
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId BPS:0 Type 65539 numInputPorts 1 numOutputPorts 1
CamX : [ INFO][CORE ] camxnode.cpp:419 InitializeSinkPortBufferProperties() Topology: IPE:0 has a sink port id 8 using format 13 dim 1920x1080
CamX : [ INFO][CORE ] camxnode.cpp:419 InitializeSinkPortBufferProperties() Topology: IPE:0 has a sink port id 9 using format 13 dim 1920x1080
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId IPE:0 Type 65538 numInputPorts 1 numOutputPorts 2
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId IPE:1 Type 65538 numInputPorts 1 numOutputPorts 1
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId JPEG Encoder:0 Type 65537 numInputPorts 1 numOutputPorts 1
CamX : [ INFO][CORE ] camxnode.cpp:419 InitializeSinkPortBufferProperties() Topology: JPEG Aggregator:0 has a sink port id 1 using format 0 dim 3840x2160
CamX : [ INFO][CORE ] camxpipeline.cpp:309 CreateNodes() Topology: Node:InstanceId JPEG Aggregator:0 Type 6 numInputPorts 1 numOutputPorts 1
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: Sensor:0(outPort 0) --> (inPort 2)IFE:0 using format 0
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: IFE:0(outPort 17) --> (inPort 0)Stats:0 using format 6
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: IFE:0(outPort 21) --> (inPort 1)Stats:0 using format 6
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: IFE:0(outPort 20) --> (inPort 4)AutoFocus:0 using format 6
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: IFE:0(outPort 8) --> (inPort 0)BPS:0 using format 9
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: IFE:0(outPort 0) --> (inPort 0)IPE:0 using format 3
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: BPS:0(outPort 1) --> (inPort 0)IPE:1 using format 12
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: IPE:1(outPort 8) --> (inPort 0)JPEG Encoder:0 using format 3
CamX : [ INFO][CORE ] camxpipeline.cpp:371 CreateNodes() Topology: Link: JPEG Encoder:0(outPort 1) --> (inPort 0)JPEG Aggregator:0 using format 3
根据上述log,可以找到 chi-cdk/vendor/topology 下面的 UsecaseJPEGEncodeLiveSnapshot 参考 usecase 、pipeline 的xml
文件应该可以画出以下usecase 拓展图(没有画 inport 和 outport,可理解为每个pipeline必有进有出)
在熟练掌握 UDM KDM 及 usecase 的 debug 流程之后,解起问题称心如意。如果不是这样,那一定是你的log 没加对,自省。