diff mbox

[RFC,v2,02/10] drm: drm_fourcc: Introduce macro-pixel info to drm_format_info

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

Commit Message

Hyun Kwon Jan. 26, 2018, 2:03 a.m. UTC
Multiple pixels can be grouped as a single unit and form a 'macro-pixel'.
This is to model formats where multiple pixels are stored together
in a specific way, likely byte-algined. 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 bpp is expected to be multiple of 8 bit.

Add 'ppm', pixels per macro-pixel, to note how many pixels are grouped
in a macro-pixel. 'bpm', bits per macro-pixel, specifies how many bits
are in a macro-pixel as there can be some extra padding bits.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
v2
- Introduce macro-pixel over scaling factors
---
---
 drivers/gpu/drm/drm_fourcc.c | 136 +++++++++++++++++++++----------------------
 include/drm/drm_fourcc.h     |   9 +++
 2 files changed, 77 insertions(+), 68 deletions(-)

Comments

Daniel Vetter Jan. 30, 2018, 10:22 a.m. UTC | #1
On Thu, Jan 25, 2018 at 06:03:59PM -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 pixels are stored together
> in a specific way, likely byte-algined. 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 bpp is expected to be multiple of 8 bit.
> 
> Add 'ppm', pixels per macro-pixel, to note how many pixels are grouped
> in a macro-pixel. 'bpm', bits per macro-pixel, specifies how many bits
> are in a macro-pixel as there can be some extra padding bits.

Should we mandate that macro-pixels are always byte-aligned? This would
mean cpm for characters per macro-pixel would be more meaningful.

> 
> Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
> ---
> v2
> - Introduce macro-pixel over scaling factors
> ---
> ---
>  drivers/gpu/drm/drm_fourcc.c | 136 +++++++++++++++++++++----------------------
>  include/drm/drm_fourcc.h     |   9 +++
>  2 files changed, 77 insertions(+), 68 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index b891fe0..8fc1e35 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -105,74 +105,74 @@ EXPORT_SYMBOL(drm_get_format_name);
>  const struct drm_format_info *__drm_format_info(u32 format)
>  {
>  	static const struct drm_format_info formats[] = {
> -		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> -		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> -		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> +		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> +		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },

Ugh. I think some macros for the common/simple cases would be useful.
There's also other people trying to add more information to these (like
alpha bits), refactoring this slightly would help I think.

>  	};
>  
>  	unsigned int i;
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index 752bd43..64038e9 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -37,6 +37,13 @@ struct drm_mode_fb_cmd2;
>   * @num_planes: Number of color planes (1 to 3)
>   * @cpp: Number of bytes per pixel (per plane)
>   * @bpp: Number of bits per pixel (per plane)
> + * @ppm: Number of pixels per macro-pixel (per plane). A macro-pixel is
> + *	composed of multiple pixels, possibly with some padding bits
> + *	around pixels. For example, some 10 bit format has 3 components
> + *	in every 32 bit, where 3 10bit components are followed by 2 bit padding.
> + * @bpm: Number of bits per macro-pixel (per plane). Bits per macro-pixel.
> + *	The value is different from bpp * ppm if a macro-pixel has
> + *	extra padding bits.

Please switch the entire kernel-doc for this structure to the in-line
member kerneldoc style. That's much more readable and groups the comments
closer to the members.

Also I think we should write these out. cpp/bpp are well-known, ppm and
bpm aren't (and bpm usually means beats per minute, so even more
confusing).
-Daniel

>   * @hsub: Horizontal chroma subsampling factor
>   * @vsub: Vertical chroma subsampling factor
>   */
> @@ -46,6 +53,8 @@ struct drm_format_info {
>  	u8 num_planes;
>  	u8 cpp[3];
>  	u8 bpp[3];
> +	u8 ppm[3];
> +	u8 bpm[3];
>  	u8 hsub;
>  	u8 vsub;
>  };
> -- 
> 2.7.4
>
Daniel Vetter Jan. 30, 2018, 10:27 a.m. UTC | #2
On Thu, Jan 25, 2018 at 06:03:59PM -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 pixels are stored together
> in a specific way, likely byte-algined. 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 bpp is expected to be multiple of 8 bit.
> 
> Add 'ppm', pixels per macro-pixel, to note how many pixels are grouped
> in a macro-pixel. 'bpm', bits per macro-pixel, specifies how many bits
> are in a macro-pixel as there can be some extra padding bits.
> 
> Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>

Another thought: If we require that a format description has either cpp or
the macro-pixel stuff set (but not both), then we could avoid changing the
entire table. Calculating the width in bytes would first use cpp, and if
that's 0, try to compute the width using the macro-pixel stuff. And if
that's also 0, then WARN_ON (since it's a kernel bug).
-Daniel

> ---
> v2
> - Introduce macro-pixel over scaling factors
> ---
> ---
>  drivers/gpu/drm/drm_fourcc.c | 136 +++++++++++++++++++++----------------------
>  include/drm/drm_fourcc.h     |   9 +++
>  2 files changed, 77 insertions(+), 68 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index b891fe0..8fc1e35 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -105,74 +105,74 @@ EXPORT_SYMBOL(drm_get_format_name);
>  const struct drm_format_info *__drm_format_info(u32 format)
>  {
>  	static const struct drm_format_info formats[] = {
> -		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> -		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> -		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> -		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> -		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> +		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> +		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> +		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> +		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>  	};
>  
>  	unsigned int i;
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index 752bd43..64038e9 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -37,6 +37,13 @@ struct drm_mode_fb_cmd2;
>   * @num_planes: Number of color planes (1 to 3)
>   * @cpp: Number of bytes per pixel (per plane)
>   * @bpp: Number of bits per pixel (per plane)
> + * @ppm: Number of pixels per macro-pixel (per plane). A macro-pixel is
> + *	composed of multiple pixels, possibly with some padding bits
> + *	around pixels. For example, some 10 bit format has 3 components
> + *	in every 32 bit, where 3 10bit components are followed by 2 bit padding.
> + * @bpm: Number of bits per macro-pixel (per plane). Bits per macro-pixel.
> + *	The value is different from bpp * ppm if a macro-pixel has
> + *	extra padding bits.
>   * @hsub: Horizontal chroma subsampling factor
>   * @vsub: Vertical chroma subsampling factor
>   */
> @@ -46,6 +53,8 @@ struct drm_format_info {
>  	u8 num_planes;
>  	u8 cpp[3];
>  	u8 bpp[3];
> +	u8 ppm[3];
> +	u8 bpm[3];
>  	u8 hsub;
>  	u8 vsub;
>  };
> -- 
> 2.7.4
>
Hyun Kwon Feb. 9, 2018, 2:19 a.m. UTC | #3
Hi Daniel,

On Tue, 2018-01-30 at 02:22:40 -0800, Daniel Vetter wrote:
> On Thu, Jan 25, 2018 at 06:03:59PM -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 pixels are stored together
> > in a specific way, likely byte-algined. 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 bpp is expected to be multiple of 8 bit.
> > 
> > Add 'ppm', pixels per macro-pixel, to note how many pixels are grouped
> > in a macro-pixel. 'bpm', bits per macro-pixel, specifies how many bits
> > are in a macro-pixel as there can be some extra padding bits.
> 
> Should we mandate that macro-pixels are always byte-aligned? This would
> mean cpm for characters per macro-pixel would be more meaningful.
> 

Agreed. That would simplify stuff and be more clean.

> > 
> > Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
> > ---
> > v2
> > - Introduce macro-pixel over scaling factors
> > ---
> > ---
> >  drivers/gpu/drm/drm_fourcc.c | 136 +++++++++++++++++++++----------------------
> >  include/drm/drm_fourcc.h     |   9 +++
> >  2 files changed, 77 insertions(+), 68 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> > index b891fe0..8fc1e35 100644
> > --- a/drivers/gpu/drm/drm_fourcc.c
> > +++ b/drivers/gpu/drm/drm_fourcc.c
> > @@ -105,74 +105,74 @@ EXPORT_SYMBOL(drm_get_format_name);
> >  const struct drm_format_info *__drm_format_info(u32 format)
> >  {
> >  	static const struct drm_format_info formats[] = {
> > -		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },

[snip]

> +		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> 
> Ugh. I think some macros for the common/simple cases would be useful.
> There's also other people trying to add more information to these (like
> alpha bits), refactoring this slightly would help I think.
> 
> >  	};
> >  
> >  	unsigned int i;
> > diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> > index 752bd43..64038e9 100644
> > --- a/include/drm/drm_fourcc.h
> > +++ b/include/drm/drm_fourcc.h
> > @@ -37,6 +37,13 @@ struct drm_mode_fb_cmd2;
> >   * @num_planes: Number of color planes (1 to 3)
> >   * @cpp: Number of bytes per pixel (per plane)
> >   * @bpp: Number of bits per pixel (per plane)
> > + * @ppm: Number of pixels per macro-pixel (per plane). A macro-pixel is
> > + *	composed of multiple pixels, possibly with some padding bits
> > + *	around pixels. For example, some 10 bit format has 3 components
> > + *	in every 32 bit, where 3 10bit components are followed by 2 bit padding.
> > + * @bpm: Number of bits per macro-pixel (per plane). Bits per macro-pixel.
> > + *	The value is different from bpp * ppm if a macro-pixel has
> > + *	extra padding bits.
> 
> Please switch the entire kernel-doc for this structure to the in-line
> member kerneldoc style. That's much more readable and groups the comments
> closer to the members.

Sure, will do.

> 
> Also I think we should write these out. cpp/bpp are well-known, ppm and
> bpm aren't (and bpm usually means beats per minute, so even more
> confusing).

Would having more explanation in the member descriptions abvoe, maybe with
some renaming, be sufficient? or did you mean different write-up?

Thanks,
-hyun

> -Daniel
> 
> >   * @hsub: Horizontal chroma subsampling factor
> >   * @vsub: Vertical chroma subsampling factor
> >   */
> > @@ -46,6 +53,8 @@ struct drm_format_info {
> >  	u8 num_planes;
> >  	u8 cpp[3];
> >  	u8 bpp[3];
> > +	u8 ppm[3];
> > +	u8 bpm[3];
> >  	u8 hsub;
> >  	u8 vsub;
> >  };
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Hyun Kwon Feb. 9, 2018, 2:19 a.m. UTC | #4
Hi Daniel,

On Tue, 2018-01-30 at 02:27:07 -0800, Daniel Vetter wrote:
> On Thu, Jan 25, 2018 at 06:03:59PM -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 pixels are stored together
> > in a specific way, likely byte-algined. 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 bpp is expected to be multiple of 8 bit.
> > 
> > Add 'ppm', pixels per macro-pixel, to note how many pixels are grouped
> > in a macro-pixel. 'bpm', bits per macro-pixel, specifies how many bits
> > are in a macro-pixel as there can be some extra padding bits.
> > 
> > Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
> 
> Another thought: If we require that a format description has either cpp or
> the macro-pixel stuff set (but not both), then we could avoid changing the
> entire table. Calculating the width in bytes would first use cpp, and if
> that's 0, try to compute the width using the macro-pixel stuff. And if
> that's also 0, then WARN_ON (since it's a kernel bug).

That certainly will minimize the change. Thanks a lot for suggestion! I will
address your comments in next version.

Thanks,
-hyun

> -Daniel
> 
> > ---
> > v2
> > - Introduce macro-pixel over scaling factors
> > ---
> > ---
> >  drivers/gpu/drm/drm_fourcc.c | 136 +++++++++++++++++++++----------------------
> >  include/drm/drm_fourcc.h     |   9 +++
> >  2 files changed, 77 insertions(+), 68 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> > index b891fe0..8fc1e35 100644
> > --- a/drivers/gpu/drm/drm_fourcc.c
> > +++ b/drivers/gpu/drm/drm_fourcc.c
> > @@ -105,74 +105,74 @@ EXPORT_SYMBOL(drm_get_format_name);
> >  const struct drm_format_info *__drm_format_info(u32 format)
> >  {
> >  	static const struct drm_format_info formats[] = {
> > -		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > -		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > -		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > -		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > -		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > -		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > -		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > -		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > +		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > +		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > +		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > +		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > +		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > +		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > +		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >  	};
> >  
> >  	unsigned int i;
> > diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> > index 752bd43..64038e9 100644
> > --- a/include/drm/drm_fourcc.h
> > +++ b/include/drm/drm_fourcc.h
> > @@ -37,6 +37,13 @@ struct drm_mode_fb_cmd2;
> >   * @num_planes: Number of color planes (1 to 3)
> >   * @cpp: Number of bytes per pixel (per plane)
> >   * @bpp: Number of bits per pixel (per plane)
> > + * @ppm: Number of pixels per macro-pixel (per plane). A macro-pixel is
> > + *	composed of multiple pixels, possibly with some padding bits
> > + *	around pixels. For example, some 10 bit format has 3 components
> > + *	in every 32 bit, where 3 10bit components are followed by 2 bit padding.
> > + * @bpm: Number of bits per macro-pixel (per plane). Bits per macro-pixel.
> > + *	The value is different from bpp * ppm if a macro-pixel has
> > + *	extra padding bits.
> >   * @hsub: Horizontal chroma subsampling factor
> >   * @vsub: Vertical chroma subsampling factor
> >   */
> > @@ -46,6 +53,8 @@ struct drm_format_info {
> >  	u8 num_planes;
> >  	u8 cpp[3];
> >  	u8 bpp[3];
> > +	u8 ppm[3];
> > +	u8 bpm[3];
> >  	u8 hsub;
> >  	u8 vsub;
> >  };
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Daniel Vetter Feb. 19, 2018, 9:02 a.m. UTC | #5
On Thu, Feb 08, 2018 at 06:19:32PM -0800, Hyun Kwon wrote:
> Hi Daniel,
> 
> On Tue, 2018-01-30 at 02:22:40 -0800, Daniel Vetter wrote:
> > On Thu, Jan 25, 2018 at 06:03:59PM -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 pixels are stored together
> > > in a specific way, likely byte-algined. 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 bpp is expected to be multiple of 8 bit.
> > > 
> > > Add 'ppm', pixels per macro-pixel, to note how many pixels are grouped
> > > in a macro-pixel. 'bpm', bits per macro-pixel, specifies how many bits
> > > are in a macro-pixel as there can be some extra padding bits.
> > 
> > Should we mandate that macro-pixels are always byte-aligned? This would
> > mean cpm for characters per macro-pixel would be more meaningful.
> > 
> 
> Agreed. That would simplify stuff and be more clean.
> 
> > > 
> > > Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
> > > ---
> > > v2
> > > - Introduce macro-pixel over scaling factors
> > > ---
> > > ---
> > >  drivers/gpu/drm/drm_fourcc.c | 136 +++++++++++++++++++++----------------------
> > >  include/drm/drm_fourcc.h     |   9 +++
> > >  2 files changed, 77 insertions(+), 68 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> > > index b891fe0..8fc1e35 100644
> > > --- a/drivers/gpu/drm/drm_fourcc.c
> > > +++ b/drivers/gpu/drm/drm_fourcc.c
> > > @@ -105,74 +105,74 @@ EXPORT_SYMBOL(drm_get_format_name);
> > >  const struct drm_format_info *__drm_format_info(u32 format)
> > >  {
> > >  	static const struct drm_format_info formats[] = {
> > > -		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> 
> [snip]
> 
> > +		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > 
> > Ugh. I think some macros for the common/simple cases would be useful.
> > There's also other people trying to add more information to these (like
> > alpha bits), refactoring this slightly would help I think.
> > 
> > >  	};
> > >  
> > >  	unsigned int i;
> > > diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> > > index 752bd43..64038e9 100644
> > > --- a/include/drm/drm_fourcc.h
> > > +++ b/include/drm/drm_fourcc.h
> > > @@ -37,6 +37,13 @@ struct drm_mode_fb_cmd2;
> > >   * @num_planes: Number of color planes (1 to 3)
> > >   * @cpp: Number of bytes per pixel (per plane)
> > >   * @bpp: Number of bits per pixel (per plane)
> > > + * @ppm: Number of pixels per macro-pixel (per plane). A macro-pixel is
> > > + *	composed of multiple pixels, possibly with some padding bits
> > > + *	around pixels. For example, some 10 bit format has 3 components
> > > + *	in every 32 bit, where 3 10bit components are followed by 2 bit padding.
> > > + * @bpm: Number of bits per macro-pixel (per plane). Bits per macro-pixel.
> > > + *	The value is different from bpp * ppm if a macro-pixel has
> > > + *	extra padding bits.
> > 
> > Please switch the entire kernel-doc for this structure to the in-line
> > member kerneldoc style. That's much more readable and groups the comments
> > closer to the members.
> 
> Sure, will do.
> 
> > 
> > Also I think we should write these out. cpp/bpp are well-known, ppm and
> > bpm aren't (and bpm usually means beats per minute, so even more
> > confusing).
> 
> Would having more explanation in the member descriptions abvoe, maybe with
> some renaming, be sufficient? or did you mean different write-up?

I meant the member name itself needs to be more self-explanatory. Forcing
everyone to go to the docs is inefficient. Good docs are still needed ofc.
-Daniel

> 
> Thanks,
> -hyun
> 
> > -Daniel
> > 
> > >   * @hsub: Horizontal chroma subsampling factor
> > >   * @vsub: Vertical chroma subsampling factor
> > >   */
> > > @@ -46,6 +53,8 @@ struct drm_format_info {
> > >  	u8 num_planes;
> > >  	u8 cpp[3];
> > >  	u8 bpp[3];
> > > +	u8 ppm[3];
> > > +	u8 bpm[3];
> > >  	u8 hsub;
> > >  	u8 vsub;
> > >  };
> > > -- 
> > > 2.7.4
> > > 
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
Daniel Vetter Feb. 19, 2018, 9:03 a.m. UTC | #6
On Thu, Feb 08, 2018 at 06:19:42PM -0800, Hyun Kwon wrote:
> Hi Daniel,
> 
> On Tue, 2018-01-30 at 02:27:07 -0800, Daniel Vetter wrote:
> > On Thu, Jan 25, 2018 at 06:03:59PM -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 pixels are stored together
> > > in a specific way, likely byte-algined. 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 bpp is expected to be multiple of 8 bit.
> > > 
> > > Add 'ppm', pixels per macro-pixel, to note how many pixels are grouped
> > > in a macro-pixel. 'bpm', bits per macro-pixel, specifies how many bits
> > > are in a macro-pixel as there can be some extra padding bits.
> > > 
> > > Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
> > 
> > Another thought: If we require that a format description has either cpp or
> > the macro-pixel stuff set (but not both), then we could avoid changing the
> > entire table. Calculating the width in bytes would first use cpp, and if
> > that's 0, try to compute the width using the macro-pixel stuff. And if
> > that's also 0, then WARN_ON (since it's a kernel bug).
> 
> That certainly will minimize the change. Thanks a lot for suggestion! I will
> address your comments in next version.

Forgot to add: Also WARN_ON if both are set (since that risks creating an
incosistency).
-Daniel

> 
> Thanks,
> -hyun
> 
> > -Daniel
> > 
> > > ---
> > > v2
> > > - Introduce macro-pixel over scaling factors
> > > ---
> > > ---
> > >  drivers/gpu/drm/drm_fourcc.c | 136 +++++++++++++++++++++----------------------
> > >  include/drm/drm_fourcc.h     |   9 +++
> > >  2 files changed, 77 insertions(+), 68 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> > > index b891fe0..8fc1e35 100644
> > > --- a/drivers/gpu/drm/drm_fourcc.c
> > > +++ b/drivers/gpu/drm/drm_fourcc.c
> > > @@ -105,74 +105,74 @@ EXPORT_SYMBOL(drm_get_format_name);
> > >  const struct drm_format_info *__drm_format_info(u32 format)
> > >  {
> > >  	static const struct drm_format_info formats[] = {
> > > -		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > > -		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > > -		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > > -		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > > -		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > > -		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > > -		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > -		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > > +		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
> > > +		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > > +		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
> > > +		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > > +		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
> > > +		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > +		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> > >  	};
> > >  
> > >  	unsigned int i;
> > > diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> > > index 752bd43..64038e9 100644
> > > --- a/include/drm/drm_fourcc.h
> > > +++ b/include/drm/drm_fourcc.h
> > > @@ -37,6 +37,13 @@ struct drm_mode_fb_cmd2;
> > >   * @num_planes: Number of color planes (1 to 3)
> > >   * @cpp: Number of bytes per pixel (per plane)
> > >   * @bpp: Number of bits per pixel (per plane)
> > > + * @ppm: Number of pixels per macro-pixel (per plane). A macro-pixel is
> > > + *	composed of multiple pixels, possibly with some padding bits
> > > + *	around pixels. For example, some 10 bit format has 3 components
> > > + *	in every 32 bit, where 3 10bit components are followed by 2 bit padding.
> > > + * @bpm: Number of bits per macro-pixel (per plane). Bits per macro-pixel.
> > > + *	The value is different from bpp * ppm if a macro-pixel has
> > > + *	extra padding bits.
> > >   * @hsub: Horizontal chroma subsampling factor
> > >   * @vsub: Vertical chroma subsampling factor
> > >   */
> > > @@ -46,6 +53,8 @@ struct drm_format_info {
> > >  	u8 num_planes;
> > >  	u8 cpp[3];
> > >  	u8 bpp[3];
> > > +	u8 ppm[3];
> > > +	u8 bpm[3];
> > >  	u8 hsub;
> > >  	u8 vsub;
> > >  };
> > > -- 
> > > 2.7.4
> > > 
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index b891fe0..8fc1e35 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -105,74 +105,74 @@  EXPORT_SYMBOL(drm_get_format_name);
 const struct drm_format_info *__drm_format_info(u32 format)
 {
 	static const struct drm_format_info formats[] = {
-		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
-		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
-		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
-		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
-		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
-		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
-		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
-		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
-		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
-		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .bpp = { 24, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 1, 0, 0 }, .bpp = { 8, 0, 0 },  .ppm =  { 1, 0, 0 }, .bpm = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .bpp = { 16, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 16, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 24, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 24, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .bpp = { 32, 8, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 32, 8, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
+		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 4 },
+		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
+		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 4, .vsub = 1 },
+		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
+		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 2 },
+		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .bpp = { 8, 8, 8 },  .ppm =  { 1, 1, 1 }, .bpm = { 8, 8, 8 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
+		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 2 },
+		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .bpp = { 8, 16, 0 }, .ppm =  { 1, 1, 0 }, .bpm = { 8, 16, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .bpp = { 16, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 16, 0, 0 }, .hsub = 2, .vsub = 1 },
+		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .bpp = { 32, 0, 0 }, .ppm =  { 1, 0, 0 }, .bpm = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
 	};
 
 	unsigned int i;
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 752bd43..64038e9 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -37,6 +37,13 @@  struct drm_mode_fb_cmd2;
  * @num_planes: Number of color planes (1 to 3)
  * @cpp: Number of bytes per pixel (per plane)
  * @bpp: Number of bits per pixel (per plane)
+ * @ppm: Number of pixels per macro-pixel (per plane). A macro-pixel is
+ *	composed of multiple pixels, possibly with some padding bits
+ *	around pixels. For example, some 10 bit format has 3 components
+ *	in every 32 bit, where 3 10bit components are followed by 2 bit padding.
+ * @bpm: Number of bits per macro-pixel (per plane). Bits per macro-pixel.
+ *	The value is different from bpp * ppm if a macro-pixel has
+ *	extra padding bits.
  * @hsub: Horizontal chroma subsampling factor
  * @vsub: Vertical chroma subsampling factor
  */
@@ -46,6 +53,8 @@  struct drm_format_info {
 	u8 num_planes;
 	u8 cpp[3];
 	u8 bpp[3];
+	u8 ppm[3];
+	u8 bpm[3];
 	u8 hsub;
 	u8 vsub;
 };