0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _KOMEDA_FORMAT_CAPS_H_
0009 #define _KOMEDA_FORMAT_CAPS_H_
0010
0011 #include <linux/types.h>
0012 #include <uapi/drm/drm_fourcc.h>
0013 #include <drm/drm_fourcc.h>
0014
0015 #define AFBC(x) DRM_FORMAT_MOD_ARM_AFBC(x)
0016
0017
0018 #define AFBC_16x16(x) AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | (x))
0019 #define AFBC_32x8(x) AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 | (x))
0020
0021
0022 #define _YTR AFBC_FORMAT_MOD_YTR
0023 #define _SPLIT AFBC_FORMAT_MOD_SPLIT
0024 #define _SPARSE AFBC_FORMAT_MOD_SPARSE
0025 #define _CBR AFBC_FORMAT_MOD_CBR
0026 #define _TILED AFBC_FORMAT_MOD_TILED
0027 #define _SC AFBC_FORMAT_MOD_SC
0028
0029
0030 #define KOMEDA_FMT_RICH_LAYER BIT(0)
0031 #define KOMEDA_FMT_SIMPLE_LAYER BIT(1)
0032 #define KOMEDA_FMT_WB_LAYER BIT(2)
0033
0034 #define AFBC_TH_LAYOUT_ALIGNMENT 8
0035 #define AFBC_HEADER_SIZE 16
0036 #define AFBC_SUPERBLK_ALIGNMENT 128
0037 #define AFBC_SUPERBLK_PIXELS 256
0038 #define AFBC_BODY_START_ALIGNMENT 1024
0039 #define AFBC_TH_BODY_START_ALIGNMENT 4096
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 struct komeda_format_caps {
0059 u32 hw_id;
0060 u32 fourcc;
0061 u32 supported_layer_types;
0062 u32 supported_rots;
0063 u32 supported_afbc_layouts;
0064 u64 supported_afbc_features;
0065 };
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 struct komeda_format_caps_table {
0077 u32 n_formats;
0078 const struct komeda_format_caps *format_caps;
0079 bool (*format_mod_supported)(const struct komeda_format_caps *caps,
0080 u32 layer_type, u64 modifier, u32 rot);
0081 };
0082
0083 extern u64 komeda_supported_modifiers[];
0084
0085 const struct komeda_format_caps *
0086 komeda_get_format_caps(struct komeda_format_caps_table *table,
0087 u32 fourcc, u64 modifier);
0088
0089 u32 komeda_get_afbc_format_bpp(const struct drm_format_info *info,
0090 u64 modifier);
0091
0092 u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table,
0093 u32 layer_type, u32 *n_fmts);
0094
0095 void komeda_put_fourcc_list(u32 *fourcc_list);
0096
0097 bool komeda_format_mod_supported(struct komeda_format_caps_table *table,
0098 u32 layer_type, u32 fourcc, u64 modifier,
0099 u32 rot);
0100
0101 #endif