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

Commit 2b0a8517 authored by Stanimir Varbanov's avatar Stanimir Varbanov Committed by Mauro Carvalho Chehab
Browse files

media: venus: helpers: add a helper function to set dynamic buffer mode



Adds a new helper function to set dynamic buffer mode if it is
supported by current HFI version. The dynamic buffer mode is
set unconditionally for both decoder outputs.

Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Tested-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent f0383520
Loading
Loading
Loading
Loading
+22 −0
Original line number Original line Diff line number Diff line
@@ -524,6 +524,28 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt)
}
}
EXPORT_SYMBOL_GPL(venus_helper_set_color_format);
EXPORT_SYMBOL_GPL(venus_helper_set_color_format);


int venus_helper_set_dyn_bufmode(struct venus_inst *inst)
{
	const u32 ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE;
	struct hfi_buffer_alloc_mode mode;
	int ret;

	if (!is_dynamic_bufmode(inst))
		return 0;

	mode.type = HFI_BUFFER_OUTPUT;
	mode.mode = HFI_BUFFER_MODE_DYNAMIC;

	ret = hfi_session_set_property(inst, ptype, &mode);
	if (ret)
		return ret;

	mode.type = HFI_BUFFER_OUTPUT2;

	return hfi_session_set_property(inst, ptype, &mode);
}
EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode);

static void delayed_process_buf_func(struct work_struct *work)
static void delayed_process_buf_func(struct work_struct *work)
{
{
	struct venus_buffer *buf, *n;
	struct venus_buffer *buf, *n;
+1 −0
Original line number Original line Diff line number Diff line
@@ -40,6 +40,7 @@ int venus_helper_set_output_resolution(struct venus_inst *inst,
int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
			      unsigned int output_bufs);
			      unsigned int output_bufs);
int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt);
int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt);
int venus_helper_set_dyn_bufmode(struct venus_inst *inst);
void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf);
void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf);
void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx);
void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx);
void venus_helper_init_instance(struct venus_inst *inst);
void venus_helper_init_instance(struct venus_inst *inst);
+3 −12
Original line number Original line Diff line number Diff line
@@ -555,18 +555,9 @@ static int vdec_set_properties(struct venus_inst *inst)
			return ret;
			return ret;
	}
	}


	if (core->res->hfi_version == HFI_VERSION_3XX ||
	ret = venus_helper_set_dyn_bufmode(inst);
	    inst->cap_bufs_mode_dynamic) {
		struct hfi_buffer_alloc_mode mode;

		ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE;
		mode.type = HFI_BUFFER_OUTPUT;
		mode.mode = HFI_BUFFER_MODE_DYNAMIC;

		ret = hfi_session_set_property(inst, ptype, &mode);
	if (ret)
	if (ret)
		return ret;
		return ret;
	}


	if (ctr->post_loop_deb_mode) {
	if (ctr->post_loop_deb_mode) {
		ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER;
		ptype = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER;