测试平台:
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 :
02-10 07:23:16.149 701 701 I QCamera :
02-10 07:23:16.149 701 701 I QCamera :
02-10 07:23:16.150 701 701 I QCamera :
02-10 07:23:16.150 701 701 I QCamera :
02-10 07:23:16.150 701 701 I QCamera :
02-10 07:23:16.150 701 701 I QCamera :
02-10 07:23:16.150 701 701 I QCamera :
02-10 07:23:16.150 701 701 I QCamera :
02-10 07:23:16.150 701 701 I QCamera :
打开camera apk时输出的log:
07-11 19:06:58.278 31746 31746 D QCamera :
07-11 19:06:58.583 31746 31746 D QCamera :
07-11 19:06:58.915 31746 31746 D QCamera :
=================================================================
//导出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:
//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:
//查看用的是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