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

Commit ad0ce55e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Add support for encoder deinterlacing"

parents 0000c6e2 9178dfa5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1342,7 +1342,15 @@ int create_pkt_cmd_session_set_property(
		break;
	}
	case HAL_CONFIG_VPE_DEINTERLACE:
	{
		struct hfi_enable *hfi;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_CONFIG_VPE_DEINTERLACE;
		hfi = (struct hfi_enable *) &pkt->rg_property_data[1];
		hfi->enable = ((struct hal_enable *) pdata)->enable;
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_H264_GENERATE_AUDNAL:
	{
		struct hfi_enable *hfi;
+56 −2
Original line number Diff line number Diff line
@@ -139,7 +139,8 @@ enum msm_venc_ctrl_cluster {
	MSM_VENC_CTRL_CLUSTER_BITRATE = 1 << 8,
	MSM_VENC_CTRL_CLUSTER_TIMING = 1 << 9,
	MSM_VENC_CTRL_CLUSTER_VP8_PROFILE_LEVEL = 1 << 10,
	MSM_VENC_CTRL_CLUSTER_MAX = 1 << 11,
	MSM_VENC_CTRL_CLUSTER_DEINTERLACE = 1 << 11,
	MSM_VENC_CTRL_CLUSTER_MAX = 1 << 12,
};

static struct msm_vidc_ctrl msm_venc_ctrls[] = {
@@ -405,7 +406,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		(1 << V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_270)
		),
		.qmenu = mpeg_video_rotation,
		.cluster = 0,
		.cluster = MSM_VENC_CTRL_CLUSTER_DEINTERLACE,
	},
	{
		.id = V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP,
@@ -747,6 +748,16 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.step = 1,
		.cluster = 0,
	},
	{
		.id = V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE,
		.name = "Deinterlace for encoder",
		.type = V4L2_CTRL_TYPE_BOOLEAN,
		.minimum = V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_DISABLED,
		.maximum = V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_ENABLED,
		.default_value = V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_DISABLED,
		.step = 1,
		.cluster = MSM_VENC_CTRL_CLUSTER_DEINTERLACE,
	},
};

#define NUM_CTRLS ARRAY_SIZE(msm_venc_ctrls)
@@ -1581,6 +1592,8 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		pdata = &profile_level;
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_ROTATION:
	{
		struct v4l2_ctrl *deinterlace = NULL;
		if (!(inst->capability.pixelprocess_capabilities &
			HAL_VIDEO_ENCODER_ROTATION_CAPABILITY)) {
			dprintk(VIDC_ERR, "Rotation not supported: 0x%x",
@@ -1588,6 +1601,15 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
			rc = -ENOTSUPP;
			break;
		}
		deinterlace =
			TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE);
		if (ctrl->val && deinterlace && deinterlace->val !=
				V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_DISABLED) {
			dprintk(VIDC_ERR,
				"Rotation not supported with deinterlacing");
			rc = -EINVAL;
			break;
		}
		property_id =
			HAL_CONFIG_VPE_OPERATIONS;
		operations.rotate = venc_v4l2_to_hal(
@@ -1596,6 +1618,7 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		operations.flip = HAL_FLIP_NONE;
		pdata = &operations;
		break;
	}
	case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP: {
		struct v4l2_ctrl *qpp, *qpb;

@@ -1951,6 +1974,37 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	default:
		rc = -ENOTSUPP;
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE:
	{
		struct v4l2_ctrl *rotation = NULL;
		if (!(inst->capability.pixelprocess_capabilities &
			HAL_VIDEO_ENCODER_DEINTERLACE_CAPABILITY)) {
			dprintk(VIDC_ERR, "Deinterlace not supported: 0x%x",
					ctrl->id);
			rc = -ENOTSUPP;
			break;
		}
		rotation = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_ROTATION);
		if (ctrl->val && rotation && rotation->val !=
			V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_NONE) {
			dprintk(VIDC_ERR,
				"Deinterlacing not supported with rotation");
			rc = -EINVAL;
			break;
		}
		property_id = HAL_CONFIG_VPE_DEINTERLACE;
		switch (ctrl->val) {
		case V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_ENABLED:
			enable.enable = 1;
			break;
		case V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_DISABLED:
		default:
			enable.enable = 0;
			break;
		}
		pdata = &enable;
		break;
	}
	}
#undef TRY_GET_CTRL

+7 −0
Original line number Diff line number Diff line
@@ -720,6 +720,8 @@ const char *v4l2_ctrl_get_name(u32 id)
	case V4L2_CID_MPEG_VIDC_VIDEO_CIR_MBS: return "Intra Refresh CIR MBS";
	case V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL:
		return "VP8 Profile Level";
	case V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE:
		return "Deinterlace for encoder";

	/* CAMERA controls */
	/* Keep the order of the 'case's the same as in videodev2.h! */
@@ -1007,6 +1009,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
		*min = 0;
		*max = *step = 1;
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE:
		*type = V4L2_CTRL_TYPE_BOOLEAN;
		*min = 0;
		*max = *step = 1;
		break;
	default:
		*type = V4L2_CTRL_TYPE_INTEGER;
		break;
+7 −0
Original line number Diff line number Diff line
@@ -794,6 +794,13 @@ enum v4l2_mpeg_vidc_video_preserve_text_quality {
	V4L2_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY_ENABLED = 1
};

#define V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE \
		(V4L2_CID_MPEG_MSM_VIDC_BASE + 35)
enum v4l2_mpeg_vidc_video_deinterlace {
	V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_DISABLED = 0,
	V4L2_CID_MPEG_VIDC_VIDEO_DEINTERLACE_ENABLED = 1
};

/*  Camera class control IDs */

#define V4L2_CID_CAMERA_CLASS_BASE 	(V4L2_CTRL_CLASS_CAMERA | 0x900)