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

Commit 5e3276c9 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 generic LTR mode support"

parents 3c10ef9d 80123c21
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1658,7 +1658,7 @@ int create_pkt_cmd_session_set_property(
		struct hfi_ltrmode *hfi;
		struct hal_ltrmode *hal = pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_H264_LTRMODE;
			HFI_PROPERTY_PARAM_VENC_LTRMODE;
		hfi = (struct hfi_ltrmode *) &pkt->rg_property_data[1];
		hfi->ltrmode = get_hfi_ltr_mode(hal->ltrmode);
		hfi->ltrcount = hal->ltrcount;
@@ -1671,7 +1671,7 @@ int create_pkt_cmd_session_set_property(
		struct hfi_ltruse *hfi;
		struct hal_ltruse *hal = pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_CONFIG_VENC_H264_USELTRFRAME;
			HFI_PROPERTY_CONFIG_VENC_USELTRFRAME;
		hfi = (struct hfi_ltruse *) &pkt->rg_property_data[1];
		hfi->frames = hal->frames;
		hfi->refltr = hal->refltr;
@@ -1684,10 +1684,10 @@ int create_pkt_cmd_session_set_property(
		struct hfi_ltrmark *hfi;
		struct hal_ltrmark *hal = pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_CONFIG_VENC_H264_MARKLTRFRAME;
			HFI_PROPERTY_CONFIG_VENC_MARKLTRFRAME;
		hfi = (struct hfi_ltrmark *) &pkt->rg_property_data[1];
		hfi->markframe = hal->markframe;
		pkt->size += sizeof(u32) * 2;
		pkt->size += sizeof(u32) + sizeof(struct hfi_ltrmark);
		break;
	}
	case HAL_PARAM_VENC_HIER_P_NUM_FRAMES:
+9 −1
Original line number Diff line number Diff line
@@ -415,6 +415,10 @@ static inline void copy_cap_prop(
		struct vidc_hal_session_init_done *sess_init_done)
{
	struct hal_capability_supported *out = NULL;
	if (!in) {
		dprintk(VIDC_ERR, "Invalid input for supported capabilties\n");
		return;
	}
	switch (in->capability_type) {
	case HFI_CAPABILITY_FRAME_WIDTH:
		out = &sess_init_done->width;
@@ -451,9 +455,13 @@ static inline void copy_cap_prop(
	case HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS:
		out = &sess_init_done->hier_p;
		break;

	case HFI_CAPABILITY_ENC_LTR_COUNT:
		out = &sess_init_done->ltr_count;
		break;
	}

	if (in && out) {
	if (out) {
		out->capability_type =
			(enum hal_capability)in->capability_type;
		out->min = in->min;
+45 −28
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#define B_FRAME_QP 30
#define MAX_INTRA_REFRESH_MBS 300
#define MAX_NUM_B_FRAMES 4
#define MAX_LTR_FRAME_COUNT 10

#define L_MODE V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY
#define CODING V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY
@@ -819,9 +820,10 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.name = "H264 Use LTR",
		.type = V4L2_CTRL_TYPE_BUTTON,
		.minimum = 0,
		.maximum = 1,
		.maximum = (MAX_LTR_FRAME_COUNT - 1),
		.default_value = 0,
		.step = 1,
		.qmenu = NULL,
		.cluster = 0,
	},
	{
@@ -829,7 +831,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.name = "Ltr Count",
		.type = V4L2_CTRL_TYPE_INTEGER,
		.minimum = 0,
		.maximum = 1,
		.maximum = MAX_LTR_FRAME_COUNT,
		.default_value = 0,
		.step = 1,
		.qmenu = NULL,
@@ -851,9 +853,10 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.name = "H264 Mark LTR",
		.type = V4L2_CTRL_TYPE_BUTTON,
		.minimum = 0,
		.maximum = 0,
		.maximum = (MAX_LTR_FRAME_COUNT - 1),
		.default_value = 0,
		.step = 0,
		.step = 1,
		.qmenu = NULL,
		.cluster = 0,
	},
	{
@@ -2177,14 +2180,14 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_USELTRFRAME:
		property_id = HAL_CONFIG_VENC_USELTRFRAME;
		useltr.refltr = 0x1;
		useltr.refltr = ctrl->val;
		useltr.useconstrnt = false;
		useltr.frames = 0;
		pdata = &useltr;
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_MARKLTRFRAME:
		property_id = HAL_CONFIG_VENC_MARKLTRFRAME;
		markltr.markframe = 0x1;
		markltr.markframe = ctrl->val;
		pdata = &markltr;
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_HIER_P_NUM_LAYERS:
@@ -2237,6 +2240,7 @@ static int try_set_ext_ctrl(struct msm_vidc_inst *inst,
	struct v4l2_ctrl *cluster;
	u32 property_id = 0;
	void *pdata = NULL;
	struct msm_vidc_core_capability *cap = NULL;

	if (!inst || !inst->core || !inst->core->device || !ctrl) {
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
@@ -2252,8 +2256,8 @@ static int try_set_ext_ctrl(struct msm_vidc_inst *inst,
	}

	hdev = inst->core->device;
	cap = &inst->capability;

	if (ctrl->count) {
	control = ctrl->controls;
	for (i = 0; i < ctrl->count; i++) {
		switch (control[i].id) {
@@ -2265,6 +2269,18 @@ static int try_set_ext_ctrl(struct msm_vidc_inst *inst,
			break;
		case V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT:
			ltrmode.ltrcount =  control[i].value;
			if (ltrmode.ltrcount > cap->ltr_count.max) {
				dprintk(VIDC_ERR,
						"Invalid LTR count %d. Supported max: %d\n",
						ltrmode.ltrcount,
						cap->ltr_count.max);
				/*
				 * FIXME: Return an error (-EINVALID)
				 * here once VP8 supports LTR count
				 * capability
				 */
				ltrmode.ltrcount = 1;
			}
			ltrmode.trustmode = 1;
			property_id = HAL_PARAM_VENC_LTRMODE;
			pdata = &ltrmode;
@@ -2275,7 +2291,8 @@ static int try_set_ext_ctrl(struct msm_vidc_inst *inst,
			rc = -ENOTSUPP;
			break;
		}
		}
		if (rc)
			break;
	}

	if (!rc && property_id) {
+2 −0
Original line number Diff line number Diff line
@@ -481,6 +481,8 @@ static void handle_session_init_done(enum command_response cmd, void *data)
			inst->capability.scale_x = session_init_done->scale_x;
			inst->capability.scale_y = session_init_done->scale_y;
			inst->capability.hier_p = session_init_done->hier_p;
			inst->capability.ltr_count =
				session_init_done->ltr_count;
			inst->capability.pixelprocess_capabilities =
				call_hfi_op(hdev, get_core_capabilities);
			inst->capability.capability_set = true;
+1 −0
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ struct msm_vidc_core_capability {
	struct hal_capability_supported scale_x;
	struct hal_capability_supported scale_y;
	struct hal_capability_supported hier_p;
	struct hal_capability_supported ltr_count;
	u32 capability_set;
	enum buffer_mode_type buffer_mode[MAX_PORT_NUM];
};
Loading