@@ -103,6 +103,12 @@ extern "C" {
103
103
/* 8 bpp Red */
104
104
#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
105
105
106
+ /* 10 bpp Red */
107
+ #define DRM_FORMAT_R10 fourcc_code('R', '1', '0', ' ') /* [15:0] x:R 6:10 little endian */
108
+
109
+ /* 12 bpp Red */
110
+ #define DRM_FORMAT_R12 fourcc_code('R', '1', '2', ' ') /* [15:0] x:R 4:12 little endian */
111
+
106
112
/* 16 bpp Red */
107
113
#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
108
114
@@ -372,6 +378,12 @@ extern "C" {
372
378
373
379
#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
374
380
381
+ #define fourcc_mod_get_vendor (modifier ) \
382
+ (((modifier) >> 56) & 0xff)
383
+
384
+ #define fourcc_mod_is_vendor (modifier , vendor ) \
385
+ (fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor)
386
+
375
387
#define fourcc_mod_code (vendor , val ) \
376
388
((((uint64_t)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
377
389
@@ -899,9 +911,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier)
899
911
900
912
/*
901
913
* The top 4 bits (out of the 56 bits alloted for specifying vendor specific
902
- * modifiers) denote the category for modifiers. Currently we have only two
903
- * categories of modifiers ie AFBC and MISC . We can have a maximum of sixteen
904
- * different categories.
914
+ * modifiers) denote the category for modifiers. Currently we have three
915
+ * categories of modifiers ie AFBC, MISC and AFRC . We can have a maximum of
916
+ * sixteen different categories.
905
917
*/
906
918
#define DRM_FORMAT_MOD_ARM_CODE (__type , __val ) \
907
919
fourcc_mod_code(ARM, ((uint64_t)(__type) << 52) | ((__val) & 0x000fffffffffffffULL))
@@ -1016,6 +1028,109 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier)
1016
1028
*/
1017
1029
#define AFBC_FORMAT_MOD_USM (1ULL << 12)
1018
1030
1031
+ /*
1032
+ * Arm Fixed-Rate Compression (AFRC) modifiers
1033
+ *
1034
+ * AFRC is a proprietary fixed rate image compression protocol and format,
1035
+ * designed to provide guaranteed bandwidth and memory footprint
1036
+ * reductions in graphics and media use-cases.
1037
+ *
1038
+ * AFRC buffers consist of one or more planes, with the same components
1039
+ * and meaning as an uncompressed buffer using the same pixel format.
1040
+ *
1041
+ * Within each plane, the pixel/luma/chroma values are grouped into
1042
+ * "coding unit" blocks which are individually compressed to a
1043
+ * fixed size (in bytes). All coding units within a given plane of a buffer
1044
+ * store the same number of values, and have the same compressed size.
1045
+ *
1046
+ * The coding unit size is configurable, allowing different rates of compression.
1047
+ *
1048
+ * The start of each AFRC buffer plane must be aligned to an alignment granule which
1049
+ * depends on the coding unit size.
1050
+ *
1051
+ * Coding Unit Size Plane Alignment
1052
+ * ---------------- ---------------
1053
+ * 16 bytes 1024 bytes
1054
+ * 24 bytes 512 bytes
1055
+ * 32 bytes 2048 bytes
1056
+ *
1057
+ * Coding units are grouped into paging tiles. AFRC buffer dimensions must be aligned
1058
+ * to a multiple of the paging tile dimensions.
1059
+ * The dimensions of each paging tile depend on whether the buffer is optimised for
1060
+ * scanline (SCAN layout) or rotated (ROT layout) access.
1061
+ *
1062
+ * Layout Paging Tile Width Paging Tile Height
1063
+ * ------ ----------------- ------------------
1064
+ * SCAN 16 coding units 4 coding units
1065
+ * ROT 8 coding units 8 coding units
1066
+ *
1067
+ * The dimensions of each coding unit depend on the number of components
1068
+ * in the compressed plane and whether the buffer is optimised for
1069
+ * scanline (SCAN layout) or rotated (ROT layout) access.
1070
+ *
1071
+ * Number of Components in Plane Layout Coding Unit Width Coding Unit Height
1072
+ * ----------------------------- --------- ----------------- ------------------
1073
+ * 1 SCAN 16 samples 4 samples
1074
+ * Example: 16x4 luma samples in a 'Y' plane
1075
+ * 16x4 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer
1076
+ * ----------------------------- --------- ----------------- ------------------
1077
+ * 1 ROT 8 samples 8 samples
1078
+ * Example: 8x8 luma samples in a 'Y' plane
1079
+ * 8x8 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer
1080
+ * ----------------------------- --------- ----------------- ------------------
1081
+ * 2 DONT CARE 8 samples 4 samples
1082
+ * Example: 8x4 chroma pairs in the 'UV' plane of a semi-planar YUV buffer
1083
+ * ----------------------------- --------- ----------------- ------------------
1084
+ * 3 DONT CARE 4 samples 4 samples
1085
+ * Example: 4x4 pixels in an RGB buffer without alpha
1086
+ * ----------------------------- --------- ----------------- ------------------
1087
+ * 4 DONT CARE 4 samples 4 samples
1088
+ * Example: 4x4 pixels in an RGB buffer with alpha
1089
+ */
1090
+
1091
+ #define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02
1092
+
1093
+ #define DRM_FORMAT_MOD_ARM_AFRC (__afrc_mode ) \
1094
+ DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFRC, __afrc_mode)
1095
+
1096
+ /*
1097
+ * AFRC coding unit size modifier.
1098
+ *
1099
+ * Indicates the number of bytes used to store each compressed coding unit for
1100
+ * one or more planes in an AFRC encoded buffer. The coding unit size for chrominance
1101
+ * is the same for both Cb and Cr, which may be stored in separate planes.
1102
+ *
1103
+ * AFRC_FORMAT_MOD_CU_SIZE_P0 indicates the number of bytes used to store
1104
+ * each compressed coding unit in the first plane of the buffer. For RGBA buffers
1105
+ * this is the only plane, while for semi-planar and fully-planar YUV buffers,
1106
+ * this corresponds to the luma plane.
1107
+ *
1108
+ * AFRC_FORMAT_MOD_CU_SIZE_P12 indicates the number of bytes used to store
1109
+ * each compressed coding unit in the second and third planes in the buffer.
1110
+ * For semi-planar and fully-planar YUV buffers, this corresponds to the chroma plane(s).
1111
+ *
1112
+ * For single-plane buffers, AFRC_FORMAT_MOD_CU_SIZE_P0 must be specified
1113
+ * and AFRC_FORMAT_MOD_CU_SIZE_P12 must be zero.
1114
+ * For semi-planar and fully-planar buffers, both AFRC_FORMAT_MOD_CU_SIZE_P0 and
1115
+ * AFRC_FORMAT_MOD_CU_SIZE_P12 must be specified.
1116
+ */
1117
+ #define AFRC_FORMAT_MOD_CU_SIZE_MASK 0xf
1118
+ #define AFRC_FORMAT_MOD_CU_SIZE_16 (1ULL)
1119
+ #define AFRC_FORMAT_MOD_CU_SIZE_24 (2ULL)
1120
+ #define AFRC_FORMAT_MOD_CU_SIZE_32 (3ULL)
1121
+
1122
+ #define AFRC_FORMAT_MOD_CU_SIZE_P0 (__afrc_cu_size ) (__afrc_cu_size)
1123
+ #define AFRC_FORMAT_MOD_CU_SIZE_P12 (__afrc_cu_size ) ((__afrc_cu_size) << 4)
1124
+
1125
+ /*
1126
+ * AFRC scanline memory layout.
1127
+ *
1128
+ * Indicates if the buffer uses the scanline-optimised layout
1129
+ * for an AFRC encoded buffer, otherwise, it uses the rotation-optimised layout.
1130
+ * The memory layout is the same for all planes.
1131
+ */
1132
+ #define AFRC_FORMAT_MOD_LAYOUT_SCAN (1ULL << 8)
1133
+
1019
1134
/*
1020
1135
* Arm 16x16 Block U-Interleaved modifier
1021
1136
*
0 commit comments