Re: [PATCH] drm/fourcc: Add modifier definitions for Arm Fixed Rate Compression

2021-07-26 Thread Liviu Dudau
On Thu, Jul 01, 2021 at 06:07:09PM +0100, Normunds Rieksts wrote:
> Arm Fixed Rate Compression (AFRC) is a proprietary fixed rate image
> compression protocol and format.
> It is designed to provide guaranteed bandwidth and memory footprint
> reductions in graphics and media use-cases.
> 
> This patch aims to add modifier definitions for describing
> AFRC.
> 
> Signed-off-by: Normunds Rieksts 

Applied to drm-misc-next.

Best regards,
Liviu

> ---
>  include/uapi/drm/drm_fourcc.h | 109 +-
>  1 file changed, 106 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index f7156322aba5..9f4bb4a6f358 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -900,9 +900,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
>  
>  /*
>   * The top 4 bits (out of the 56 bits alloted for specifying vendor specific
> - * modifiers) denote the category for modifiers. Currently we have only two
> - * categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen
> - * different categories.
> + * modifiers) denote the category for modifiers. Currently we have three
> + * categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of
> + * sixteen different categories.
>   */
>  #define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \
>   fourcc_mod_code(ARM, ((__u64)(__type) << 52) | ((__val) & 
> 0x000fULL))
> @@ -1017,6 +1017,109 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 
> modifier)
>   */
>  #define AFBC_FORMAT_MOD_USM  (1ULL << 12)
>  
> +/*
> + * Arm Fixed-Rate Compression (AFRC) modifiers
> + *
> + * AFRC is a proprietary fixed rate image compression protocol and format,
> + * designed to provide guaranteed bandwidth and memory footprint
> + * reductions in graphics and media use-cases.
> + *
> + * AFRC buffers consist of one or more planes, with the same components
> + * and meaning as an uncompressed buffer using the same pixel format.
> + *
> + * Within each plane, the pixel/luma/chroma values are grouped into
> + * "coding unit" blocks which are individually compressed to a
> + * fixed size (in bytes). All coding units within a given plane of a buffer
> + * store the same number of values, and have the same compressed size.
> + *
> + * The coding unit size is configurable, allowing different rates of 
> compression.
> + *
> + * The start of each AFRC buffer plane must be aligned to an alignment 
> granule which
> + * depends on the coding unit size.
> + *
> + * Coding Unit Size   Plane Alignment
> + *    ---
> + * 16 bytes   1024 bytes
> + * 24 bytes   512  bytes
> + * 32 bytes   2048 bytes
> + *
> + * Coding units are grouped into paging tiles. AFRC buffer dimensions must 
> be aligned
> + * to a multiple of the paging tile dimensions.
> + * The dimensions of each paging tile depend on whether the buffer is 
> optimised for
> + * scanline (SCAN layout) or rotated (ROT layout) access.
> + *
> + * Layout   Paging Tile Width   Paging Tile Height
> + * --   -   --
> + * SCAN 16 coding units 4 coding units
> + * ROT  8  coding units 8 coding units
> + *
> + * The dimensions of each coding unit depend on the number of components
> + * in the compressed plane and whether the buffer is optimised for
> + * scanline (SCAN layout) or rotated (ROT layout) access.
> + *
> + * Number of Components in Plane   Layout  Coding Unit Width   Coding 
> Unit Height
> + * -   -   -   
> --
> + * 1   SCAN16 samples  4 samples
> + * Example: 16x4 luma samples in a 'Y' plane
> + *  16x4 chroma 'V' values, in the 'V' plane of a fully-planar YUV 
> buffer
> + * -   -   -   
> --
> + * 1   ROT 8 samples   8 samples
> + * Example: 8x8 luma samples in a 'Y' plane
> + *  8x8 chroma 'V' values, in the 'V' plane of a fully-planar YUV 
> buffer
> + * -   -   -   
> --
> + * 2   DONT CARE   8 samples   4 samples
> + * Example: 8x4 chroma pairs in the 'UV' plane of a semi-planar YUV buffer
> + * -   -   -   
> --
> + * 3   DONT CARE   4 samples   4 samples
> + * Example: 4x4 pixels in an RGB buffer without alpha
> + * -   -   -   
> --
> + * 4   DONT CARE   4 samples   4 samples
> + * Example: 4x4 pixels in an RGB buffer with alpha
> + */
> +
> +#define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02
> +
> +#define 

Re: [PATCH] drm/fourcc: Add modifier definitions for Arm Fixed Rate Compression

2021-07-12 Thread Simon Ser
Thanks a lot for the documentation, I appreciate the effort.


Re: [PATCH] drm/fourcc: Add modifier definitions for Arm Fixed Rate Compression

2021-07-12 Thread Liviu Dudau
On Thu, Jul 01, 2021 at 06:07:09PM +0100, Normunds Rieksts wrote:
> Arm Fixed Rate Compression (AFRC) is a proprietary fixed rate image
> compression protocol and format.
> It is designed to provide guaranteed bandwidth and memory footprint
> reductions in graphics and media use-cases.
> 
> This patch aims to add modifier definitions for describing
> AFRC.
> 
> Signed-off-by: Normunds Rieksts 

Looks good to me!

Reviewed-by: Liviu Dudau 

Best regards,
Liviu

> ---
>  include/uapi/drm/drm_fourcc.h | 109 +-
>  1 file changed, 106 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index f7156322aba5..9f4bb4a6f358 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -900,9 +900,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
>  
>  /*
>   * The top 4 bits (out of the 56 bits alloted for specifying vendor specific
> - * modifiers) denote the category for modifiers. Currently we have only two
> - * categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen
> - * different categories.
> + * modifiers) denote the category for modifiers. Currently we have three
> + * categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of
> + * sixteen different categories.
>   */
>  #define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \
>   fourcc_mod_code(ARM, ((__u64)(__type) << 52) | ((__val) & 
> 0x000fULL))
> @@ -1017,6 +1017,109 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 
> modifier)
>   */
>  #define AFBC_FORMAT_MOD_USM  (1ULL << 12)
>  
> +/*
> + * Arm Fixed-Rate Compression (AFRC) modifiers
> + *
> + * AFRC is a proprietary fixed rate image compression protocol and format,
> + * designed to provide guaranteed bandwidth and memory footprint
> + * reductions in graphics and media use-cases.
> + *
> + * AFRC buffers consist of one or more planes, with the same components
> + * and meaning as an uncompressed buffer using the same pixel format.
> + *
> + * Within each plane, the pixel/luma/chroma values are grouped into
> + * "coding unit" blocks which are individually compressed to a
> + * fixed size (in bytes). All coding units within a given plane of a buffer
> + * store the same number of values, and have the same compressed size.
> + *
> + * The coding unit size is configurable, allowing different rates of 
> compression.
> + *
> + * The start of each AFRC buffer plane must be aligned to an alignment 
> granule which
> + * depends on the coding unit size.
> + *
> + * Coding Unit Size   Plane Alignment
> + *    ---
> + * 16 bytes   1024 bytes
> + * 24 bytes   512  bytes
> + * 32 bytes   2048 bytes
> + *
> + * Coding units are grouped into paging tiles. AFRC buffer dimensions must 
> be aligned
> + * to a multiple of the paging tile dimensions.
> + * The dimensions of each paging tile depend on whether the buffer is 
> optimised for
> + * scanline (SCAN layout) or rotated (ROT layout) access.
> + *
> + * Layout   Paging Tile Width   Paging Tile Height
> + * --   -   --
> + * SCAN 16 coding units 4 coding units
> + * ROT  8  coding units 8 coding units
> + *
> + * The dimensions of each coding unit depend on the number of components
> + * in the compressed plane and whether the buffer is optimised for
> + * scanline (SCAN layout) or rotated (ROT layout) access.
> + *
> + * Number of Components in Plane   Layout  Coding Unit Width   Coding 
> Unit Height
> + * -   -   -   
> --
> + * 1   SCAN16 samples  4 samples
> + * Example: 16x4 luma samples in a 'Y' plane
> + *  16x4 chroma 'V' values, in the 'V' plane of a fully-planar YUV 
> buffer
> + * -   -   -   
> --
> + * 1   ROT 8 samples   8 samples
> + * Example: 8x8 luma samples in a 'Y' plane
> + *  8x8 chroma 'V' values, in the 'V' plane of a fully-planar YUV 
> buffer
> + * -   -   -   
> --
> + * 2   DONT CARE   8 samples   4 samples
> + * Example: 8x4 chroma pairs in the 'UV' plane of a semi-planar YUV buffer
> + * -   -   -   
> --
> + * 3   DONT CARE   4 samples   4 samples
> + * Example: 4x4 pixels in an RGB buffer without alpha
> + * -   -   -   
> --
> + * 4   DONT CARE   4 samples   4 samples
> + * Example: 4x4 pixels in an RGB buffer with alpha
> + */
> +
> +#define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02
> +
> +#define 

[PATCH] drm/fourcc: Add modifier definitions for Arm Fixed Rate Compression

2021-07-01 Thread Normunds Rieksts
Arm Fixed Rate Compression (AFRC) is a proprietary fixed rate image
compression protocol and format.
It is designed to provide guaranteed bandwidth and memory footprint
reductions in graphics and media use-cases.

This patch aims to add modifier definitions for describing
AFRC.

Signed-off-by: Normunds Rieksts 
---
 include/uapi/drm/drm_fourcc.h | 109 +-
 1 file changed, 106 insertions(+), 3 deletions(-)

diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index f7156322aba5..9f4bb4a6f358 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -900,9 +900,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
 
 /*
  * The top 4 bits (out of the 56 bits alloted for specifying vendor specific
- * modifiers) denote the category for modifiers. Currently we have only two
- * categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen
- * different categories.
+ * modifiers) denote the category for modifiers. Currently we have three
+ * categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of
+ * sixteen different categories.
  */
 #define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \
fourcc_mod_code(ARM, ((__u64)(__type) << 52) | ((__val) & 
0x000fULL))
@@ -1017,6 +1017,109 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 
modifier)
  */
 #define AFBC_FORMAT_MOD_USM(1ULL << 12)
 
+/*
+ * Arm Fixed-Rate Compression (AFRC) modifiers
+ *
+ * AFRC is a proprietary fixed rate image compression protocol and format,
+ * designed to provide guaranteed bandwidth and memory footprint
+ * reductions in graphics and media use-cases.
+ *
+ * AFRC buffers consist of one or more planes, with the same components
+ * and meaning as an uncompressed buffer using the same pixel format.
+ *
+ * Within each plane, the pixel/luma/chroma values are grouped into
+ * "coding unit" blocks which are individually compressed to a
+ * fixed size (in bytes). All coding units within a given plane of a buffer
+ * store the same number of values, and have the same compressed size.
+ *
+ * The coding unit size is configurable, allowing different rates of 
compression.
+ *
+ * The start of each AFRC buffer plane must be aligned to an alignment granule 
which
+ * depends on the coding unit size.
+ *
+ * Coding Unit Size   Plane Alignment
+ *    ---
+ * 16 bytes   1024 bytes
+ * 24 bytes   512  bytes
+ * 32 bytes   2048 bytes
+ *
+ * Coding units are grouped into paging tiles. AFRC buffer dimensions must be 
aligned
+ * to a multiple of the paging tile dimensions.
+ * The dimensions of each paging tile depend on whether the buffer is 
optimised for
+ * scanline (SCAN layout) or rotated (ROT layout) access.
+ *
+ * Layout   Paging Tile Width   Paging Tile Height
+ * --   -   --
+ * SCAN 16 coding units 4 coding units
+ * ROT  8  coding units 8 coding units
+ *
+ * The dimensions of each coding unit depend on the number of components
+ * in the compressed plane and whether the buffer is optimised for
+ * scanline (SCAN layout) or rotated (ROT layout) access.
+ *
+ * Number of Components in Plane   Layout  Coding Unit Width   Coding Unit 
Height
+ * -   -   -   
--
+ * 1   SCAN16 samples  4 samples
+ * Example: 16x4 luma samples in a 'Y' plane
+ *  16x4 chroma 'V' values, in the 'V' plane of a fully-planar YUV 
buffer
+ * -   -   -   
--
+ * 1   ROT 8 samples   8 samples
+ * Example: 8x8 luma samples in a 'Y' plane
+ *  8x8 chroma 'V' values, in the 'V' plane of a fully-planar YUV 
buffer
+ * -   -   -   
--
+ * 2   DONT CARE   8 samples   4 samples
+ * Example: 8x4 chroma pairs in the 'UV' plane of a semi-planar YUV buffer
+ * -   -   -   
--
+ * 3   DONT CARE   4 samples   4 samples
+ * Example: 4x4 pixels in an RGB buffer without alpha
+ * -   -   -   
--
+ * 4   DONT CARE   4 samples   4 samples
+ * Example: 4x4 pixels in an RGB buffer with alpha
+ */
+
+#define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02
+
+#define DRM_FORMAT_MOD_ARM_AFRC(__afrc_mode) \
+   DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFRC, __afrc_mode)
+
+/*
+ * AFRC coding unit size modifier.
+ *
+ * Indicates the number of bytes used to store each compressed coding unit for
+ * one or more planes in an AFRC encoded buffer. The coding unit size for 
chrominance
+ * is the same for both Cb and