Camera驱动 | CAMX驱动基本调试手段

2023-03-13 09:04:24 浏览数 (1)

高通相关网址:Createpoint: https://createpoint.qti.qualcomm.com(可下载文档,Release Note,Case,文档,工具等等)Chipcode: https://chipcode.qti.qualcomm.com(下载私有代码)开源代码: https://www.codeaurora.org/xwiki/bin/QAEP/release(下载开源代码)Case: https://support-qualcomm.force.com/(高通Case)

高通网站 image 转换工具: https://cap.qti.qualcomm.com/default.aspx

调试平台信息:【SDM845/670】

以下为参考用例,具体请以 sdm845_cafvendorqcomproprietarycamxsrccorecamxsettings.xml 为准!!!

Log信息相关

代码语言:javascript复制
--AF相关LOG控制--
例: setprop persist.vendor.camera.logInfoMask 0x8000000 //AF info level log 
   setprop persist.vendor.camera.logVerboseMask 0x8000000 //AF verbose level log

   adb shell "echo logInfoMask=0x8000000 >> /vendor/etc/camera/camxoverridesettings.txt" 
   adb shell "echo logVerboseMask=0x8000000 >> /vendor/etc/camera/camxoverridesettings.txt"

Mask值对应如下:(1 << 27)=0x8000000 即对应AF模块

// The group tag for a given debug print message
typedef UINT32 CamxLogGroup;
static const CamxLogGroup CamxLogGroupNone = (1 << 0); ///< Generic group
static const CamxLogGroup CamxLogGroupSensor = (1 << 1); ///< Sensor
static const CamxLogGroup CamxLogGroupIFace = (1 << 2); ///< IFace
static const CamxLogGroup CamxLogGroupISP = (1 << 3); ///< ISP
static const CamxLogGroup CamxLogGroupPProc = (1 << 4); ///< Post Processor
static const CamxLogGroup CamxLogGroupImgLib = (1 << 5); ///< Image Lib
static const CamxLogGroup CamxLogGroupCPP = (1 << 6); ///< CPP
static const CamxLogGroup CamxLogGroupHAL = (1 << 7); ///< HAL
static const CamxLogGroup CamxLogGroupJPEG = (1 << 8); ///< JPEG
static const CamxLogGroup CamxLogGroupStats = (1 << 9); ///< Stats
static const CamxLogGroup CamxLogGroupCSL = (1 << 10); ///< CSL
static const CamxLogGroup CamxLogGroupApp = (1 << 11); ///< Application
static const CamxLogGroup CamxLogGroupUtils = (1 << 12); ///< Utilities
static const CamxLogGroup CamxLogGroupSync = (1 << 13); ///< Sync
static const CamxLogGroup CamxLogGroupMemSpy = (1 << 14); ///< MemSpy
static const CamxLogGroup CamxLogGroupAssert = (1 << 15); ///< Asserts
static const CamxLogGroup CamxLogGroupCore = (1 << 16); ///< Core
static const CamxLogGroup CamxLogGroupHWL = (1 << 17); ///< HWL
static const CamxLogGroup CamxLogGroupChi = (1 << 18); ///< CHI
static const CamxLogGroup CamxLogGroupDRQ = (1 << 19); ///< DRQ
static const CamxLogGroup CamxLogGroupFD = (1 << 20); ///< FD
static const CamxLogGroup CamxLogGroupIQMod = (1 << 21); ///< IQ module
static const CamxLogGroup CamxLogGroupLRME = (1 << 22); ///< LRME
static const CamxLogGroup CamxLogGroupNCS = (1 << 23); ///< NCS
static const CamxLogGroup CamxLogGroupMeta = (1 << 24); ///< Metadata
static const CamxLogGroup CamxLogGroupAEC = (1 << 25); ///< AEC //0x2000000
static const CamxLogGroup CamxLogGroupAWB = (1 << 26); ///< AWB //0x4000000
static const CamxLogGroup CamxLogGroupAF = (1 << 27); ///< AF //0x8000000

--禁用深度焦点指示--
setprop persist.vendor.camera.af.depthfocus 1
disableFocusIndication=1

--关闭 PDAF--
setprop persist.vendor.camera.disablePDAF 1
disablePDAF=1

--开启PDLib log--
setprop persist.camera.pdaf_logging 1

--开启PDAF performance log--
setprop persist.camera.pdaf_profiling 1 

--开启 AF debug log--
setprop persist.camera.stats.af.debug 5
setprop persist.camera.stats.haf.debug 5 

--设置 fullsweep 模式--
afFullsweep=0 //fullsweep off
afFullsweep=1 //far to near
afFullsweep=2 //near to far
afFullsweep=3 //both

--Dump EEPROM 保存OTP数据至 /data/misc/camera/ --
dumpSensorEEPROMData=1

--3A调试 exif信息--
debugDataSizeAEC=6000
debugDataSizeAWB=550000
debugDataSizeAF=70000



--CHI Override log--
persist.vendor.camera.logInfoMask 0x40080    //default:0x0
persist.vendor.camera.logVerboseMask 0x40000  //default:0x0
vendor.debug.camera.overrideLogLevels 0x1F   //default:1

<Help>Bitmask of log levels, bit 0 - error, bit 1 - warning, bit 2 - info, bit 3 - debug</Help>

--Assert--
persist.vendor.camera.assertMask
assertMask=0x2

--Warning log--
persist.vendor.camera.logWarningMask
logWarningMask=0x2 

--Info log--
persist.vendor.camera.logInfoMask
logInfoMask=0x2 

--Perf Info log--
persist.vendor.camera.logPerfInfoMask 
logPerfInfoMask=0x2 

--Verbose Info log--
persist.vendor.camera.logVerboseMask 
logVerboseMask=0x2 

--Entry/Exit log--
persist.vendor.camera.logEntryExitMask
logEntryExitMask=0x2

--DRQ Log--
persist.vendor.camera.logDRQEnable 
logDRQEnable=TRUE 

--System Log Enable--
persist.vendor.camera.systemLogEnable
systemLogEnable=FALSE

--Log filename-- 
persist.vendor.camera.debugLogFilename
debugLogFilename=cameralog 

--Trace group--
persist.vendor.camera.traceGroupsEnable
traceGroupsEnable=0x2

--Enable FPS Logs--
persist.vendor.camera.enableFPSLog
enableFPSLog=TRUE 

ChiOverride 设置

(1)开关ZSL

代码语言:javascript复制
vendor.debug.camera.overrideDisableZSL
adb shell "echo overrideDisableZSL=1 >> /vendor/etc/camera/camxoverridesettings.txt"

(2)开关MFNR 

代码语言:javascript复制
vendor.debug.camera.overrideEnableMFNR
adb shell "echo overrideEnableMFNR=1 >> /vendor/etc/camera/camxoverridesettings.txt"

(3)强制选择一个usecase

代码语言:javascript复制
vendor.debug.camera.overrideForceUsecaseId
adb shell "echo overrideForceUsecaseId=8 >> /vendor/etc/camera/camxoverridesettings.txt”

(4)强制选择一个sensor mode

代码语言:javascript复制
vendor.debug.camera.overrideForceSensorMode
adb shell "echo overrideForceSensorMode=1 >> /vendor/etc/camera/camxoverridesettings.txt"

(5)启用GPU Node Rotation Usecase

代码语言:javascript复制
vendor.debug.camera.overrideGPURotationUsecase
adb shell "echo overrideGPURotationUsecase=1 >> /vendor/etc/camera/camxoverridesettings.txt"

(6)强制使用不带3A的HFR Usecase

代码语言:javascript复制
vendor.debug.camera.overrideHFRNo3AUseCase
adb shell "echo overrideHFRNo3AUseCase=1 >> /vendor/etc/camera/camxoverridesettings.txt"

(7)允许使用AdvancedCameraUsecase

代码语言:javascript复制
vendor.debug.camera.overrideUseAdvancedUsecase
adb shell "echo overrideUseAdvancedUsecase=0 >> /vendor/etc/camera/camxoverridesettings.txt"

(8)开启 EIS V2/V3 

代码语言:javascript复制
vendor.debug.camera.eisv2enable
adb shell "echo EISV2Enable=1 >> /vendor/etc/camera/camxoverridesettings.txt"

vendor.debug.camera.eisv3enable
adb shell "echo EISV3Enable=1 >> /vendor/etc/camera/camxoverridesettings.txt"

(9) EIS V2/V3 Margin 

代码语言:javascript复制
vendor.debug.camera.eisv2margin
adb shell "echo EISV2Margin=0.4 >> /vendor/etc/camera/camxoverridesettings.txt"

vendor.debug.camera.eisv3margin
adb shell "echo EISV3Margin=0.4 >> /vendor/etc/camera/camxoverridesettings.txt"

(10)EIS V2/V3 Frame Delay 

代码语言:javascript复制
vendor.debug.camera.eisv2framedelay
adb shell "echo EISV2FrameDelay=1 >> /vendor/etc/camera/camxoverridesettings.txt" 

vendor.debug.camera.eisv3framedelay 
adb shell "echo EISV3FrameDelay=1 >> /vendor/etc/camera/camxoverridesettings.txt" 

(11)Number of PCRs before stream on 

代码语言:javascript复制
vendor.debug.camera.numPCRsBeforeStreamOn
adb shell "echo numPCRsBeforeStreamOn=1 >> /vendor/etc/camera/camxoverridesettings.txt"

(12)图像 Buffer Count Override (初始化期间分配的图像buffer计数,默认值8)

代码语言:javascript复制
vendor.debug.camera.overrideImageBufferCount
adb shell "echo overrideImageBufferCount=7 >> /vendor/etc/camera/camxoverridesettings.txt"

(13)Stats Frame Skipping 【0: invalid. <default 1: No Skip.> 2: skip 1 frame. 3: skip 2 frames】

代码语言:javascript复制
vendor.debug.camera.statsProcessingSkipCount
adb shell "echo statsProcessingSkipFactor=2 >> /vendor/etc/camera/camxoverridesettings.txt

获取raw和metadata用于ISP调试

(1) Enable Dump

代码语言:javascript复制
adb shell setprop persist.vendor.camera.imageDumpMask 6  ->No dumps = 0x0
                                  ->All output ports for IFE    = 0x1
                                  ->All output ports for IPE    = 0x2
                                  ->All output ports for BPS    = 0x4

adb shell setprop persist.vendor.camera.offlineImageDumpOnly 1
adb shell setprop persist.vendor.camera.reprocessDump 1
adb shell setprop persist.vendor.camera.autoImageDump 1
adb shell setprop persist.vendor.camera.autoImageDumpIPEoutputPortMask 0x100
          <Help>
               Output port mask for IPE:
               IPEOutputPortDisplay         = 0x100;
               IPEOutputPortVideo           = 0x200;
               IPEOutputPortFullRef         = 0x400;
               IPEOutputPortDS4Ref          = 0x800;
               IPEOutputPortDS16Ref         = 0x1000;
               IPEOutputPortDS64Ref         = 0x2000;
               ALLports                     = 0x3F00
          </Help>
adb shell setprop persist.vendor.camera.autoImageDumpIPEInstanceMask 12
          <Help>
               IPEInstanceName0             = 0x1;
               IPEInstanceName1             = 0x2;
               IPEInstanceName2             = 0x4;
               IPEInstanceName3             = 0x8;
               IPEInstanceName4             = 0x10;
               IPEInstanceName5             = 0x20;
               IPEInstanceName6             = 0x40;
               IPEInstanceName7             = 0x80;
               IPEInstanceName8             = 0x100;
               IPEInstanceName9             = 0x200;
               IPEInstanceName10            = 0x400;
               IPEInstanceName11            = 0x800;
               IPEInstanceName12            = 0x1000;
               IPEInstanceName13            = 0x2000;
               IPEInstanceName14            = 0x4000;
               IPEInstanceName15            = 0x8000;
               IPEInstanceName16            = 0x10000;
               IPEInstanceName17            = 0x20000;
               IPEInstanceName18            = 0x40000;
               IPEInstanceName19            = 0x80000;
               IPEInstanceName20            = 0x100000;
               IPEInstanceName21            = 0x200000;
               AllInstances                 = 0xFFFFFFFF
          </Help>


adb shell setprop persist.vendor.camera.autoImageDumpIFEoutputPortMask 0x100
            <Help>
               Output port mask:
               IFE:
                    IFEOutputPortFull            = 0x1;
                    IFEOutputPortDS4             = 0x2;
                    IFEOutputPortDS16            = 0x4;
                    IFEOutputPortCAMIFRaw        = 0x8;
                    IFEOutputPortLSCRaw          = 0x10;
                    IFEOutputPortGTMRaw          = 0x20;
                    IFEOutputPortFD              = 0x40;
                    IFEOutputPortPDAF            = 0x80;
                    IFEOutputPortRDI0            = 0x100;
                    IFEOutputPortRDI1            = 0x200;
                    IFEOutputPortRDI2            = 0x400;
                    IFEOutputPortRDI3            = 0x800;
                    IFEOutputPortStatsRS         = 0x1000;
                    IFEOutputPortStatsCS         = 0x2000;
                    IFEOutputPortStatsIHIST      = 0x8000;
                    IFEOutputPortStatsBHIST      = 0x10000;
                    IFEOutputPortStatsHDRBE      = 0x20000;
                    IFEOutputPortStatsHDRBHIST   = 0x40000;
                    IFEOutputPortStatsTLBG       = 0x80000;
                    IFEOutputPortStatsBF         = 0x100000;
                    IFEOutputPortStatsAWBBG      = 0x200000;
                    IFEOutputPortDisplayFull     = 0x400000;
                    IFEOutputPortDisplayDS4      = 0x800000;
                    IFEOutputPortDisplayDS16     = 0x1000000;
                    IFEOutputPortStatsDualPD     = 0x2000000;
                    ALLports                     = 0x3FFBFFF
                    AllPixelOutput               = 0x1C00047
                    AllRawOutput                 = 0xFB8
                    AllRDIOutput                 = 0xF00
                    AllStatsOutput               = 0x3FB000
            </Help>

adb shell setprop persist.vendor.camera.autoImageDumpIFEInstanceMask 0x7
            <Help>
               Instance mask:
               IFE:
                    IFEInstanceName0            = 0x1;
                    IFEInstanceName1            = 0x2;
                    IFEInstanceName2            = 0x4;
                    AllInstances                = 0x7
            </Help>

代码语言:javascript复制
adb shell "echo autoImageDumpMask=6>>/vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo offlineImageDumpOnly=TRUE>>/vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo reprocessDump=TRUE >>/vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo autoImageDump=TRUE>>/vendor/etc/camera/camxoverridesettings.txt"
...

生成路径: data/misc/camera/  或  data/vendor/camera/  

使用Chromatix 工具查看:

  ① *.RAWMIPI → rename to *.RAW, *.YUV420NV21 → Rename to *.YUV 

  ② RAW → BPP 10, pack: mipi pattern: RGGB    YUV → BPP 8, Sub-sample: Ycbcr420, Format: Semi-Planar 

 开启dump后预览会比较卡,可以修改dump部分代码(/src/utils/camximagedump.cpp b/src/utils/camximagedump.cpp),过滤特定格式缓解卡顿:

代码语言:javascript复制
#include "camximagedump.h" 
#include "camximagebuffer.h" 
#include "camximageformatutils.h" 
#include <cutils/properties.h> 
CAMX_NAMESPACE_BEGIN
@@ -99,6  100,28 @@ VOID ImageDump::Dump(
OsUtils::SNPrintF(suffix, sizeof(suffix), "ERROR"); 
break; 
}
 // add format mask 
  char value[100] = ""; 
  static int nFirstTime = 1;   static int nDumpMask = 0; 
  if(nFirstTime) 
  { 
    property_get("persist.camera.dump.formatmask", value, "0"); 
    nFirstTime = 0; 
    nDumpMask=atoi(value);
  } 
  if(nDumpMask > 0) 
  { 
   if(static_cast<INT32>(pDumpInfo->pFormat->format) != nDumpMask) 
   { 
     CAMX_LOG_ERROR(CamxLogGroupUtils, "stop dump format: %d, only dump format: %dn", pDumpInfo->pFormat->format, nDumpMask);
     return; 
   } 
  } 
   
 // 

然后可以参考 “camxformats.h”中的掩码定义dump指定的图像格式:

代码语言:javascript复制
adb shell setprop persist.camera.dump.formatmask 15  // dump YUV420NV12TP10

(2)将 TP10 转换成 YUV 10bit 格式

  dump到大量TP10格式的YUV文件后,模拟器不能直接支持TP10格式,需要使用Chromatix 7将其转换为Yuv420_10bit的格式,转换步骤如下:

  1.打开chromatix 7并打开您的项目。

  2.选择视频场景( video Scenario)。

  3.打开TF界面,检查宽度和高度。TF界面中显示的宽度和高度应与文件名中的宽度和高度完全相同。(xxxx[WW]_[HH]xxxx.YUV420NV12TP10)如果不相同,请先更正。

  3.1 你需要关闭Chromatix7. 然后进入Chromatix7 工程目录。

  3.2 打开并修改 sensorData.txt 中的宽和高。(C7projectScenario.DefaultSensor.0Usecase.VideosensorData.txt,路径取决于您使用的场景)

  3.3 修改以下两行并保存,然后再执行第3步。

代码语言:javascript复制
2036, /* raw image width */ 
1144, /* raw image height */ 

  4. 点击 “TP10 to Planar” 并选择重命名的yuv文件,您只需要选择xxx_0.yuv,工具就可以找到剩余的文件,然后选择输出文件夹。

  5. 等几秒钟,您就可以得到输出名如 xxx_pln_0.YUV, xxx_pln_1.YUV … 的文件,所有的tp10文件都被转换了。

(3) Get Meta

  步骤: ① 设备开启meta

      ② 拍照获得jpeg

      ③ 通过C7获取meta   (QualcommSpectraSim280.exe - metaparsetest.jpg -》 C7SimulatorSpectra280)

代码语言:javascript复制
adb shell "echo tuningDumpDataSizeIFE=5000 >> /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo tuningDumpDataSizeBPS=20000 >> /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo tuningDumpDataSizeIPE=150000 >> /vendor/etc/camera/camxoverridesettings.txt

0 人点赞