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

Hyun Kwon hyun.kwon at xilinx.com
Sat Feb 10 01:35:52 UTC 2018


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 at 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];
+
+	/**
 	 * @hsub:
 	 *
 	 * Horizontal chroma subsampling factor
-- 
2.7.4



More information about the dri-devel mailing list