Exemplo n.º 1
0
uint32_t mm_camera_get_msm_frame_len(cam_format_t fmt_type,
                                     camera_mode_t mode,
                                     int width,
                                     int height,
                                     int image_type,
                                     uint8_t *num_planes,
                                     uint32_t plane[])
{
    uint32_t size;
    *num_planes = 0;
    int local_height;

    switch (fmt_type) {
    case CAMERA_YUV_420_NV12:
    case CAMERA_YUV_420_NV21:
        *num_planes = 2;
        if(CAMERA_MODE_3D == mode) {
            size = (uint32_t)(PAD_TO_2K(width*height)*3/2);
            plane[0] = PAD_TO_WORD(width*height);
        } else {
            if (image_type == OUTPUT_TYPE_V) {
                plane[0] = PAD_TO_2K(width * height);
                plane[1] = PAD_TO_2K(width * height/2);
            } else if (image_type == OUTPUT_TYPE_P) {
                plane[0] = PAD_TO_WORD(width * height);
                plane[1] = PAD_TO_WORD(width * height/2);
            } else {
                plane[0] = PAD_TO_WORD(width * CEILING16(height));
                plane[1] = PAD_TO_WORD(width * CEILING16(height)/2);
            }
            size = plane[0] + plane[1];
        }
        break;
    case CAMERA_BAYER_SBGGR10:
        *num_planes = 1;
        plane[0] = PAD_TO_WORD(width * height);
        size = plane[0];
        break;
    case CAMERA_YUV_422_NV16:
    case CAMERA_YUV_422_NV61:
      if( image_type == OUTPUT_TYPE_S || image_type == OUTPUT_TYPE_V) {
        local_height = CEILING16(height);
      } else {
        local_height = height;
      }
        *num_planes = 2;
        plane[0] = PAD_TO_WORD(width * height);
        plane[1] = PAD_TO_WORD(width * height);
        size = plane[0] + plane[1];
        break;
    default:
        CDBG("%s: format %d not supported.\n",
            __func__, fmt_type);
        size = 0;
    }
    CDBG("%s:fmt=%d,image_type=%d,width=%d,height=%d,frame_len=%d\n",
        __func__, fmt_type, image_type, width, height, size);
    return size;
}
Exemplo n.º 2
0
void msm_send_frame_to_vpe(uint32_t pyaddr, uint32_t pcbcraddr,
		struct timespec *ts, int output_type)
{
	uint32_t temp_pyaddr = 0, temp_pcbcraddr = 0;
	CDBG("[CAM] vpe input, pyaddr = 0x%x, pcbcraddr = 0x%x\n",
		pyaddr, pcbcraddr);
	msm_io_w(pyaddr, vpe_device->vpebase + VPE_SRCP0_ADDR_OFFSET);
	msm_io_w(pcbcraddr, vpe_device->vpebase + VPE_SRCP1_ADDR_OFFSET);
	if (vpe_ctrl->state == 1)
		pr_err("[CAM] =====VPE is busy!!!  Wrong!========\n");

	if (output_type != OUTPUT_TYPE_ST_R)
		vpe_ctrl->ts = *ts;

	if (output_type == OUTPUT_TYPE_ST_L) {
		vpe_ctrl->pcbcr_before_dis = msm_io_r(vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
		temp_pyaddr = msm_io_r(vpe_device->vpebase +
			VPE_OUTP0_ADDR_OFFSET);

		if (vpe_ctrl->frame_pack == TOP_DOWN_FULL)
			temp_pcbcraddr = temp_pyaddr + (vpe_ctrl->out_w * vpe_ctrl->out_h * 2);
		else if ((vpe_ctrl->frame_pack == SIDE_BY_SIDE_HALF) ||
				(vpe_ctrl->frame_pack == SIDE_BY_SIDE_FULL))
			temp_pcbcraddr = temp_pyaddr +
				PAD_TO_2K((vpe_ctrl->out_w * 2) * vpe_ctrl->out_h,
				vpe_ctrl->pad_2k_bool);
		else
			CDBG("[CAM] %s: Invalid Frame Packing = %d\n", __func__,
				 vpe_ctrl->frame_pack);

		msm_io_w(temp_pcbcraddr, vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
	}

	if (vpe_ctrl->dis_en) {
		/* Changing the VPE output CBCR address,
		to make Y/CBCR continuous */
		vpe_ctrl->pcbcr_before_dis = msm_io_r(vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
		temp_pyaddr = msm_io_r(vpe_device->vpebase +
			VPE_OUTP0_ADDR_OFFSET);
		temp_pcbcraddr = temp_pyaddr + vpe_ctrl->pcbcr_dis_offset;
		msm_io_w(temp_pcbcraddr, vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
	}

	vpe_ctrl->output_type = output_type;
	vpe_ctrl->state = 1;
	vpe_start();
}
Exemplo n.º 3
0
void msm_send_frame_to_vpe(uint32_t p0_phy_add, uint32_t p1_phy_add,
		struct timespec *ts, int output_type)
{
	uint32_t temp_pyaddr = 0, temp_pcbcraddr = 0;

	CDBG("vpe input, p0_phy_add = 0x%x, p1_phy_add = 0x%x\n",
		p0_phy_add, p1_phy_add);
	msm_camera_io_w(p0_phy_add,
		vpe_device->vpebase + VPE_SRCP0_ADDR_OFFSET);
	msm_camera_io_w(p1_phy_add,
		vpe_device->vpebase + VPE_SRCP1_ADDR_OFFSET);

	if (vpe_ctrl->state == VPE_STATE_ACTIVE)
		CDBG(" =====VPE is busy!!!  Wrong!========\n");

	if (output_type != OUTPUT_TYPE_ST_R)
		vpe_ctrl->ts = *ts;

	if (output_type == OUTPUT_TYPE_ST_L) {
		vpe_ctrl->pcbcr_before_dis =
			msm_camera_io_r(vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
		temp_pyaddr = msm_camera_io_r(vpe_device->vpebase +
			VPE_OUTP0_ADDR_OFFSET);
		temp_pcbcraddr = temp_pyaddr + PAD_TO_2K(vpe_ctrl->out_w *
			vpe_ctrl->out_h * 2, vpe_ctrl->pad_2k_bool);
		msm_camera_io_w(temp_pcbcraddr, vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
	}

	if (vpe_ctrl->dis_en) {
		/* Changing the VPE output CBCR address,
		to make Y/CBCR continuous */
		vpe_ctrl->pcbcr_before_dis =
			msm_camera_io_r(vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
		temp_pyaddr = msm_camera_io_r(vpe_device->vpebase +
			VPE_OUTP0_ADDR_OFFSET);
		temp_pcbcraddr = temp_pyaddr + vpe_ctrl->pcbcr_dis_offset;
		msm_camera_io_w(temp_pcbcraddr, vpe_device->vpebase +
			VPE_OUTP1_ADDR_OFFSET);
	}

	vpe_ctrl->output_type = output_type;
	vpe_ctrl->state = VPE_STATE_ACTIVE;
	vpe_start();
}