void msm_vpe_offset_update(int frame_pack, uint32_t pyaddr, uint32_t pcbcraddr,
	struct timespec *ts, int output_id, struct msm_st_half st_half,
	int frameid)
{
	struct msm_vpe_buf_info vpe_buf;
	uint32_t input_stride;

	vpe_buf.vpe_crop.in2_w = st_half.stCropInfo.in_w;
	vpe_buf.vpe_crop.in2_h = st_half.stCropInfo.in_h;
	vpe_buf.vpe_crop.out2_w = st_half.stCropInfo.out_w;
	vpe_buf.vpe_crop.out2_h = st_half.stCropInfo.out_h;
	vpe_ctrl->dis_offset.dis_offset_x = st_half.pix_x_off;
	vpe_ctrl->dis_offset.dis_offset_y = st_half.pix_y_off;
	vpe_ctrl->dis_offset.frame_id = frameid;
	vpe_ctrl->frame_pack = frame_pack;
	vpe_ctrl->output_type = output_id;

	input_stride = (st_half.buf_cbcr_stride * (1<<16)) +
		st_half.buf_y_stride;

	msm_io_w(input_stride, vpe_device->vpebase + VPE_SRC_YSTRIDE1_OFFSET);

	vpe_update_scaler_with_dis(&(vpe_buf.vpe_crop),
		&(vpe_ctrl->dis_offset));

	msm_send_frame_to_vpe(pyaddr, pcbcraddr, ts, output_id);
}
Beispiel #2
0
void msm_vpe_offset_update(int frame_pack, uint32_t pyaddr, uint32_t pcbcraddr,
	struct timespec *ts, int output_id, int32_t x, int32_t y,
	int32_t frameid, struct msm_st_crop stCropInfo)
{
	struct msm_vpe_buf_info vpe_buf;

	/* TODO: Update cropinfo from msm_sync. */
	vpe_buf.vpe_crop.in2_w = stCropInfo.in_w;
	vpe_buf.vpe_crop.in2_h = stCropInfo.in_h;
	vpe_buf.vpe_crop.out2_w = stCropInfo.out_w;
	vpe_buf.vpe_crop.out2_h = stCropInfo.out_h;
	vpe_ctrl->dis_offset.dis_offset_x = x;
	vpe_ctrl->dis_offset.dis_offset_y = y;
	vpe_ctrl->dis_offset.frame_id = frameid;
	vpe_ctrl->frame_pack = frame_pack;
	vpe_ctrl->output_type = output_id;

	vpe_update_scaler_with_dis(&(vpe_buf.vpe_crop),
		&(vpe_ctrl->dis_offset));

	msm_send_frame_to_vpe(pyaddr, pcbcraddr, ts, output_id);
}
static int vpe_proc_general(struct msm_vpe_cmd *cmd)
{
	int rc = 0;
	uint32_t *cmdp = NULL;
	struct msm_queue_cmd *qcmd = NULL;
	struct msm_vpe_buf_info *vpe_buf;
	int turbo_mode = 0;
	struct msm_sync *sync = (struct msm_sync *)vpe_ctrl->syncdata;
	CDBG("vpe_proc_general: cmdID = %s, length = %d\n",
		vpe_general_cmd[cmd->id], cmd->length);
	switch (cmd->id) {
	case VPE_ENABLE:
		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
		if (!cmdp) {
			rc = -ENOMEM;
			goto vpe_proc_general_done;
		}
		if (copy_from_user(cmdp,
			(void __user *)(cmd->value),
			cmd->length)) {
			rc = -EFAULT;
			goto vpe_proc_general_done;
		}
		turbo_mode = *((int *)(cmd->value));
		rc = turbo_mode ? vpe_enable(VPE_TURBO_MODE_CLOCK_RATE)
			: vpe_enable(VPE_NORMAL_MODE_CLOCK_RATE);
		break;
	case VPE_DISABLE:
		rc = vpe_disable();
		break;
	case VPE_RESET:
	case VPE_ABORT:
		rc = vpe_reset();
		break;
	case VPE_START:
		rc = vpe_start();
		break;

	case VPE_INPUT_PLANE_CFG:
		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
		if (!cmdp) {
			rc = -ENOMEM;
			goto vpe_proc_general_done;
		}
		if (copy_from_user(cmdp,
			(void __user *)(cmd->value),
			cmd->length)) {
			rc = -EFAULT;
			goto vpe_proc_general_done;
		}
		vpe_input_plane_config(cmdp);
		break;

	case VPE_OPERATION_MODE_CFG:
		CDBG("cmd->length = %d\n", cmd->length);
		if (cmd->length != VPE_OPERATION_MODE_CFG_LEN_ZSL) {
			rc = -EINVAL;
			goto vpe_proc_general_done;
		}
		cmdp = kmalloc(VPE_OPERATION_MODE_CFG_LEN_ZSL,
					GFP_ATOMIC);
		if (copy_from_user(cmdp,
			(void __user *)(cmd->value),
			VPE_OPERATION_MODE_CFG_LEN_ZSL)) {
			rc = -EFAULT;
			goto vpe_proc_general_done;
		}
		rc = vpe_operation_config(cmdp);
		CDBG("rc = %d \n", rc);
		break;

	case VPE_OUTPUT_PLANE_CFG:
		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
		if (!cmdp) {
			rc = -ENOMEM;
			goto vpe_proc_general_done;
		}
		if (copy_from_user(cmdp,
			(void __user *)(cmd->value),
			cmd->length)) {
			rc = -EFAULT;
			goto vpe_proc_general_done;
		}
		vpe_output_plane_config(cmdp);
		break;

	case VPE_SCALE_CFG_TYPE:
		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
		if (!cmdp) {
			rc = -ENOMEM;
			goto vpe_proc_general_done;
		}
		if (copy_from_user(cmdp,
			(void __user *)(cmd->value),
			cmd->length)) {
			rc = -EFAULT;
			goto vpe_proc_general_done;
		}
		vpe_update_scale_coef(cmdp);
		break;

	case VPE_CMD_DIS_OFFSET_CFG: {
		struct msm_vfe_resp *vdata;
		/* first get the dis offset and frame id. */
		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
		if (!cmdp) {
			rc = -ENOMEM;
			goto vpe_proc_general_done;
		}
		if (copy_from_user(cmdp,
			(void __user *)(cmd->value),
			cmd->length)) {
			rc = -EFAULT;
			goto vpe_proc_general_done;
		}
		/* get the offset. */
		vpe_ctrl->dis_offset = *(struct dis_offset_type *)cmdp;
		qcmd = msm_dequeue_vpe(&sync->vpe_q, list_vpe_frame);
		if (!qcmd) {
			pr_err("%s: no video frame.\n", __func__);
			kfree(cmdp);
			return -EAGAIN;
		}
		vdata = (struct msm_vfe_resp *)(qcmd->command);
		vpe_buf = &vdata->vpe_bf;
		vpe_update_scaler_with_dis(&(vpe_buf->vpe_crop),
					&(vpe_ctrl->dis_offset));

		msm_send_frame_to_vpe(vpe_buf->y_phy, vpe_buf->cbcr_phy,
						&(vpe_buf->ts), OUTPUT_TYPE_V);

		if (!qcmd || !atomic_read(&qcmd->on_heap)) {
			kfree(cmdp);
			return -EAGAIN;
		}
		if (!atomic_sub_return(1, &qcmd->on_heap))
			kfree(qcmd);
		break;
	}

	default:
		break;
	}
vpe_proc_general_done:
	kfree(cmdp);
	return rc;
}