Qcom平台 Camera 调试技巧 01

CPU & GPU Android 系统负载相关

查看系统资源 cpu mem 占用, 以进程的形式

 进去后, 按 p 进行 cpu 占比由大到小的排序显示, 显示有延时, 默认 5s 刷新一次
  adb shell top

查看系统 mem 占比

  adb shell dumpsys meminfo

查看系统 cpu 占比

  adb shell dumpsys cpuinfo

查看所有运行的后台进程

adb shell ps -A

camera 外部 YUV 库, Android SDK下 

  目录: external/libyuv/

获取系统cpu使用情况

参考链接: 原文链接:https://blog.csdn.net/u010126792/article/details/61617491

获取系统cpu使用情况 

//获取cpu的最大工作频率(多个核心修改cpu0,cpu1进行查询): 

 adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 

获取cpu使用率情况 

 结果包括总的cpu使用率和每个核的cpu使用率 
 但结果无法直接得到cpu每个核心的使用率,需要通过公式进行计算,查看非常不方便。 
 还可以设置cpu的工作模式,一般包括interactive conservative ondemand userspace powersave performance 这几种工作模式, 
 adb shell "cat /proc/stat" 

 cpu的使用率,也可以利用top命令,但无法查看单个核的使用率 
 cpu无论4核,8核,还是10核同时工作的一般只有4个核心。
 adb shell "cat /proc/stat" 
 cpu系统架构,核心数等 
 adb shell dumpsys cpuinfo 

获取系统GPU使用情况

//获取系统GPU使用情况,gpu使用率 

查看 GPU busy 占比 

 // 会打印出两个值, 第一个/第二个 就是 GPU busy 的百分比 
 adb  shell "cat /sys/class/kgsl/kgsl-3d0/gpubusy" 
//结果包含两列数字,已用第一列和第二列做除法可以得到gpu的使用率 

查看 GPU 的 clk 频率

  adb shell "cat /sys/class/kgsl/kgsl-3d0/gpuclk" 
//现在更多的程序利用opengles,vulkan等gpu接口绘制,他们直接申请gpu存储,节省了cpu消耗,使绘制更快。

获取cpu的工作频率 

 adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 

adb 查看系统当前支持 camera

【Android9.0】

  adb shell
  cd  vendor/etc/camera
  cat camera_config.xml

AEC 自动曝光测试

 adb 开启 aec log // aetest 自动曝光测试
  adb shell setprop persist.vendor.camera.sensor.debug 5
  adb shell setprop persist.vendor.camera.stats.aec.debug 5  // 设置 aec 全局 debug log
  adb shell setprop persist.vendor.camera.stats.aetest 1        //  开启自动曝光测试
  AEC 测试设备、环境光固定,设置完后,重启相机生效

dump OTP 数据

adb shell setprop persist.vendor.camera.cal.dump 1
数据路径:
"/data/misc/camera/" 
或者
"/data/vendor/camera/"

dump h.264 编码数据流

adb shell chmod 777 data/vendor/media

adb shell setenforce 0
adb shell setprop vidc.enc.log.in 1
adb shell setprop vendor.vidc.enc.log.in 1
adb shell setprop vidc.enc.log.out 1
adb shell setprop vendor.vidc.enc.log.out 1

data/vendor/media 目录下会生成编码后的数据流

抓取 h.264 编码log

adb root
adb shell setenforce 0
adb shell "echo 0x103F > /d/msm_vidc/debug_level"
adb shell "echo 0x3f   > /d/msm_vidc/fw_level"
adb shell "echo 100    > /sys/module/videobuf2_core/parameters/debug"
adb shell "echo 0      > /proc/sys/kernel/kptr_restrict"

adb shell setprop vidc.debug.level 7
adb shell setprop vendor.vidc.debug.level 7
adb shell chmod 777 data/vendor/media

打印进程调用栈

adb shell debuggerd -b




 vfe clk 的计算

vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\iface2\iface_util.c
static uint64_t iface_util_get_vfe_clk(
  uint32_t num_sensor_meta,
  ispif_out_info_t *split_info,
  sensor_out_info_t *sensor_out_info,
  uint32_t isp_id)
  min_line_length = MIN(ll_max, theoretical_line_length);
  if (min_line_length) {
    vfe_clk = pixels_per_line * sensor_out_info->op_pixel_clk /
               min_line_length;
  } else {
    vfe_clk = sensor_out_info->op_pixel_clk;
  }

  /* Make sure the vfe clock meets the minimum VBI requirements */
  if ((sensor_out_info->min_vbi != 0) &&
      (sensor_out_info->min_vbi < REQUIRED_MIN_VBI)){
    vfe_clk = vfe_clk * REQUIRED_MIN_VBI / sensor_out_info->min_vbi;
    CDBG_HIGH("%s: not enough VBI cycle %d\n",__func__,
      sensor_out_info->min_vbi);
  }

  { /* override to force ISP clock rate */
    char prop[255];
    int override = 0;
    property_get("persist.vendor.camera.dualcam.override", prop, "0");
    override = atoi(prop);
    if (override) {
      vfe_clk = MAX(vfe_clk, sensor_out_info->op_pixel_clk);
    }
  } /* override to force ISP clock rate */

ae收敛帧数计算

aec_settle




ISO计算

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

查看 camera 支持的分辨率

adb shell dumpsys media.camera

固定帧率 

persist.vendor.debug.set.fixedfps

调试 查看帧率 Log

关键字:PROFILE_PREVIEW_FRAMES_PER_SECOND 

默认fps log是不输出的,需要用到adb命令打开 
adb 打开帧率log 

adb shell setprop persist.vendor.debug.sf.showfps 1

预览帧率(preview fps ) Log

打印preview帧率log的文件路径和函数:

// HAL-1 架构的
hardware\qcom\camera\QCamera2\HAL\QCamera2HWICallbacks.cpp
void QCamera2HardwareInterface::debugShowPreviewFPS()

帧率计算方式:

mPFps = (((double)(mPFrameCount - mPLastFrameCount)) * (double)(s2ns(1))) / (double)diff;

preview帧率 log:

01-04 06:35:15.331   523  3321 I QCamera : <HAL><INFO> debugShowPreviewFPS: 3332: [KPI Perf]: PROFILE_PREVIEW_FRAMES_PER_SECOND : 29.7241 Cam ID = 0

如果找不到 preview、video、raw的 fps log,
请先打开 hal log 和 fps log,后重启,再录像,再抓log

open hal log: adb shell setprop persist.vendor.camera.hal.debug 5
open fps log: adb shell setprop persist.vendor.debug.sf.showfps 1
adb sync
adb reboot

视频帧率 (video fps)  Log 

关键字:PROFILE_PREVIEW_FRAMES_PER_SECOND 

默认fps log是不输出的,需要用到adb命令打开 

adb 打开帧率log 
adb shell setprop persist.vendor.debug.sf.showfps 1 

打印video帧率log的文件路径和函数: 

hardware\qcom\camera\QCamera2\HAL\QCamera2HWICallbacks.cpp 
void QCamera2HardwareInterface::debugShowVideoFPS() 

video fps计算方式 

 mVFps = (((double)(mVFrameCount - mVLastFrameCount)) * (double)(s2ns(1))) / (double)diff;

video fps log:

01-04 06:34:52.713   523  3316 I QCamera : <HAL><INFO> debugShowVideoFPS: 3308: [KPI Perf]: PROFILE_VIDEO_FRAMES_PER_SECOND: 32.9534 Cam ID = 0 

调试 Cam AE 自动曝光测试

AE TEST,用于检测曝光的线性度。需要配合开启AEC LOG和使用。

AEC 测试设备、环境光固定,设置完后,重启相机生效。

adb shell setprop persist.vendor.camera.sensor.debug 5
adb shell setprop persist.vendor.camera.stats.aec.debug 5  // 设置 aec 全局 debug log
adb shell setprop persist.vendor.camera.stats.aetest 1     //  开启自动曝光测试

调试 3A Simulation AWB 模拟

需要使用 CHromatix 6.6 Tools,并导入 metedata 文件和3A DLL 文件。

metadata 文件如下:

调试 dump metadata 数据

Please try below command and be sure to enable zsl 

adb root
adb remount
adb shell setprop persist.vendor.camera.raw_yuv 1
adb shell setprop persist.vendor.camera.raw.format 31
adb shell chmod 777 /data
adb shell setprop persist.vendor.camera.dumpimg 20
adb shell setprop persist.vendor.camera.zsl_raw 1
adb shell setprop persist.vendor.camera.dumpmetadata 1
adb shell setenforce 0
adb shell sync

待续。。。

猜你喜欢

转载自blog.csdn.net/FANG_YISHAO/article/details/120516360
今日推荐