summaryrefslogtreecommitdiff
path: root/drivers/media/platform/qcom/venus/hfi_platform_v4.c
blob: 4fc2fd04ca9d174809a5596aef9e3648a56457f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 */
#include "hfi_platform.h"

static const struct hfi_platform_codec_freq_data codec_freq_data[] =  {
	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675, 10 },
	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675, 10 },
	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675, 10 },
	{ V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200, 10 },
	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200, 10 },
	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200, 10 },
	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200, 10 },
	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10 },
};

static const struct hfi_platform_codec_freq_data *
get_codec_freq_data(u32 session_type, u32 pixfmt)
{
	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
	const struct hfi_platform_codec_freq_data *found = NULL;

	for (i = 0; i < data_size; i++) {
		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
			found = &data[i];
			break;
		}
	}

	return found;
}

static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
{
	const struct hfi_platform_codec_freq_data *data;

	data = get_codec_freq_data(session_type, codec);
	if (data)
		return data->vpp_freq;

	return 0;
}

static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
{
	const struct hfi_platform_codec_freq_data *data;

	data = get_codec_freq_data(session_type, codec);
	if (data)
		return data->vsp_freq;

	return 0;
}

const struct hfi_platform hfi_plat_v4 = {
	.codec_vpp_freq = codec_vpp_freq,
	.codec_vsp_freq = codec_vsp_freq,
};