【Android Camera】SOF Freeze

    sof freeze(SOF:start of frame)表示ISP这边没有收到sensor这边输出的图像帧数据,这时必须检查 CSID/CSIPHY/CAMIF是否出错。有专门建立了thread来负责SOF的检测,start_sof_check_thread() -> mct_bus_sof_thread_run(),log当中会有下面的错误发出:

// msm-3.18/drivers/media/platform/msm/camera_v2/msm.c

      case MSM_CAM_V4L2_IOCTL_NOTIFY_DEBUG: {
          if (event_data->status) {
              pr_err("%s:Notifying subdevs about potential sof freeze\n",
                  __func__);

  首先看能否dump出现数据:

/*
0 Disabled; this value is set by default
2 Dump preview frames
8 Dump snapshot frames
16 Dump video frames
*/

adb root
adb shell setprop persist.camera.isp.dump 8
adb shell chmod 777 /data

  Verifying the VFE hardware configuration

In the msm_isp_axis_util.c file, locate the following code snippet:

if (vfe_dev->dump_reg)
    msm_camera_io_dump_2(vfe_dev->vfe_base, 0x900);

Replace it with:

if (1)
    msm_camera_io_dump_2(vfe_dev->vfe_base, 0x900);

  若声明的传感器输出大小与 VFE 实际接收到的传感器输出大小之间不匹配,将发生 CAMIF错误。

//mm-camera/mm-camera2/media-controller/modules/iface2/iface_util.c

static void iface_util_dump_camif_cfg(struct msm_vfe_input_cfg *input_cfg)                                                                       
{
  struct msm_vfe_pix_cfg *pix_cfg = NULL;
  
  if (input_cfg == NULL)
    return;
  
  pix_cfg = &input_cfg->d.pix_cfg;
  IFACE_HIGH("=====Camif DUMP cfg for PIX interface====\n");
  IFACE_HIGH("camif input type = %d(MIPI=3), op_pix_clk = %d\n",
    pix_cfg->camif_cfg.camif_input, input_cfg->input_pix_clk);
  IFACE_HIGH("camif pix_pattern(RGRG-0/GRGR-1/BGBG-2/GBGB-3) = %d\n",
    pix_cfg->pixel_pattern);
  IFACE_HIGH("camif first_pix = %d, last_pix = %d\n",
    pix_cfg->camif_cfg.first_pixel, pix_cfg->camif_cfg.last_pixel);
  IFACE_HIGH("camif first_line = %d, last_line = %d\n",
    pix_cfg->camif_cfg.first_line, pix_cfg->camif_cfg.last_line);
  IFACE_HIGH("camif pixels_per_line = %d, lines_per_frame = %d\n",
    pix_cfg->camif_cfg.pixels_per_line, pix_cfg->camif_cfg.lines_per_frame);
  IFACE_HIGH("camif irq subsample pattern = %x, period = %d sof_step %d\n",
    pix_cfg->camif_cfg.subsample_cfg.irq_subsample_pattern,
    pix_cfg->camif_cfg.subsample_cfg.irq_subsample_period,
    pix_cfg->camif_cfg.subsample_cfg.sof_counter_step);
}

  将调试消息中指示的帧大小与 ISP 传感器的帧大小进行比较。在以下 CAMIF 错误示例中,错误状态 0x9a70a00 表示 ISP 接收帧的大小为 2471x2560(0x9a7 = 2471,0xa00 = 2560)。

01-01 08:07:20.175 E/mm-camera( 302): isp_hw_camif_dump_cfg: camif
input_format= 0 
01-01 08:07:20.175 E/mm-camera( 302): isp_hw_camif_dump_cfg: camif
last_pix = 6527 
01-01 08:07:20.175 E/mm-camera( 302): isp_hw_camif_dump_cfg: camif
last_line = 0 
01-01 08:07:20.175 E/mm-camera( 302): isp_hw_camif_dump_cfg: camif
lines per frame = 2448 
01-01 08:07:24.335 E/klogd (640): [81.563301]
msm_vfe40_process_error_status: camif error status: 0x9a70a00

如果存在不匹配,则根本原因可能如下:

  检查传感器设置是否正确,是否满足分辨率大小的要求。例如,传感器的输出大小配置为 12 MB,但 ISP 的接收大小却配置为 8 MB。可能有些传感器无法确保在新分辨率设置发送至传感器后,最初的帧大小能够满足要求。在这种情况下,需要与传感器供应商一起解决此问题。

你可能感兴趣的:(【Android Camera】SOF Freeze)