forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/arm/malidp_hw.h
....@@ -1,11 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 *
34 * (C) COPYRIGHT 2013-2016 ARM Limited. All rights reserved.
4
- *
5
- * This program is free software and is provided to you under the terms of the
6
- * GNU General Public License version 2 as published by the Free Software
7
- * Foundation, and any use by you of this program is subject to the terms
8
- * of such GNU licence.
95 *
106 * ARM Mali DP hardware manipulation routines.
117 */
....@@ -36,6 +32,12 @@
3632 SE_MEMWRITE = BIT(5),
3733 };
3834
35
+enum rotation_features {
36
+ ROTATE_NONE, /* does not support rotation at all */
37
+ ROTATE_ANY, /* supports rotation on any buffers */
38
+ ROTATE_COMPRESSED, /* supports rotation only on compressed buffers */
39
+};
40
+
3941 struct malidp_format_id {
4042 u32 format; /* DRM fourcc */
4143 u8 layer; /* bitmask of layers supporting it */
....@@ -62,6 +64,10 @@
6264 u16 ptr; /* address offset for the pointer register */
6365 u16 stride_offset; /* offset to the first stride register. */
6466 s16 yuv2rgb_offset; /* offset to the YUV->RGB matrix entries */
67
+ u16 mmu_ctrl_offset; /* offset to the MMU control register */
68
+ enum rotation_features rot; /* type of rotation supported */
69
+ /* address offset for the AFBC decoder registers */
70
+ u16 afbc_decoder_offset;
6571 };
6672
6773 enum malidp_scaling_coeff_set {
....@@ -85,7 +91,10 @@
8591 };
8692
8793 /* regmap features */
88
-#define MALIDP_REGMAP_HAS_CLEARIRQ (1 << 0)
94
+#define MALIDP_REGMAP_HAS_CLEARIRQ BIT(0)
95
+#define MALIDP_DEVICE_AFBC_SUPPORT_SPLIT BIT(1)
96
+#define MALIDP_DEVICE_AFBC_YUV_420_10_SUPPORT_SPLIT BIT(2)
97
+#define MALIDP_DEVICE_AFBC_YUYV_USE_422_P2 BIT(3)
8998
9099 struct malidp_hw_regmap {
91100 /* address offset of the DE register bank */
....@@ -171,7 +180,8 @@
171180 * Calculate the required rotation memory given the active area
172181 * and the buffer format.
173182 */
174
- int (*rotmem_required)(struct malidp_hw_device *hwdev, u16 w, u16 h, u32 fmt);
183
+ int (*rotmem_required)(struct malidp_hw_device *hwdev, u16 w, u16 h,
184
+ u32 fmt, bool has_modifier);
175185
176186 int (*se_set_scaling_coeffs)(struct malidp_hw_device *hwdev,
177187 struct malidp_se_config *se_config,
....@@ -241,6 +251,9 @@
241251
242252 /* size of memory used for rotating layers, up to two banks available */
243253 u32 rotation_memory[2];
254
+
255
+ /* priority level of RQOS register used for driven the ARQOS signal */
256
+ u32 arqos_value;
244257 };
245258
246259 static inline u32 malidp_hw_read(struct malidp_hw_device *hwdev, u32 reg)
....@@ -311,7 +324,9 @@
311324 void malidp_se_irq_fini(struct malidp_hw_device *hwdev);
312325
313326 u8 malidp_hw_get_format_id(const struct malidp_hw_regmap *map,
314
- u8 layer_id, u32 format);
327
+ u8 layer_id, u32 format, bool has_modifier);
328
+
329
+int malidp_format_get_bpp(u32 fmt);
315330
316331 static inline u8 malidp_hw_get_pitch_align(struct malidp_hw_device *hwdev, bool rotated)
317332 {
....@@ -380,4 +395,18 @@
380395
381396 #define MALIDP_GAMMA_LUT_SIZE 4096
382397
398
+#define AFBC_SIZE_MASK AFBC_FORMAT_MOD_BLOCK_SIZE_MASK
399
+#define AFBC_SIZE_16X16 AFBC_FORMAT_MOD_BLOCK_SIZE_16x16
400
+#define AFBC_YTR AFBC_FORMAT_MOD_YTR
401
+#define AFBC_SPARSE AFBC_FORMAT_MOD_SPARSE
402
+#define AFBC_CBR AFBC_FORMAT_MOD_CBR
403
+#define AFBC_SPLIT AFBC_FORMAT_MOD_SPLIT
404
+#define AFBC_TILED AFBC_FORMAT_MOD_TILED
405
+#define AFBC_SC AFBC_FORMAT_MOD_SC
406
+
407
+#define AFBC_MOD_VALID_BITS (AFBC_SIZE_MASK | AFBC_YTR | AFBC_SPLIT | \
408
+ AFBC_SPARSE | AFBC_CBR | AFBC_TILED | AFBC_SC)
409
+
410
+extern const u64 malidp_format_modifiers[];
411
+
383412 #endif /* __MALIDP_HW_H__ */