xref: /linux/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Register definition file for Samsung MFC V12.x Interface (FIMV) driver
4  *
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *     http://www.samsung.com/
7  */
8 
9 #ifndef _REGS_MFC_V12_H
10 #define _REGS_MFC_V12_H
11 
12 #include <linux/sizes.h>
13 #include "regs-mfc-v10.h"
14 
15 /* MFCv12 Context buffer sizes */
16 #define MFC_CTX_BUF_SIZE_V12		(30 * SZ_1K)
17 #define MFC_H264_DEC_CTX_BUF_SIZE_V12	(2 * SZ_1M)
18 #define MFC_OTHER_DEC_CTX_BUF_SIZE_V12	(30 * SZ_1K)
19 #define MFC_H264_ENC_CTX_BUF_SIZE_V12	(100 * SZ_1K)
20 #define MFC_HEVC_ENC_CTX_BUF_SIZE_V12	(40 * SZ_1K)
21 #define MFC_OTHER_ENC_CTX_BUF_SIZE_V12	(25 * SZ_1K)
22 
23 /* MFCv12 variant defines */
24 #define MAX_FW_SIZE_V12			(SZ_1M)
25 #define MAX_CPB_SIZE_V12		(7 * SZ_1M)
26 #define MFC_VERSION_V12			0xC0
27 #define MFC_NUM_PORTS_V12		1
28 #define S5P_FIMV_CODEC_VP9_ENC		27
29 #define MFC_CHROMA_PAD_BYTES_V12        256
30 #define S5P_FIMV_D_ALIGN_PLANE_SIZE_V12 256
31 
32 /* Encoder buffer size for MFCv12 */
33 #define ENC_V120_BASE_SIZE(x, y) \
34 	((((x) + 3) * ((y) + 3) * 8) \
35 	+ ((((y) * 64) + 2304) * ((x) + 7) / 8))
36 
37 #define ENC_V120_H264_ME_SIZE(x, y) \
38 	ALIGN((ENC_V120_BASE_SIZE(x, y) \
39 	+ (DIV_ROUND_UP((x) * (y), 64) * 32)), 256)
40 
41 #define ENC_V120_MPEG4_ME_SIZE(x, y) \
42 	ALIGN((ENC_V120_BASE_SIZE(x, y) \
43 	+ (DIV_ROUND_UP((x) * (y), 128) * 16)), 256)
44 
45 #define ENC_V120_VP8_ME_SIZE(x, y) \
46 	ALIGN(ENC_V120_BASE_SIZE((x), (y)), 256)
47 
48 #define ENC_V120_HEVC_ME_SIZE(x, y)     \
49 	ALIGN(((((x) + 3) * ((y) + 3) * 32)       \
50 	+ ((((y) * 128) + 2304) * ((x) + 3) / 4)), 256)
51 
52 #endif /*_REGS_MFC_V12_H*/
53