Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2e194ae authored by Deva Ramasubramanian's avatar Deva Ramasubramanian Committed by Stephen Boyd
Browse files

msm: vidc: Migrate to kernel 3.10



Migrate to kernel 3.10 which has contains minor changes in the
V4L2 interface:
- Driver needs to specify how it provides timestamps
- Driver needs to declare itself as a mem2mem driver so that
  certain ioctls are not masked out before reaching the driver.
- Vendor specific buffer flags have been changed as to not
  conflict with standard flags
- Controls that are of boolean type need to explicitly set the
  step to 1.

Change-Id: I1a38471d9ee0c74abe39ae7ce1a0f2912195db30
Signed-off-by: default avatarDeva Ramasubramanian <dramasub@codeaurora.org>
parent 6006e743
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -813,6 +813,7 @@ static int msm_vidc_probe(struct platform_device *pdev)
		msm_vidc_release_video_device;
	core->vdev[MSM_VIDC_DECODER].vdev.fops = &msm_v4l2_vidc_fops;
	core->vdev[MSM_VIDC_DECODER].vdev.ioctl_ops = &msm_v4l2_ioctl_ops;
	core->vdev[MSM_VIDC_DECODER].vdev.vfl_dir = VFL_DIR_M2M;
	core->vdev[MSM_VIDC_DECODER].type = MSM_VIDC_DECODER;
	rc = video_register_device(&core->vdev[MSM_VIDC_DECODER].vdev,
					VFL_TYPE_GRABBER, nr);
@@ -833,6 +834,7 @@ static int msm_vidc_probe(struct platform_device *pdev)
		msm_vidc_release_video_device;
	core->vdev[MSM_VIDC_ENCODER].vdev.fops = &msm_v4l2_vidc_fops;
	core->vdev[MSM_VIDC_ENCODER].vdev.ioctl_ops = &msm_v4l2_ioctl_ops;
	core->vdev[MSM_VIDC_ENCODER].vdev.vfl_dir = VFL_DIR_M2M;
	core->vdev[MSM_VIDC_ENCODER].type = MSM_VIDC_ENCODER;
	rc = video_register_device(&core->vdev[MSM_VIDC_ENCODER].vdev,
				VFL_TYPE_GRABBER, nr + 1);
+10 −6
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = {
		.minimum = V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_DISABLE,
		.maximum = V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_ENABLE,
		.default_value = V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_DISABLE,
		.step = 1,
	},
	{
		.id = V4L2_CID_MPEG_VIDC_VIDEO_SECURE,
@@ -243,7 +244,7 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = {
	},
	{
		.id = V4L2_CID_MPEG_VIDC_SET_PERF_LEVEL,
		.name = "Encoder Performance Level",
		.name = "Decoder Performance Level",
		.type = V4L2_CTRL_TYPE_MENU,
		.minimum = V4L2_CID_MPEG_VIDC_PERF_LEVEL_NOMINAL,
		.maximum = V4L2_CID_MPEG_VIDC_PERF_LEVEL_TURBO,
@@ -1558,14 +1559,17 @@ int msm_vdec_ctrl_init(struct msm_vidc_inst *inst)
			}
		}


		msm_vdec_ctrls[idx].priv = ctrl;
	}
		ret_val = inst->ctrl_handler.error;
	if (ret_val)
		if (ret_val) {
			dprintk(VIDC_ERR,
			"Error adding ctrls to ctrl handle, %d\n",
					"Error adding ctrl (%s) to ctrl handle, %d\n",
					msm_vdec_ctrls[idx].name,
					inst->ctrl_handler.error);
			return ret_val;
		}

		msm_vdec_ctrls[idx].priv = ctrl;
	}

	/* Construct clusters */
	for (idx = 1; idx < MSM_VDEC_CTRL_CLUSTER_MAX; ++idx) {
+12 −8
Original line number Diff line number Diff line
@@ -688,6 +688,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.maximum = V4L2_MPEG_VIDC_VIDEO_H264_VUI_TIMING_INFO_ENABLED,
		.default_value =
			V4L2_MPEG_VIDC_VIDEO_H264_VUI_TIMING_INFO_DISABLED,
		.step = 1,
		.cluster = MSM_VENC_CTRL_CLUSTER_TIMING,
	},
	{
@@ -696,6 +697,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.type = V4L2_CTRL_TYPE_BOOLEAN,
		.minimum = V4L2_MPEG_VIDC_VIDEO_H264_AU_DELIMITER_DISABLED,
		.maximum = V4L2_MPEG_VIDC_VIDEO_H264_AU_DELIMITER_ENABLED,
		.step = 1,
		.default_value =
			V4L2_MPEG_VIDC_VIDEO_H264_AU_DELIMITER_DISABLED,
	},
@@ -731,6 +733,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.minimum = BITSTREAM_RESTRICT_DISABLED,
		.maximum = BITSTREAM_RESTRICT_ENABLED,
		.default_value = BITSTREAM_RESTRICT_ENABLED,
		.step = 1,
		.cluster = 0,
	},
	{
@@ -741,6 +744,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.maximum = V4L2_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY_ENABLED,
		.default_value =
			V4L2_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY_DISABLED,
		.step = 1,
		.cluster = 0,
	},
};
@@ -2614,18 +2618,18 @@ int msm_venc_ctrl_init(struct msm_vidc_inst *inst)
					msm_venc_ctrls[idx].default_value);
			}
		}
		if (!ctrl) {

		ret_val = inst->ctrl_handler.error;
		if (ret_val) {
			dprintk(VIDC_ERR,
			"Failed to get ctrl for: idx: %d, %d\n",
			idx, msm_venc_ctrls[idx].id);
					"Error adding ctrl (%s) to ctrl handle, %d\n",
					msm_venc_ctrls[idx].name,
					inst->ctrl_handler.error);
			return ret_val;
		}

		msm_venc_ctrls[idx].priv = ctrl;
	}
	ret_val = inst->ctrl_handler.error;
	if (ret_val)
		dprintk(VIDC_ERR,
			"CTRL ERR: Error adding ctrls to ctrl handle, %d\n",
			inst->ctrl_handler.error);

	/* Construct clusters */
	for (idx = 1; idx < MSM_VENC_CTRL_CLUSTER_MAX; ++idx) {
+3 −0
Original line number Diff line number Diff line
@@ -350,9 +350,12 @@ static inline int vb2_bufq_init(struct msm_vidc_inst *inst,
		dprintk(VIDC_ERR, "buf_type = %d not recognised\n", type);
		return -EINVAL;
	}

	q->type = type;
	q->io_modes = VB2_MMAP | VB2_USERPTR;
	q->io_flags = 0;
	q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;

	if (sess == MSM_VIDC_DECODER)
		q->ops = msm_vdec_get_vb2q_ops();
	else if (sess == MSM_VIDC_ENCODER)
+9 −8
Original line number Diff line number Diff line
@@ -695,19 +695,20 @@ struct v4l2_buffer {
#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE	0x0800
#define V4L2_BUF_FLAG_NO_CACHE_CLEAN		0x1000
#define V4L2_BUF_FLAG_EOS			0x2000
#define V4L2_QCOM_BUF_FLAG_CODECCONFIG		0x4000
#define V4L2_QCOM_BUF_FLAG_EOSEQ		0x8000
#define V4L2_QCOM_BUF_TIMESTAMP_INVALID		0x10000
#define V4L2_QCOM_BUF_FLAG_IDRFRAME		0x20000	/*Image is a IDR-frame*/
#define V4L2_QCOM_BUF_FLAG_DECODEONLY		0x40000
#define V4L2_QCOM_BUF_DATA_CORRUPT		0x80000
#define V4L2_QCOM_BUF_DROP_FRAME		0x100000
#define V4L2_QCOM_BUF_INPUT_UNSUPPORTED		0x200000
/* Timestamp type */
#define V4L2_BUF_FLAG_TIMESTAMP_MASK		0xe000
#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN		0x0000
#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC	0x2000
#define V4L2_BUF_FLAG_TIMESTAMP_COPY		0x4000
/* Vendor extensions */
#define V4L2_QCOM_BUF_FLAG_CODECCONFIG		0x10000
#define V4L2_QCOM_BUF_FLAG_EOSEQ		0x20000
#define V4L2_QCOM_BUF_TIMESTAMP_INVALID		0x40000
#define V4L2_QCOM_BUF_FLAG_IDRFRAME		0x80000	/*Image is a IDR-frame*/
#define V4L2_QCOM_BUF_FLAG_DECODEONLY		0x100000
#define V4L2_QCOM_BUF_DATA_CORRUPT		0x200000
#define V4L2_QCOM_BUF_DROP_FRAME		0x400000
#define V4L2_QCOM_BUF_INPUT_UNSUPPORTED		0x800000

/**
 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor