diff mbox

[RFC,v3,2/6] drm: drm_fourcc: Introduce macro-pixel info to drm_format_info

Message ID 1518226556-7181-3-git-send-email-hyun.kwon@xilinx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hyun Kwon Feb. 10, 2018, 1:35 a.m. UTC
Multiple pixels can be grouped as a single unit and form a 'macro-pixel'.
This is to model formats where multiple non-byte aligned pixels are stored
together in a byte-aligned way. For example, if 3 - 10 bit
pixels are stored in 32 bit, the 32 bit stroage can be treated as
a single macro-pixel with 3 pixels. This aligns non-byte addressable
formats with drm core where each pixel / component is expected to be
byte aligned.

Add 'pixels_per_macro' to note how many pixels are in a macro-pixel.
'bytes_per_macro' specifies the size of a macro-pixel in bytes.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
v3
- Rename members and rephrase descriptions
- Rephrase the commit message
- Use in-line style comments
v2
- Introduce macro-pixel over scaling factors
---
---
 include/drm/drm_fourcc.h | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Feb. 19, 2018, 11:20 a.m. UTC | #1
On Fri, Feb 09, 2018 at 05:35:52PM -0800, Hyun Kwon wrote:
> Multiple pixels can be grouped as a single unit and form a 'macro-pixel'.
> This is to model formats where multiple non-byte aligned pixels are stored
> together in a byte-aligned way. For example, if 3 - 10 bit
> pixels are stored in 32 bit, the 32 bit stroage can be treated as
> a single macro-pixel with 3 pixels. This aligns non-byte addressable
> formats with drm core where each pixel / component is expected to be
> byte aligned.
> 
> Add 'pixels_per_macro' to note how many pixels are in a macro-pixel.
> 'bytes_per_macro' specifies the size of a macro-pixel in bytes.
> 
> Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
> ---
> v3
> - Rename members and rephrase descriptions
> - Rephrase the commit message
> - Use in-line style comments
> v2
> - Introduce macro-pixel over scaling factors
> ---
> ---
>  include/drm/drm_fourcc.h | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index b00bae4..ce59329 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -58,11 +58,33 @@ struct drm_format_info {
>  	/**
>  	 * @cpp:
>  	 *
> -	 * Number of bytes per pixel (per plane)
> +	 * Number of bytes per pixel (per plane). @cpp shouldn't be used when
> +	 * @pixels_per_macropixel and @bytes_per_macropixel are used.
>  	 */
>  	u8 cpp[3];
>  
>  	/**
> +	 * @pixels_per_macropixel:
> +	 *
> +	 * Number of pixels per macro-pixel (per plane). A macro-pixel is
> +	 * composed of multiple pixels, and there can be extra bits between
> +	 * pixels. This must be used along with @bytes_per_macropixel, only
> +	 * when single pixel size is not byte-aligned. In this case, @cpp
> +	 * is not valid and should be 0.
> +	 */
> +	u8 pixels_per_macropixel[3];
> +
> +	/*
> +	 * @bytes_per_macropixel:
> +	 *
> +	 * Number of bytes per macro-pixel (per plane). A macro-pixel is
> +	 * composed of multiple pixels. The size of single macro-pixel should
> +	 * be byte-aligned. This should be used with @pixels_per_macropixel,
> +	 * and @cpp should be 0.
> +	 */
> +	u8 bytes_per_macropixel[3];

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
> +	/**
>  	 * @hsub:
>  	 *
>  	 * Horizontal chroma subsampling factor
> -- 
> 2.7.4
>
diff mbox

Patch

diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index b00bae4..ce59329 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -58,11 +58,33 @@  struct drm_format_info {
 	/**
 	 * @cpp:
 	 *
-	 * Number of bytes per pixel (per plane)
+	 * Number of bytes per pixel (per plane). @cpp shouldn't be used when
+	 * @pixels_per_macropixel and @bytes_per_macropixel are used.
 	 */
 	u8 cpp[3];
 
 	/**
+	 * @pixels_per_macropixel:
+	 *
+	 * Number of pixels per macro-pixel (per plane). A macro-pixel is
+	 * composed of multiple pixels, and there can be extra bits between
+	 * pixels. This must be used along with @bytes_per_macropixel, only
+	 * when single pixel size is not byte-aligned. In this case, @cpp
+	 * is not valid and should be 0.
+	 */
+	u8 pixels_per_macropixel[3];
+
+	/*
+	 * @bytes_per_macropixel:
+	 *
+	 * Number of bytes per macro-pixel (per plane). A macro-pixel is
+	 * composed of multiple pixels. The size of single macro-pixel should
+	 * be byte-aligned. This should be used with @pixels_per_macropixel,
+	 * and @cpp should be 0.
+	 */
+	u8 bytes_per_macropixel[3];
+
+	/**
 	 * @hsub:
 	 *
 	 * Horizontal chroma subsampling factor