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

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

打开camera apk时输出的log:

07-11 19:06:58.278 31746 31746 D QCamera : camera_open: 3140: E camera_idx = 0
07-11 19:06:58.583 31746 31746 D QCamera : camera_open: 3140: E camera_idx = 1
07-11 19:06:58.915 31746 31746 D QCamera : 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: < 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  
      [email protected]: 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: <  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

 

你可能感兴趣的:(android,中常见问题)