S5K4H7调试:
seq_type
enum msm_sensor_power_seq_type_t {
SENSOR_CLK,//0
SENSOR_GPIO,//1
SENSOR_VREG,//2
SENSOR_I2C_MUX,//3
SENSOR_I2C,
};
enum camerab_mode_t {
CAMERA_MODE_2D_B = (1<<0),
CAMERA_MODE_3D_B = (1<<1),
CAMERA_MODE_INVALID = (1<<2),
};
参照文档80-NL239-32文档
S5K4H7YX adb logcat
01-22 13:01:07.105 561 7469 E mm-camera:
说明是SOF IRQ timerout问题,ISP没有接收到SOF IRQ from the kernel.我们必须检查CSID/CSIPHY/CAMIF是否配错。
开始
[ 17.890471] msm_csiphy_release csiphy_params, lane assign 0x0 mask = 0x0
后来:
[ 185.386464] msm_csiphy_release csiphy_params, lane assign 0x180 mask = 0x7
正常摄像头打不开有以下几种可能:
1)打开摄像头的时候掉电了,DVDD1.2,IOVDD1.8,AVDD2.8,RST,PWDN出现异常
2)CSID Core,CSIPHY配置错误
3)Lane设置错误
4)效果文件缺失,导致报错
后面问高通是SDM439,SDM429平台lane_mask和lane_assign配置规格和其他平台不一样,而且需要多加一个属性:
.data_rate = 624000000ULL * 1, //----> it is in Mbps
这样前摄像S5K4H7就可以点亮。
======================================
GC2375后副摄像:
frameworks/base/core/java/android/hardware/Camera.java:299: String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
frameworks/base/core/java/android/hardware/camera2/CameraManager.java:918: String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
frameworks/base/core/java/android/hardware/camera2/CameraManager.java:994: String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
frameworks/base/core/java/android/hardware/camera2/CameraManager.java:1147: String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
frameworks/base/core/java/android/hardware/camera2/CameraManager.java:1246: String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
高通平台副摄可见
做过双摄项目的一般都知道, 副摄(一般id为2)对上层App是不可见的, 但我们在开发过程用需要对副摄进行一些测试, 因此是需要能打开副摄的,高通平台隐藏副摄是在Framework层做的处理, 代码如下:
API1 代码:
frameworks/base/core/java/android/hardware/Camera.java
public static int getNumberOfCameras() {
boolean exposeAuxCamera = false;
String packageName = ActivityThread.currentOpPackageName();
/* Force to expose only two cameras
* if the package name does not falls in this bucket
*/
String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
if (packageList.length() > 0) {
TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
splitter.setString(packageList);
for (String str : splitter) {
if (packageName.equals(str)) {
exposeAuxCamera = true;
break;
}
}
}
int numberOfCameras = _getNumberOfCameras();
if (exposeAuxCamera == false && (numberOfCameras > 2)) {
numberOfCameras = 2;
}
return numberOfCameras;
}
API2 代码:
frameworks/base/core/java/android/hardware/camera2/CameraManager.java
...
/**
* Get a list of all camera IDs that are at least PRESENT; ignore devices that are
* NOT_PRESENT or ENUMERATING, since they cannot be used by anyone.
*/
public String[] getCameraIdList() {
String[] cameraIds = null;
synchronized(mLock) {
// Try to make sure we have an up-to-date list of camera devices.
connectCameraServiceLocked();
boolean exposeAuxCamera = false;
String packageName = ActivityThread.currentOpPackageName();
String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
if (packageList.length() > 0) {
TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
splitter.setString(packageList);
for (String str : splitter) {
if (packageName.equals(str)) {
exposeAuxCamera = true;
break;
}
}
}
...
可以看到,这段代码逻辑是如果App包名在camera.aux.packagelist这个属性中,则可以打开副摄, 否则不行.因此打开副摄有两种方法:
1.设置camera.aux.packagelist这个属性, 把要打开的App包名添加进去
1)手动改骁龙相机可以打开
adb root;
adb shell setprop vendor.camera.aux.packagelist org.codeaurora.snapcam
2)代码改system.prop让systemui应用可以打开副摄像头
实际上,vs5项目应该默认就是打开的了:
device/vinet/vs5/system.prop:201:vendor.camera.aux.packagelist=org.codeaurora.snapcam
#Expose aux camera for below packages
-vendor.camera.aux.packagelist=org.codeaurora.snapcam
+#modify-allow facelock monitor camera id :2,3
+vendor.camera.aux.packagelist=org.codeaurora.snapcam,com.android.systemui
然后systemui应用也可以监听camera id为2和3的状态。(注:人脸识别是集成在systemui中)
2.删除这部分限制Camera个数的代码(不推荐)
GC2375设置成后摄之后的,打开camera的log:
[ 134.758465] msm_csid_init: CSID_VERSION = 0x30040002
[ 134.759003] msm_csid_irq CSID1_IRQ_STATUS_ADDR = 0x800
[ 134.771974] msm_sensor_config32:419 gc2375 cfgtype = 7
[ 134.772032] msm_sensor_config32:419 gc2375 cfgtype = 5
[ 134.776314] ===(1)sensor_power_up msm_sensor_config32:807 ===
[ 134.782043] MSM-CPP cpp_init_hardware:1133 CPP HW Version: 0x40030002
[ 134.782055] MSM-CPP cpp_init_hardware:1151 stream_cnt:0
[ 134.793653] ===msm_sensor_power_up===
[ 134.798573] Sensor 2 tagged as NON-SECURE
[ 134.802368] ===Sensor 2 tagged as NON-SECURE
[ 134.806219] ===s_ctrl->sensor_device_type = 1===
[ 134.814818] ===msm_camera_power_up===
[ 134.815164] msm_camera_power_up:1432
[ 134.819856] msm_camera_power_up index 0
[ 134.822475] msm_camera_power_up type 2
[ 134.826279] msm_cam_sensor_handle_reg_gpio: 1321 Seq val: 1, config: 1[ 134.829751] msm_cam_sensor_handle_reg_gpio: 1355 GPIO offset: 3, seq_val: 1
[ 134.850939] msm_camera_power_up index 1
[ 134.850989] msm_camera_power_up type 1
[ 134.853689] msm_camera_power_up:1502 gpio set val 35
[ 134.868605] msm_camera_power_up index 2
[ 134.868648] msm_camera_power_up type 0
[ 134.880655] msm_camera_power_up index 3
[ 134.880693] msm_camera_power_up type 1
[ 134.883412] msm_camera_power_up:1502 gpio set val 50
[ 134.889242] msm_camera_power_up index 4
[ 134.892667] msm_camera_power_up type 1
[ 134.896599] msm_camera_power_up:1502 gpio set val 40
[ 134.904540] msm_camera_power_up index 5
[ 134.904745] msm_camera_power_up type 1
[ 134.908313] msm_camera_power_up:1502 gpio set val 50
[ 134.914520] msm_camera_power_up index 6
[ 134.917258] msm_camera_power_up type 1
[ 134.920939] msm_camera_power_up:1502 gpio set val 40
[ 134.927366] msm_cci_init:1442: hw_version = 0x10020004
[ 134.929936] msm_camera_power_up exit
[ 134.938580] ===1.s_ctrl->func_tbl->sensor_match_id(s_ctrl);===
[ 134.938616] ===[WHL]msm_sensor_match_id===
[ 134.944772] ===No writes needed for this sensor before probe
[ 134.948282] ===slave_info->sensor_id_reg_addr = 240
[ 134.954620] ===(1)msm_camera_cci_i2c_read===
[ 134.958815] ===chipid = 0x2375
[ 134.963303] ===msm_sensor_match_id: read id: 0x2375 expected id 0x2375:
[ 134.965951] ===msm_sensor_power_up ret = 0===
[ 134.972616] msm_sensor_config32:816 sensor state 1
[ 134.977005] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.030018] hbtp_input_ioctl_handler: The input device is already created
[ 135.031323] type=1400 audit(1548753574.279:113): avc: denied { read } for pid=3570 comm=43616D6572612048616E646C657220 name="u:object_r:vendor_default_prop:s0" dev="0
[ 135.038775] type=1400 audit(1548753574.799:114): avc: denied { read } for pid=5280 comm="hbtp_daemon" name="runtime_status" dev="sysfs" ino=28369 scontext=u:r:hbtp:s0
[ 135.055674] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.057058] msm_csid_irq CSID1_IRQ_STATUS_ADDR = 0x800
[ 135.073379] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.091132] type=1400 audit(1548753574.799:114): avc: denied { read } for pid=5280 comm="hbtp_daemon" name="runtime_status" dev="sysfs" ino=28369 scontext=u:r:hbtp:s0
[ 135.095773] type=1400 audit(1548753574.839:115): avc: denied { read } for pid=552 comm="CAM_AECAWB" name="u:object_r:default_prop:s0" dev="tmpfs" ino=17721 scontext=0
[ 135.108509] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.125193] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.125901] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.147926] type=1400 audit(1548753574.839:115): avc: denied { read } for pid=552 comm="CAM_AECAWB" name="u:object_r:default_prop:s0" dev="tmpfs" ino=17721 scontext=0
[ 135.153041] type=1400 audit(1548753574.869:116): avc: denied { read } for pid=552 comm="CAM_MctServ_1" name="u:object_r:default_prop:s0" dev="tmpfs" ino=17721 sconte0
[ 135.156382] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.197896] type=1400 audit(1548753574.889:118): avc: denied { read } for pid=552 comm="CAM_MctServ_1" name="u:object_r:default_prop:s0" dev="tmpfs" ino=17721 sconted
[ 135.203339] init: starting service 'vendor.vm_bms'...
[ 135.228032] type=1400 audit(1548753574.919:119): avc: denied { read } for pid=552 comm="CAM_MctBus_1" name="u:object_r:default_prop:s0" dev="tmpfs" ino=17721 scontex0
[ 135.241031] init: Service 'vendor.vm_bms' (pid 5366) exited with status 255
[ 135.255537] init: Sending signal 9 to service 'vendor.vm_bms' (pid 5366) process group...
[ 135.262535] libprocessgroup: Successfully killed process cgroup uid 0 pid 5366 in 0ms
[ 135.290384] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.324768] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 135.351650] msm_vfe40_process_error_status: vfe 1 camif error status: 0x4af0000
[ 135.351692] 0x0000: 00000001 00000040 00000000 04b00640
[ 135.357903] 0x0010: 0000063f 000004af 00000000 00000000
[ 135.363628] 0x0020: ffffffff 0014047d 04af0000 a10c0000
[ 135.391633] CAM-SMMU cam_smmu_check_vaddr_in_range:298 Cannot find vaddr:0000000000000000 in SMMU.
[ 135.391633] vfe uses invalid virtual address
[ 135.391719] msm_vfe_iommu_fault_handler: fault address is 1008d000
[ 135.404297] msm_isp_process_iommu_page_fault:1858] VFE1 Handle Page fault! vfe_dev 0000000000000000
[ 135.410044] msm_isp_halt_send_error: vfe1 fatal error!
[ 135.426090] msm_isp_buf_mgr_debug: ==== SMMU page fault addr 1008d000 ====
[ 135.426619] msm_isp_buf_mgr_debug: nearby stream id 80010009, frame_id 0
[ 135.428619] mdss_dsi_fifo_status: status=44441000
[ 135.439323] msm_isp_buf_mgr_debug: nearby buf index 2, plane 0, state 4
[ 135.444627] msm_isp_buf_mgr_debug: buf address 0000000000000000 -- 0000000000000000
[ 135.450390] msm_isp_print_ping_pong_address: stream 0 ping bit 0 uses buffer 0000000000000000-0000000000000000, num_isp 1
[ 135.459953] msm_isp_print_ping_pong_address: stream 0 ping bit 1 uses buffer 0000000000000000-0000000000000000, num_isp 1
[ 135.472199] msm_isp_print_ping_pong_address: stream 1 ping bit 0 uses buffer 0000000000000000-0000000000000000, num_isp 1
[ 135.480345] msm_isp_print_ping_pong_address: stream 1 ping bit 1 uses buffer 0000000000000000-0000000000000000, num_isp 1
[ 135.493774] 0x0000: 00000000 00000000 00000000 00000001
[ 135.502708] 0x0010: 10c00000 10800000 00000004 0240043b
[ 135.507245] 0x0020: 006304af 00c8257b 00000001 ffffffff
[ 135.513462] 0x0030: 00000001 10ddb000 109db000 00000004
[ 135.517844] 0x0040: 067c024d 00630257 00c812bb 00000001
[ 135.523874] 0x0050: ffffffff 00000001 10100000 10280000
[ 135.528499] 0x0060: 00000000 08ca00fd 002701df 00500efb
[ 135.534992] 0x0070: 00000001 ffffffff 00000001 1014b000
[ 135.539063] 0x0080: 102cb000 00000000 09c800ae 002700ef
[ 135.545354] 0x0090: 0050077b 00000001 ffffffff 00000000
[ 135.549609] 0x00A0: 00000000 00000000 00000000 00000000
[ 135.556027] 0x00B0: 00000000 00000000 00000000 00000000
[ 135.560228] 0x00C0: 00000000 00000000 00000000 00000000
[ 135.568140] 0x00D0: 00000000 00000000 00000000 00000000
[ 135.571790] 0x00E0: 00000000 00000000 00000000 00000000
[ 135.576090] 0x00F0: 00000000 00000000 00000000 00000000
[ 135.582552] 0x0100: 00000000 00000000 10088000 10090000
[ 135.586694] 0x0110: 00000000 8bc0003f 00000001 ffffffff
[ 135.592686] 0x0120: 10040000 10060000 00000000 8b40007f
[ 135.597123] 0x0130: 00000001 ffffffff 10038000 1003c000
[ 135.603482] 0x0140: 00000000 8ac0007f 00000001 ffffffff
[ 135.607869] 0x0150: 00000000 00000000 00000000 8ab0000f
[ 135.614482] 0x0160: 00000000 00000000 10052000 1005c000
[ 135.622032] 0x0170: 00000000 8aa80007 00000001 ffffffff
[ 135.625223] 0x0180: 00000000 00000000 00000000 8a98000f
[ 135.629065] 0x0190: 00000000 00000000 00000000 00000000
[ 135.638665] 0x01A0: 00000000 8a88000f 00000000 00000000
[ 135.639678] 0x01B0: 1001f000 10037000 00000000 8a78000f
[ 135.650069] 0x01C0: 00000001 ffffffff 00000000 00000000
[ 135.655584] 0x01D0: 00000000 00000000 00000000 00000000
[ 135.656095] 0x01E0: 00000000 00000000 00000000 00000000
[ 135.665079] 0x01F0: 00000000 00000000 00000000 00000000
[ 135.676401] CAM-SMMU cam_smmu_check_vaddr_in_range:298 Cannot find vaddr:0000000000000000 in SMMU.
[ 135.676401] vfe uses invalid virtual address
[ 135.678680] msm_vfe_iommu_fault_handler: fault address is 1008d0c0
[ 135.697161] msm_isp_process_iommu_page_fault: overflow detected during IOMMU
[ 137.969160] msm_private_ioctl:Notifying subdevs about potential sof freeze
[ 137.983010] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR0 = 0x0
[ 137.983156] MSM-SENSOR-INIT msm_sensor_init_subdev_ioctl:122 default
[ 137.983156]
[ 137.984010] msm_csid_irq CSID1_IRQ_STATUS_ADDR = 0x44
[ 137.996139] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR1 = 0x0
[ 138.001093] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR2 = 0xf0
[ 138.006481] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR3 = 0x0
[ 138.011739] msm_csiphy_irq CSIPHY1_IRQ_CLK_STATUS_ADDR0 = 0x0
[ 138.017276] msm_csiphy_irq CSIPHY1_IRQ_CLK_STATUS_ADDR1 = 0xc0
[ 138.025468] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR0 = 0x0
[ 138.028808] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR1 = 0x0
[ 138.034235] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR2 = 0xf0
[ 138.039701] msm_csiphy_irq CSIPHY1_IRQ_STATUS_ADDR3 = 0x0
[ 138.045010] msm_csiphy_irq CSIPHY1_IRQ_CLK_STATUS_ADDR0 = 0x0
[ 138.050427] msm_csiphy_irq CSIPHY1_IRQ_CLK_STATUS_ADDR1 = 0xc0
[ 138.180134] msm_vfe40_axi_halt:VFE1 halt timeout rc=0
[ 138.219497] healthd: battery l=100 v=4303 t=30.6 h=2 st=2 c=212 fc=3481000 cc=0 chg=u
[ 138.221955] healthd: battery l=100 v=4303 t=30.4 h=2 st=2 c=212 fc=3481000 cc=0 chg=u
[ 138.225658] init: Untracked pid 5372 received signal 13
[ 138.228693] init: Untracked pid 5374 exited with status 0
[ 138.238153] msm_sensor_config32:419 gc2375 cfgtype = 2
[ 138.246966] init: Service 'vendor.hbtp' (pid 5280) received signal 11
[ 138.249935] init: Sending signal 9 to service 'vendor.hbtp' (pid 5280) process group...
[ 138.259493] libprocessgroup: Successfully killed process cgroup uid 1000 pid 5280 in 0ms
[ 138.351855] msm_sensor_config32:419 gc2375 cfgtype = 6
[ 138.351900] ===(2)sensor_power_down msm_sensor_config32:837===
[ 138.356985] msm_camera_power_down:1658
[ 138.363487] msm_camera_power_down index 0
[ 138.366106] msm_camera_power_down type 1
[ 138.368136] MSM-CPP cpp_release_hardware:1214 cpp hw release done
[ 138.375804] msm_camera_power_down index 1
[ 138.379510] msm_camera_power_down type 1
[ 138.385788] msm_camera_power_down index 2
[ 138.387499] msm_camera_power_down type 0
[ 138.397638] msm_camera_power_down index 3
[ 138.397674] msm_camera_power_down type 1
[ 138.406707] msm_camera_power_down index 4
[ 138.406741] msm_camera_power_down type 2
[ 138.409991] msm_cam_sensor_handle_reg_gpio: 1321 Seq val: 1, config: 0[ 138.413949] msm_cam_sensor_handle_reg_gpio: 1355 GPIO offset: 3, seq_val: 1
[ 138.428468] msm_camera_power_down exit
[ 138.428515] msm_sensor_config32:846 sensor state 0
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/csiphy/include/msm_csiphy_10_0_0_hwreg.h:20:#define LANE_MASK_PHY_B 0x2C
#define LANE_MASK_AGGR_MODE 0x1F
#define LANE_MASK_PHY_A 0x13
#define LANE_MASK_PHY_B 0x2C
#define mask_enable_clk_A 0x1
#define mask_enable_clk_B 0x2
#define mask_phy_enable_A 0x3
#define mask_phy_enable_B 0xC
msm_csiphy.c (msm-4.9\drivers\media\platform\msm\camera_v2\sensor\csiphy):static int msm_csiphy_snps_lane_config(
...
/* lane mask usage
* BIT LANE
* 0(LSB) PHY A data 0
* 1 PHY A data 1
* 2 PHY B data 0
* 3 PHY B data 1
* 4 PHY A clk (clk 0)
* 5 PHY B clk (clk 1)
*/
...
}
adb logcat -b kernel
01-30 10:10:28.795 0 0 E msm_sensor_config32: 419 gc2375 cfgtype = 2
01-30 10:10:28.898 0 0 E : msm_csiphy_lane_config csiphy_params, mask = 0x2c cnt = 1, data rate = 780000000
01-30 10:10:28.898 0 0 E : msm_csiphy_lane_config csiphy_params, settle cnt = 0x14 csid 1
01-30 10:10:28.906 0 0 E msm_csiphy_snps_lane_config: 345 lane_maks: 0x2c, cur_snps_state = 0
01-30 10:10:28.907 0 0 E msm_sensor_config32: 419 gc2375 cfgtype = 2
01-30 10:10:28.920 0 0 E : ===phy B,num_lanes = 2;
1. please set:
adb shell setprop persist.camera.expose.aux 1
SDM439平台应该改为:
adb shell setprop persist.vendor.camera.expose.aux 1
2. please check cameraID log:
hardware/qcom/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_interface.c:2459:void sort_camera_info(int num_cam)
for (i = 0; i < idx; i++) {
LOGI("Camera id: %d facing: %d, type: %d is_yuv: %d",
i, g_cam_ctrl.info[i].facing, g_cam_ctrl.cam_type[i], g_cam_ctrl.is_yuv[i]);
}
从0开始枚举,打开adb shell setprop persist.vendor.camera.expose.aux 1之后,adb连上之后马上抓adb logcat,就看到Camera id了
01-31 09:09:47.048 2034 2034 I QCamera :
01-31 09:09:47.048 2034 2034 I QCamera :
而且mm-camera也有在跑
adb shell setprop persist.vendor.camera.expose.aux 0是看不到Camera id的,而且mm-camera也没在跑
将三个摄像头都配置上,logcat
QCamera也能枚举出ID
02-01 10:59:30.026 535 6251 I QCamera :
02-01 10:59:35.740 535 535 I QCamera :
02-01 10:59:40.690 535 535 I QCamera :
GC2375配置成辅摄且为1 lane,没有收到数据
02-01 10:59:46.145 535 8697 E mm-camera:
使用adb logcat -v threadtime 命令, 可以啥看日志的输出时间和线程信息;
加载日志缓冲区 : 使用 adb logcat -b 缓冲区类型 命令;
-- Android中的日志缓冲区 : system缓冲区 - 与系统相关的日志信息, radio缓冲区 - 广播电话相关的日志信息, events缓冲区 - 事件相关的日志信息, main缓冲区 - 默认的缓冲区;
adb logcat -b kernel加载kernel日志缓冲区
02-01 14:19:21.994 0 0 E msm_cam_sensor_handle_reg_gpio: 1321 Seq val: 1, config: 0
02-01 14:19:21.994 0 0 E msm8937-pinctrl 1000000.pinctrl: pin GPIO_35 already requested by 1b0c000.qcom,cci:qcom,camera@1; cannot claim for 1b0c000.qcom,cci:qcom,camera@0
02-01 14:19:21.994 0 0 E msm8937-pinctrl 1000000.pinctrl: pin-35 (1b0c000.qcom,cci:qcom,camera@0) status -22
02-01 14:19:21.994 0 0 E msm8937-pinctrl 1000000.pinctrl: could not request pin 35 (GPIO_35) from group gpio35 on device 1000000.pinctrl
02-01 14:19:21.994 0 0 E qcom,camera 1b0c000.qcom,cci: qcom,camera@0: Error applying setting, reverse things back
02-01 14:19:21.995 0 0 E msm_camera_power_down: 1750 cannot set pin to suspend state
应该是GPIO-35后摄和后辅摄都在用,所以冲突了。所以可能导致后辅摄切换到后摄的时候,有时候会异常退出camera,也有可能是1lane的补丁导致的,因为去掉1lane的补丁就不会了,唯一的问题是切换的时候,后辅摄切到后摄的时候,会切出来一个后辅摄像倒了180度的图像出来,这个年后再查!
1.另外一个现象是后辅摄要和后摄一起配置上才能点亮,单独配置成前摄或和前摄一起配上都点不亮。高通工程师电话回复也是要后摄和后辅摄xml文件都配置上,硬件都接上,才能识别到后辅摄。另外一个说法就是说骁龙相机默认打开camera id为0的摄像头,也就是后摄像头,如果后摄没配,那打开就会出问题,那单独配前摄像头可以是因为,后摄没有就把前摄像头当后摄打开了。
2.还有一个就是GC2375的配置寄存器的settle time要和平台的settle cnt匹配起来,否则SDM439平台会出现打开预览一段时间之后挂掉的问题,GC2375的原厂的FAE原来碰过类似的问题,
高通FAE也建议改settle_cnt的值,sensor厂要求sensor settle > 平台settle > sensor prepare,sensor端的settle = prepare + zero,目前0x29(T_HS_PREPARE_SET,默认0x06)为0x04,
0x2a寄存器(T_HS_Zero_set,默认0x0a,140ns)为0x07,反正大概sensor settle就是100多ns,平台settle是settle_cnt(0x14)*5ns=100ns,基本能达到高速MIPI的数据同步的要求,改完之后那就不会出现预览一段时间后挂掉的问题了。
3.配置了后摄,前摄,后辅摄之后,从后摄切换到前摄再切换到后辅摄,再切后摄像会出来一个倒了180度的后辅摄的图像,其实这个是后双摄的摄像头,也是正常的,切换完单摄像头就切换到双摄像头。
GPIO35用来打开DVDD1.8和AVDD2.8V的LDO电压,如果关闭,GC2375无法正常probe,无法正常读到ID。
撤销git add 操作:
git reset HEAD kernel/msm-4.9/arch/arm64/boot/dts/vinet/sdm439-camera-sensor-vs5.dtsi
撤销git commit操作:
git commit -m "本功能全部完成"
执行完commit后,想撤回commit,怎么办?
这样凉拌:
git reset --soft HEAD^
这样就成功的撤销了你的commit
注意,仅仅是撤回commit操作,您写的代码仍然保留。HEAD^的意思是上一个版本,也可以写成HEAD~1,如果你进行了2次commit,想都撤回,可以使用HEAD~2
--soft
不删除工作空间改动代码,撤销commit,不撤销git add .
--hard
删除工作空间改动代码,撤销commit,撤销git add .
注意完成这个操作后,就恢复到了上一次的commit状态
顺便说一下,如果commit注释写错了,只是想改一下注释,只需要:
git commit --amend
此时会进入默认vim编辑器,修改注释完毕后保存就好了。
------------------------------------------------------------------------
闪光灯驱动:
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/flash/msm_flash.c
打开闪光灯的配置方法:
diff --git a/kernel/msm-4.9/arch/arm64/boot/dts/vinet/sdm439-camera-sensor-vs5.dtsi b/kernel/msm-4.9/arch/arm64/boot/dts/vinet/sdm439-camera-sensor-vs5.dtsi
index 7aa33dc033..ec45ac21aa 100755
--- a/kernel/msm-4.9/arch/arm64/boot/dts/vinet/sdm439-camera-sensor-vs5.dtsi
+++ b/kernel/msm-4.9/arch/arm64/boot/dts/vinet/sdm439-camera-sensor-vs5.dtsi
@@ -164,7 +164,7 @@
qcom,csiphy-sd-index = <0>;
qcom,csid-sd-index = <0>;
qcom,mount-angle = <90>;
- //qcom,led-flash-src = <&led_flash0>;
+ qcom,led-flash-src = <&led_flash0>;
//qcom,eeprom-src = <&eeprom0>;
//qcom,actuator-src = <&actuator0>;
cam_vana-supply = <&pm8953_l22>;
wanghl@server:~/work/sdm439_android$ git diff vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml
diff --git a/vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml b/vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml
index 32dd13304d..20da06b8e6 100755
--- a/vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml
+++ b/vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml
@@ -89,6 +89,7 @@ LensInfo : Information of the lens present in the module.
+
只有xml文件配置上了闪光灯,才能打出log:
[ 17.842825] ===s_ctrl->sensordata->flash_name = pmic
而且骁龙相机的的setting菜单才能看到Flash图标,下拉菜单的手电筒才能用,否则是灰色不可用。
读取ID的地方:
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_cci_i2c.c
msm_camera_cci_i2c_read
上电的地方:
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
msm_camera_power_up
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
msm_sensor_power_up
如果读取ID失败会POWERDOWN
获取用户空间配置(xml文件顶层配置,驱动上电时序):
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c
msm_sensor_get_power_up_settings
==================================================================
xml文件的配置的ActuatorName对应驱动的.actuator_name:
.actuator_params =
{
.module_name = "fitipower",
.actuator_name = "fp5518",
...
AF驱动vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/actuator/libs/fp5518/fp5518_actuator.h是拿通用的驱动DW9763驱动改的,在此基础之上修改了
IIC地址和初始化代码,actuator_tuned_params并没有修改,在合入OTP功能之后可能需要修改以下几个值:
.initial_code = 180,
.code_per_step = 1,
.qvalue = 128,
合完AF后切换摄像头会异常退出的问题:
static int msm_sensor_config32(struct msm_sensor_ctrl_t *s_ctrl,
void *argp)
函数里设计到的:
enum msm_sensor_cfg_type_t {
CFG_SET_SLAVE_INFO,//0
CFG_SLAVE_READ_I2C,//1
CFG_WRITE_I2C_ARRAY,//2
CFG_SLAVE_WRITE_I2C_ARRAY,//3
CFG_WRITE_I2C_SEQ_ARRAY,//4
CFG_POWER_UP,//5
CFG_POWER_DOWN,//6
CFG_SET_STOP_STREAM_SETTING,//7
CFG_GET_SENSOR_INFO,//8
CFG_GET_SENSOR_INIT_PARAMS,//9
CFG_SET_INIT_SETTING,//10
CFG_SET_RESOLUTION,//11
CFG_SET_STOP_STREAM,//12
CFG_SET_START_STREAM,//13
CFG_SET_SATURATION,//14
CFG_SET_CONTRAST,//15
CFG_SET_SHARPNESS,
CFG_SET_ISO,
CFG_SET_EXPOSURE_COMPENSATION,
CFG_SET_ANTIBANDING,
CFG_SET_BESTSHOT_MODE,
CFG_SET_EFFECT,
CFG_SET_WHITE_BALANCE,
CFG_SET_AUTOFOCUS,
CFG_CANCEL_AUTOFOCUS,
CFG_SET_STREAM_TYPE,
CFG_SET_I2C_SYNC_PARAM,
CFG_WRITE_I2C_ARRAY_ASYNC,
CFG_WRITE_I2C_ARRAY_SYNC,
CFG_WRITE_I2C_ARRAY_SYNC_BLOCK,
};
切换摄像头挂了的问题:
adb logcat -b kernel
02-17 00:59:04.550 0 0 E msm_camera_request_gpio_table: 774 gpio 35:CAM_VANA request fails
02-17 00:59:04.554 0 0 E msm8937-pinctrl 1000000.pinctrl: pin GPIO_35 already requested by 1b0c000.qcom,cci:qcom,camera@1; cannot claim for 1b0c000.qcom,cci:qcom,camera@0
02-17 00:59:04.561 0 0 E msm8937-pinctrl 1000000.pinctrl: pin-35 (1b0c000.qcom,cci:qcom,camera@0) status -22
02-17 00:59:04.575 0 0 E msm8937-pinctrl 1000000.pinctrl: could not request pin 35 (GPIO_35) from group gpio35 on device 1000000.pinctrl
02-17 00:59:04.584 0 0 E qcom,camera 1b0c000.qcom,cci: qcom,camera@0: Error applying setting, reverse things back
02-17 00:59:04.595 0 0 E msm_camera_power_up: 1459 cannot set pin to active state
应该和这个无关,去除AF后正常切换的时候也报这个log:
adb logcat:
02-17 01:13:26.239 556 6496 E mm-camera:
02-17 01:13:26.271 556 6458 E mm-camera:
02-17 01:13:26.383 6294 6326 E Camera : Error 100
02-17 01:13:26.395 6294 6326 E CameraErrorCallback: Got camera error callback. error=100
可能怀疑的原因:1.IIC报错 2.电源异常
打开后摄像头:
02-18 08:52:41.579 547 5926 I mm-camera:
02-18 08:52:41.641 547 1574 I QCamera :
02-18 08:52:41.746 547 1574 I QCamera :
打开前摄像头:
02-18 08:57:40.641 547 6283 I mm-camera:
02-18 08:57:40.704 547 1572 I QCamera :
02-18 08:57:40.756 547 1571 I QCamera :
打开后辅摄:
02-18 09:01:11.719 547 6591 I mm-camera:
02-18 09:01:11.765 547 1574 I QCamera :
02-18 09:01:11.808 547 1572 I QCamera :
打开后双摄:
02-18 09:02:56.818 547 6720 I mm-camera:
02-18 09:02:56.865 547 6746 I mm-camera:
02-18 09:02:56.910 547 1572 I QCamera :
02-18 09:02:56.962 547 1574 I QCamera :
后实验证实去掉camera的kernel层的驱动:kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/下的一些调试log,切换摄像头会异常退出的情况就没有了
=============================================================================
需要注意的知识点:
1.对锁机制,定时器的理解
1)互斥锁(mutex)
特点:对于读者和写者来说。只要有一方获取了锁,另一方则不能继续获取,进而执行临界区代码。
2)读写锁
特点:读写锁适合于对数据结构的读次数比写次数多得多的情况.因为,读模式锁定时可以共享,以写模式锁住时意味着独占,所以读写锁又叫共享-独占锁.
3)自旋锁
特点:轮询忙等待。
在单核cpu下不起作用:被自旋锁保护的临界区代码执行时不能进行挂起状态,会造成死锁
自旋锁的初衷就是:在短期间内进行轻量级的锁定。一个被争用的自旋锁使得请求它的线程在等待锁重新可用的期间进行自旋(特别浪费处理器时间),
所以自旋锁不应该被持有时间过长。如果需要长时间锁定的话, 最好使用信号量。
4)完成量
完成量表示为一个执行单元需要等待另一个执行单元完成某事后方可执行,它是一种轻量级机制(比如等待TE信号)
定时器:
1)如果时间精度要求不高,可以使用sleep,uslepp函数让进程睡眠一段时间来实现定时
2)如果不想阻塞,在linux下面我们一般使用alarm函数(SIGALRM信号)跟setitimer(较为精确)函数来实现定时功能
2.编写编译脚本,内核裁剪的经验
3.aidl文件理解,HAL层整套流程的理解
4.自我提升的途径,网站,书籍
5.进程通信的方式
管道( pipe ):单向传输,父子或者兄弟进程间使用
信号量( semophore ) :信号量是一个计数器,常作为一种锁机制,同步手段。
消息队列( message queue ) :消息的链表,更多信息字节流
信号 ( sinal ) :比较复杂的通信方式,用于通知接收进程某个事件已经发生。
共享内存( shared memory ) :共享内存是最快的 IPC 方式,高通AP与ADSP就是这种方式
套接字( socket ) :可用于不同机器间的进程通信。
6.野指针
产生原因和避免方法:
1、指针定义时未被初始化:指向随机区域(所以初始化要置空)
2、指针被释放时没有被置空:(所以释放要置空)
3、指针操作超越变量作用域:不要返回指向栈内存的指针,因为栈内存在函数结束的时候会被释放(所以养成良好编程习惯)
7.内存分配有哪几种方式:
1)从静态存储区域分配:它是由编译器自动分配和释放的,即内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在,直到整个程序运行结束时才被释放,如全局变量与 static 变量。
2)在栈上分配:它同样也是由编译器自动分配和释放的,即在执行函数时,函数内局部变量的存储单元都可以在栈上创建,函数执行结束时这些存储单元将被自动释放。需要注意的是,栈内存分配运算内置于处理器的指令集中,它的运行效率一般很高,但是分配的内存容量有限。
3)从堆上分配:也被称为动态内存分配,它是由程序员手动完成申请和释放的。即程序在运行的时候由程序员使用内存分配函数(如 malloc 函数)来申请任意多少的内存,使用完之后再由程序员自己负责使用内存释放函数(如 free 函数)来释放内存。也就是说,动态内存的整个生存期是由程序员自己决定的,使用非常灵活。需要注意的是,如果在堆上分配了内存空间,就必须及时释放它,否则将会导致运行的程序出现内存泄漏等错误。
============================================================================
S5K4H7 Camera EEPROM:
typedef enum {
CAM_GLBL_DBG_NONE = 0,
CAM_GLBL_DBG_ERR = 1,
CAM_GLBL_DBG_WARN = 2,
CAM_GLBL_DBG_HIGH = 3,
CAM_GLBL_DBG_DEBUG = 4,
CAM_GLBL_DBG_LOW = 5,
CAM_GLBL_DBG_INFO = 6
} cam_global_debug_level_t;
wanghl@server:~/work/sdm439_android$ adb reboot
wanghl@server:~/work/sdm439_android$
wanghl@server:~/work/sdm439_android$ adb shell getprop persist.vendor.camera.sensor.debug
wanghl@server:~/work/sdm439_android$ adb root
restarting adbd as root
//root之后才能获取到属性
wanghl@server:~/work/sdm439_android$ adb shell getprop persist.vendor.camera.sensor.debug
4//只能打出DEBUG级别的LOG,LOW级别的LOG是打不出的,INFO级别是不可控的,是一定会打印的。
wanghl@server:~/work/sdm439_android$
要打出CAM_GLBL_DBG_LOW级别的LOG,必须设置persist.vendor.camera.sensor.debug为5,而且必须root!
adb root
adb disable-verity
adb reboot
adb root
adb remount
adb shell setprop persist.vendor.camera.sensor.debug 5
adb logcat -v threadtime | grep "eeprom"
02-19 09:34:23.736 541 5615 D mm-camera:
02-19 09:34:23.736 541 5615 D mm-camera:
02-19 09:34:23.736 541 5615 D mm-camera:
重启之后:
02-19 09:34:23.736 541 5615 D mm-camera:
02-19 09:34:23.736 541 5615 D mm-camera:
02-19 09:34:23.736 541 5615 D mm-camera:
02-19 09:34:23.792 541 5617 D mm-camera:
02-19 09:34:23.985 541 5613 D mm-camera:
所以设置完log打印级别之后最好是重启!!!
============================================
CTS测试失败
android.app.cts.SystemFeaturesTest#testSensorFeatures fail junit.framework.AssertionFailedError: PackageManager#hasSystemFeature(android.hardware.sensor.compass) returns true but SensorManager#getSensorList(2) shows sensors [] expected:
根据CTS log分析:是由于默认指南针(compass) Sensor功能是打开的,但是在SensorManager没有枚举到对应的sensor
解决方法:
如果指南针功能不支持,我们关闭对应的系统特性就好了!
hasSystemFeature(String string)方法用于判断系统是否有特定的模块功能,如查询是否有wifi功能,hasSystemFeature(PackageManager.FEATURE_WIFI);
PackageManager.FEATURE_WIFI = "android.hardware.wifi"
"android.hardware.wifi"字符串来源于系统中xxxx.xml文件,搜索一下系统中哪个文件带"android.hardware.sensor.compass"字符串:
wanghl@server:~/work/sdm439_android$ find out/target/product/vs5/ -name "android.hardware.sensor.compass.xml" 2>/dev/null
out/target/product/vs5/vendor/etc/permissions/android.hardware.sensor.compass.xml
wanghl@server:~/work/sdm439_android$ find frameworks/ -name "android.hardware.sensor.compass.xml" 2>/dev/null
frameworks/native/data/etc/android.hardware.sensor.compass.xml
devices目录下覆盖该文件,令他的字段为空,覆盖文件为:
验证方法:
修改前:
wanghl@server:~/work/sdm439_android$ adb shell pm list features | grep "sensor"
feature:android.hardware.camera.capability.manual_sensor
feature:android.hardware.sensor.accelerometer
feature:android.hardware.sensor.compass//目前系统存在指南针特性
feature:android.hardware.sensor.light
feature:android.hardware.sensor.proximity
feature:android.hardware.sensor.stepcounter
feature:android.hardware.sensor.stepdetector
wanghl@server:~/work/sdm439_android$
修改后:覆盖不生效,feature:android.hardware.sensor.compass依然存在,原因是:
device/vinet/vs5/vs5.mk工程的MK文件才是真正执行将.xml文件拷贝到out目录操作的地方,
# Feature definition files for msm8937
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepcounter.xml \
frameworks/native/data/etc/android.hardware.sensor.stepdetector.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepdetector.xml
去除 frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
这一项,不要复制xml文件到out目录下,改完out目录下确实没有该文件了,但是adb shell pm list features依然后compass,原因是还有另外一个文件会拷贝到out目录下:
device/qcom/common/base.mk:1099: frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \
handheld_core_hardware.xml文件存在
但是后面报了一个新的错误:
android.app.cts.SystemFeaturesTest#testSensorFeatures fail junit.framework.AssertionFailedError: PackageManager#hasSystemFeature(android.hardware.sensor.gyroscope) returns false but SensorManager#getSensorList(4) shows sensors [LSM6DSM Gyroscope, LSM6DSM Gyroscope -Wakeup Secondary] expected:
这个是因为我们有陀螺仪的硬件却没有陀螺仪的系统个性,所以出现不匹配的问题,解决方法:在vs5.mk添加对应的陀螺仪属性:PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
- frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
+ frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \
frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepcounter.xml \
=======================================================================================================
typedef enum
{
ROLLOFF_TL84_LIGHT, /* 0:Flourescent */
ROLLOFF_A_LIGHT, /* 1:Incandescent */
ROLLOFF_D65_LIGHT, /* 2:Day Light */
ROLLOFF_H_LIGHT, /* 3:Horizon */ // 306
ROLLOFF_MAX_LIGHT,
ROLLOFF_INVALID_LIGHT = ROLLOFF_MAX_LIGHT
} chromatix_rolloff_light_type;
#define MESH_ROLLOFF_SIZE (17 * 13) //0x302
typedef struct
{
unsigned short VersionNum;
unsigned short OffsetX;
unsigned short OffsetY;
unsigned short RatioX;
unsigned short RatioY;
unsigned short MapWidth;
unsigned short MapHeight;
unsigned short Left_GainMap[MAXLENGTH2D];
unsigned short Right_GainMap[MAXLENGTH2D];
short PD_conversion_coeff[MAX_PDAF_WINDOW];
unsigned short VersionNum_DCC;
unsigned short Q_factor_DCC;
unsigned short MapWidth_DCC;
unsigned short MapHeight_DCC;
} pdaf_2D_cal_data_t;
* binning_factor: 1 for no binning, 2 for V 1/2 H 1/2 binning and so on
* binning_method: 0 for average, 1 for addition (summed)
旧的平台的PDAF log开关:
persist.camera.pdaf_logging
SDM430平台的PDAF log开关:
persist.vendor.camera.pdaf_logging
这是通过 dump PDAF的SO库文件看出来的:
objdump -s vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8937_64/vendor/lib/libmmcamera_pdaf.so > pdaf_so.txt
11cc0 70657273 6973742e 76656e64 6f722e63 persist.vendor.c
11cd0 616d6572 612e7064 61665f6c 6f676769 amera.pdaf_loggi
11ce0 6e670069 6e76616c 69642076 65727369 ng.invalid versi
11cf0 6f6e2070 6172616d 2e0a0050 44205432 on param...
打开摄像头的时候,添加、查看PDAF 初始化log:
+++ b/vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/sensor/module/sensor_pdaf_api.c
@@ -1128,7 +1128,7 @@ boolean pdaf_init(void *sctrl, void *data){
cur_res = ctrl->s_data->cur_res;
out_info = &sensor_lib->out_info_array.out_info[ctrl->s_data->cur_res];
s_data = ctrl->s_data;
-
+ SERR("PDAF_init enter");
if(!out_info->is_pdaf_supported)
return rc;
wanghl@server:~/work/sdm439_android$ adb logcat | grep "pdaf"
03-02 06:58:13.816 543 5611 E mm-camera:
打开camera:
wanghl@server:~/work/sdm439_android$ adb logcat | grep "PDLib"
03-02 07:23:13.324 543 6770 E : PDLib Version: Major: 5 Minor: 3 Revision: 5
默认不会打印,需要打开log开关才会打印:
adb shell setprop persist.vendor.camera.pdaf_logging 1
PD lib v4.5以上,defocus 是无符号 DCC(abs)
对应库文件代码:
11d60 74707574 20627566 6665722e 0a005044 tput buffer...PD
11d70 4c696220 56657273 696f6e3a 204d616a Lib Version: Maj
11d80 6f723a20 2564204d 696e6f72 3a202564 or: %d Minor: %d
11d90 20526576 6973696f 6e3a2025 64007065 Revision: %d.pe
对应之前高通的回复:
高通回复MSM8909不支持PDAF,版本信息只能通过libmmcamera_pdaf.so的log打印出来:
01-14 03:23:24.565 854 3361 E : PDLib Version: Major: 4 Minor: 4 Revision: 0
另外还有一个log打印也是PDLib库打印出来的:
03-05 10:56:17.223 525 4086 E : pdaf cal: version number 4
12190 5f715f66 6f726d61 743d3600 70646166 _q_format=6.pdaf
121a0 2063616c 3a207665 7273696f 6e206e75 cal: version nu
121b0 6d626572 20256400 2f646174 612f7665 mber %d./data/ve
说明PDAF版本就是L4版本
adb shell setprop persist.vendor.camera.pdaf_dump 1
生成dump的RAW文件:
./data/vendor/camera/pdaf_input__undefined_time__0.raw
=======================================================
高通的Quick Charge 2.0充电技术内置有APSD(Automatic Power Source Detection)芯片,能自动对电源进行侦测,识别电量输入是来自什么方向,如PC、电源插座、USB等等,
对每一个电量来源进行IP标记,能够快速辨认。其次,AICL(Automactic Imput Current Limit)技术也能主动去识别电源适配器的属性,进行智能适配,例如知晓输入电流的大小,
根据电流的大小平衡适配器输出的电流和终端所需要的电流。
其实不止OPPO一家深耕于手机快速充电技术的研究,高通在自家骁龙400、600以及800芯片上也内置有Quick Charge 2.0快速充电技术。与OPPO自家的充电技术不同的是,
根据功率(P)=电压(U)x电流(I)的计算公式,在电池容量一定的情况下,高通Quick Charge 2.0将充电电压从5V提高到9V,将充电电流由1A暴增到1.6A,官方宣称3300mAh的电池只要半个钟就能充满60%,
不过为了防止电流电压过大对手机造成影响,高通也在充电器上加入了一个智能的APSD(Automatic Power Source Detection)芯片。
欠压锁定(under voltage lock out),常称之为UVLO,欠压锁定就是当输入电压低于某一值时,电源芯片不工作,处于保护状态
SDM439 SOC ID:
vs5:/ # cat /sys/devices/soc0/soc_id
353
vs5:/ # cat /sys/devices/soc0/platform_subtype_id
4
vs5:/ # cat /sys/devices/soc0/hw_platform
QRD
vs5:/ # getprop ro.board.platform
msm8937
------------------------
SDM429 SOC ID:
vs5:/ # cat /sys/devices/soc0/soc_id
354
msm8937_64:/ # cat /sys/devices/soc0/platform_subtype_id
3
msm8937_64:/ # cat /sys/devices/soc0/hw_platform
QRD
msm8937_64:/ # getprop ro.board.platform
msm8937
---------------------------
wanghl@server:~/work/sdm439_android$ find vendor/ -name "*" | xargs grep "af_pdaf_proc_pd" -n --color 2>/dev/null
匹配到二进制文件 vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8937_64/vendor/lib64/libmmcamera2_stats_lib.so
匹配到二进制文件 vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8937_64/vendor/lib/libmmcamera2_stats_lib.so
persist.vendor.camera.stats.debug.mask
persist.vendor.camera.stats.debug
adb shell setprop persist.vendor.camera.stats.af.debug 5
adb shell setprop persist.vendor.camera.stats.haf.debug 5
wanghl@server:~/work/sdm439_android$ adb logcat | grep "GO_TO_DEST"
03-12 14:35:14.096 534 5810 D mm-camera:
03-12 14:35:14.133 534 5810 D mm-camera:
对着垂直条纹图:
03-12 14:43:57.901 534 6220 D mm-camera:
03-12 14:43:57.901 534 6220 D mm-camera:
03-12 14:43:57.937 534 6220 D mm-camera:
03-12 14:43:57.937 534 6220 D mm-camera:
03-12 14:43:57.967 534 6220 D mm-camera:
03-12 14:43:57.967 534 6220 D mm-camera:
03-12 14:43:58.000 534 6220 D mm-camera:
03-12 14:43:58.000 534 6220 D mm-camera:
03-12 14:43:58.035 534 6220 D mm-camera:
03-12 14:43:58.035 534 6220 D mm-camera:
03-12 14:43:58.068 534 6220 D mm-camera:
03-12 14:43:58.068 534 6220 D mm-camera:
03-12 14:43:58.100 534 6220 D mm-camera:
03-12 14:43:58.100 534 6220 D mm-camera:
03-12 14:43:58.138 534 6220 D mm-camera:
03-12 14:43:58.138 534 6220 D mm-camera:
kernel阶段打印EEPROM的内容:
kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c
#undef CDBG
-#define CDBG(fmt, args...) pr_debug(fmt, ##args)
+#define CDBG(fmt, args...) pr_err(fmt, ##args)
DEFINE_MSM_MUTEX(msm_eeprom_mutex);
#ifdef CONFIG_COMPAT
@@ -415,7 +415,7 @@ static int eeprom_parse_memory_map(struct msm_eeprom_ctrl_t *e_ctrl,
}
memptr = e_ctrl->cal_data.mapdata;
for (i = 0; i < e_ctrl->cal_data.num_data; i++)
- CDBG("memory_data[%d] = 0x%X\n", i, memptr[i]);
+ CDBG("===1.memory_data[%d] = 0x%X\n", i, memptr[i]);
return rc;
userspace阶段(logcat)打印EEPROM内容:
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/eeprom/libs/fp5518/fp5518_eeprom.c
#if 1
for(i=0x0000;i <= 0x0AEB; i++){
SLOW("wanghl otp addr:0x%x data:0x%x",i,e_ctrl->eeprom_params.buffer[i]);
}
#endif
系统默认支持的camera分辨率:
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/mct/pipeline/mct_pipeline.c
===================================================
现象记录:
1.打开普通AF和PDAF功能,但是EEPROM中又没有数据的模组,后摄将无法对焦,去掉PDAF也是不可以对焦!去掉FP5518 EEPROM校准,待验证!
2.后辅摄切到视频模式会挂掉!
抓RAW图:
adb shell setprop persist.vendor.camera.dumpimg 16
adb shell setprop persist.vendor.camera.zsl_raw 1
adb shell setprop persist.vendor.camera.raw_yuv 1
adb shell setprop persist.vendor.camera.snapshot_raw 1
data/vendor/camera/201903160602550r_2560x1920_39.raw
----------------------------------------------
------------------------------------
调LCD注意亮点:
1.
调屏幕的时候,在logo显示阶段应该首先排除logo分区,splash分区的影响,如果spalsh.img的分辨率与屏幕不一致是无法正常显示的,可以选择
fastboot erase splash先擦除splash分区,用默认的小企鹅的图片显示
2.如果LK显示阶段,初始化代码指令多下了0xFF,0xFF,0xFF,0xFF 的空指令,将会使得后续的所有初始化指令执行失败,初始化失败,关闭屏幕,关闭背光。
3.如果出现规律性的黑屏,亮屏循环现象,有可能是ESD check的寄存器命令或返回值出错。v51项目二供恒久瑞说ESD check不稳定,建议量产的时候不开。
-------------------------------------
ubuntu14.04挂载新硬盘:
1.插入硬盘,检查系统有没有监测到硬盘插入?
sudo fdisk -lu 查看硬盘及分区情况,只有硬盘和分区信息,没有挂载点信息:
Disk /dev/sda: 256.1 GB, 256060514304 bytes//固态SSD
255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sda doesn't contain a valid partition table//没有有效分区表
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes//本机系统所在第一块硬盘
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00012482
设备 启动 起点 终点 块数 Id 系统
/dev/sdb1 * 2048 585727 291840 83 Linux
/dev/sdb2 585728 40585215 19999744 83 Linux
/dev/sdb3 40585216 56586239 8000512 82 Linux 交换 / Solaris
/dev/sdb4 56586240 1953523711 948468736 83 Linux
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes//新插入的第二快硬盘
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/sdc doesn't contain a valid partition table//没有有效分区表
2.将硬盘/dev/sdc格式化成ext4格式:
sudo mkfs -t ext4 /dev/sdc
3.手动挂在硬盘/dev/sdc分区
1)先查看硬盘挂在的情况:
wanghl@server:~$ sudo df -lh
文件系统 容量 已用 可用 已用% 挂载点
udev 7.9G 4.0K 7.9G 1% /dev
tmpfs 1.6G 6.0M 1.6G 1% /run
/dev/sdb2 19G 7.4G 11G 42% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 7.9G 23M 7.9G 1% /run/shm
none 100M 52K 100M 1% /run/user
/dev/sdb1 268M 43M 208M 17% /boot
/dev/sdb4 891G 735G 111G 87% /home
/dev/sda 235G 11G 212G 5% /home/ssd
2)手动挂载:
sudo mount -t ext4 /dev/sdc /home/code(/home/code挂载目录需要新建)
3)再次查看挂载情况:
wanghl@server:~$ sudo df -lh
文件系统 容量 已用 可用 已用% 挂载点
udev 7.9G 4.0K 7.9G 1% /dev
tmpfs 1.6G 6.0M 1.6G 1% /run
/dev/sdb2 19G 7.4G 11G 42% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 7.9G 23M 7.9G 1% /run/shm
none 100M 52K 100M 1% /run/user
/dev/sdb1 268M 43M 208M 17% /boot
/dev/sdb4 891G 736G 110G 88% /home
/dev/sda 235G 11G 212G 5% /home/ssd
/dev/sdc 917G 72M 871G 1% /home/code//新的分区挂载到home/code下了,接着就可以愉快地在code目录下clone代码了
4.设置开机自启动,开机自动挂在分区到指定挂在目录:
sudo vi /etc/fstab
新增一行挂载命令:
/dev/sdc /home/code ext4 defaults 0 2
重启,搞定!
===============================================================
手动改动配置:
adb push camera_config.xml vendor/etc/camera/camera_config.xml
安装骁龙相机:
adb install out/target/product/vs5A/system/priv-app/SnapdragonCamera/SnapdragonCamera.apk
3A sync:
AEC(auto exposure control),自动曝光控制
AF SYNC
AWB
Bokeh Mode:
打开HAL3的开关:
public static boolean getCamera2Mode() {
return PERSIST_CAMERA_CAMERA2;
}
private static final boolean PERSIST_CAMERA_CAMERA2 =
SystemProperties.getBoolean("persist.sys.camera.camera2", false);
adb shell setprop persist.sys.camera.camera2 1
但是设置之后,SnapCamera打不开,报错:
真正崩溃的原因是vendor下缺少高通私有的库文件,这些是为API2增加的功能,API1是不会用到这样的库文件的
03-26 04:01:42.285 5887 5887 E linker : library "/system/lib64/libjni_imageutil.so" ("/system/lib64/libjni_imageutil.so") needed or dlopened by "/system/lib64/libnativeloader.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="", permitted_paths="/data:/mnt/expand:/data/data/org.codeaurora.snapcam"]
这个只是检查了key,只是警告,不是真正崩溃的原因:
03-26 13:41:21.882 10083 10083 W System.err: org.json.JSONException: No value for pref_camera2_flashmode_key
所以骁龙相机没办法强制走API2,只能走API1
int halVersion, int deviceVersion, apiLevel effectiveApiLevel三者之间的判定规则,决定是走API1,API2,HAL1,HAL3,打开camera的时候就会去调用:
frameworks/av/services/camera/libcameraservice/CameraService.cpp
Status CameraService::makeClient(const sp
const sp
int api1CameraId, int facing, int clientPid, uid_t clientUid, int servicePid,
bool legacyMode, int halVersion, int deviceVersion, apiLevel effectiveApiLevel,
/*out*/sp
if (halVersion < 0 || halVersion == deviceVersion) {
// Default path: HAL version is unspecified by caller, create CameraClient
// based on device version reported by the HAL.
switch(deviceVersion) {
case CAMERA_DEVICE_API_VERSION_1_0:
if (effectiveApiLevel == API_1) { // Camera1 API route
sp
*client = new CameraClient(cameraService, tmp, packageName,
api1CameraId, facing, clientPid, clientUid,
getpid(), legacyMode);
} else { // Camera2 API route
ALOGW("Camera using old HAL version: %d", deviceVersion);
return STATUS_ERROR_FMT(ERROR_DEPRECATED_HAL,
"Camera device \"%s\" HAL version %d does not support camera2 API",
cameraId.string(), deviceVersion);
}
break;
case CAMERA_DEVICE_API_VERSION_3_0:
case CAMERA_DEVICE_API_VERSION_3_1:
case CAMERA_DEVICE_API_VERSION_3_2:
case CAMERA_DEVICE_API_VERSION_3_3:
case CAMERA_DEVICE_API_VERSION_3_4:
if (effectiveApiLevel == API_1) { // Camera1 API route
sp
*client = new Camera2Client(cameraService, tmp, packageName,
cameraId, api1CameraId,
facing, clientPid, clientUid,
servicePid, legacyMode);
} else { // Camera2 API route
sp
static_cast
*client = new CameraDeviceClient(cameraService, tmp, packageName, cameraId,
facing, clientPid, clientUid, servicePid);
}
break;
default:
// Should not be reachable
ALOGE("Unknown camera device HAL version: %d", deviceVersion);
return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
"Camera device \"%s\" has unknown HAL version %d",
cameraId.string(), deviceVersion);
}
} else {
// A particular HAL version is requested by caller. Create CameraClient
// based on the requested HAL version.
if (deviceVersion > CAMERA_DEVICE_API_VERSION_1_0 &&
halVersion == CAMERA_DEVICE_API_VERSION_1_0) {
// Only support higher HAL version device opened as HAL1.0 device.
sp
*client = new CameraClient(cameraService, tmp, packageName,
api1CameraId, facing, clientPid, clientUid,
servicePid, legacyMode);
} else {
// Other combinations (e.g. HAL3.x open as HAL2.x) are not supported yet.
ALOGE("Invalid camera HAL version %x: HAL %x device can only be"
" opened as HAL %x device", halVersion, deviceVersion,
CAMERA_DEVICE_API_VERSION_1_0);
return STATUS_ERROR_FMT(ERROR_ILLEGAL_ARGUMENT,
"Camera device \"%s\" (HAL version %d) cannot be opened as HAL version %d",
cameraId.string(), deviceVersion, halVersion);
}
}
return Status::ok();
}
使用命令检查Camera HAL版本(检查Camera HAL device device@后面的数值,1.x即为HAL1版本,3.x即为HAL3版本)
wanghl@server:~/work/sdm439_android$ adb shell dumpsys media.camera | grep "Camera HAL"
== Camera HAL device [email protected]/legacy/0 (v1.0) static information: ==
== Camera HAL device [email protected]/legacy/0 (v1.0) dumpState: ==
== Camera HAL device [email protected]/legacy/0 (v3.3) static information: ==
== Camera HAL device [email protected]/legacy/0 (v3.3) dumpState: ==
== Camera HAL device [email protected]/legacy/1 (v1.0) static information: ==
== Camera HAL device [email protected]/legacy/1 (v1.0) dumpState: ==
== Camera HAL device [email protected]/legacy/1 (v3.3) static information: ==
== Camera HAL device [email protected]/legacy/1 (v3.3) dumpState: ==
== Camera HAL device [email protected]/legacy/2 (v1.0) static information: ==
== Camera HAL device [email protected]/legacy/2 (v1.0) dumpState: ==
== Camera HAL device [email protected]/legacy/2 (v3.3) static information: ==
== Camera HAL device [email protected]/legacy/2 (v3.3) dumpState: ==
== Camera HAL device [email protected]/legacy/3 (v1.0) static information: ==
== Camera HAL device [email protected]/legacy/3 (v1.0) dumpState: ==
== Camera HAL device [email protected]/legacy/3 (v3.3) static information: ==
== Camera HAL device [email protected]/legacy/3 (v3.3) dumpState: ==
说明我们的系统1.0和3.3都支持
原生骁龙相机:API1调用HAL1,打开双摄
03-26 12:01:10.949 719 9262 W CameraService: ===[wanghl]halVersion: 0x100, deviceVersion = 0x303, effectiveApiLevel = 1===
03-26 12:01:11.122 559 1622 E QCamera :
03-26 12:01:11.123 559 1622 E QCamera :
halVersion:CAMERA_DEVICE_API_VERSION_1_0
deviceVersion:CAMERA_DEVICE_API_VERSION_3_3
effectiveApiLevel:API_1
根据以上代码判断,最终走HAL1.0
API1调用HAL3:,打开双摄
03-26 12:13:17.345 719 9262 W CameraService: ===[wanghl]halVersion: 0xffffffff, deviceVersion = 0x303, effectiveApiLevel = 1===
03-26 13:13:38.538 714 3628 W CameraService: ===[wanghl]halVersion < 0===
03-26 13:13:38.538 714 3628 W CameraService: ===[wanghl]API_1 ===
03-26 12:13:17.466 559 1622 E QCamera :
03-26 12:13:17.467 559 1622 E QCamera :
halVersion: 0xffffffff,halVersion是一个int值,int halVersion = 0xffffffff,就是2的32次方,实际上int值的范围是(-2的31次方到2的31次方-1),超出范围后则0xffffffff取它的补码,
正数的补码和原码相同,负数的补码按位取反,然后加1,0xffffffff,符号位(最高位)是1,所以这个数是负数,内存中的数值为补码表示。最高位符号位不变,还是1,其余各位按位取反,末尾加1,结果就是1000 0000 0000 0000 0000 0000 0000 0001,也就是-1,halVersion满足小于0的条件,
halVersion < 0
deviceVersion:CAMERA_DEVICE_API_VERSION_3_3
effectiveApiLevel:API_1
代码走的是:Camera2Client,但是挂掉,打不开预览
API2调用HAL3:,打开双摄
03-26 12:23:41.991 719 2063 W CameraService: ===[wanghl]halVersion: 0xffffffff, deviceVersion = 0x303, effectiveApiLevel = 2===
03-26 13:13:38.538 714 3628 W CameraService: ===[wanghl]halVersion < 0===
03-26 13:13:38.538 714 3628 W CameraService: ===[wanghl]API_2 ===
03-26 12:23:41.999 559 9423 E QCamera :
03-26 12:23:42.000 559 9423 E QCamera :
03-26 12:23:42.247 559 9423 E QCamera :
03-26 12:23:42.287 559 9423 E QCamera :
halVersion < 0
deviceVersion:CAMERA_DEVICE_API_VERSION_3_3
effectiveApiLevel:API_2
代码走的是:CameraDeviceClient,可以打开预览
工厂测试APP:打开辅摄
03-26 12:34:37.737 719 9262 W CameraService: ===[wanghl]halVersion: 0xffffffff, deviceVersion = 0x303, effectiveApiLevel = 2===
03-26 13:13:38.538 714 3628 W CameraService: ===[wanghl]halVersion < 0===
03-26 13:13:38.538 714 3628 W CameraService: ===[wanghl]API_2 ===
03-26 12:34:37.750 559 559 E QCamera :
03-26 12:34:37.751 559 559 E QCamera :
03-26 12:34:37.937 559 559 E QCamera :
halVersion < 0
deviceVersion:CAMERA_DEVICE_API_VERSION_3_3
effectiveApiLevel:API_2
代码走的是:CameraDeviceClient,可以打开预览
HAL1:流程:
frameworks/base/core/java/android/hardware/Camera.java
open->Camera->cameraInitNormal->cameraInitVersion
556 private int cameraInitVersion(int cameraId, int halVersion) {
//Force HAL1 if the package name falls in this bucket
String packageList = SystemProperties.get("vendor.camera.hal1.packagelist", "");//强制添加apk包名到这个属性,可以令他强制走HAL1
if (packageList.length() > 0) {
TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
splitter.setString(packageList);
for (String str : splitter) {
if (packageName.equals(str)) {
halVersion = CAMERA_HAL_API_VERSION_1_0;
break;
}
}
}
wanghl@server:~/work/sdm439_android$ adb shell getprop vendor.camera.hal1.packagelist
com.skype.raider,com.google.android.talk//这两个应用强制走HAL1
我使用APP同事写的API2调用HAL3的双摄APP,添加log打印如下:
//HAL3才会打印这个log:
wanghl@server:~/work/sdm439_android$ adb logcat | grep "sensor_mount_angle"
03-26 04:10:21.181 552 1644 E QCamera :
03-26 04:10:21.234 552 1644 E QCamera :
修改/hardware/qcom/camera/QCamera2/util/QCameraFOVControl.cpp
@@ -200,6 +200,7 @@ cam_capability_t QCameraFOVControl::consolidateCapabilities(
uint32_t previewSizesTblCntMain = capsMainCam->preview_sizes_tbl_cnt;
uint32_t previewSizesTblCntAux = capsAuxCam->preview_sizes_tbl_cnt;
uint32_t previewSizesTblCntFinal = 0;
+ capsConsolidated.sensor_mount_angle = capsAuxCam->sensor_mount_angle;
for (uint32_t i = 0; i < previewSizesTblCntMain; ++i) {
for (uint32_t j = 0; j < previewSizesTblCntAux; ++j) {
wanghl@server:~/work/sdm439_android$ adb logcat | grep "sensor_mount_angle"
03-26 09:48:48.921 549 14764 E QCamera :
03-26 09:48:48.974 549 14764 E QCamera :
但是切换到Bokeh Mode会变成主摄翻转180,所以该改这里并不合适!修改如下:
1)hardware/qcom/camera/QCamera2/util/QCameraFOVControl.cpp
@@ -212,6 +212,7 @@ cam_capability_t QCameraFOVControl::consolidateCapabilities(
capsAuxCam->preview_sizes_tbl[j].width;//副摄预览宽度大小最为双摄预览大小
capsConsolidated.preview_sizes_tbl[previewSizesTblCntFinal].height =
capsAuxCam->preview_sizes_tbl[j].height;//副摄预览高度大小最为双摄预览大小
+ capsConsolidated.sensor_mount_angle = capsAuxCam->sensor_mount_angle; //to fix angle of aux preview in dual camera
}
2)为了规避bokeh mode倒了180度的问题,打开bokeh mode的时候,把主摄预览改为辅摄预览:
hardware/qcom/camera/QCamera2/util/QCameraFOVControl.cpp
@@ -212,6 +212,9 @@ cam_capability_t QCameraFOVControl::consolidateCapabilities(
capsAuxCam->preview_sizes_tbl[j].width;
capsConsolidated.preview_sizes_tbl[previewSizesTblCntFinal].height =
capsAuxCam->preview_sizes_tbl[j].height;
+ #if FIX_DUALCAMERA_ANGLE
+ capsConsolidated.sensor_mount_angle = capsAuxCam->sensor_mount_angle; //to fix angle of aux preview in dual camera(upside down for 180)
+ #endif
}
++previewSizesTblCntFinal;
QCamera2HWI.cpp (z:\home\wanghl\work\sdm439_android\hardware\qcom\camera\qcamera2\hal): *gCamCapability[mCameraId] = m_pFovControl->consolidateCapabilities(
QCamera3HWI.cpp (z:\home\wanghl\work\sdm439_android\hardware\qcom\camera\qcamera2\hal3): *gCamCapability[cameraId] = pFovControl->consolidateCapabilities(
另外不管是走HAL1还是HAL3都是会去调用consolidateCapabilities这个方法
-----------------------------------------------------------------------
骁龙相机打开camera的方法:
packages/apps/SnapdragonCamera/src/com/android/camera/AndroidCameraManagerImpl.java
233 @Override
234 public void handleMessage(final Message msg) {
235 try {
236 switch (msg.what) {
237 case OPEN_CAMERA:
238 try {
239 Method openMethod = Class.forName("android.hardware.Camera").getMethod(
240 "openLegacy", int.class, int.class);//反射,
241 mCamera = (android.hardware.Camera) openMethod.invoke(//invoke用于去调用某个类里没有public的方法,强制调用,比普通APP的方法多传了halversion参数
242 null, msg.arg1, CAMERA_HAL_API_VERSION_1_0);
243 } catch (Exception e) {
244 /* Retry with open if openLegacy doesn't exist/fails */
245 Log.v(TAG, "openLegacy failed due to " + e.getMessage()
246 + ", using open instead");
247 mCamera = android.hardware.Camera.open(msg.arg1);
248 }
"android.hardware.Camera"这个类所在的文件是Camera.java,我们在framework目录下去找这个文件:
wanghl@server:~/work/sdm439_android$ find frameworks/ -name "Camera.java" 2>/dev/null
frameworks/base/core/java/android/hardware/Camera.java//API1
frameworks/base/graphics/java/android/graphics/Camera.java
符合路径是android/hardware/Camera.java(android.hardware就是代表framework下的路径)的就是frameworks/base/core/java/android/hardware/Camera.java
打开这个文件去搜索"openLegacy"这个方法:
* @hide//hide的就是不public的方法:
*/
public static Camera openLegacy(int cameraId, int halVersion) {
if (halVersion < CAMERA_HAL_API_VERSION_1_0) {//传-1不会报错
throw new IllegalArgumentException("Invalid HAL version " + halVersion);
}
return new Camera(cameraId, halVersion);
}
往下搜索Camera(cameraId, halVersion);这个方法:
/**
* Create a legacy camera object.
*
* @param cameraId The hardware camera to access, between 0 and
* {@link #getNumberOfCameras()}-1.
* @param halVersion The HAL API version this camera device to be opened as.
*/
private Camera(int cameraId, int halVersion) {
int err = cameraInitVersion(cameraId, halVersion);//再查找这个方法
if (checkInitErrors(err)) {
if (err == -EACCES) {
throw new RuntimeException("Fail to connect to camera service");
} else if (err == -ENODEV) {
throw new RuntimeException("Camera initialization failed");
} else if (err == -ENOSYS) {
throw new RuntimeException("Camera initialization failed because some methods"
+ " are not implemented");
} else if (err == -EOPNOTSUPP) {
throw new RuntimeException("Camera initialization failed because the hal"
+ " version is not supported by this device");
} else if (err == -EINVAL) {
throw new RuntimeException("Camera initialization failed because the input"
+ " arugments are invalid");
} else if (err == -EBUSY) {
throw new RuntimeException("Camera initialization failed because the camera"
+ " device was already opened");
} else if (err == -EUSERS) {
throw new RuntimeException("Camera initialization failed because the max"
+ " number of camera devices were already opened");
}
// Should never hit this.
throw new RuntimeException("Unknown camera error");
}
}
private int cameraInitVersion(int cameraId, int halVersion) {
mShutterCallback = null;
mRawImageCallback = null;
mJpegCallback = null;
mPreviewCallback = null;
mPostviewCallback = null;
mUsingPreviewAllocation = false;
mZoomListener = null;
/* ### QC ADD-ONS: START */
mCameraDataCallback = null;
mCameraMetaDataCallback = null;
/* ### QC ADD-ONS: END */
Looper looper;
if ((looper = Looper.myLooper()) != null) {
mEventHandler = new EventHandler(this, looper);
} else if ((looper = Looper.getMainLooper()) != null) {
mEventHandler = new EventHandler(this, looper);
} else {
mEventHandler = null;
}
String packageName = ActivityThread.currentOpPackageName();
//Force HAL1 if the package name falls in this bucket
String packageList = SystemProperties.get("vendor.camera.hal1.packagelist", "");
if (packageList.length() > 0) {
TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
splitter.setString(packageList);
for (String str : splitter) {
if (packageName.equals(str)) {
halVersion = CAMERA_HAL_API_VERSION_1_0;//如果包名有在vendor.camera.hal1.packagelist属性表立面,强制走HAL1.0
break;
}
}
}
return native_setup(new WeakReference
}
//这个方法可能是普通APP调用opencamera的时候的调用:先打开camera设备,openCamera();
/** used by Camera#open, Camera#open(int) */
Camera(int cameraId) {
if(cameraId >= getNumberOfCameras()){
throw new RuntimeException("Unknown camera ID");
}
int err = cameraInitNormal(cameraId);
if (checkInitErrors(err)) {
if (err == -EACCES) {
throw new RuntimeException("Fail to connect to camera service");
} else if (err == -ENODEV) {
throw new RuntimeException("Camera initialization failed");
}
// Should never hit this.
throw new RuntimeException("Unknown camera error");
}
initAppOps();
}
---------------------------------
Exception in thread "main" java.lang.IllegalArgumentException: Multiple entries with same key: android/hardware/Camera$CameraInfo=com.google.turbine.binder.bound.SourceBoundClass@3fd7a715 and android/hardware/Camera$CameraInfo=com.google.turbine.binder.bound.SourceBoundClass@711f39f9
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:186)
at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:102)
at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:88)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:359)
at com.google.turbine.binder.env.SimpleEnv$Builder.build(SimpleEnv.java:48)
at com.google.turbine.binder.Binder.bindSourceBoundClasses(Binder.java:124)
at com.google.turbine.binder.Binder.bind(Binder.java:74)
at com.google.turbine.main.Main.compile(Main.java:76)
at com.google.turbine.main.Main.compile(Main.java:61)
at com.google.turbine.main.Main.main(Main.java:56)
vs5代码编译不过,换了另外一块硬盘的代码能够编译过,费解
---------------------------------------------
Soong是以前Android基于make的编译系统的替代品。它以Android.bp文件替代Android.mk,Android.bp文件用类似JSON的简洁声明来描述需要构建的模块。
编译系统变化
随着android工程越来越大,包含的module越来越多,以makefile组织的项目编译花费的时间越来越多。谷歌在7.0开始引入了ninja进行编译系统的组织。相对于make来说ninja在大的项目管理中速度
和并行方面有突出的优势,因此谷歌采用了ninja来取代之前使用的make。但是现有的android项目还是由makefile组织,因此谷歌引入了kati将makefile翻译成ninja文件。 从Android 7.0开始,
android的编译系统发生了变化,之前依赖Makefile组织编译系统,
从7.0开始逐步引入了kati soong(optional未正式使用,需要USE_SOONG=true开启),将Android.mk文件转化成ninja文件,
使用ninja文件对编译系统进行管理。
从8.0开始,android 引入了Android.bp文件来替代之前的Android.mk文件,不同于Android.mk,Android.bp只是纯粹的配置文件,不包括分支、循环等流程控制。
在android项目上如何进行选择编译、解析配置、转换成ninja等,Soong就被创造出来,将Android.bp转换为ninja文件进行管理。
同时,Soong还会编译生成一个androidmk命令可以手动将Android.mk
转换成Android.bp文件。
-------------------------------------------
双摄预览倒180度的问题:
强制修改骁龙相机,API1调用HAL3的话,1)setting会扫掉很多设置项,bokeh也不见了! 2)第一次打开后辅摄会挂掉,第二次才能打开
/packages/apps/SnapdragonCamera/src/com/android/camera/AndroidCameraManagerImpl.java
@@ -239,7 +239,7 @@ class AndroidCameraManagerImpl implements CameraManager {
Method openMethod = Class.forName("android.hardware.Camera").getMethod(
"openLegacy", int.class, int.class);
mCamera = (android.hardware.Camera) openMethod.invoke(
- null, msg.arg1, CAMERA_HAL_API_VERSION_1_0);
+ null, msg.arg1, -1);
} catch (Exception e) {
03-29 04:47:46.962 551 6994 E QCamera :
03-29 04:47:46.962 551 6994 E QCamera :
/*Enum to inform about camera type in dual camera use-cases*/
typedef enum {
CAM_ROLE_DEFAULT,//0
CAM_ROLE_BAYER,//1
CAM_ROLE_MONO,//2
CAM_ROLE_WIDE,//3
CAM_ROLE_TELE,//4
CAM_ROLE_WIDE_FALLBACK,//5
} cam_dual_camera_role_t;
双摄:
04-01 08:38:19.001 561 9543 E QCamera :
04-01 08:38:19.001 561 9543 E QCamera :
04-01 08:38:19.001 561 9543 E QCamera :
04-01 08:38:19.001 561 9543 E QCamera :
Bokeh mode:
04-01 08:48:17.744 561 9995 E QCamera :
04-01 08:48:17.744 561 9995 E QCamera :
04-01 08:48:17.744 561 9995 E QCamera :
04-01 08:48:17.744 561 9995 E QCamera :
04-01 08:48:17.744 561 9995 E QCamera :
04-01 08:48:17.744 561 9995 E QCamera :
04-01 08:48:17.744 561 9995 E QCamera :
04-01 08:48:17.776 561 9996 E QCamera :
04-01 08:48:17.776 561 9996 E QCamera :
04-01 08:48:17.776 561 9996 E QCamera :
04-01 08:48:17.971 561 9995 E QCamera :
04-01 08:48:17.971 561 9995 E QCamera :
04-01 08:48:17.971 561 9995 E QCamera :
04-01 08:48:17.972 561 9995 E QCamera :
--------------------------------------------------------------------------------------------------
辅摄和双摄倒切换到video模式挂掉的问题:
{ 1600, 1200}, // 2MP UXGA
1.log分析:
挂掉时候的log:
03-16 13:35:46.683 5458 5458 E AndroidRuntime: FATAL EXCEPTION: main
03-16 13:35:46.683 5458 5458 E AndroidRuntime: Process: org.codeaurora.snapcam, PID: 5458
03-16 13:35:46.683 5458 5458 E AndroidRuntime: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
03-16 13:35:46.683 5458 5458 E AndroidRuntime: at java.util.ArrayList.get(ArrayList.java:437)
03-16 13:35:46.683 5458 5458 E AndroidRuntime: at com.android.camera.CameraSettings.getSupportedHighestVideoQuality(CameraSettings.java:421) //com.android.camera.CameraSettings代表文件路径/com/android/camera/CameraSettings.java
packages/apps/SnapdragonCamera/src/com/android/camera/CameraSettings.java调用getSupportedHighestVideoQuality的时候数组下标溢出了,
public static String getSupportedHighestVideoQuality(
int cameraId, Parameters parameters) {
// When launching the camera app first time, we will set the video quality
// to the first one (i.e. highest quality) in the supported list
List
assert (supported != null) : "No supported video quality is found";
return supported.get(0);//CameraSettings.java:421,supported这个List里面没有内容,又去取内容,就提示数组下标溢出了,supported的获取为空了,也就是getSupportedVideoQualities(cameraId,parameters);获取不到内容
}
在函数getSupportedVideoQualities添加log分析:
public static ArrayList
ArrayList
List
Log.d(TAG,"[wanghl]getSupportedVideoQualities");
for (String videoSize : temp) {
Log.d(TAG,"[wanghl]videoSize=" + videoSize);
if (VIDEO_QUALITY_TABLE.containsKey(videoSize)) {
Log.d(TAG,"[wanghl]videoSize in the VIDEO_QUALITY_TABLE");
int profile = VIDEO_QUALITY_TABLE.get(videoSize);
if (CamcorderProfile.hasProfile(cameraId, profile)) {
Log.d(TAG,"[wanghl]profile:"+profile+", videoSize:"+videoSize);
supported.add(videoSize);
}
}
}
return supported;
}
我这样添加log,然后发现:
1. 看parameters.getSupportedVideoSizes()是否有值--有返回值
2. 它的值是否在VIDEO_QUALITY_TABLE中--有些分辨率有
3,在VIDEO_QUALITY_TABLE的值media profile中是否有配置 --都没有配置
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]getSupportedVideoQualities
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=1280x960
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=1280x720
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=1280x480
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=1280x400
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=864x480
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=800x480
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=720x480
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=640x480
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=480x640
04-01 08:05:05.632 5417 5417 D CameraSettings: [wanghl]videoSize=640x360
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=480x360
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=480x320
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=352x288
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=320x240
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=240x320
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=176x144
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=144x176
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=160x120
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]getSupportedVideoQualities
04-01 08:05:05.633 5417 5417 D CameraSettings: [wanghl]videoSize=1280x960
04-01 08:05:05.635 5417 5417 D CameraSettings: [wanghl]videoSize=1280x720
04-01 08:05:05.635 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.635 5417 5417 D CameraSettings: [wanghl]videoSize=1280x480
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=1280x400
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=864x480
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=800x480
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=720x480
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=640x480
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=480x640
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=640x360
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=480x360
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=480x320
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=352x288
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=320x240
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=240x320
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=176x144
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=144x176
04-01 08:05:05.636 5417 5417 D CameraSettings: [wanghl]videoSize=160x120
所以问题就出在:CamcorderProfile.hasProfile(cameraId, profile)匹配不到profle
media profile配置文件:
原生:
device/qcom/msm8937_32/media/media_profiles_8937.xml
定制项目:
device/vinet/vs5A_open/media/media_profiles_8937.xml
device/vinet/vs5A_open/vs5A_open.mk
125 # media_profiles and media_codecs xmls for msm8937
126 ifeq ($(TARGET_ENABLE_QC_AV_ENHANCEMENTS), true)
127 PRODUCT_COPY_FILES += device/vinet/vs5A_open/media/media_profiles_8937.xml:system/etc/media_profiles.xml \
128 device/vinet/vs5A_open/media/media_profiles_8937.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml \
这两个文件其实是一样,
1|vs5A:/ # find . -name "*profiles*" 2>/dev/null
./system/etc/media_profiles_V1_0.dtd
./system/etc/media_profiles.xml//就是它了
./system/etc/cne/Nexus/VZW/VZW_profiles.xml
./system/etc/cne/Nexus/ROW/ROW_profiles.xml
./system/etc/cne/Nexus/ATT/ATT_profiles.xml
./system/etc/media_profiles_8956.xml
./vendor/etc/media_profiles_V1_0.xml
./vendor/etc/media_profiles_vendor.xml//或者是他
./vendor/etc/media_profiles.xml
./vendor/etc/media_profiles_8956.xml
./data/misc/profiles
device/vinet/vs5A_open/media/media_profiles_8937.xml修改添加camera id 2和camera id 3配置后就能找到profile了,全编译才能起作用,push不起作用
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]getSupportedVideoQualities
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize=1280x960
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize=1280x720
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]profile:5, videoSize:1280x720
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize=1280x480
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize=1280x400
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize=864x480
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize=800x480
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize=720x480
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 12:19:53.618 5656 5656 D CameraSettings: [wanghl]profile:4, videoSize:720x480
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=640x480
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]profile:10000, videoSize:640x480
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=480x640
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=640x360
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=480x360
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=480x320
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=352x288
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]profile:3, videoSize:352x288
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=320x240
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]profile:7, videoSize:320x240
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=240x320
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=176x144
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize in the VIDEO_QUALITY_TABLE
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]profile:2, videoSize:176x144
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=144x176
04-01 12:19:53.619 5656 5656 D CameraSettings: [wanghl]videoSize=160x120
追一下CamcorderProfile.hasProfile(cameraId, profile)这个函数
import android.media.CamcorderProfile;
android.media.CamcorderProfile所在文件在:
frameworks/base/media/java/android/media/CamcorderProfile.java
查找hasProfile(cameraId, profile)方法:
public static boolean hasProfile(int cameraId, int quality) {
return native_has_camcorder_profile(cameraId, quality);
}
native_has_camcorder_profile就跳到C++的JNI层:
frameworks/base/media/jni/android_media_MediaProfiles.cpp
static const JNINativeMethod gMethodsForCamcorderProfileClass[] = {
{"native_init", "()V", (void *)android_media_MediaProfiles_native_init},
{"native_get_camcorder_profile", "(II)Landroid/media/CamcorderProfile;",
(void *)android_media_MediaProfiles_native_get_camcorder_profile},
{"native_has_camcorder_profile", "(II)Z",
(void *)android_media_MediaProfiles_native_has_camcorder_profile},//指定到android_media_MediaProfiles_native_has_camcorder_profile方法
};
228 static jboolean
229 android_media_MediaProfiles_native_has_camcorder_profile(JNIEnv* /* env */, jobject /* thiz */,
230 jint id, jint quality)
231 {
232 ALOGV("native_has_camcorder_profile: %d %d", id, quality);
233 if (!isCamcorderQualityKnown(quality)) {
234 return JNI_FALSE;
235 }
236
237 camcorder_quality q = static_cast
238 return sProfiles->hasCamcorderProfile(id, q) ? JNI_TRUE : JNI_FALSE;
239 }
MediaProfiles *sProfiles = NULL;
frameworks/av/include/media/MediaProfiles.h
class MediaProfiles
{
public:
/*
* If property media.settings.xml is not set:
*
* getInstance() will search through paths listed in xmlFiles.
* The search goes through members of xmlFiles in the order that they are
* defined, so files at lower indices have higher priority than those at
* higher indices.
*
* TODO: Add runtime validation of xml files. A search should be considered
* successful only when validation is successful.
*/
static constexpr char const * const xmlFiles[] = {
"odm/etc/media_profiles_V1_0.xml",
"vendor/etc/media_profiles_V1_0.xml",
"system/etc/media_profiles.xml"
};
...
/**
* Returns true if a profile for the given camera at the given quality exists,
* or false if not.
*/
bool hasCamcorderProfile(int cameraId, camcorder_quality quality) const;
...
}
frameworks/av/media/libmedia/MediaProfiles.cpp
bool MediaProfiles::hasCamcorderProfile(int cameraId, camcorder_quality quality) const
{
return (getCamcorderProfileIndex(cameraId, quality) != -1);
}
int MediaProfiles::getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const
{
int index = -1;
for (size_t i = 0, n = mCamcorderProfiles.size(); i < n; ++i) {
if (mCamcorderProfiles[i]->mCameraId == cameraId &&
mCamcorderProfiles[i]->mQuality == quality) {
index = i;
break;
}
}
return index;
}
profiles->mCamcorderProfiles.size()
MediaProfiles *profiles
所以profiles也是一个MediaProfiles,也就是xml文件:
"odm/etc/media_profiles_V1_0.xml",
"vendor/etc/media_profiles_V1_0.xml",
"system/etc/media_profiles.xml"
------------------------------------------------------------------------------
确认双摄两路视频流都有输出?
04-02 02:29:42.088 544 1598 I QCamera :
04-02 02:29:42.089 544 6808 I QCamera :
04-02 02:29:42.120 544 6811 E mm-camera:
04-02 02:29:42.120 544 6811 E mm-camera:
04-02 02:29:42.120 544 6811 E mm-camera:
驱动需要增加HW sync寄存器指令,SENSOR_SET_DUALCAM_SETTINGS
高通回复:
12-09 10:59:06.878 782 5840 E mm-camera:
12-09 10:59:06.878 782 5811 E mm-camera:
切换到双摄的一些ERROR log
04-03 09:02:37.148 8399 9358 E mm-camera:
04-03 09:02:37.351 8399 8806 E mm-camera:
04-03 09:02:37.392 8483 9250 E MediaPlayerNative: error (1, -2147483648)
04-03 09:02:37.425 8483 9250 E MediaPlayerNative: error (1, -2147483648)
04-03 09:02:37.458 8483 9250 E MediaPlayerNative: error (1, -2147483648)
04-03 09:02:37.547 8399 8806 I mm-camera:
04-03 09:02:37.553 8399 8806 E mm-camera:
04-03 09:02:37.553 8399 8806 E mm-camera:
04-03 09:02:37.593 8399 8806 E mm-camera:
04-03 09:02:37.601 8399 8806 E mm-camera:
04-03 09:02:37.601 8399 8806 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.611 8399 9477 E mm-camera:
04-03 09:02:37.630 8399 9477 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.641 8399 9451 E mm-camera:
04-03 09:02:37.675 8399 9451 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.678 8399 9477 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.679 8399 9451 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.681 8399 9477 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.682 8399 9451 E mm-camera:
04-03 09:02:37.705 8399 9455 E mm-camera:
04-03 09:02:37.745 8399 9481 E mm-camera:
04-03 09:02:37.745 8399 9481 E mm-camera:
04-03 09:02:37.841 8399 9467 E mm-camera:
04-03 09:02:37.841 8399 9467 E mm-camera:
04-03 09:02:37.882 8399 9490 E mm-camera:
04-03 09:02:37.888 8399 9451 E mm-camera:
04-03 09:02:37.891 8399 9451 E mm-camera:
04-03 09:02:37.892 8399 9477 E mm-camera:
04-03 09:02:37.897 8399 9451 E mm-camera:
04-03 09:02:37.900 8399 9477 E mm-camera:
04-03 09:02:37.903 8399 9451 E mm-camera:
04-03 09:02:37.905 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.933 8399 9477 E mm-camera:
04-03 09:02:37.971 8399 9477 E mm-camera:
04-03 09:02:37.982 8399 9490 E mm-camera:
04-03 09:02:37.983 8399 9477 E mm-camera:
04-03 09:02:37.983 8399 9491 E mm-camera:
04-03 09:02:37.983 8399 9491 E mm-camera:
04-03 09:02:37.983 8399 9491 E mm-camera:
04-03 09:02:37.983 8399 9491 E mm-camera:
04-03 09:02:37.983 8399 9491 E mm-camera:
04-03 09:02:38.000 8399 9477 E mm-camera:
04-03 09:02:38.010 8399 9477 E mm-camera:
04-03 09:02:38.015 8399 9477 E mm-camera:
04-03 09:02:38.016 8399 9477 E mm-camera:
04-03 09:02:38.017 8399 9477 E mm-camera:
04-03 09:02:38.022 8399 9477 E mm-camera:
04-03 09:02:38.023 8399 9477 E mm-camera:
04-03 09:02:38.033 8399 9477 E mm-camera:
04-03 09:02:38.037 8399 9477 E mm-camera:
04-03 09:02:38.042 8399 9451 I mm-camera:
04-03 09:02:38.042 8399 9451 I mm-camera:
04-03 09:02:38.045 8399 9451 I mm-camera:
04-03 09:02:38.045 8399 9451 I mm-camera:
04-03 09:02:38.050 8399 9451 I mm-camera:
04-03 09:02:38.050 8399 9451 I mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.053 8399 9451 E mm-camera:
04-03 09:02:38.072 8399 9451 E mm-camera:
04-03 09:02:38.075 8399 9467 E mm-camera:
04-03 09:02:38.076 8399 9468 E mm-camera:
04-03 09:02:38.076 8399 9468 E mm-camera:
04-03 09:02:38.078 8399 9451 E mm-camera:
04-03 09:02:38.094 8399 9451 E mm-camera:
04-03 09:02:38.101 8399 9451 E mm-camera:
04-03 09:02:38.108 8399 9451 E mm-camera:
04-03 09:02:38.109 8399 9451 E mm-camera:
04-03 09:02:38.115 8399 9451 E mm-camera:
04-03 09:02:38.124 8399 9451 E mm-camera:
04-03 09:02:38.127 8399 9451 E mm-camera:
04-03 09:02:38.145 8399 9491 E mm-camera:
04-03 09:02:38.145 8399 9491 E mm-camera:
04-03 09:02:38.145 8399 9491 E mm-camera:
04-03 09:02:38.165 8399 9531 E mm-camera: