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

Commit 6d0429b9 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 to config nal size for encoder"

parents 0baf9e2a 6b3b9438
Loading
Loading
Loading
Loading
+39 −0
Original line number Original line Diff line number Diff line
@@ -856,6 +856,36 @@ static int copy_caps_to_sessions(struct hfi_capability_supported *cap,
	return 0;
	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(
static enum vidc_status hfi_parse_init_done_properties(
		struct msm_vidc_capability *capabilities,
		struct msm_vidc_capability *capabilities,
		u32 num_sessions, u8 *data_ptr, u32 num_properties,
		u32 num_sessions, u8 *data_ptr, u32 num_properties,
@@ -984,6 +1014,15 @@ static enum vidc_status hfi_parse_init_done_properties(
		}
		}
		case HFI_PROPERTY_PARAM_NAL_STREAM_FORMAT_SUPPORTED:
		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 +=
			next_offset +=
				sizeof(struct hfi_nal_stream_format_supported);
				sizeof(struct hfi_nal_stream_format_supported);
			num_properties--;
			num_properties--;
+33 −1
Original line number Original line Diff line number Diff line
@@ -164,6 +164,15 @@ static const char *const iframe_sizes[] = {
	"Unlimited"
	"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[] = {
static struct msm_vidc_ctrl msm_venc_ctrls[] = {
	{
	{
		.id = V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD,
		.id = V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD,
@@ -1197,7 +1206,22 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.step = 1,
		.step = 1,
		.qmenu = NULL,
		.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_ONE_NAL_PER_BUFFER) |
		(1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_ONE_BYTE_LENGTH) |
		(1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_TWO_BYTE_LENGTH) |
		(1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_FOUR_BYTE_LENGTH)
		),
		.qmenu = mpeg_video_stream_format,
	},
};
};


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


	if (!inst || !inst->core || !inst->core->device) {
	if (!inst || !inst->core || !inst->core->device) {
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
@@ -2211,6 +2236,13 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		vui_timing_info.time_scale = NSEC_PER_SEC;
		vui_timing_info.time_scale = NSEC_PER_SEC;
		break;
		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_LTRMODE:
	case V4L2_CID_MPEG_VIDC_VIDEO_LTRMODE:
	case V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT:
	case V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT:
	case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_WIDTH:
	case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_WIDTH:
+5 −0
Original line number Original line Diff line number Diff line
@@ -1523,6 +1523,11 @@ static int try_get_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDC_VIDEO_TME_PAYLOAD_VERSION:
	case V4L2_CID_MPEG_VIDC_VIDEO_TME_PAYLOAD_VERSION:
		ctrl->val = inst->capability.tme_version;
		ctrl->val = inst->capability.tme_version;
		break;
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_FORMAT:
		ctrl->val =
			inst->capability.nal_stream_format.
				nal_stream_format_supported;
		break;
	default:
	default:
		/*
		/*
		 * Other controls aren't really volatile, shouldn't need to
		 * Other controls aren't really volatile, shouldn't need to