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

Commit 0230cde7 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Add support to config nal size for encoder"

parents e8ca04f6 8319c946
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -858,6 +858,37 @@ static int copy_caps_to_sessions(struct hfi_capability_supported *cap,
	return 0;
}

static int copy_nal_stream_format_caps_to_sessions(u32 nal_stream_format_value,
		struct msm_vidc_capability *capabilities, u32 num_sessions,
		u32 codecs, u32 domain)
{
	u32 i = 0;
	struct msm_vidc_capability *capability;
	u32 sess_codec;
	u32 sess_domain;

	for (i = 0; i < num_sessions; i++) {
		sess_codec = 0;
		sess_domain = 0;
		capability = &capabilities[i];

		if (capability->codec)
			sess_codec =
				vidc_get_hfi_codec(capability->codec);
		if (capability->domain)
			sess_domain =
				vidc_get_hfi_domain(capability->domain);

		if (!(sess_codec & codecs && sess_domain & domain))
			continue;

		capability->nal_stream_format.nal_stream_format_supported =
				nal_stream_format_value;
	}

	return 0;
}

static enum vidc_status hfi_parse_init_done_properties(
		struct msm_vidc_capability *capabilities,
		u32 num_sessions, u8 *data_ptr, u32 num_properties,
@@ -986,6 +1017,15 @@ static enum vidc_status hfi_parse_init_done_properties(
		}
		case HFI_PROPERTY_PARAM_NAL_STREAM_FORMAT_SUPPORTED:
		{
			struct hfi_nal_stream_format_supported *prop =
				(struct hfi_nal_stream_format_supported *)
					(data_ptr + next_offset);

			copy_nal_stream_format_caps_to_sessions(
					prop->nal_stream_format_supported,
					capabilities, num_sessions,
					codecs, domain);

			next_offset +=
				sizeof(struct hfi_nal_stream_format_supported);
			num_properties--;
+30 −1
Original line number Diff line number Diff line
@@ -147,6 +147,15 @@ static const char *const iframe_sizes[] = {
	"Unlimited"
};

static const char *const mpeg_video_stream_format[] = {
	"NAL Format Start Codes",
	"NAL Format One NAL Per Buffer",
	"NAL Format One Byte Length",
	"NAL Format Two Byte Length",
	"NAL Format Four Byte Length",
	NULL
};

static struct msm_vidc_ctrl msm_venc_ctrls[] = {
	{
		.id = V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD,
@@ -1097,7 +1106,19 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.step = 1,
		.qmenu = NULL,
	},

	{
		.id = V4L2_CID_MPEG_VIDC_VIDEO_STREAM_FORMAT,
		.name = "NAL Format",
		.type = V4L2_CTRL_TYPE_MENU,
		.minimum = V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_STARTCODES,
		.maximum = V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_FOUR_BYTE_LENGTH,
		.default_value = V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_STARTCODES,
		.menu_skip_mask = ~(
		(1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_STARTCODES) |
		(1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_FOUR_BYTE_LENGTH)
		),
		.qmenu = mpeg_video_stream_format,
	},
};

#define NUM_CTRLS ARRAY_SIZE(msm_venc_ctrls)
@@ -1226,6 +1247,7 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	struct hal_vui_timing_info vui_timing_info = {0};
	enum hal_iframesize_type iframesize_type = HAL_IFRAMESIZE_TYPE_DEFAULT;
	u32 color_primaries, custom_matrix;
	struct hal_nal_stream_format_select stream_format;

	if (!inst || !inst->core || !inst->core->device) {
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
@@ -2024,6 +2046,13 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		vui_timing_info.time_scale = NSEC_PER_SEC;
		break;
	}
	case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_FORMAT:
	{
		property_id = HAL_PARAM_NAL_STREAM_FORMAT_SELECT;
		stream_format.nal_stream_format_select = BIT(ctrl->val);
		pdata = &stream_format;
		break;
	}
	case V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT:
	case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_WIDTH:
	case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_HEIGHT:
+4 −0
Original line number Diff line number Diff line
@@ -1665,6 +1665,10 @@ static int try_get_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDC_VIDEO_TME_PAYLOAD_VERSION:
		ctrl->val = inst->capability.tme_version;
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_FORMAT:
		ctrl->val =
		inst->capability.nal_stream_format.nal_stream_format_supported;
		break;
	default:
		/*
		 * Other controls aren't really volatile, shouldn't need to