Android 高通平台camera hal层调试方法和命令

测试平台:
Platform HW:sdm660_64
Platform SW:Android8.1.0
================================================================================================
FrameWorks层:
系统默认提供了dump当前Camera所有配置及状态的方法,方便了调试。

dump实现代码位置:
frameworks/av/services/camera/libcameraservice/CameraService.cpp
frameworks/av/camera/CameraParameters.cpp

dump指令:

$ adb shell dumpsys media.camera
或者  adb shell dumpsys media.camera >logdump.txt

//查看丢帧情况
logcat |grep -i "dropping frame"
================================================================================================
HAL层:

vendor/qcom/proprietary/mm-camera/mm-camera2/log_debug/android/camera_dbg.c
adb shell setprop persist.camera.mct.debug 6
adb shell setprop persist.camera.sensor.debug 6
adb shell setprop persist.camera.hal.debug 6

adb shell setprop persist.camera.global.debug 6  全部打开会导致camera

系统bring up时log输出:

02-10 07:23:16.149   701   701 I QCamera : <MCI><INFO> get_num_of_cameras: 2779: dev_info[id=0,name='video3']   
02-10 07:23:16.149   701   701 I QCamera : <MCI><INFO> get_num_of_cameras: 2779: dev_info[id=1,name='video4']
02-10 07:23:16.149   701   701 I QCamera : <MCI><INFO> get_num_of_cameras: 2779: dev_info[id=2,name='video5']   

02-10 07:23:16.150   701   701 I QCamera : <MCI><INFO> sort_camera_info: 2500: Found Back Main Camera: i: 0     idx: 0
02-10 07:23:16.150   701   701 I QCamera : <MCI><INFO> sort_camera_info: 2516: Found Front Main Camera: i: 1    idx: 1
02-10 07:23:16.150   701   701 I QCamera : <MCI><INFO> sort_camera_info: 2535: Found Back Aux Camera: i: 2 idx: 2
02-10 07:23:16.150   701   701 I QCamera : <MCI><INFO> sort_camera_info: 2618: Camera id: 0 facing: 0, type: 1  is_yuv: 0
02-10 07:23:16.150   701   701 I QCamera : <MCI><INFO> sort_camera_info: 2618: Camera id: 1 facing: 1, type: 1  is_yuv: 0
02-10 07:23:16.150   701   701 I QCamera : <MCI><INFO> sort_camera_info: 2624: Number of cameras 3 sorted 3
02-10 07:23:16.150   701   701 I QCamera : <MCI><INFO> get_num_of_cameras: 2797: num_cameras=3

打开camera apk时输出的log:

07-11 19:06:58.278 31746 31746 D QCamera : <MCI><DBG> camera_open: 3140: E camera_idx = 0
07-11 19:06:58.583 31746 31746 D QCamera : <MCI><DBG> camera_open: 3140: E camera_idx = 1
07-11 19:06:58.915 31746 31746 D QCamera : <MCI><DBG> camera_open: 3140: E camera_idx = 2
=================================================================

//导出yuv数据的方法
adb shell setprop  persist.vendor.camera.dumpimg  4

//yuv图片路径
/data/vendor/camera


代码中的定义
#define QCAMERA_DUMP_FRM_PREVIEW             1
#define QCAMERA_DUMP_FRM_VIDEO               (1<<1)
#define QCAMERA_DUMP_FRM_INPUT_JPEG          (1<<2)
#define QCAMERA_DUMP_FRM_THUMBNAIL           (1<<3)
#define QCAMERA_DUMP_FRM_RAW                 (1<<4)
#define QCAMERA_DUMP_FRM_OUTPUT_JPEG         (1<<5)
#define QCAMERA_DUMP_FRM_INPUT_REPROCESS     (1<<6)

===============================================================

//camera 自动场景检测
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/stats/stats_module.c

//176x144 无法拍照修改点
hardware\qcom\camera\QCamera2\stack\common\cam_types.h
#define MAX_SIZES_CNT 40  改为#define MAX_SIZES_CNT 49
对应的so  camera.sdm660.so

======================================================================

//打开Camera底层log
adb root
adb remount
adb shell setprop persist.vendor.camera.global.debug 5
adb shell setprop persist.vendor.camera.stats.aec.debug 5
adb shell setprop persist.vendor.camera.stats.awb.debug 5
adb shell setprop persist.vendor.camera.stats.af.debug 5
adb shell setprop persist.vendor.camera.stats.q3a.debug 5
adb shell setprop persist.vendor.camera.stats.haf.debug 5


adb shell setprop persist.vendor.camera.mci.debug 5
adb shell setprop persist.vendor.camera.hal.debug 5
adb shell setprop persist.vendor.camera.sensor.debug 5
adb shell setprop persist.vendor.camera.mct.debug 5
adb shell setprop persist.vendor.camera.isp.debug 5


adb shell setprop persist.vendor.camera.quadcfa.id 0
adb shell setprop persist.vendor.camera.quadcfa.pic_size 4644x3488

3A log
adb shell setprop persist.vendor.camera.mobicat 2
adb shell setprop persist.vendor.camera.stats.debugexif 16711680

//抓取kernel中log命令
adb shell cat /proc/kmsg >log.txt
adb shell demsg >log.txt
adb logcat -b all >log.txt

//相机对焦代码
af_biz.c

//af对焦成功的log关键字:af_util_done:
adb shell setprop persist.vendor.camera.mci.debug 3
 如果显示af_haf_process: state: GO_TO_DEST,则说明是PDAF起效

//调试pdaf高通文档  kba-170501033706_3_[camera]_pdaf_tuning_note.pdf
adb shell setprop persist.vendor.camera.sensor.debug 5
按1.1.2 Port side 章节,查看log

//闪光灯代码
flash.c

//编译performance版本修改linux kernel 中的配置文件:
device\qcom\sdm660_64\AndroidBoard.mk
#----------------------------------------------------------------------
# Compile Linux Kernel
#----------------------------------------------------------------------
ifeq ($(KERNEL_DEFCONFIG),)
   ifeq ($(TARGET_BUILD_VARIANT),user)
     KERNEL_DEFCONFIG := sdm660-perf_defconfig
   else
KERNEL_DEFCONFIG := sdm660_defconfig
     #KERNEL_DEFCONFIG := sdm660-perf_defconfig  //performance版本
   endif
endif

//添加log,查看相机预览分辨率是多少
vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\isp2\module\isp_util.c
后置摄像头预览分辨率,在isp_util_broadcast_crop_info方法中添加如下log:
    if(mct_event.identity == 0x30002)
        ISP_ERR("liubin preview size BST_JERRY_DBG2: fov %d %d %d %d", zoom_params_arr[i].fov_output.x,zoom_params_arr[i].fov_output.y,zoom_params_arr[i].fov_output.crop_out_x,zoom_params_arr[i].fov_output.crop_out_y);


//查看bokeh双摄丢帧情况
12-31 16:31:00.066   664   933 I mm-camera: <IMGLIB>< INFO> 3439: module_qdc_common_handle_frame_drop: Dropping frame 205 sessionid 5 valid_pcr 0


//patch的使用
device/qcom/sepolicy$ git apply ../../../vendor/qcom/proprietary/mm-camera/16Mpatch/patch/devices_sepolicy.patch
device/qcom/sdm660_64$ git apply ../../../vendor/qcom/proprietary/mm-camera/16Mpatch/patch/device_sdm660_64.patch

//CameraProvider初始化处
CameraProvider::initialize  
      CamProvider@2.4-impl-sprd: Loaded "Sprd Camera HAL3" camera module

//集成美颜算法
./vendor/qcom/proprietary/common/config/device-vendor-SDM845-pureAOSP.mk:3023:MM_CAMERA += libjni_makeupV2
./vendor/qcom/proprietary/common/config/device-vendor.mk:3650:MM_CAMERA += libjni_makeupV2

//集成全景算法
qcom/proprietary/common/config/device-vendor-SDM845-pureAOSP.mk:3021:MM_CAMERA += libjni_panorama
qcom/proprietary/common/config/device-vendor.mk:3618:MM_CAMERA += libjni_panorama

//查看pdaf是否生效
D mm-camera: <STATS_HAF ><  LOW> 1436: af_pdaf_populate_process_monitor_output: focus_level 0 ,stability 100,confidence 100 is_trig_refocus 1
      
//查看用的是api1还是api2
CameraService: CameraService::connect call (PID -1 "org.codeaurora.snapcam", camera ID 0) for HAL version 256 and Camera API version 1      //API1

CameraService: CameraService::connect call (PID -1 "org.codeaurora.snapcam", camera ID 3) for HAL version default and Camera API version 2  //API2

//后摄raw图尺寸配置(4208*3120)
vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\sensors\sensor\libs\s5k3l6\s5k3l6_lib.h
//前摄raw图尺寸配置(2320*1744)
vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\sensors\sensor\libs\s5k3p9sp\s5k3p9sp_lib.h


//hal入库编译的so
camera.sdm660
编译方法:     hardware/qcom/camera$ mm
编译出的路径: out/target/product/sdm660_64/obj_arm/SHARED_LIBRARIES/camera.sdm660_intermediates/camera.sdm660.so
替换路径:     adb push camera.sdm660.so /system/vendor/lib/hw

//system\media\camera\src  对应的so
system/media/camera$mm  设置环境mm编译,使用32位so
//system\lib\libcamera_metadata.so

//编解码的配置路径(可能影响gts或vts是否能通过的一些问题)
\device\qcom\common\media\media_profiles.xml

//查看camera参数
QCamera3HWI.cpp  translateToHalMetadata

//高通相机apk中设置使用api1还是api2
adb shell setprop persist.sys.camera.camera2 true
adb shell setprop persist.sys.camera.camera2 false

 

  • 1
    点赞
  • 32
    收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论 1

打赏作者

流冰8095

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

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

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

打赏作者

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

抵扣说明:

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

余额充值