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

media: venus: Enable low power setting for encoder



Set the FW to run in low power for encoder
to accommodate more session without losing much on quality.

Signed-off-by: default avatarDikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 51bb3989
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -292,6 +292,7 @@ struct clock_data {
	unsigned long freq;
	unsigned long vpp_freq;
	unsigned long vsp_freq;
	unsigned long low_power_freq;
};

#define to_venus_buffer(ptr)	container_of(ptr, struct venus_buffer, vb)
@@ -315,6 +316,10 @@ struct venus_ts_metadata {
	struct v4l2_timecode tc;
};

enum venus_inst_modes {
	VENUS_LOW_POWER = BIT(0),
};

/**
 * struct venus_inst - holds per instance parameters
 *
@@ -444,6 +449,7 @@ struct venus_inst {
	unsigned int pic_struct;
	bool next_buf_last;
	bool drain_active;
	enum venus_inst_modes flags;
};

#define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
+2 −0
Original line number Diff line number Diff line
@@ -1627,6 +1627,8 @@ int venus_helper_session_init(struct venus_inst *inst)
								  session_type);
	inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version, codec,
								  session_type);
	inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version, codec,
								       session_type);

	return 0;
}
+7 −3
Original line number Diff line number Diff line
@@ -415,9 +415,6 @@
#define HFI_BUFFER_MODE_RING			0x1000002
#define HFI_BUFFER_MODE_DYNAMIC			0x1000003

#define HFI_VENC_PERFMODE_MAX_QUALITY		0x1
#define HFI_VENC_PERFMODE_POWER_SAVE		0x2

/*
 * HFI_PROPERTY_SYS_COMMON_START
 * HFI_DOMAIN_BASE_COMMON + HFI_ARCH_COMMON_OFFSET + 0x0000
@@ -848,6 +845,13 @@ struct hfi_framesize {
	u32 height;
};

#define HFI_VENC_PERFMODE_MAX_QUALITY		0x1
#define HFI_VENC_PERFMODE_POWER_SAVE		0x2

struct hfi_perf_mode {
	u32 video_perf_mode;
};

#define VIDC_CORE_ID_DEFAULT	0
#define VIDC_CORE_ID_1		1
#define VIDC_CORE_ID_2		2
+16 −0
Original line number Diff line number Diff line
@@ -50,6 +50,22 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session
	return freq;
}

unsigned long
hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_type)
{
	const struct hfi_platform *plat;
	unsigned long freq = 0;

	plat = hfi_platform_get(version);
	if (!plat)
		return 0;

	if (plat->codec_lp_freq)
		freq = plat->codec_lp_freq(session_type, codec);

	return freq;
}

u8 hfi_platform_num_vpp_pipes(enum hfi_version version)
{
	const struct hfi_platform *plat;
+4 −0
Original line number Diff line number Diff line
@@ -43,11 +43,13 @@ struct hfi_platform_codec_freq_data {
	u32 session_type;
	unsigned long vpp_freq;
	unsigned long vsp_freq;
	unsigned long low_power_freq;
};

struct hfi_platform {
	unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec);
	unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec);
	unsigned long (*codec_lp_freq)(u32 session_type, u32 codec);
	void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count);
	const struct hfi_plat_caps *(*capabilities)(unsigned int *entries);
	u8 (*num_vpp_pipes)(void);
@@ -63,5 +65,7 @@ unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 code
					      u32 session_type);
unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec,
					      u32 session_type);
unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec,
					     u32 session_type);
u8 hfi_platform_num_vpp_pipes(enum hfi_version version);
#endif
Loading