V853使用MIPI CSI接口是否只支持RAW格式像素?
-
因为给的V853 sensor支持列表全都是raw格式的摄像头,我再在/tina-v853-open/lichee/linux-4.9/drivers/media/platform/sunxi-vin/modules/sensor文件夹下搜索mipi_bps,因为mipi摄像头肯定要设置这个参数,结果只找到rn6854和nvp名称开头的驱动是使用YUV像素的,但这些传感器在kernel_menuconfig里都不能选中。
我再仔细看了看教程,用到的名词是"YUV 的并口模组",用的是例子是OV5640,它的驱动里没有设置mipi_bps,所以,,是我误解了?V853的MIPI CSI不能接收YUV格式像素? -
@xjy_5 MIPI CSI接收的是RAW数据,不支持YUV这样的
-
@awwwwa 难怪这么久都没有成,一开始就错了,呜呜呜...
现在又有了另一个问题,TC358743里有另一个模式使用的是MEDIA_BUS_FMT_RGB888_1X24,这个V853支持吗?现在我找了半天大概也是不支持 -
@xjy_5 RGB888_1X24 我感觉是直出RGB信号的吧
这个DTSI是在T507上配置的,可以参考一下
vind0:vind@0 { compatible = "allwinner,sunxi-vin-media", "simple-bus"; #address-cells = <2>; #size-cells = <2>; ranges; device_id = <0>; vind0_clk = <384000000>; reg = <0x0 0x06600800 0x0 0x200>, <0x0 0x06600000 0x0 0x800>; clocks = <&clk_csi_top>, <&clk_pll_csi>, <&clk_csi_master0>, <&clk_hosc>, <&clk_pll_csi>, <&clk_csi_master1>, <&clk_hosc>, <&clk_pll_csi>; pinctrl-names = "mclk0-default","mclk0-sleep","mclk1-default","mclk1-sleep"; pinctrl-0 = <&csi_mclk0_pins_a>; pinctrl-1 = <&csi_mclk0_pins_b>; pinctrl-2 = <&csi_mclk1_pins_a>; pinctrl-3 = <&csi_mclk1_pins_b>; status = "okay"; csi_cci0:cci@0 { compatible = "allwinner,sunxi-csi_cci"; reg = <0x0 0x06614000 0x0 0x400>; interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; pinctrl-names = "default","sleep"; pinctrl-0 = <&csi_cci0_pins_a>; pinctrl-1 = <&csi_cci0_pins_b>; device_id = <0>; status = "okay"; }; csi_cci1:cci@1 { compatible = "allwinner,sunxi-csi_cci"; reg = <0x0 0x06614400 0x0 0x400>; interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>; pinctrl-names = "default","sleep"; pinctrl-0 = <&csi_cci1_pins_a>; pinctrl-1 = <&csi_cci1_pins_b>; device_id = <1>; status = "okay"; }; csi0:csi@0 { device_type = "csi0"; compatible = "allwinner,sunxi-csi"; reg = <0x0 0x06601000 0x0 0x1000>; interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; device_id = <0>; iommus = <&mmu_aw 4 1>; status = "okay"; }; csi1:csi@1 { device_type = "csi1"; compatible = "allwinner,sunxi-csi"; reg = <0x0 0x06602000 0x0 0x1000>; interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; pinctrl-names = "default","sleep"; pinctrl-0 = <&csi1_pins_a>; pinctrl-1 = <&csi1_pins_b>; device_id = <1>; iommus = <&mmu_aw 4 1>; status = "okay"; }; mipi0:mipi@0 { compatible = "allwinner,sunxi-mipi"; reg = <0x0 0x0660C000 0x0 0x1000>; interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; device_id = <0>; status = "okay"; }; isp0:isp@0 { compatible = "allwinner,sunxi-isp"; device_id = <0>; status = "okay"; }; isp1:isp@1 { compatible = "allwinner,sunxi-isp"; device_id = <1>; status = "okay"; }; scaler0:scaler@0 { compatible = "allwinner,sunxi-scaler"; device_id = <0>; iommus = <&mmu_aw 4 1>; status = "okay"; }; scaler1:scaler@1 { compatible = "allwinner,sunxi-scaler"; device_id = <1>; iommus = <&mmu_aw 4 1>; status = "okay"; }; scaler2:scaler@2 { compatible = "allwinner,sunxi-scaler"; device_id = <2>; iommus = <&mmu_aw 4 1>; status = "okay"; }; scaler3:scaler@3 { compatible = "allwinner,sunxi-scaler"; device_id = <3>; iommus = <&mmu_aw 4 1>; status = "okay"; }; scaler4:scaler@4 { compatible = "allwinner,sunxi-scaler"; device_id = <4>; iommus = <&mmu_aw 4 1>; status = "okay"; }; scaler5:scaler@5 { compatible = "allwinner,sunxi-scaler"; device_id = <5>; iommus = <&mmu_aw 4 1>; status = "okay"; }; actuator0:actuator@0 { device_type = "actuator0"; compatible = "allwinner,sunxi-actuator"; actuator0_name = "ad5820_act"; actuator0_slave = <0x18>; actuator0_af_pwdn = <>; actuator0_afvdd = "afvcc-csi"; actuator0_afvdd_vol = <2800000>; status = "disabled"; }; flash0:flash@0 { device_type = "flash0"; compatible = "allwinner,sunxi-flash"; flash0_type = <2>; flash0_en = <>; flash0_mode = <>; flash0_flvdd = ""; flash0_flvdd_vol = <>; device_id = <0>; status = "disabled"; }; sensor0:sensor@0 { device_type = "sensor0"; compatible = "allwinner,sunxi-sensor"; sensor0_mname = "tc358743_mipi"; sensor0_twi_cci_id = <2>; sensor0_twi_addr = <0x1f>; sensor0_mclk_id = <0>; sensor0_pos = "rear"; sensor0_isp_used = <0>; sensor0_fmt = <0>; sensor0_stby_mode = <0>; sensor0_vflip = <0>; sensor0_hflip = <0>; sensor0_cameravdd-supply = <>; sensor0_cameravdd_vol = <2800000>; sensor0_iovdd-supply = <®_cldo4>; sensor0_iovdd_vol = <1800000>; sensor0_avdd-supply = <>; sensor0_avdd_vol = <>; sensor0_dvdd-supply = <>; sensor0_dvdd_vol = <>; sensor0_power_en = <>; sensor0_reset = <&pio PI 8 1 0 1 0>; sensor0_pwdn = <>; sensor0_sm_vs = <>; flash_handle = <&flash0>; act_handle = <&actuator0>; device_id = <0>; status = "okay"; }; sensor1:sensor@1 { device_type = "sensor1"; compatible = "allwinner,sunxi-sensor"; sensor1_mname = "ov5647"; sensor1_twi_cci_id = <1>; sensor1_twi_addr = <0x6c>; sensor1_mclk_id = <1>; sensor1_pos = "front"; sensor1_isp_used = <0>; sensor1_fmt = <0>; sensor1_stby_mode = <0>; sensor1_vflip = <0>; sensor1_hflip = <0>; sensor1_cameravdd-supply = <>; sensor1_cameravdd_vol = <2800000>; sensor1_iovdd-supply = <>; sensor1_iovdd_vol = <2800000>; sensor1_avdd-supply = <>; sensor1_avdd_vol = <2800000>; sensor1_dvdd-supply = <>; sensor1_dvdd_vol = <1500000>; sensor1_power_en = <>; sensor1_reset = <&pio PE 14 1 0 1 0>; sensor1_pwdn = <&pio PE 15 1 0 1 0>; sensor1_sm_vs = <>; flash_handle = <>; act_handle = <>; device_id = <1>; status = "disable"; }; vinc0:vinc@0 { device_type = "vinc0"; compatible = "allwinner,sunxi-vin-core"; reg = <0x0 0x06609000 0x0 0x200>; interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; vinc0_csi_sel = <0>; vinc0_mipi_sel = <0>; vinc0_isp_sel = <0>; vinc0_isp_tx_ch = <0>; vinc0_rear_sensor_sel = <0>; vinc0_front_sensor_sel = <0>; vinc0_sensor_list = <0>; device_id = <0>; iommus = <&mmu_aw 4 1>; status = "okay"; }; vinc1:vinc@1 { device_type = "vinc1"; compatible = "allwinner,sunxi-vin-core"; reg = <0x0 0x06609200 0x0 0x200>; interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; vinc1_csi_sel = <0>; vinc1_mipi_sel = <0>; vinc1_isp_sel = <0>; vinc1_isp_tx_ch = <0>; vinc1_rear_sensor_sel = <0>; vinc1_front_sensor_sel = <0>; vinc1_sensor_list = <0>; device_id = <1>; iommus = <&mmu_aw 4 1>; status = "okay"; }; vinc2:vinc@2 { device_type = "vinc2"; compatible = "allwinner,sunxi-vin-core"; reg = <0x0 0x06609400 0x0 0x200>; interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; vinc2_csi_sel = <0>; vinc2_mipi_sel = <0>; vinc2_isp_sel = <0>; vinc2_isp_tx_ch = <0>; vinc2_rear_sensor_sel = <0>; vinc2_front_sensor_sel = <0>; vinc2_sensor_list = <0>; device_id = <2>; iommus = <&mmu_aw 4 1>; status = "disabled"; }; vinc3:vinc@3 { device_type = "vinc3"; compatible = "allwinner,sunxi-vin-core"; reg = <0x0 0x06609600 0x0 0x200>; interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; vinc3_csi_sel = <0>; vinc3_mipi_sel = <0>; vinc3_isp_sel = <0>; vinc3_isp_tx_ch = <0>; vinc3_rear_sensor_sel = <0>; vinc3_front_sensor_sel = <0>; vinc3_sensor_list = <0>; device_id = <3>; iommus = <&mmu_aw 4 1>; status = "disabled"; }; vinc4:vinc@4 { device_type = "vinc4"; compatible = "allwinner,sunxi-vin-core"; reg = <0x0 0x06609800 0x0 0x200>; interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; vinc4_csi_sel = <1>; vinc4_mipi_sel = <0xff>; vinc4_isp_sel = <1>; vinc4_isp_tx_ch = <0>; vinc4_rear_sensor_sel = <1>; vinc4_front_sensor_sel = <1>; vinc4_sensor_list = <0>; device_id = <4>; iommus = <&mmu_aw 5 1>; status = "disabled"; }; vinc5:vinc@5 { device_type = "vinc5"; compatible = "allwinner,sunxi-vin-core"; reg = <0x0 0x06609A00 0x0 0x200>; interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; vinc5_csi_sel = <1>; vinc5_mipi_sel = <0xff>; vinc5_isp_sel = <1>; vinc5_isp_tx_ch = <0>; vinc5_rear_sensor_sel = <1>; vinc5_front_sensor_sel = <1>; vinc5_sensor_list = <0>; device_id = <5>; iommus = <&mmu_aw 5 1>; status = "disabled"; }; };
-
重新确认了一下,MIPI 接受的数据格式与MIPI无关,也就是MIPI也可以接收YUV这类数据。
是否是因为后端配置的问题。参考T507的TC358743驱动配置的是
MEDIA_BUS_FMT_UYVY8_2X8
-
@awwwwa 应该后端设置出问题了,开了VIN_LOG_FMT,能看到这些内容
[ 275.372862] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 [ 275.379926] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 [ 275.387026] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 [ 275.393968] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 [ 275.400968] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 2006 1 [ 275.407939] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 3001 1 [ 275.414908] [VIN]sd coutinue sd:-562396204 pipesd:-563186176 [ 275.421282] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 275.428284] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 275.435211] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 275.442505] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1
-
@awwwwa 我这边设备树的设置
sensor0:sensor@0 { device_type = "sensor0"; sensor0_mname = "rk628_mipi"; sensor0_twi_cci_id = <1>; sensor0_twi_addr = <0xA0>; sensor0_mclk_id = <0>; sensor0_pos = "rear"; sensor0_isp_used = <0>; sensor0_fmt = <0>; sensor0_stby_mode = <0>; sensor0_vflip = <0>; sensor0_hflip = <0>; sensor0_iovdd-supply = <®_aldo2>; sensor0_iovdd_vol = <1800000>; sensor0_avdd-supply = <>; sensor0_avdd_vol = <>; sensor0_dvdd-supply = <>; sensor0_dvdd_vol = <>; flash_handle = <&flash0>; act_handle = <&actuator0>; device_id = <0>; status = "okay"; };
驱动里的设置
/* * Store information about the video data format. */ static struct sensor_format_struct sensor_formats[] = { { .desc = "UYVY 4:2:2", .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */ .regs = 0, .regs_size = 0, .bpp = 2, }, };
根据VIN_LOG_FMT的debug信息,抓图时它会调用到sunxi_isp_subdev_set_fmt函数,而sunxi_isp_formats的定义并未包含YUV格式像素,我想问题应该就在这,但是不敢乱改代码,也不知道怎么改
static struct isp_pix_fmt sunxi_isp_formats[] = { { .fourcc = V4L2_PIX_FMT_SBGGR8, .mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8, .infmt = ISP_BGGR, .input_bit = RAW_8, }, { .fourcc = V4L2_PIX_FMT_SGBRG8, .mbus_code = MEDIA_BUS_FMT_SGBRG8_1X8, .infmt = ISP_GBRG, .input_bit = RAW_8, }, { .fourcc = V4L2_PIX_FMT_SGRBG8, .mbus_code = MEDIA_BUS_FMT_SGRBG8_1X8, .infmt = ISP_GRBG, .input_bit = RAW_8, }, { .fourcc = V4L2_PIX_FMT_SRGGB8, .mbus_code = MEDIA_BUS_FMT_SRGGB8_1X8, .infmt = ISP_RGGB, .input_bit = RAW_8, }, { .fourcc = V4L2_PIX_FMT_SBGGR10, .mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, .infmt = ISP_BGGR, .input_bit = RAW_10, }, { .fourcc = V4L2_PIX_FMT_SGBRG8, .mbus_code = MEDIA_BUS_FMT_SGBRG10_1X10, .infmt = ISP_GBRG, .input_bit = RAW_10, }, { .fourcc = V4L2_PIX_FMT_SGRBG10, .mbus_code = MEDIA_BUS_FMT_SGRBG10_1X10, .infmt = ISP_GRBG, .input_bit = RAW_10, }, { .fourcc = V4L2_PIX_FMT_SRGGB10, .mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10, .infmt = ISP_RGGB, .input_bit = RAW_10, }, { .fourcc = V4L2_PIX_FMT_SBGGR12, .mbus_code = MEDIA_BUS_FMT_SBGGR12_1X12, .infmt = ISP_BGGR, .input_bit = RAW_12, }, { .fourcc = V4L2_PIX_FMT_SGBRG12, .mbus_code = MEDIA_BUS_FMT_SGBRG12_1X12, .infmt = ISP_GBRG, .input_bit = RAW_12, }, { .fourcc = V4L2_PIX_FMT_SGRBG12, .mbus_code = MEDIA_BUS_FMT_SGRBG12_1X12, .infmt = ISP_GRBG, .input_bit = RAW_12, }, { .fourcc = V4L2_PIX_FMT_SRGGB12, .mbus_code = MEDIA_BUS_FMT_SRGGB12_1X12, .infmt = ISP_RGGB, .input_bit = RAW_12, }, };
-
@awwwwa 是不是要改ISP驱动啊?还是说应用层调用的时候有什么办法不使用ISP?
-
@xjy_5 驱动都不用ISP,ISP是上层用户程序定义的,可以用camerademo抓图测试绕过ISP
-
sensor0:sensor@0 { device_type = "sensor0"; sensor0_mname = "gc2053_mipi"; /* 必须要和驱动的 SENSOR_NAME 一致 */ sensor0_twi_cci_id = <1>; /* 所使用的twi id号,本例中使用的是twi1,故填写为1 */ sensor0_twi_addr = <0x6e>; /* sensor 设备ID地址,必须与驱动中的I2C_ADDR一致 */ sensor0_mclk_id = <0>; /* 所使用的mclk id号,本例中使用的是MCLK0,故填写为0 */ sensor0_pos = "rear"; sensor0_isp_used = <1>; /* 所使用的sensor为raw sensor,需要过ISP处理,故填写为1 */ sensor0_fmt = <1>; /* sensor输出的图像格式,YUV:0,RAW:1 */ sensor0_stby_mode = <0>; sensor0_vflip = <0>; /* VIPP 图像垂直翻转 */ sensor0_hflip = <0>; /* VIPP 图像水平翻转 */ sensor0_iovdd-supply = <®_aldo2>;/* sensor iovdd 连接的 ldo,根据硬件原理图的连接来决定(在硬件原理图中搜索aldo,然后找到CSI-iovdd对应的 是哪一个aldo即可) */ sensor0_iovdd_vol = <1800000>; /* iovdd的电压 */ sensor0_avdd-supply = <®_bldo2>; /* sensor avdd连接的 ldo,根据硬件原理图的连接来决定 */ sensor0_avdd_vol = <2800000>; /* 同上 */ sensor0_dvdd-supply = <®_dldo2>; /* 同上 */ sensor0_dvdd_vol = <1200000>; /* 同上 */ sensor0_power_en = <>; sensor0_reset = <&pio PA 11 1 0 1 0>; /* GPIO 信息配置:pio 端口 组内序号 功能分配 内部电阻状态 驱动能力 输出电平状态,本例中使用的是PA11*/ sensor0_pwdn = <&pio PA 9 1 0 1 0>; /* GPIO 信息配置:pio 端口 组内序号 功能分配 内部电阻状态 驱动能力 输出电平状态,本例中使用的是PA9*/ flash_handle = <&flash0>; act_handle = <&actuator0>; status = "okay"; };
填写
Sensor
输出图像格式
sensor
输出图像格式定义在sensor_format_struct
结构体中,vin v4l2
驱动框架通过获取sensor_format_struct
结构体成员信息来获取当前sensor
输出图像格式,sensor_formats
结构体中需要填写的成员是.desc
和.mbus_code
。
.desc
是描述sensor
输出的图像格式,本例中gc2053
是RGB Raw sensor
,故.desc
成员填写为"Raw RGB Bayer"
。.mbus_code
为sensor
图像数据输出顺序,sensor RAW
图像是以Bayer
格式传输的(每个像素只表示RGB
其中一个分量),常见的Bayer
格式为:RGGB
、BGGR
、GRBG
、GBRG
,这个可以询问一下sensor
原厂或者翻阅sensor datasheet
进行查找。.mbus_code
若填错, 会导致色彩偏紫红和出现网格状纹理。 本例中
gc2053
图像输出格式为RGGB
,且当前的配置是10bit mipi
接口,故.mbus_code
填写为
MEDIA_BUS_FMT_SRGGB10_1X10
,若当前调试的sensor
配置是8bit
输出,
则.mbus_code
填写为MEDIA_BUS_FMT_SRGGB8_1X8
,按照这种规则进行填写。static struct sensor_format_struct sensor_formats[] = { { .desc = "Raw RGB Bayer", /* 填写 Sensor 初始化时默认的 Bayer 格式,目的是告知主控端ISP当前图像的 Bayer 格式,ISP需要以同样的格式来接收和处理图像数据 */ .mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10, .regs = sensor_fmt_raw, .regs_size = ARRAY_SIZE(sensor_fmt_raw), .bpp = 1 }, };
如果
sensor
输出图像格式是YUV
的话,则需要根据sensor
图像数据输出顺序选择YUYV/VYUY/UYVY/YVYU
其中一种,如下:static struct sensor_format_struct sensor_formats[] = { { .desc = "YUYV 4:2:2", .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8, .regs = sensor_fmt_raw, .regs_size = ARRAY_SIZE(sensor_fmt_raw), .bpp = 2, }, };
同时,
sensor_get_fmt_mbus_core
函数也要将当前sensor
的图像输出格式赋值给函数参数*code
,有些sensor
在翻转后RGB
顺序不会自动进行调整,需要主控端ISP
需要按照当前sensor
翻转后的图像格式更新RGB
顺序,避免翻转后出现图像色彩异常的问题,如下,gc2053
支持翻转后sensor
内部自动调整RGB
顺序,所以函数参数*code仍赋值为MEDIA_BUS_FMT_SRGGB10_1X10
。static int sensor_get_fmt_mbus_core(struct v4l2_subdev *sd, int *code) { *code = MEDIA_BUS_FMT_SRGGB10_1X10; // gc2053 support change the rgb format by itself } static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) { int ret = 0; struct sensor_info *info = to_state(sd); switch (cmd) { case VIDIOC_VIN_GET_SENSOR_CODE: /* vin v4l2框架层在sensor翻转接口被调用后, 通过VIDIOC_VIN_GET_SENSOR_CODE获取当前sensor的RGB顺序 */ sensor_get_fmt_mbus_core(sd, (int *)arg); break; default: return -EINVAL; } return ret; }
-
@awwwwa 现在这个VIN_LOG_FMT信息就是用camerademo出来的
root@TinaLinux:/# camerademo setting [CAMERA]********************************************************** [CAMERA]* * [CAMERA]* this is camera test. * [CAMERA]* * [CAMERA]********************************************************** [CAMERA] Please input the setting parameters according to the prompts. [CAMERA]********************************************************** [CAMERA] open /dev/video0! [CAMERA]********************************************************** [CAMERA]********************************************************** [CAMERA] Please enter the data save path: /root/pic [CAMERA] Please enter the number of captured photos: 3 [CAMERA] Please enter the data save type: [CAMERA] 0:save BMP and YUV formats [CAMERA] 1:save BMP format [CAMERA] 2:save YUV format 2 [CAMERA]************************[ 8937.879172] [rk628_mipi]PWR_ON! ********************************[ 8937.886596] [rk628_mipi]sensor_init ** [CAMERA] The path to data sa[ 8937.893118] rk628_mipi 1-0050: RK628 I2C driver version: 00.00.08 ving is /root/pic. [CAMERA] The[ 8937.901698] [rk628_mipi]do nothing rk628 init over number of captured photos is 3.[ 8937.909981] [VIN]fmt yuv mask [CAMERA] save yuv format [ 8937.916008] [VIN_LOG_FMT]rk628_mipi sensor_set_fmt 640*480 0x2008 0xffffffff [ 8937.926317] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 [ 8937.933353] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 [ 8937.940457] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 [ 8937.947415] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 [ 8937.954397] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 2006 1 [ 8937.961354] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 3001 1 [ 8937.968357] [VIN]sd coutinue sd:-562396204 pipesd:-563186176 [ 8937.974701] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 8937.981689] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 8937.988660] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 8937.995940] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 640*480 3001 1 [ 8938.002974] [VIN]sd coutinue sd:-546217488 pipesd:-563186176 ... [CAMERA]********************************************************* [CAMERA] The sensor supports the following formats : [CAMERA] index 0 : YUV422P [CAMERA] index 1 : NV16 [CAMERA] index 2 : NV61 [CAMERA] index 3 : YUV420 [CAMERA] index 4 : YVU420 [CAMERA] index 5 : NV12 [CAMERA] index 6 : NV21 [CAMERA] index 7 : BGGR8 [CAMERA] index 8 : GBRG8 [CAMERA] index 9 : GRBG8 [CAMERA] index 10 : RGGB8 [CAMERA] index 11 : BGGR10 [CAMERA] index 12 : GBRG10 [CAMERA] index 13 : GRBG10 [CAMERA] index 14 : RGGB10 [CAMERA] index 15 : BGGR12 [CAMERA] index 16 : GBRG12 [CAMERA] index 17 : GRBG12 [CAMERA] index 18 : RGGB12 [CAMERA] index 19 : YUYV [CAMERA] index 20 : UYVY [CAMERA] index 21 : VYUY [CAMERA] index 22 : YVYU [CAMERA] index 23 : YUYV [CAMERA] index 24 : UYVY [CAMERA] index 25 : VYUY [CAMERA] index 26 : YVYU [CAMERA] index 27 : UYVY [CAMERA] index 28 : VYUY [CAMERA] index 29 : YVYU [CAMERA] index 30 : YUYV [CAMERA] Please enter the serial number you need for pixelformat: 0 [CAMERA] The input value is 0. [CAMERA] camera pixelformat: YUV422P [CAMERA]********************************************************** [CAMERA] The YUV422P supports the following resolutions: [CAMERA] Index 0 : 1920 * 1080 [CAMERA] Please enter the serial number you need for windows size: 0 [CAMERA] The input value is 0. [ 9072.528405] [VIN]fmt yuv mask [CAMERA] Resolution size : 1920 [ 9072.534471] [VIN_LOG_FMT]rk628_mipi sensor_set_fmt 1920*1080 0x2008 0x1 * 1080 [CAMERA] The photo save [ 9072.544715] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 path is /root/pic. [CAMERA] The[ 9072.554467] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 number of photos taken is 3. [[ 9072.564306] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 CAMERA]usr cap mplane begin io[ 9072.573988] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 n_alloc_open pid: 1398, g_allo[ 9072.583725] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 2006 1 c_context = 0xb6ea2f70 [CAMERA[ 9072.593411] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 3001 1 ] Camera capture framerate is 60[ 9072.603182] [VIN]sd coutinue sd:-562396204 pipesd:-563186176 /1 [ 9072.612239] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 9072.619571] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 9072.626530] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 9072.633790] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 9072.641057] [VIN]sd coutinue sd:-546217488 pipesd:-563186176 [ 9072.647460] [VIN]code coutinue code:12289 tcode:8200 [ 9072.653041] [VIN_LOG_FMT]rk628_mipi sensor_set_fmt 1920*1080 0x2006 0x1 [ 9072.660520] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 [ 9072.667605] [VIN_LOG_FMT]sunxi_mipi_subdev_set_fmt 1920*1080 2006 1 [ 9072.674677] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 [ 9072.681636] [VIN_LOG_FMT]sunxi_csi_subdev_set_fmt 1920*1080 2006 1 [ 9072.688640] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 2006 1 [ 9072.695596] [VIN_LOG_FMT]sunxi_tdm_subdev_set_fmt 1920*1080 3001 1 [ 9072.702569] [VIN]sd coutinue sd:-562396204 pipesd:-563186176 [ 9072.708941] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 9072.715923] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 9072.722860] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 9072.730157] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 9072.737419] [VIN]sd coutinue sd:-546217488 pipesd:-563186176 [ 9072.743803] [VIN]code coutinue code:12289 tcode:8198 ... [ 9073.672793] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 9073.679792] [VIN_LOG_FMT]sunxi_isp_subdev_set_fmt 1920*1080 3001 1 [ 9073.686747] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 9073.694002] [VIN_LOG_FMT]sunxi_scaler_subdev_set_fmt 1920*1080 3001 1 [ 9073.701259] [VIN]sd coutinue sd:-546217488 pipesd:-563186176 [ 9073.707658] [VIN]code coutinue code:12289 tcode:8203 [ 9073.713228] [VIN]fin code:0x3001 fincou:13 [ 9073.717871] [VIN_ERR]vin is not support this pixelformat [ 9073.723821] [VIN_ERR]vin_pipeline_try_format failed [CAMERA_ERR] setting t[ 9073.729444] [rk628_mipi]PWR_OFF!do nothing he data format failed! root@TinaLinux:/#
-
@awwwwa reset脚,中断脚我在设备树其他地方定义,在驱动的sensor_init里获取来用了,也能用,iic是用rk628原本的regmap,也能用,不过这些放一边先。
驱动里设置 MEDIA_BUS_FMT_UYVY8_2X8 用camerademo抓图应该设置那个像素格式?使用gc2053的经验告诉我,设备树里关掉isp后抓图设置的像素格式应该和驱动里设置的一致,那MEDIA_BUS_FMT_UYVY8_2X8 对应的是哪个?int return_format(char *short_name) { if (strcmp(short_name, "YUV422P") == 0) return V4L2_PIX_FMT_YUV422P; else if (strcmp(short_name, "YUV420") == 0) return V4L2_PIX_FMT_YUV420; else if (strcmp(short_name, "YVU420") == 0) return V4L2_PIX_FMT_YVU420; else if (strcmp(short_name, "NV16") == 0) return V4L2_PIX_FMT_NV16; else if (strcmp(short_name, "NV12") == 0) return V4L2_PIX_FMT_NV12; else if (strcmp(short_name, "NV61") == 0) return V4L2_PIX_FMT_NV61; else if (strcmp(short_name, "NV21") == 0) return V4L2_PIX_FMT_NV21; else if (strcmp(short_name, "YUYV") == 0) return V4L2_PIX_FMT_YUYV; else if (strcmp(short_name, "YVYU") == 0) return V4L2_PIX_FMT_YVYU; else if (strcmp(short_name, "UYVY") == 0) return V4L2_PIX_FMT_UYVY; else if (strcmp(short_name, "VYUY") == 0) return V4L2_PIX_FMT_VYUY; else if (strcmp(short_name, "MJPEG") == 0) return V4L2_PIX_FMT_MJPEG; else if (strcmp(short_name, "H264") == 0) return V4L2_PIX_FMT_H264; else if (strcmp(short_name, "BGGR8") == 0) return V4L2_PIX_FMT_SBGGR8; else if (strcmp(short_name, "GBRG8") == 0) return V4L2_PIX_FMT_SGBRG8; else if (strcmp(short_name, "GRBG8") == 0) return V4L2_PIX_FMT_SGRBG8; else if (strcmp(short_name, "RGGB8") == 0) return V4L2_PIX_FMT_SRGGB8; else if (strcmp(short_name, "BGGR10") == 0) return V4L2_PIX_FMT_SBGGR10; else if (strcmp(short_name, "GBRG10") == 0) return V4L2_PIX_FMT_SGBRG10; else if (strcmp(short_name, "GRBG10") == 0) return V4L2_PIX_FMT_SGRBG10; else if (strcmp(short_name, "RGGB10") == 0) return V4L2_PIX_FMT_SRGGB10; else if (strcmp(short_name, "BGGR12") == 0) return V4L2_PIX_FMT_SBGGR12; else if (strcmp(short_name, "GBRG12") == 0) return V4L2_PIX_FMT_SGBRG12; else if (strcmp(short_name, "GRBG12") == 0) return V4L2_PIX_FMT_SGRBG12; else if (strcmp(short_name, "RGGB12") == 0) return V4L2_PIX_FMT_SRGGB12; else return -1; }
-
@awwwwa 要是有办法绕掉sunxi_isp.c就好了 ,sunxi_csi_formats里都有MEDIA_BUS_FMT_UYVY8_2X8的定义了
-
@xjy_5 一般来说配置sensor0_isp_used = <0>; 就不会调用ISP,虽然会配置但是不会处理。需要再跟踪一下调用
-
@awwwwa 出图了,黑白色,我的天,今晚做梦都能笑出来了,哈哈
主要改了sunxi_isp_formats 和 sunxi_tdm_formats ,添加了含MEDIA_BUS_FMT_UYVY8_2X8的定义static struct tdm_format sunxi_tdm_formats[] = { { .code = MEDIA_BUS_FMT_UYVY8_2X8, .input_type = INPUTTPYE_8BIT, .input_bit_width = RAW_8BIT, .raw_fmt = BAYER_RGGB, },{ ...
static struct isp_pix_fmt sunxi_isp_formats[] = { { .fourcc = V4L2_PIX_FMT_YUV422P, .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, .infmt = ISP_BGGR, .input_bit = RAW_8, },{ ...
用yuvplayer看的图
-
@awwwwa 能看到有点彩色,但和图像有偏移
-
@awwwwa 果然这邪门方法还是不想,出图了,黑白色搞不定,除非继续深挖改写代码,这样这块只会变得越来越像屎山,有没有什么靠谱的办法啊。
-
@awwwwa 看来设备树里关ISP只是不使用硬件ISP但set_fmt还是会在代码里面过过,我开了ISP就出现isp error了,现在看来抓图应该是抓成功了,但数据格式不太对,有颜色,颜色都有偏移,文件大小也稍大了些,理论上192010802=417200字节,实际上是4177920字节,多出来什么了?
我截图桌面用ffmpeg转成yuv422图片确实是417200字节
-
@xjy_5 这个不太清楚了,没有调试过这款芯片。我这边是T507+TC358743实现的
-
@awwwwa 我这边想走硬件获取视频输入好适配H264编码,像素格式YUV422P,默认mpp的程序里是不支持这个格式的,原来的就只有YUV420,请问有哪个设备的SDK适配了YUV422P像素格式的摄像头吗?我参考参考程序
在videoInputHW.c里有
-
@xjy_5 请问最后有成功支持TC358743吗?
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号