做高通 Camera HAL3开发的一些技术点的总结、整理。
做个记录,方便后续查阅。
productName是项目名
- out Target路径:\out\target\product\productName\
- chi-cdk:\vendor\qcom\proprietary\chi-cdk\
- ldc node:\vendor\qcom\proprietary\chi-cdk\oem\qcom\node\ldc\
- node编译出来的so:\vendor\lib64\camera\components\
- usecase编译的so: \vendor\lib64\com.qti.chiusecaseselector.so (修改pipeline的xml后需要编译usecase的so)
- chi-cdk编译的so: \vendor\lib64\hw\com.qti.chi.override.so
- usecase xml文件:chi-cdk\oem\qcom\topology\titan\fillmore\fillmore_usecase.xml
- pipelines xml文件:chi-cdk\oem\qcom\topology\titan\usecase-components\usecases\UsecaseZSL\pipelines\
- vendortag文件:chi-cdk\oem\qcom\vendortag\chivendortagoemdefines.h
- RealTimeFeature.xml:chi-cdk\oem\qcom\topology\titan\usecase-components\segments\fillmore\RealTimeFeature.xml
- camxoverridesettings.txt:高通提供给开发者的临时调试方式,控制log打印、数据dump等、在设备目录的vendor/etc/camera/下,目录camera和camxoverridesettings.txt都需要自己手动创建
bin文件:/vendor/lib64/camera (如果将bin文件删除到只剩一个,那么驱动上电就只上一个,打开相机就只打开这个摄像头)
配置文件:
- \vendor\qcom\proprietary\chi-cdk\oem\qcom\buildbins\build\android\binary_taro
- /vendor/qcom/proprietary/chi-cdk/oem/qcom/module
驱动文件:
- \vendor\qcom\proprietary\chi-cdk\oem\qcom\sensor\s5khm6
在/vendor/qcom/proprietary下查找camxsettings.xml,找到后通过修改camxoverridesettings.txt来改变camxsettings.xml中定义的变量的值
- /vendor/etc/camera # echo enableDSM=FALSE >> camxoverridesettings.txt
- /vendor/etc/camera # cat camxoverridesettings.txt
chi log:例如:CHX_LOG_ERROR(fmt, args);
adb shell "echo overrideLogLevels=0x1f >> /vendor/etc/camera/camxoverridesettings.txt"
或:adb shell setprop vendor.debug.camera.overrideLogLevels 0x1F (camxsettings.xml中定义,不同的代码可能有区别)
平常开的log(按需要开,全部都开会丢日志且影响性能):
hal/core/chi
- adb shell "echo logInfoMask=0x50080 >> /vendor/etc/camera/camxoverridesettings.txt"
- adb shell setprop persist.vendor.camera.logVerboseMask 0xFFFFFFFF
- adb shell setprop persist.vendor.camera.logEntryExitMask 0xFFFFFFFF
- adb shell setprop persist.vendor.camera.logInfoMask 0xFFFFFFFF
- adb shell setprop persist.vendor.camera.logWarningMask 0xFFFFFFFF
- adb shell setprop persist.vendor.camera.logConfigMask 0xFFFFFFFF
- adb shell setprop persist.vendor.camera.systemLogEnable TRUE
- adb shell setprop persist.vendor.camera.logLogDRQMask 0xFFFFFFFF
camx log:
- adb shell "echo overrideLogLevels=0xF >> /vendor/etc/camera/camxoverridesettings.txt"
- adb shell "echo logVerboseMask=0x1000 >> /vendor/etc/camera/camxoverridesettings.txt"
- adb shell "echo logInfoMask=0xFFFFFFFF >> /vendor/etc/camera/camxoverridesettings.txt"
Chifeature2graphselector.cpp:1549 SelectFeatureGraphforRequestFromTable()
Tag:"Selected feature graph for request:"
通常需要先执行如下命令才能打印出Log:
- adb shell echo "overrideLogLevels=0x9" >>/vendor/etc/camera/camxoverridesettings.txt
- adb shell echo overrideLogLevels=8 >>echo/vendor/etc/camera/camxoverridesettings.txt
平台不同,具体也有所区别:
8350:
- static const UINT32 CHX LOG CONFIG MASK =4:
- adb shell echo overrideLogLevels=4 >>/vendor/etc/camera/camxoverridesettings.txt
8450:
- adb shell overrideLogLevels=8 >>"echo/vendor/etc/camera/camxoverridesettings.txt
- CHX LOG INFO("Selected feature graph for request %u : %spFeature2RequestObject->GetAppFrameNumber (),requestGraph. pGraphDesc->pFeatureGraphName);
sm4350:
- adb shell "echo overrideLogLevels=4>>/vendor/etc/camera/camxoverridesettings.txt
- CHX LOG CONFIG(Feature2Mapping: Selected feature graph : %s"pChiFeature2GraphDesc->pFeatureGraphName);
代码查找:
找到chifeature2rawhdrdescriptor.cpp
查找ChiFeature2PipelineDescriptor
日志查找:
Tag: "StreamingOn"
AdvancedCameraUsecase,UsecaseMultiCamera等usecase 会 调用CreatePipelines()创建 pipeline
chifeature2也会调用 CreatePipelines() 创建 pipeline
举个例子:
在SAT模式下,预览走的是非featue2,拍照走的是feature2:
//创建的三个pipeline:SATOfflinePreview;RealtimePreviewSATO;Merge3YuvCustomTolYuv
1.Log TAG:"StreamingOn for pipeline"查当前pipeline
2.\vendor\qcom\proprietary\chi-cdk\oem\qcom\topology\titan 目录下找pipeline的xml
3.pipeline xml里看
4.找到CamxInclude的xml
5.添加node
在\camx\src\core\hal\camxhal3stream.cpp中添加堆栈打印
camx/src/lib/build/android/Android.mk 里添加 LOCAL_SHARED_LIBRARIES += libutilscallstack
代码中要打印堆栈的地方添加:android::CallStack stackprintf("xxxxxx");
详细见《Add a VendorTag》篇
高通 Camera HAL3:添加一个VendorTag_shawn·xiao的博客-CSDN博客
chi-cdk\oem\qcom\multicamera\chimcxcameraconfig\configs\fillmore\fillmore_legacymc.xml
可以只用memcopy Node来排除:
头文件:#include
\chi-cdk\oem\qcom\node\awrawhdr\build\android\Android.mk下添加:
LOCAL_SHARED_LIBRARIES :=
libcutils \
代码:if(property_get_int32("debug.vendor.camera.dumpawraw",0))
主要看第二个
(1).05-14 06:40:13.737 7710 7779 V CamX : [ VERB][STATS_AEC] caecxcontrol.h:586: PrintFrameControl CID 1 role 0 fID 227 mode PerFrame skipped:0 flash off lux 276.5 ISO 640 (short safe long) G 13.319 13.319 13.319 ET 60000000 60000000 60000000 SI 799110720 799110720 799110720 settled 1 brightness settled 1 FL 219.9 snapshot normal LED1 0 LED2 0 LEDAF 0 LEDFD 0 predictive 1.0 flashduration 0 compenDB 1.000 compenADRC 1.000 shortBlend 1.000000 FinalFlickerMode 1
(2) Gain:ExpTime
找到注摄的驱动setting文件
qssi12_7450/vendor/qcom/proprietary/chi-cdk/oem/qcom/sensor/s5khm6/s5khm6_sensor.xml
找到Qcfa定义,全部去掉
\chi-cdk\core\chiframework\chimcxdevicecaps.cpp
填曝光值函数:FillExposureTime()
\camx\src\core\camximagesensordata.cpp
从sensor xml中获取配置并计算 赋值最小、中间和最大曝光值:GetSensorStaticCapability()
/chi-cdk/oem/qcom/sensor/s5khm6/s5khm6_sensor.xml
驱动配置文件里配置:
10
65525
之前的博文中也有列举过,再列举一次
不同机型,产品性能及定位不同,即使基线一样usecase等也有可能不一样,
高通这么做给了手机厂商极大的自定义空间,举个某机型例子,UseCase可以场景复用,对应的pipeline也可以不用或复用
标定结果写入calib_result的patch,文件777权限没有设置成功,导致生成的calib_result文件没有第三方可读权限,
可通过adb shell ls -laZ calib_result查看为-rwx------
如下改动patch,经调试第三方可以读取calib_result,权限变为-rwxrwxrwx:
{
mode_t pCurMask = umask(0);
......
umask(pCurMask);
}