Commit bc28936b authored by Dikshita Agarwal's avatar Dikshita Agarwal Committed by Mauro Carvalho Chehab
Browse files

media: venus: helpers, hfi, vdec: Set actual plane constraints to FW



Set actual plane alignments to FW with
HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO to calculate
correct buffer size.

bod: Fixed fall-through error in pkt_session_set_property_6xx() switch
     Ensure setting format constraints on 6xx only

Signed-off-by: default avatarDikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent c934d9d4
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -1103,6 +1103,30 @@ int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode)
}
EXPORT_SYMBOL_GPL(venus_helper_set_work_mode);

int venus_helper_set_format_constraints(struct venus_inst *inst)
{
	const u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO;
	struct hfi_uncompressed_plane_actual_constraints_info pconstraint;

	if (!IS_V6(inst->core))
		return 0;

	pconstraint.buffer_type = HFI_BUFFER_OUTPUT2;
	pconstraint.num_planes = 2;
	pconstraint.plane_format[0].stride_multiples = 128;
	pconstraint.plane_format[0].max_stride = 8192;
	pconstraint.plane_format[0].min_plane_buffer_height_multiple = 32;
	pconstraint.plane_format[0].buffer_alignment = 256;

	pconstraint.plane_format[1].stride_multiples = 128;
	pconstraint.plane_format[1].max_stride = 8192;
	pconstraint.plane_format[1].min_plane_buffer_height_multiple = 16;
	pconstraint.plane_format[1].buffer_alignment = 256;

	return hfi_session_set_property(inst, ptype, &pconstraint);
}
EXPORT_SYMBOL_GPL(venus_helper_set_format_constraints);

int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
			      unsigned int output_bufs,
			      unsigned int output2_bufs)
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ int venus_helper_set_output_resolution(struct venus_inst *inst,
				       unsigned int width, unsigned int height,
				       u32 buftype);
int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode);
int venus_helper_set_format_constraints(struct venus_inst *inst);
int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
			      unsigned int output_bufs,
			      unsigned int output2_bufs);
+13 −0
Original line number Diff line number Diff line
@@ -1259,6 +1259,19 @@ pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt,
	pkt->data[0] = ptype;

	switch (ptype) {
	case HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO: {
		struct hfi_uncompressed_plane_actual_constraints_info *in = pdata;
		struct hfi_uncompressed_plane_actual_constraints_info *info = prop_data;

		info->buffer_type = in->buffer_type;
		info->num_planes = in->num_planes;
		info->plane_format[0] = in->plane_format[0];
		if (in->num_planes > 1)
			info->plane_format[1] = in->plane_format[1];

		pkt->shdr.hdr.size += sizeof(u32) + sizeof(*info);
		break;
	}
	case HFI_PROPERTY_CONFIG_HEIC_FRAME_QUALITY: {
		struct hfi_heic_frame_quality *in = pdata, *cq = prop_data;

+4 −0
Original line number Diff line number Diff line
@@ -715,6 +715,10 @@ static int vdec_output_conf(struct venus_inst *inst)
	if (ret)
		return ret;

	ret = venus_helper_set_format_constraints(inst);
	if (ret)
		return ret;

	if (inst->dpb_fmt) {
		ret = venus_helper_set_multistream(inst, false, true);
		if (ret)