All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/36] Add support 10bit yuv format
@ 2019-09-23 12:38 ` Sandy Huang
  0 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Matthias Brugger; +Cc: linux-mediatek, hjc, linux-arm-kernel

This series of patches is to add 2 plane YCbCr 10bit format
support, but now the drm_format_info.cpp[3] unit is BytePerPlane,
when we add define 10bit YUV format, here have some problems.
So we change cpp to bpp, use unit BitPerPlane to describe the data
format.

Sandy Huang (36):
  drm/fourcc: Add 2 plane YCbCr 10bit format support
  drm/rockchip: use bpp instead of cpp for drm_format_info
  drm/i915: use bpp instead of cpp for drm_format_info
  drm: exynos: use bpp instead of cpp for drm_format_info
  drm/sun4i: use bpp instead of cpp for drm_format_info
  drm/amd: use bpp instead of cpp for drm_format_info
  drm/gma500: use bpp instead of cpp for drm_format_info
  drm/msm: use bpp instead of cpp for drm_format_info
  dm/vmwgfx: use bpp instead of cpp for drm_format_info
  drm/arm: use bpp instead of cpp for drm_format_info
  drm/armada: use bpp instead of cpp for drm_format_info
  drm/radeon: use bpp instead of cpp for drm_format_info
  drm/nouveau: use bpp instead of cpp for drm_format_info
  drm/tegra: use bpp instead of cpp for drm_format_info
  drm/mediatek: use bpp instead of cpp for drm_format_info
  drm/tilcdc: use bpp instead of cpp for drm_format_info
  drm/zte: use bpp instead of cpp for drm_format_info
  drm/xen: use bpp instead of cpp for drm_format_info
  drm/vkms: use bpp instead of cpp for drm_format_info
  drm/ast: use bpp instead of cpp for drm_format_info
  drm/vc4: use bpp instead of cpp for drm_format_info
  drm/atmel-hlcdc: use bpp instead of cpp for drm_format_info
  drm/cirrus: use bpp instead of cpp for drm_format_info
  drm/hisilicon: use bpp instead of cpp for drm_format_info
  drm/imx: use bpp instead of cpp for drm_format_info
  drm/vboxvideo: use bpp instead of cpp for drm_format_info
  drm/pl111: use bpp instead of cpp for drm_format_info
  drm/qxl: use bpp instead of cpp for drm_format_info
  drm/ingenic: use bpp instead of cpp for drm_format_info
  drm/sti: use bpp instead of cpp for drm_format_info
  drm/stm: use bpp instead of cpp for drm_format_info
  drm/mcde: use bpp instead of cpp for drm_format_info
  drm/mgag200: use bpp instead of cpp for drm_format_info
  drm/tve200: use bpp instead of cpp for drm_format_info
  drm/udl: use bpp instead of cpp for drm_format_info
  drm/omapdrm: use bpp instead of cpp for drm_format_info

 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c             |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c             |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c             |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c              |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c              |   2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |   6 +-
 .../drm/arm/display/komeda/komeda_framebuffer.c    |   2 +-
 drivers/gpu/drm/arm/malidp_hw.c                    |   2 +-
 drivers/gpu/drm/arm/malidp_planes.c                |   2 +-
 drivers/gpu/drm/armada/armada_fbdev.c              |   2 +-
 drivers/gpu/drm/armada/armada_plane.c              |   6 +-
 drivers/gpu/drm/ast/ast_mode.c                     |   8 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c    |   2 +-
 drivers/gpu/drm/cirrus/cirrus.c                    |  10 +-
 drivers/gpu/drm/drm_client.c                       |   4 +-
 drivers/gpu/drm/drm_fb_helper.c                    |   8 +-
 drivers/gpu/drm/drm_format_helper.c                |   4 +-
 drivers/gpu/drm/drm_fourcc.c                       | 172 +++++++++++----------
 drivers/gpu/drm/drm_framebuffer.c                  |   2 +-
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c      |   4 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c         |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c          |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_fimc.c           |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c           |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_gsc.c            |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c            |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_rotator.c        |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_scaler.c         |   4 +-
 drivers/gpu/drm/exynos/exynos_mixer.c              |   4 +-
 drivers/gpu/drm/gma500/framebuffer.c               |   4 +-
 drivers/gpu/drm/gma500/gma_display.c               |   4 +-
 drivers/gpu/drm/gma500/mdfld_intel_display.c       |   6 +-
 drivers/gpu/drm/gma500/oaktrail_crtc.c             |   4 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c     |   6 +-
 drivers/gpu/drm/i915/display/intel_atomic_plane.c  |   2 +-
 drivers/gpu/drm/i915/display/intel_display.c       |  28 ++--
 drivers/gpu/drm/i915/display/intel_fbc.c           |   8 +-
 drivers/gpu/drm/i915/display/intel_fbdev.c         |   6 +-
 drivers/gpu/drm/i915/display/intel_sprite.c        |   4 +-
 drivers/gpu/drm/i915/i915_debugfs.c                |   4 +-
 drivers/gpu/drm/i915/intel_pm.c                    |  28 ++--
 drivers/gpu/drm/imx/ipuv3-plane.c                  |   8 +-
 drivers/gpu/drm/ingenic/ingenic-drm.c              |   2 +-
 drivers/gpu/drm/mcde/mcde_display.c                |   4 +-
 drivers/gpu/drm/mediatek/mtk_drm_fb.c              |   2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c           |   2 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c             |  16 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c           |   4 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c          |   2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c           |   2 +-
 drivers/gpu/drm/msm/msm_fb.c                       |   2 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c            |   7 +-
 drivers/gpu/drm/nouveau/dispnv50/base507c.c        |   4 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c        |   2 +-
 drivers/gpu/drm/omapdrm/omap_fb.c                  |   8 +-
 drivers/gpu/drm/pl111/pl111_display.c              |   2 +-
 drivers/gpu/drm/qxl/qxl_draw.c                     |   2 +-
 drivers/gpu/drm/radeon/atombios_crtc.c             |  10 +-
 drivers/gpu/drm/radeon/r100.c                      |   4 +-
 drivers/gpu/drm/radeon/radeon_display.c            |   6 +-
 drivers/gpu/drm/radeon/radeon_fb.c                 |   2 +-
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c        |  14 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c         |   2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c        |   4 +-
 drivers/gpu/drm/sti/sti_gdp.c                      |   2 +-
 drivers/gpu/drm/stm/ltdc.c                         |   2 +-
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c             |   2 +-
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c             |   2 +-
 drivers/gpu/drm/tegra/dc.c                         |   2 +-
 drivers/gpu/drm/tegra/drm.c                        |   2 +-
 drivers/gpu/drm/tegra/fb.c                         |   2 +-
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c               |   2 +-
 drivers/gpu/drm/tilcdc/tilcdc_plane.c              |   2 +-
 drivers/gpu/drm/tve200/tve200_display.c            |   2 +-
 drivers/gpu/drm/udl/udl_fb.c                       |   4 +-
 drivers/gpu/drm/vboxvideo/vbox_mode.c              |   2 +-
 drivers/gpu/drm/vc4/vc4_plane.c                    |  10 +-
 drivers/gpu/drm/vkms/vkms_plane.c                  |   2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c                 |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c                |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c               |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c               |   2 +-
 drivers/gpu/drm/xen/xen_drm_front_kms.c            |   2 +-
 drivers/gpu/drm/zte/zx_plane.c                     |   4 +-
 include/drm/drm_fourcc.h                           |   4 +-
 include/uapi/drm/drm_fourcc.h                      |  15 ++
 86 files changed, 299 insertions(+), 277 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 00/36] Add support 10bit yuv format
@ 2019-09-23 12:38 ` Sandy Huang
  0 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Matthias Brugger; +Cc: linux-mediatek, hjc, linux-arm-kernel

This series of patches is to add 2 plane YCbCr 10bit format
support, but now the drm_format_info.cpp[3] unit is BytePerPlane,
when we add define 10bit YUV format, here have some problems.
So we change cpp to bpp, use unit BitPerPlane to describe the data
format.

Sandy Huang (36):
  drm/fourcc: Add 2 plane YCbCr 10bit format support
  drm/rockchip: use bpp instead of cpp for drm_format_info
  drm/i915: use bpp instead of cpp for drm_format_info
  drm: exynos: use bpp instead of cpp for drm_format_info
  drm/sun4i: use bpp instead of cpp for drm_format_info
  drm/amd: use bpp instead of cpp for drm_format_info
  drm/gma500: use bpp instead of cpp for drm_format_info
  drm/msm: use bpp instead of cpp for drm_format_info
  dm/vmwgfx: use bpp instead of cpp for drm_format_info
  drm/arm: use bpp instead of cpp for drm_format_info
  drm/armada: use bpp instead of cpp for drm_format_info
  drm/radeon: use bpp instead of cpp for drm_format_info
  drm/nouveau: use bpp instead of cpp for drm_format_info
  drm/tegra: use bpp instead of cpp for drm_format_info
  drm/mediatek: use bpp instead of cpp for drm_format_info
  drm/tilcdc: use bpp instead of cpp for drm_format_info
  drm/zte: use bpp instead of cpp for drm_format_info
  drm/xen: use bpp instead of cpp for drm_format_info
  drm/vkms: use bpp instead of cpp for drm_format_info
  drm/ast: use bpp instead of cpp for drm_format_info
  drm/vc4: use bpp instead of cpp for drm_format_info
  drm/atmel-hlcdc: use bpp instead of cpp for drm_format_info
  drm/cirrus: use bpp instead of cpp for drm_format_info
  drm/hisilicon: use bpp instead of cpp for drm_format_info
  drm/imx: use bpp instead of cpp for drm_format_info
  drm/vboxvideo: use bpp instead of cpp for drm_format_info
  drm/pl111: use bpp instead of cpp for drm_format_info
  drm/qxl: use bpp instead of cpp for drm_format_info
  drm/ingenic: use bpp instead of cpp for drm_format_info
  drm/sti: use bpp instead of cpp for drm_format_info
  drm/stm: use bpp instead of cpp for drm_format_info
  drm/mcde: use bpp instead of cpp for drm_format_info
  drm/mgag200: use bpp instead of cpp for drm_format_info
  drm/tve200: use bpp instead of cpp for drm_format_info
  drm/udl: use bpp instead of cpp for drm_format_info
  drm/omapdrm: use bpp instead of cpp for drm_format_info

 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c             |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c             |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c             |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c              |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c              |   2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |   6 +-
 .../drm/arm/display/komeda/komeda_framebuffer.c    |   2 +-
 drivers/gpu/drm/arm/malidp_hw.c                    |   2 +-
 drivers/gpu/drm/arm/malidp_planes.c                |   2 +-
 drivers/gpu/drm/armada/armada_fbdev.c              |   2 +-
 drivers/gpu/drm/armada/armada_plane.c              |   6 +-
 drivers/gpu/drm/ast/ast_mode.c                     |   8 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c    |   2 +-
 drivers/gpu/drm/cirrus/cirrus.c                    |  10 +-
 drivers/gpu/drm/drm_client.c                       |   4 +-
 drivers/gpu/drm/drm_fb_helper.c                    |   8 +-
 drivers/gpu/drm/drm_format_helper.c                |   4 +-
 drivers/gpu/drm/drm_fourcc.c                       | 172 +++++++++++----------
 drivers/gpu/drm/drm_framebuffer.c                  |   2 +-
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c      |   4 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c         |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c          |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_fimc.c           |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c           |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_gsc.c            |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c            |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_rotator.c        |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_scaler.c         |   4 +-
 drivers/gpu/drm/exynos/exynos_mixer.c              |   4 +-
 drivers/gpu/drm/gma500/framebuffer.c               |   4 +-
 drivers/gpu/drm/gma500/gma_display.c               |   4 +-
 drivers/gpu/drm/gma500/mdfld_intel_display.c       |   6 +-
 drivers/gpu/drm/gma500/oaktrail_crtc.c             |   4 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c     |   6 +-
 drivers/gpu/drm/i915/display/intel_atomic_plane.c  |   2 +-
 drivers/gpu/drm/i915/display/intel_display.c       |  28 ++--
 drivers/gpu/drm/i915/display/intel_fbc.c           |   8 +-
 drivers/gpu/drm/i915/display/intel_fbdev.c         |   6 +-
 drivers/gpu/drm/i915/display/intel_sprite.c        |   4 +-
 drivers/gpu/drm/i915/i915_debugfs.c                |   4 +-
 drivers/gpu/drm/i915/intel_pm.c                    |  28 ++--
 drivers/gpu/drm/imx/ipuv3-plane.c                  |   8 +-
 drivers/gpu/drm/ingenic/ingenic-drm.c              |   2 +-
 drivers/gpu/drm/mcde/mcde_display.c                |   4 +-
 drivers/gpu/drm/mediatek/mtk_drm_fb.c              |   2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c           |   2 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c             |  16 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c           |   4 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c          |   2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c           |   2 +-
 drivers/gpu/drm/msm/msm_fb.c                       |   2 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c            |   7 +-
 drivers/gpu/drm/nouveau/dispnv50/base507c.c        |   4 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c        |   2 +-
 drivers/gpu/drm/omapdrm/omap_fb.c                  |   8 +-
 drivers/gpu/drm/pl111/pl111_display.c              |   2 +-
 drivers/gpu/drm/qxl/qxl_draw.c                     |   2 +-
 drivers/gpu/drm/radeon/atombios_crtc.c             |  10 +-
 drivers/gpu/drm/radeon/r100.c                      |   4 +-
 drivers/gpu/drm/radeon/radeon_display.c            |   6 +-
 drivers/gpu/drm/radeon/radeon_fb.c                 |   2 +-
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c        |  14 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c         |   2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c        |   4 +-
 drivers/gpu/drm/sti/sti_gdp.c                      |   2 +-
 drivers/gpu/drm/stm/ltdc.c                         |   2 +-
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c             |   2 +-
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c             |   2 +-
 drivers/gpu/drm/tegra/dc.c                         |   2 +-
 drivers/gpu/drm/tegra/drm.c                        |   2 +-
 drivers/gpu/drm/tegra/fb.c                         |   2 +-
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c               |   2 +-
 drivers/gpu/drm/tilcdc/tilcdc_plane.c              |   2 +-
 drivers/gpu/drm/tve200/tve200_display.c            |   2 +-
 drivers/gpu/drm/udl/udl_fb.c                       |   4 +-
 drivers/gpu/drm/vboxvideo/vbox_mode.c              |   2 +-
 drivers/gpu/drm/vc4/vc4_plane.c                    |  10 +-
 drivers/gpu/drm/vkms/vkms_plane.c                  |   2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c                 |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c                |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c               |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c               |   2 +-
 drivers/gpu/drm/xen/xen_drm_front_kms.c            |   2 +-
 drivers/gpu/drm/zte/zx_plane.c                     |   4 +-
 include/drm/drm_fourcc.h                           |   4 +-
 include/uapi/drm/drm_fourcc.h                      |  15 ++
 86 files changed, 299 insertions(+), 277 deletions(-)

-- 
2.7.4




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-23 12:38 ` Sandy Huang
@ 2019-09-23 12:38   ` Sandy Huang
  -1 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter
  Cc: hjc, linux-kernel

The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
10bit YUV format, here have some problem.
So we change cpp to bpp, use unit BitPerPlane to describe the data
format.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/drm_client.c        |   4 +-
 drivers/gpu/drm/drm_fb_helper.c     |   8 +-
 drivers/gpu/drm/drm_format_helper.c |   4 +-
 drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
 drivers/gpu/drm/drm_framebuffer.c   |   2 +-
 include/drm/drm_fourcc.h            |   4 +-
 include/uapi/drm/drm_fourcc.h       |  15 ++++
 7 files changed, 115 insertions(+), 94 deletions(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index d9a2e36..a36ffbe 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
 
 	dumb_args.width = width;
 	dumb_args.height = height;
-	dumb_args.bpp = info->cpp[0] * 8;
+	dumb_args.bpp = info->bpp[0];
 	ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
 	if (ret)
 		goto err_delete;
@@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
 	int ret;
 
 	info = drm_format_info(format);
-	fb_req.bpp = info->cpp[0] * 8;
+	fb_req.bpp = info->bpp[0];
 	fb_req.depth = info->depth;
 	fb_req.width = width;
 	fb_req.height = height;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index a7ba5b4..b30e782 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
 					  struct drm_clip_rect *clip)
 {
 	struct drm_framebuffer *fb = fb_helper->fb;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
 	void *src = fb_helper->fbdev->screen_buffer + offset;
 	void *dst = fb_helper->buffer->vaddr + offset;
@@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	 * Changes struct fb_var_screeninfo are currently not pushed back
 	 * to KMS, hence fail if different settings are requested.
 	 */
-	if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
+	if (var->bits_per_pixel != fb->format->bpp[0] ||
 	    var->xres > fb->width || var->yres > fb->height ||
 	    var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
 		DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
 			  "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
 			  var->xres, var->yres, var->bits_per_pixel,
 			  var->xres_virtual, var->yres_virtual,
-			  fb->width, fb->height, fb->format->cpp[0] * 8);
+			  fb->width, fb->height, fb->format->bpp[0]);
 		return -EINVAL;
 	}
 
@@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
 	info->pseudo_palette = fb_helper->pseudo_palette;
 	info->var.xres_virtual = fb->width;
 	info->var.yres_virtual = fb->height;
-	info->var.bits_per_pixel = fb->format->cpp[0] * 8;
+	info->var.bits_per_pixel = fb->format->bpp[0];
 	info->var.accel_flags = FB_ACCELF_TEXT;
 	info->var.xoffset = 0;
 	info->var.yoffset = 0;
diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
index 0897cb9..eea3afb 100644
--- a/drivers/gpu/drm/drm_format_helper.c
+++ b/drivers/gpu/drm/drm_format_helper.c
@@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
 void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
 		   struct drm_rect *clip)
 {
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	size_t len = (clip->x2 - clip->x1) * cpp;
 	unsigned int y, lines = clip->y2 - clip->y1;
 
@@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
 			   struct drm_framebuffer *fb,
 			   struct drm_rect *clip)
 {
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
 	size_t len = (clip->x2 - clip->x1) * cpp;
 	unsigned int y, lines = clip->y2 - clip->y1;
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index c630064..071dc07 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_XYUV8888,	.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_XVYU2101010,	.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_XVYU12_16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_XVYU16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_XYUV8888,	.depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_XVYU2101010,	.depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_XVYU12_16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_XVYU16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
 		{ .format = DRM_FORMAT_Y0L0,		.depth = 0,  .num_planes = 1,
 		  .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
 		  .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 0b72468..7b29e97 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
 	r->height = fb->height;
 	r->width = fb->width;
 	r->depth = fb->format->depth;
-	r->bpp = fb->format->cpp[0] * 8;
+	r->bpp = fb->format->bpp[0];
 	r->pitch = fb->pitches[0];
 
 	/* GET_FB() is an unprivileged ioctl so we must not return a
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 306d1ef..021358d 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -73,12 +73,12 @@ struct drm_format_info {
 		/**
 		 * @cpp:
 		 *
-		 * Number of bytes per pixel (per plane), this is aliased with
+		 * Number of bits per pixel (per plane), this is aliased with
 		 * @char_per_block. It is deprecated in favour of using the
 		 * triplet @char_per_block, @block_w, @block_h for better
 		 * describing the pixel format.
 		 */
-		u8 cpp[3];
+		u8 bpp[3];
 
 		/**
 		 * @char_per_block:
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 3feeaa3..5fe89e9 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -266,6 +266,21 @@ extern "C" {
 #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
 
 /*
+ * 2 plane YCbCr 10bit
+ * index 0 = Y plane, [9:0] Y
+ * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
+ * or
+ * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
+ */
+
+#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
+#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
+#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
+
+/*
  * 3 plane YCbCr
  * index 0: Y plane, [7:0] Y
  * index 1: Cb plane, [7:0] Cb
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
@ 2019-09-23 12:38   ` Sandy Huang
  0 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter
  Cc: linux-kernel

The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
10bit YUV format, here have some problem.
So we change cpp to bpp, use unit BitPerPlane to describe the data
format.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/drm_client.c        |   4 +-
 drivers/gpu/drm/drm_fb_helper.c     |   8 +-
 drivers/gpu/drm/drm_format_helper.c |   4 +-
 drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
 drivers/gpu/drm/drm_framebuffer.c   |   2 +-
 include/drm/drm_fourcc.h            |   4 +-
 include/uapi/drm/drm_fourcc.h       |  15 ++++
 7 files changed, 115 insertions(+), 94 deletions(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index d9a2e36..a36ffbe 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
 
 	dumb_args.width = width;
 	dumb_args.height = height;
-	dumb_args.bpp = info->cpp[0] * 8;
+	dumb_args.bpp = info->bpp[0];
 	ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
 	if (ret)
 		goto err_delete;
@@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
 	int ret;
 
 	info = drm_format_info(format);
-	fb_req.bpp = info->cpp[0] * 8;
+	fb_req.bpp = info->bpp[0];
 	fb_req.depth = info->depth;
 	fb_req.width = width;
 	fb_req.height = height;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index a7ba5b4..b30e782 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
 					  struct drm_clip_rect *clip)
 {
 	struct drm_framebuffer *fb = fb_helper->fb;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
 	void *src = fb_helper->fbdev->screen_buffer + offset;
 	void *dst = fb_helper->buffer->vaddr + offset;
@@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	 * Changes struct fb_var_screeninfo are currently not pushed back
 	 * to KMS, hence fail if different settings are requested.
 	 */
-	if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
+	if (var->bits_per_pixel != fb->format->bpp[0] ||
 	    var->xres > fb->width || var->yres > fb->height ||
 	    var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
 		DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
 			  "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
 			  var->xres, var->yres, var->bits_per_pixel,
 			  var->xres_virtual, var->yres_virtual,
-			  fb->width, fb->height, fb->format->cpp[0] * 8);
+			  fb->width, fb->height, fb->format->bpp[0]);
 		return -EINVAL;
 	}
 
@@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
 	info->pseudo_palette = fb_helper->pseudo_palette;
 	info->var.xres_virtual = fb->width;
 	info->var.yres_virtual = fb->height;
-	info->var.bits_per_pixel = fb->format->cpp[0] * 8;
+	info->var.bits_per_pixel = fb->format->bpp[0];
 	info->var.accel_flags = FB_ACCELF_TEXT;
 	info->var.xoffset = 0;
 	info->var.yoffset = 0;
diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
index 0897cb9..eea3afb 100644
--- a/drivers/gpu/drm/drm_format_helper.c
+++ b/drivers/gpu/drm/drm_format_helper.c
@@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
 void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
 		   struct drm_rect *clip)
 {
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	size_t len = (clip->x2 - clip->x1) * cpp;
 	unsigned int y, lines = clip->y2 - clip->y1;
 
@@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
 			   struct drm_framebuffer *fb,
 			   struct drm_rect *clip)
 {
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
 	size_t len = (clip->x2 - clip->x1) * cpp;
 	unsigned int y, lines = clip->y2 - clip->y1;
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index c630064..071dc07 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_XBGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
-		{ .format = DRM_FORMAT_ARGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_ABGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
-		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_XYUV8888,	.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
-		{ .format = DRM_FORMAT_XVYU2101010,	.depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_XVYU12_16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
-		{ .format = DRM_FORMAT_XVYU16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_C8,		.depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB332,		.depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR233,		.depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA4444,	.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR1555,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA5551,	.depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGB565,		.depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR565,		.depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB888,		.depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGR888,		.depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XRGB8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX8888,	.depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGB565_A8,	.depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGR565_A8,	.depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_RGBX1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_BGRX1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR2101010,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA1010102,	.depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ARGB8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBA8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRA8888,	.depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_XBGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
+		{ .format = DRM_FORMAT_ARGB16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_ABGR16161616F,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGB888_A8,	.depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGR888_A8,	.depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XRGB8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_XBGR8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_RGBX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_BGRX8888_A8,	.depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
+		{ .format = DRM_FORMAT_YUV410,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU410,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV411,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU411,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV420,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU420,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV422,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU422,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUV444,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVU444,		.depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV12,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV21,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV16,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV61,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV24,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV42,		.depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YUYV,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_YVYU,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_UYVY,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_VYUY,		.depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_XYUV8888,	.depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_AYUV,		.depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
+		{ .format = DRM_FORMAT_XVYU2101010,	.depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_XVYU12_16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
+		{ .format = DRM_FORMAT_XVYU16161616,	.depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
 		{ .format = DRM_FORMAT_Y0L0,		.depth = 0,  .num_planes = 1,
 		  .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
 		  .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 0b72468..7b29e97 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
 	r->height = fb->height;
 	r->width = fb->width;
 	r->depth = fb->format->depth;
-	r->bpp = fb->format->cpp[0] * 8;
+	r->bpp = fb->format->bpp[0];
 	r->pitch = fb->pitches[0];
 
 	/* GET_FB() is an unprivileged ioctl so we must not return a
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 306d1ef..021358d 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -73,12 +73,12 @@ struct drm_format_info {
 		/**
 		 * @cpp:
 		 *
-		 * Number of bytes per pixel (per plane), this is aliased with
+		 * Number of bits per pixel (per plane), this is aliased with
 		 * @char_per_block. It is deprecated in favour of using the
 		 * triplet @char_per_block, @block_w, @block_h for better
 		 * describing the pixel format.
 		 */
-		u8 cpp[3];
+		u8 bpp[3];
 
 		/**
 		 * @char_per_block:
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 3feeaa3..5fe89e9 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -266,6 +266,21 @@ extern "C" {
 #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
 
 /*
+ * 2 plane YCbCr 10bit
+ * index 0 = Y plane, [9:0] Y
+ * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
+ * or
+ * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
+ */
+
+#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
+#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
+#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
+
+/*
  * 3 plane YCbCr
  * index 0: Y plane, [7:0] Y
  * index 1: Cb plane, [7:0] Cb
-- 
2.7.4



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 02/36] drm/rockchip: use bpp instead of cpp for drm_format_info
  2019-09-23 12:38 ` Sandy Huang
  (?)
@ 2019-09-23 12:38   ` Sandy Huang
  -1 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Sandy Huang, Heiko Stübner, David Airlie, Daniel Vetter
  Cc: linux-arm-kernel, linux-rockchip, linux-kernel

cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  | 2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index ca01234..ee1158e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -81,7 +81,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 
 		min_size = (height - 1) * mode_cmd->pitches[i] +
 			mode_cmd->offsets[i] +
-			width * info->cpp[i];
+			width * info->bpp[i] / 8;
 
 		if (obj->size < min_size) {
 			drm_gem_object_put_unlocked(obj);
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 2f821c5..d90d4b6 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -832,7 +832,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
 	dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
 
-	offset = (src->x1 >> 16) * fb->format->cpp[0];
+	offset = (src->x1 >> 16) * fb->format->bpp[0] / 8;
 	offset += (src->y1 >> 16) * fb->pitches[0];
 	dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];
 
@@ -859,7 +859,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	if (is_yuv) {
 		int hsub = fb->format->hsub;
 		int vsub = fb->format->vsub;
-		int bpp = fb->format->cpp[1];
+		int bpp = fb->format->bpp[1] / 8;
 
 		uv_obj = fb->obj[1];
 		rk_uv_obj = to_rockchip_obj(uv_obj);
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 02/36] drm/rockchip: use bpp instead of cpp for drm_format_info
@ 2019-09-23 12:38   ` Sandy Huang
  0 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Sandy Huang, Heiko Stübner, David Airlie, Daniel Vetter
  Cc: linux-rockchip, linux-kernel, linux-arm-kernel

cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  | 2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index ca01234..ee1158e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -81,7 +81,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 
 		min_size = (height - 1) * mode_cmd->pitches[i] +
 			mode_cmd->offsets[i] +
-			width * info->cpp[i];
+			width * info->bpp[i] / 8;
 
 		if (obj->size < min_size) {
 			drm_gem_object_put_unlocked(obj);
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 2f821c5..d90d4b6 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -832,7 +832,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
 	dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
 
-	offset = (src->x1 >> 16) * fb->format->cpp[0];
+	offset = (src->x1 >> 16) * fb->format->bpp[0] / 8;
 	offset += (src->y1 >> 16) * fb->pitches[0];
 	dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];
 
@@ -859,7 +859,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	if (is_yuv) {
 		int hsub = fb->format->hsub;
 		int vsub = fb->format->vsub;
-		int bpp = fb->format->cpp[1];
+		int bpp = fb->format->bpp[1] / 8;
 
 		uv_obj = fb->obj[1];
 		rk_uv_obj = to_rockchip_obj(uv_obj);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 02/36] drm/rockchip: use bpp instead of cpp for drm_format_info
@ 2019-09-23 12:38   ` Sandy Huang
  0 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Sandy Huang, Heiko Stübner, David Airlie, Daniel Vetter
  Cc: linux-rockchip, linux-kernel, linux-arm-kernel

cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  | 2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index ca01234..ee1158e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -81,7 +81,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 
 		min_size = (height - 1) * mode_cmd->pitches[i] +
 			mode_cmd->offsets[i] +
-			width * info->cpp[i];
+			width * info->bpp[i] / 8;
 
 		if (obj->size < min_size) {
 			drm_gem_object_put_unlocked(obj);
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 2f821c5..d90d4b6 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -832,7 +832,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
 	dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
 
-	offset = (src->x1 >> 16) * fb->format->cpp[0];
+	offset = (src->x1 >> 16) * fb->format->bpp[0] / 8;
 	offset += (src->y1 >> 16) * fb->pitches[0];
 	dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];
 
@@ -859,7 +859,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	if (is_yuv) {
 		int hsub = fb->format->hsub;
 		int vsub = fb->format->vsub;
-		int bpp = fb->format->cpp[1];
+		int bpp = fb->format->bpp[1] / 8;
 
 		uv_obj = fb->obj[1];
 		rk_uv_obj = to_rockchip_obj(uv_obj);
-- 
2.7.4




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 03/36] drm/i915: use bpp instead of cpp for drm_format_info
  2019-09-23 12:38 ` Sandy Huang
                   ` (2 preceding siblings ...)
  (?)
@ 2019-09-23 12:38 ` Sandy Huang
  -1 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	David Airlie, Daniel Vetter, Ville Syrjälä,
	Maarten Lankhorst, Matt Roper, Chris Wilson, Sandy Huang,
	Sam Ravnborg, José Roberto de Souza, Daniel Drake,
	Lucas De Marchi, Lyude Paul, Dave Airlie
  Cc: Jani Nikula, Juha-Pekka Heikkila, Daniel Vetter, intel-gfx, linux-kernel

cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/i915/display/intel_atomic_plane.c |  2 +-
 drivers/gpu/drm/i915/display/intel_display.c      | 28 +++++++++++------------
 drivers/gpu/drm/i915/display/intel_fbc.c          |  8 +++----
 drivers/gpu/drm/i915/display/intel_fbdev.c        |  6 ++---
 drivers/gpu/drm/i915/display/intel_sprite.c       |  4 ++--
 drivers/gpu/drm/i915/i915_debugfs.c               |  4 ++--
 drivers/gpu/drm/i915/intel_pm.c                   | 28 +++++++++++------------
 7 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 30bd4e7..2e93234 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -123,7 +123,7 @@ unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
 	if (!plane_state->base.visible)
 		return 0;
 
-	cpp = fb->format->cpp[0];
+	cpp = fb->format->bpp[0] / 8;
 
 	/*
 	 * Based on HSD#:1408715493
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 21c71fd..732db3f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -1912,7 +1912,7 @@ static unsigned int
 intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane)
 {
 	struct drm_i915_private *dev_priv = to_i915(fb->dev);
-	unsigned int cpp = fb->format->cpp[color_plane];
+	unsigned int cpp = fb->format->bpp[color_plane] / 8;
 
 	switch (fb->modifier) {
 	case DRM_FORMAT_MOD_LINEAR:
@@ -1969,7 +1969,7 @@ static void intel_tile_dims(const struct drm_framebuffer *fb, int color_plane,
 			    unsigned int *tile_height)
 {
 	unsigned int tile_width_bytes = intel_tile_width_bytes(fb, color_plane);
-	unsigned int cpp = fb->format->cpp[color_plane];
+	unsigned int cpp = fb->format->bpp[color_plane] / 8;
 
 	*tile_width = tile_width_bytes / cpp;
 	*tile_height = intel_tile_size(to_i915(fb->dev)) / tile_width_bytes;
@@ -2207,7 +2207,7 @@ u32 intel_fb_xy_to_linear(int x, int y,
 			  int color_plane)
 {
 	const struct drm_framebuffer *fb = state->base.fb;
-	unsigned int cpp = fb->format->cpp[color_plane];
+	unsigned int cpp = fb->format->bpp[color_plane] / 8;
 	unsigned int pitch = state->color_plane[color_plane].stride;
 
 	return y * pitch + x * cpp;
@@ -2267,7 +2267,7 @@ static u32 intel_adjust_aligned_offset(int *x, int *y,
 				       u32 old_offset, u32 new_offset)
 {
 	struct drm_i915_private *dev_priv = to_i915(fb->dev);
-	unsigned int cpp = fb->format->cpp[color_plane];
+	unsigned int cpp = fb->format->bpp[color_plane] / 8;
 
 	WARN_ON(new_offset > old_offset);
 
@@ -2335,7 +2335,7 @@ static u32 intel_compute_aligned_offset(struct drm_i915_private *dev_priv,
 					unsigned int rotation,
 					u32 alignment)
 {
-	unsigned int cpp = fb->format->cpp[color_plane];
+	unsigned int cpp = fb->format->bpp[color_plane] / 8;
 	u32 offset, offset_aligned;
 
 	if (alignment)
@@ -2655,7 +2655,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
 		int x, y;
 		int ret;
 
-		cpp = fb->format->cpp[i];
+		cpp = fb->format->bpp[i] / 8;
 		width = drm_framebuffer_plane_width(fb->width, fb, i);
 		height = drm_framebuffer_plane_height(fb->height, fb, i);
 
@@ -2840,7 +2840,7 @@ intel_plane_remap_gtt(struct intel_plane_state *plane_state)
 	for (i = 0; i < num_planes; i++) {
 		unsigned int hsub = i ? fb->format->hsub : 1;
 		unsigned int vsub = i ? fb->format->vsub : 1;
-		unsigned int cpp = fb->format->cpp[i];
+		unsigned int cpp = fb->format->bpp[i] / 8;
 		unsigned int tile_width, tile_height;
 		unsigned int width, height;
 		unsigned int pitch_tiles;
@@ -3286,7 +3286,7 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb,
 			       int color_plane,
 			       unsigned int rotation)
 {
-	int cpp = fb->format->cpp[color_plane];
+	int cpp = fb->format->bpp[color_plane] / 8;
 
 	switch (fb->modifier) {
 	case DRM_FORMAT_MOD_LINEAR:
@@ -3311,7 +3311,7 @@ static int glk_max_plane_width(const struct drm_framebuffer *fb,
 			       int color_plane,
 			       unsigned int rotation)
 {
-	int cpp = fb->format->cpp[color_plane];
+	int cpp = fb->format->bpp[color_plane] / 8;
 
 	switch (fb->modifier) {
 	case DRM_FORMAT_MOD_LINEAR:
@@ -3426,7 +3426,7 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
 	 * TODO: linear and Y-tiled seem fine, Yf untested,
 	 */
 	if (fb->modifier == I915_FORMAT_MOD_X_TILED) {
-		int cpp = fb->format->cpp[0];
+		int cpp = fb->format->bpp[0] / 8;
 
 		while ((x + w) * cpp > plane_state->color_plane[0].stride) {
 			if (offset == 0) {
@@ -8513,7 +8513,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
 
 	DRM_DEBUG_KMS("%s/%s with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
 		      crtc->base.name, plane->base.name, fb->width, fb->height,
-		      fb->format->cpp[0] * 8, base, fb->pitches[0],
+		      fb->format->bpp[0], base, fb->pitches[0],
 		      plane_config->size);
 
 	plane_config->fb = intel_fb;
@@ -9753,7 +9753,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
 
 	DRM_DEBUG_KMS("%s/%s with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
 		      crtc->base.name, plane->base.name, fb->width, fb->height,
-		      fb->format->cpp[0] * 8, base, fb->pitches[0],
+		      fb->format->bpp[0], base, fb->pitches[0],
 		      plane_config->size);
 
 	plane_config->fb = intel_fb;
@@ -10350,7 +10350,7 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
 	if (HAS_GMCH(dev_priv) &&
 	    plane_state->base.rotation & DRM_MODE_ROTATE_180)
 		base += (plane_state->base.crtc_h *
-			 plane_state->base.crtc_w - 1) * fb->format->cpp[0];
+			 plane_state->base.crtc_w - 1) * fb->format->bpp[0] / 8;
 
 	return base;
 }
@@ -10728,7 +10728,7 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
 	WARN_ON(plane_state->base.visible &&
 		plane_state->color_plane[0].stride != fb->pitches[0]);
 
-	if (fb->pitches[0] != plane_state->base.crtc_w * fb->format->cpp[0]) {
+	if (fb->pitches[0] != plane_state->base.crtc_w * fb->format->bpp[0] / 8) {
 		DRM_DEBUG_KMS("Invalid cursor stride (%u) (cursor width %d)\n",
 			      fb->pitches[0], plane_state->base.crtc_w);
 		return -EINVAL;
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index d36cada..7911c49 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -172,7 +172,7 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv)
 	u32 dpfc_ctl;
 
 	dpfc_ctl = DPFC_CTL_PLANE(params->crtc.i9xx_plane) | DPFC_SR_EN;
-	if (params->fb.format->cpp[0] == 2)
+	if (params->fb.format->bpp[0] == 16)
 		dpfc_ctl |= DPFC_CTL_LIMIT_2X;
 	else
 		dpfc_ctl |= DPFC_CTL_LIMIT_1X;
@@ -219,7 +219,7 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv)
 	int threshold = dev_priv->fbc.threshold;
 
 	dpfc_ctl = DPFC_CTL_PLANE(params->crtc.i9xx_plane);
-	if (params->fb.format->cpp[0] == 2)
+	if (params->fb.format->bpp[0] == 16)
 		threshold++;
 
 	switch (threshold) {
@@ -302,7 +302,7 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv)
 	if (IS_IVYBRIDGE(dev_priv))
 		dpfc_ctl |= IVB_DPFC_CTL_PLANE(params->crtc.i9xx_plane);
 
-	if (params->fb.format->cpp[0] == 2)
+	if (params->fb.format->bpp[0] == 16)
 		threshold++;
 
 	switch (threshold) {
@@ -498,7 +498,7 @@ static int intel_fbc_alloc_cfb(struct intel_crtc *crtc)
 	WARN_ON(drm_mm_node_allocated(&fbc->compressed_fb));
 
 	size = intel_fbc_calculate_cfb_size(dev_priv, &fbc->state_cache);
-	fb_cpp = fbc->state_cache.fb.format->cpp[0];
+	fb_cpp = fbc->state_cache.fb.format->bpp[0] / 8;
 
 	ret = find_compression_threshold(dev_priv, &fbc->compressed_fb,
 					 size, fb_cpp);
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 1edd44e..ae98063 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -373,7 +373,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 		 * rather than the current pipe's, since they differ.
 		 */
 		cur_size = crtc->state->adjusted_mode.crtc_hdisplay;
-		cur_size = cur_size * fb->base.format->cpp[0];
+		cur_size = cur_size * fb->base.format->bpp[0] / 8;
 		if (fb->base.pitches[0] < cur_size) {
 			DRM_DEBUG_KMS("fb not wide enough for plane %c (%d vs %d)\n",
 				      pipe_name(intel_crtc->pipe),
@@ -389,7 +389,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 			      pipe_name(intel_crtc->pipe),
 			      crtc->state->adjusted_mode.crtc_hdisplay,
 			      crtc->state->adjusted_mode.crtc_vdisplay,
-			      fb->base.format->cpp[0] * 8,
+			      fb->base.format->bpp[0],
 			      cur_size);
 
 		if (cur_size > max_size) {
@@ -410,7 +410,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 		goto out;
 	}
 
-	ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
+	ifbdev->preferred_bpp = fb->base.format->bpp[0];
 	ifbdev->fb = fb;
 
 	drm_framebuffer_get(&ifbdev->fb->base);
diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
index 004b520..bdcdbe4 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -336,7 +336,7 @@ skl_plane_max_stride(struct intel_plane *plane,
 		     unsigned int rotation)
 {
 	const struct drm_format_info *info = drm_format_info(pixel_format);
-	int cpp = info->cpp[0];
+	int cpp = info->bpp[0] / 8;
 
 	/*
 	 * "The stride in bytes must not exceed the
@@ -1350,7 +1350,7 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state,
 	int src_x, src_y, src_w, src_h, crtc_w, crtc_h;
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->base.adjusted_mode;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int width_bytes;
 	int min_width, min_height;
 
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 62cf34d..a51ed85 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1631,7 +1631,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
 			   fbdev_fb->base.width,
 			   fbdev_fb->base.height,
 			   fbdev_fb->base.format->depth,
-			   fbdev_fb->base.format->cpp[0] * 8,
+			   fbdev_fb->base.format->bpp[0],
 			   fbdev_fb->base.modifier,
 			   drm_framebuffer_read_refcount(&fbdev_fb->base));
 		describe_obj(m, intel_fb_obj(&fbdev_fb->base));
@@ -1649,7 +1649,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
 			   fb->base.width,
 			   fb->base.height,
 			   fb->base.format->depth,
-			   fb->base.format->cpp[0] * 8,
+			   fb->base.format->bpp[0],
 			   fb->base.modifier,
 			   drm_framebuffer_read_refcount(&fb->base));
 		describe_obj(m, intel_fb_obj(&fb->base));
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index d9a7a13..a70b372 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -873,7 +873,7 @@ static void pineview_update_wm(struct intel_crtc *unused_crtc)
 			&crtc->config->base.adjusted_mode;
 		const struct drm_framebuffer *fb =
 			crtc->base.primary->state->fb;
-		int cpp = fb->format->cpp[0];
+		int cpp = fb->format->bpp[0] / 8;
 		int clock = adjusted_mode->crtc_clock;
 
 		/* Display SR */
@@ -1131,7 +1131,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
 	    level != G4X_WM_LEVEL_NORMAL)
 		cpp = 4;
 	else
-		cpp = plane_state->base.fb->format->cpp[0];
+		cpp = plane_state->base.fb->format->bpp[0] / 8;
 
 	clock = adjusted_mode->crtc_clock;
 	htotal = adjusted_mode->crtc_htotal;
@@ -1624,7 +1624,7 @@ static u16 vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
 	if (!intel_wm_plane_visible(crtc_state, plane_state))
 		return 0;
 
-	cpp = plane_state->base.fb->format->cpp[0];
+	cpp = plane_state->base.fb->format->bpp[0] / 8;
 	clock = adjusted_mode->crtc_clock;
 	htotal = adjusted_mode->crtc_htotal;
 	width = crtc_state->pipe_src_w;
@@ -2216,7 +2216,7 @@ static void i965_update_wm(struct intel_crtc *unused_crtc)
 		int clock = adjusted_mode->crtc_clock;
 		int htotal = adjusted_mode->crtc_htotal;
 		int hdisplay = crtc->config->pipe_src_w;
-		int cpp = fb->format->cpp[0];
+		int cpp = fb->format->bpp[0] / 8;
 		int entries;
 
 		entries = intel_wm_method2(clock, htotal,
@@ -2299,7 +2299,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
 		if (IS_GEN(dev_priv, 2))
 			cpp = 4;
 		else
-			cpp = fb->format->cpp[0];
+			cpp = fb->format->bpp[0] / 8;
 
 		planea_wm = intel_calculate_wm(adjusted_mode->crtc_clock,
 					       wm_info, fifo_size, cpp,
@@ -2326,7 +2326,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
 		if (IS_GEN(dev_priv, 2))
 			cpp = 4;
 		else
-			cpp = fb->format->cpp[0];
+			cpp = fb->format->bpp[0] / 8;
 
 		planeb_wm = intel_calculate_wm(adjusted_mode->crtc_clock,
 					       wm_info, fifo_size, cpp,
@@ -2378,7 +2378,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
 		if (IS_I915GM(dev_priv) || IS_I945GM(dev_priv))
 			cpp = 4;
 		else
-			cpp = fb->format->cpp[0];
+			cpp = fb->format->bpp[0] / 8;
 
 		entries = intel_wm_method2(clock, htotal, hdisplay, cpp,
 					   sr_latency_ns / 100);
@@ -2506,7 +2506,7 @@ static u32 ilk_compute_pri_wm(const struct intel_crtc_state *cstate,
 	if (!intel_wm_plane_visible(cstate, pstate))
 		return 0;
 
-	cpp = pstate->base.fb->format->cpp[0];
+	cpp = pstate->base.fb->format->bpp[0] / 8;
 
 	method1 = ilk_wm_method1(cstate->pixel_rate, cpp, mem_value);
 
@@ -2538,7 +2538,7 @@ static u32 ilk_compute_spr_wm(const struct intel_crtc_state *cstate,
 	if (!intel_wm_plane_visible(cstate, pstate))
 		return 0;
 
-	cpp = pstate->base.fb->format->cpp[0];
+	cpp = pstate->base.fb->format->bpp[0] / 8;
 
 	method1 = ilk_wm_method1(cstate->pixel_rate, cpp, mem_value);
 	method2 = ilk_wm_method2(cstate->pixel_rate,
@@ -2564,7 +2564,7 @@ static u32 ilk_compute_cur_wm(const struct intel_crtc_state *cstate,
 	if (!intel_wm_plane_visible(cstate, pstate))
 		return 0;
 
-	cpp = pstate->base.fb->format->cpp[0];
+	cpp = pstate->base.fb->format->bpp[0] / 8;
 
 	return ilk_wm_method2(cstate->pixel_rate,
 			      cstate->base.adjusted_mode.crtc_htotal,
@@ -2581,7 +2581,7 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *cstate,
 	if (!intel_wm_plane_visible(cstate, pstate))
 		return 0;
 
-	cpp = pstate->base.fb->format->cpp[0];
+	cpp = pstate->base.fb->format->bpp[0] / 8;
 
 	return ilk_wm_fbc(pri_val, drm_rect_width(&pstate->base.dst), cpp);
 }
@@ -4168,7 +4168,7 @@ int skl_check_pipe_max_pixel_rate(struct intel_crtc *intel_crtc,
 		intel_pstate = to_intel_plane_state(pstate);
 		plane_downscale = skl_plane_downscale_amount(cstate,
 							     intel_pstate);
-		bpp = pstate->fb->format->cpp[0] * 8;
+		bpp = pstate->fb->format->bpp[0];
 		if (bpp == 64)
 			plane_downscale = mul_fixed16(plane_downscale,
 						      fp_9_div_8);
@@ -4240,7 +4240,7 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
 
 	rate = mul_round_up_u32_fixed16(data_rate, down_scale_amount);
 
-	rate *= fb->format->cpp[plane];
+	rate *= fb->format->bpp[plane] / 8;
 	return rate;
 }
 
@@ -4671,7 +4671,7 @@ skl_compute_wm_params(const struct intel_crtc_state *crtc_state,
 	if (color_plane == 1 && wp->is_planar)
 		wp->width /= 2;
 
-	wp->cpp = format->cpp[color_plane];
+	wp->cpp = format->bpp[color_plane] / 8;
 	wp->plane_pixel_rate = plane_pixel_rate;
 
 	if (INTEL_GEN(dev_priv) >= 11 &&
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 04/36] drm: exynos: use bpp instead of cpp for drm_format_info
  2019-09-23 12:38 ` Sandy Huang
  (?)
@ 2019-09-23 12:38   ` Sandy Huang
  -1 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Kyungmin Park, David Airlie, Daniel Vetter, Kukjin Kim,
	Krzysztof Kozlowski
  Cc: hjc, linux-arm-kernel, linux-samsung-soc, linux-kernel

cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++--
 drivers/gpu/drm/exynos/exynos7_drm_decon.c    | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c     | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimc.c      | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_gsc.c       | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_ipp.c       | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_rotator.c   | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_scaler.c    | 4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c         | 4 ++--
 10 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 2d5cbfd..9401591 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -356,7 +356,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 		break;
 	}
 
-	DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %u\n", fb->format->cpp[0]);
+	DRM_DEV_DEBUG_KMS(ctx->dev, "bpp = %u\n", fb->format->bpp[0]);
 
 	/*
 	 * In case of exynos, setting dma-burst to 16Word causes permanent
@@ -403,7 +403,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 	struct decon_context *ctx = crtc->ctx;
 	struct drm_framebuffer *fb = state->base.fb;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 	dma_addr_t dma_addr = exynos_drm_fb_dma_addr(fb, 0);
 	u32 val;
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index f064095..d6158b7 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -310,7 +310,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 		break;
 	}
 
-	DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %d\n", fb->format->cpp[0]);
+	DRM_DEV_DEBUG_KMS(ctx->dev, "bpp = %d\n", fb->format->bpp[0]);
 
 	/*
 	 * In case of exynos, setting dma-burst to 16Word causes permanent
@@ -320,7 +320,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 	 * movement causes unstable DMA which results into iommu crash/tear.
 	 */
 
-	padding = (fb->pitches[0] / fb->format->cpp[0]) - fb->width;
+	padding = (fb->pitches[0] / fb->format->bpp[0] / 8) - fb->width;
 	if (fb->width + padding < MIN_FB_WIDTH_FOR_16WORD_BURST) {
 		val &= ~WINCONx_BURSTLEN_MASK;
 		val |= WINCONx_BURSTLEN_8WORD;
@@ -387,7 +387,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 	unsigned int last_x;
 	unsigned int last_y;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 
 	if (ctx->suspended)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index b0877b9..f82ac12 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -75,7 +75,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
 {
 	struct fb_info *fbi;
 	struct drm_framebuffer *fb = helper->fb;
-	unsigned int size = fb->width * fb->height * fb->format->cpp[0];
+	unsigned int size = fb->width * fb->height * fb->format->bpp[0] / 8;
 	unsigned int nr_pages;
 	unsigned long offset;
 
@@ -100,7 +100,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
 		return -EIO;
 	}
 
-	offset = fbi->var.xoffset * fb->format->cpp[0];
+	offset = fbi->var.xoffset * fb->format->bpp[0] / 8;
 	offset += fbi->var.yoffset * fb->pitches[0];
 
 	fbi->screen_base = exynos_gem->kvaddr + offset;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index a594ab7..ceb889c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -466,7 +466,7 @@ static void fimc_src_set_transf(struct fimc_context *ctx, unsigned int rotation)
 static void fimc_set_window(struct fimc_context *ctx,
 			    struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg, h1, h2, v1, v2;
 
 	/* cropped image */
@@ -501,7 +501,7 @@ static void fimc_set_window(struct fimc_context *ctx,
 static void fimc_src_set_size(struct fimc_context *ctx,
 			      struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg;
 
 	DRM_DEV_DEBUG_KMS(ctx->dev, "hsize[%d]vsize[%d]\n", real_width,
@@ -843,7 +843,7 @@ static void fimc_set_scaler(struct fimc_context *ctx, struct fimc_scaler *sc)
 static void fimc_dst_set_size(struct fimc_context *ctx,
 			     struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg, cfg_ext;
 
 	DRM_DEV_DEBUG_KMS(ctx->dev, "hsize[%d]vsize[%d]\n", real_width,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 8d0a929..561597b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -795,7 +795,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
 	unsigned long val, size, offset;
 	unsigned int last_x, last_y, buf_offsize, line_size;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 
 	if (ctx->suspended)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 1e4b21c..a15e2d9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -579,7 +579,7 @@ static void gsc_src_set_size(struct gsc_context *ctx,
 	cfg &= ~(GSC_SRCIMG_HEIGHT_MASK |
 		GSC_SRCIMG_WIDTH_MASK);
 
-	cfg |= (GSC_SRCIMG_WIDTH(buf->buf.pitch[0] / buf->format->cpp[0]) |
+	cfg |= (GSC_SRCIMG_WIDTH(buf->buf.pitch[0] / buf->format->bpp[0] / 8) |
 		GSC_SRCIMG_HEIGHT(buf->buf.height));
 
 	gsc_write(cfg, GSC_SRCIMG_SIZE);
@@ -881,7 +881,7 @@ static void gsc_dst_set_size(struct gsc_context *ctx,
 	/* original size */
 	cfg = gsc_read(GSC_DSTIMG_SIZE);
 	cfg &= ~(GSC_DSTIMG_HEIGHT_MASK | GSC_DSTIMG_WIDTH_MASK);
-	cfg |= GSC_DSTIMG_WIDTH(buf->buf.pitch[0] / buf->format->cpp[0]) |
+	cfg |= GSC_DSTIMG_WIDTH(buf->buf.pitch[0] / buf->format->bpp[0] / 8) |
 	       GSC_DSTIMG_HEIGHT(buf->buf.height);
 	gsc_write(cfg, GSC_DSTIMG_SIZE);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
index d45bfab..14c728e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
@@ -475,7 +475,7 @@ static int exynos_drm_ipp_check_size_limits(struct exynos_drm_ipp_buffer *buf,
 	enum drm_ipp_size_id id = rotate ? IPP_LIMIT_ROTATED : IPP_LIMIT_AREA;
 	struct drm_ipp_limit l;
 	struct drm_exynos_ipp_limit_val *lh = &l.h, *lv = &l.v;
-	int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 
 	if (!limits)
 		return 0;
@@ -570,8 +570,8 @@ static int exynos_drm_ipp_check_format(struct exynos_drm_ipp_task *task,
 			     DIV_ROUND_UP(buf->buf.width, buf->format->hsub);
 
 		if (buf->buf.pitch[i] == 0)
-			buf->buf.pitch[i] = width * buf->format->cpp[i];
-		if (buf->buf.pitch[i] < width * buf->format->cpp[i])
+			buf->buf.pitch[i] = width * buf->format->bpp[i] / 8;
+		if (buf->buf.pitch[i] < width * buf->format->bpp[i] / 8)
 			return -EINVAL;
 		if (!buf->buf.gem_id[i])
 			return -ENOENT;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index 8ebad27..8d1da0f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -139,7 +139,7 @@ static void rotator_src_set_buf(struct rot_context *rot,
 
 	/* Set buffer size configuration */
 	val = ROT_SET_BUF_SIZE_H(buf->buf.height) |
-	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->cpp[0]);
+	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->bpp[0] / 8);
 	rot_write(val, ROT_SRC_BUF_SIZE);
 
 	/* Set crop image position configuration */
@@ -187,7 +187,7 @@ static void rotator_dst_set_buf(struct rot_context *rot,
 
 	/* Set buffer size configuration */
 	val = ROT_SET_BUF_SIZE_H(buf->buf.height) |
-	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->cpp[0]);
+	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->bpp[0] / 8);
 	rot_write(val, ROT_DST_BUF_SIZE);
 
 	/* Set crop image position configuration */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
index 9af0964..c9ad312 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
@@ -166,7 +166,7 @@ static inline void scaler_set_src_span(struct scaler_context *scaler,
 	u32 val;
 
 	val = SCALER_SRC_SPAN_SET_Y_SPAN(src_buf->buf.pitch[0] /
-		src_buf->format->cpp[0]);
+		src_buf->format->bpp[0] / 8);
 
 	if (src_buf->format->num_planes > 1)
 		val |= SCALER_SRC_SPAN_SET_C_SPAN(src_buf->buf.pitch[1]);
@@ -229,7 +229,7 @@ static inline void scaler_set_dst_span(struct scaler_context *scaler,
 	u32 val;
 
 	val = SCALER_DST_SPAN_SET_Y_SPAN(dst_buf->buf.pitch[0] /
-		dst_buf->format->cpp[0]);
+		dst_buf->format->bpp[0] / 8);
 
 	if (dst_buf->format->num_planes > 1)
 		val |= SCALER_DST_SPAN_SET_C_SPAN(dst_buf->buf.pitch[1]);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 7b24338f..015dbab 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -646,7 +646,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
 
 	/* translate dma address base s.t. the source image offset is zero */
 	dma_addr = exynos_drm_fb_dma_addr(fb, 0)
-		+ (state->src.x * fb->format->cpp[0])
+		+ (state->src.x * fb->format->bpp[0] / 8)
 		+ (state->src.y * fb->pitches[0]);
 
 	spin_lock_irqsave(&ctx->reg_slock, flags);
@@ -657,7 +657,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
 
 	/* setup geometry */
 	mixer_reg_write(ctx, MXR_GRAPHIC_SPAN(win),
-			fb->pitches[0] / fb->format->cpp[0]);
+			fb->pitches[0] / fb->format->bpp[0] / 8);
 
 	val  = MXR_GRP_WH_WIDTH(state->src.w);
 	val |= MXR_GRP_WH_HEIGHT(state->src.h);
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 04/36] drm: exynos: use bpp instead of cpp for drm_format_info
@ 2019-09-23 12:38   ` Sandy Huang
  0 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Kyungmin Park, David Airlie, Daniel Vetter, Kukjin Kim,
	Krzysztof Kozlowski
  Cc: linux-samsung-soc, hjc, linux-arm-kernel, linux-kernel

cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++--
 drivers/gpu/drm/exynos/exynos7_drm_decon.c    | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c     | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimc.c      | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_gsc.c       | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_ipp.c       | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_rotator.c   | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_scaler.c    | 4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c         | 4 ++--
 10 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 2d5cbfd..9401591 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -356,7 +356,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 		break;
 	}
 
-	DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %u\n", fb->format->cpp[0]);
+	DRM_DEV_DEBUG_KMS(ctx->dev, "bpp = %u\n", fb->format->bpp[0]);
 
 	/*
 	 * In case of exynos, setting dma-burst to 16Word causes permanent
@@ -403,7 +403,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 	struct decon_context *ctx = crtc->ctx;
 	struct drm_framebuffer *fb = state->base.fb;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 	dma_addr_t dma_addr = exynos_drm_fb_dma_addr(fb, 0);
 	u32 val;
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index f064095..d6158b7 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -310,7 +310,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 		break;
 	}
 
-	DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %d\n", fb->format->cpp[0]);
+	DRM_DEV_DEBUG_KMS(ctx->dev, "bpp = %d\n", fb->format->bpp[0]);
 
 	/*
 	 * In case of exynos, setting dma-burst to 16Word causes permanent
@@ -320,7 +320,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 	 * movement causes unstable DMA which results into iommu crash/tear.
 	 */
 
-	padding = (fb->pitches[0] / fb->format->cpp[0]) - fb->width;
+	padding = (fb->pitches[0] / fb->format->bpp[0] / 8) - fb->width;
 	if (fb->width + padding < MIN_FB_WIDTH_FOR_16WORD_BURST) {
 		val &= ~WINCONx_BURSTLEN_MASK;
 		val |= WINCONx_BURSTLEN_8WORD;
@@ -387,7 +387,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 	unsigned int last_x;
 	unsigned int last_y;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 
 	if (ctx->suspended)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index b0877b9..f82ac12 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -75,7 +75,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
 {
 	struct fb_info *fbi;
 	struct drm_framebuffer *fb = helper->fb;
-	unsigned int size = fb->width * fb->height * fb->format->cpp[0];
+	unsigned int size = fb->width * fb->height * fb->format->bpp[0] / 8;
 	unsigned int nr_pages;
 	unsigned long offset;
 
@@ -100,7 +100,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
 		return -EIO;
 	}
 
-	offset = fbi->var.xoffset * fb->format->cpp[0];
+	offset = fbi->var.xoffset * fb->format->bpp[0] / 8;
 	offset += fbi->var.yoffset * fb->pitches[0];
 
 	fbi->screen_base = exynos_gem->kvaddr + offset;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index a594ab7..ceb889c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -466,7 +466,7 @@ static void fimc_src_set_transf(struct fimc_context *ctx, unsigned int rotation)
 static void fimc_set_window(struct fimc_context *ctx,
 			    struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg, h1, h2, v1, v2;
 
 	/* cropped image */
@@ -501,7 +501,7 @@ static void fimc_set_window(struct fimc_context *ctx,
 static void fimc_src_set_size(struct fimc_context *ctx,
 			      struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg;
 
 	DRM_DEV_DEBUG_KMS(ctx->dev, "hsize[%d]vsize[%d]\n", real_width,
@@ -843,7 +843,7 @@ static void fimc_set_scaler(struct fimc_context *ctx, struct fimc_scaler *sc)
 static void fimc_dst_set_size(struct fimc_context *ctx,
 			     struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg, cfg_ext;
 
 	DRM_DEV_DEBUG_KMS(ctx->dev, "hsize[%d]vsize[%d]\n", real_width,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 8d0a929..561597b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -795,7 +795,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
 	unsigned long val, size, offset;
 	unsigned int last_x, last_y, buf_offsize, line_size;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 
 	if (ctx->suspended)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 1e4b21c..a15e2d9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -579,7 +579,7 @@ static void gsc_src_set_size(struct gsc_context *ctx,
 	cfg &= ~(GSC_SRCIMG_HEIGHT_MASK |
 		GSC_SRCIMG_WIDTH_MASK);
 
-	cfg |= (GSC_SRCIMG_WIDTH(buf->buf.pitch[0] / buf->format->cpp[0]) |
+	cfg |= (GSC_SRCIMG_WIDTH(buf->buf.pitch[0] / buf->format->bpp[0] / 8) |
 		GSC_SRCIMG_HEIGHT(buf->buf.height));
 
 	gsc_write(cfg, GSC_SRCIMG_SIZE);
@@ -881,7 +881,7 @@ static void gsc_dst_set_size(struct gsc_context *ctx,
 	/* original size */
 	cfg = gsc_read(GSC_DSTIMG_SIZE);
 	cfg &= ~(GSC_DSTIMG_HEIGHT_MASK | GSC_DSTIMG_WIDTH_MASK);
-	cfg |= GSC_DSTIMG_WIDTH(buf->buf.pitch[0] / buf->format->cpp[0]) |
+	cfg |= GSC_DSTIMG_WIDTH(buf->buf.pitch[0] / buf->format->bpp[0] / 8) |
 	       GSC_DSTIMG_HEIGHT(buf->buf.height);
 	gsc_write(cfg, GSC_DSTIMG_SIZE);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
index d45bfab..14c728e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
@@ -475,7 +475,7 @@ static int exynos_drm_ipp_check_size_limits(struct exynos_drm_ipp_buffer *buf,
 	enum drm_ipp_size_id id = rotate ? IPP_LIMIT_ROTATED : IPP_LIMIT_AREA;
 	struct drm_ipp_limit l;
 	struct drm_exynos_ipp_limit_val *lh = &l.h, *lv = &l.v;
-	int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 
 	if (!limits)
 		return 0;
@@ -570,8 +570,8 @@ static int exynos_drm_ipp_check_format(struct exynos_drm_ipp_task *task,
 			     DIV_ROUND_UP(buf->buf.width, buf->format->hsub);
 
 		if (buf->buf.pitch[i] == 0)
-			buf->buf.pitch[i] = width * buf->format->cpp[i];
-		if (buf->buf.pitch[i] < width * buf->format->cpp[i])
+			buf->buf.pitch[i] = width * buf->format->bpp[i] / 8;
+		if (buf->buf.pitch[i] < width * buf->format->bpp[i] / 8)
 			return -EINVAL;
 		if (!buf->buf.gem_id[i])
 			return -ENOENT;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index 8ebad27..8d1da0f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -139,7 +139,7 @@ static void rotator_src_set_buf(struct rot_context *rot,
 
 	/* Set buffer size configuration */
 	val = ROT_SET_BUF_SIZE_H(buf->buf.height) |
-	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->cpp[0]);
+	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->bpp[0] / 8);
 	rot_write(val, ROT_SRC_BUF_SIZE);
 
 	/* Set crop image position configuration */
@@ -187,7 +187,7 @@ static void rotator_dst_set_buf(struct rot_context *rot,
 
 	/* Set buffer size configuration */
 	val = ROT_SET_BUF_SIZE_H(buf->buf.height) |
-	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->cpp[0]);
+	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->bpp[0] / 8);
 	rot_write(val, ROT_DST_BUF_SIZE);
 
 	/* Set crop image position configuration */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
index 9af0964..c9ad312 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
@@ -166,7 +166,7 @@ static inline void scaler_set_src_span(struct scaler_context *scaler,
 	u32 val;
 
 	val = SCALER_SRC_SPAN_SET_Y_SPAN(src_buf->buf.pitch[0] /
-		src_buf->format->cpp[0]);
+		src_buf->format->bpp[0] / 8);
 
 	if (src_buf->format->num_planes > 1)
 		val |= SCALER_SRC_SPAN_SET_C_SPAN(src_buf->buf.pitch[1]);
@@ -229,7 +229,7 @@ static inline void scaler_set_dst_span(struct scaler_context *scaler,
 	u32 val;
 
 	val = SCALER_DST_SPAN_SET_Y_SPAN(dst_buf->buf.pitch[0] /
-		dst_buf->format->cpp[0]);
+		dst_buf->format->bpp[0] / 8);
 
 	if (dst_buf->format->num_planes > 1)
 		val |= SCALER_DST_SPAN_SET_C_SPAN(dst_buf->buf.pitch[1]);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 7b24338f..015dbab 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -646,7 +646,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
 
 	/* translate dma address base s.t. the source image offset is zero */
 	dma_addr = exynos_drm_fb_dma_addr(fb, 0)
-		+ (state->src.x * fb->format->cpp[0])
+		+ (state->src.x * fb->format->bpp[0] / 8)
 		+ (state->src.y * fb->pitches[0]);
 
 	spin_lock_irqsave(&ctx->reg_slock, flags);
@@ -657,7 +657,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
 
 	/* setup geometry */
 	mixer_reg_write(ctx, MXR_GRAPHIC_SPAN(win),
-			fb->pitches[0] / fb->format->cpp[0]);
+			fb->pitches[0] / fb->format->bpp[0] / 8);
 
 	val  = MXR_GRP_WH_WIDTH(state->src.w);
 	val |= MXR_GRP_WH_HEIGHT(state->src.h);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 04/36] drm: exynos: use bpp instead of cpp for drm_format_info
@ 2019-09-23 12:38   ` Sandy Huang
  0 siblings, 0 replies; 27+ messages in thread
From: Sandy Huang @ 2019-09-23 12:38 UTC (permalink / raw)
  To: dri-devel, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Kyungmin Park, David Airlie, Daniel Vetter, Kukjin Kim,
	Krzysztof Kozlowski
  Cc: linux-samsung-soc, hjc, linux-arm-kernel, linux-kernel

cpp[BytePerPlane] can't describe the 10bit data format correctly,
So we use bpp[BitPerPlane] to instead cpp.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++--
 drivers/gpu/drm/exynos/exynos7_drm_decon.c    | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c     | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimc.c      | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_gsc.c       | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_ipp.c       | 6 +++---
 drivers/gpu/drm/exynos/exynos_drm_rotator.c   | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_scaler.c    | 4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c         | 4 ++--
 10 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 2d5cbfd..9401591 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -356,7 +356,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 		break;
 	}
 
-	DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %u\n", fb->format->cpp[0]);
+	DRM_DEV_DEBUG_KMS(ctx->dev, "bpp = %u\n", fb->format->bpp[0]);
 
 	/*
 	 * In case of exynos, setting dma-burst to 16Word causes permanent
@@ -403,7 +403,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 	struct decon_context *ctx = crtc->ctx;
 	struct drm_framebuffer *fb = state->base.fb;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 	dma_addr_t dma_addr = exynos_drm_fb_dma_addr(fb, 0);
 	u32 val;
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index f064095..d6158b7 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -310,7 +310,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 		break;
 	}
 
-	DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %d\n", fb->format->cpp[0]);
+	DRM_DEV_DEBUG_KMS(ctx->dev, "bpp = %d\n", fb->format->bpp[0]);
 
 	/*
 	 * In case of exynos, setting dma-burst to 16Word causes permanent
@@ -320,7 +320,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
 	 * movement causes unstable DMA which results into iommu crash/tear.
 	 */
 
-	padding = (fb->pitches[0] / fb->format->cpp[0]) - fb->width;
+	padding = (fb->pitches[0] / fb->format->bpp[0] / 8) - fb->width;
 	if (fb->width + padding < MIN_FB_WIDTH_FOR_16WORD_BURST) {
 		val &= ~WINCONx_BURSTLEN_MASK;
 		val |= WINCONx_BURSTLEN_8WORD;
@@ -387,7 +387,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
 	unsigned int last_x;
 	unsigned int last_y;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 
 	if (ctx->suspended)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index b0877b9..f82ac12 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -75,7 +75,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
 {
 	struct fb_info *fbi;
 	struct drm_framebuffer *fb = helper->fb;
-	unsigned int size = fb->width * fb->height * fb->format->cpp[0];
+	unsigned int size = fb->width * fb->height * fb->format->bpp[0] / 8;
 	unsigned int nr_pages;
 	unsigned long offset;
 
@@ -100,7 +100,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
 		return -EIO;
 	}
 
-	offset = fbi->var.xoffset * fb->format->cpp[0];
+	offset = fbi->var.xoffset * fb->format->bpp[0] / 8;
 	offset += fbi->var.yoffset * fb->pitches[0];
 
 	fbi->screen_base = exynos_gem->kvaddr + offset;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index a594ab7..ceb889c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -466,7 +466,7 @@ static void fimc_src_set_transf(struct fimc_context *ctx, unsigned int rotation)
 static void fimc_set_window(struct fimc_context *ctx,
 			    struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg, h1, h2, v1, v2;
 
 	/* cropped image */
@@ -501,7 +501,7 @@ static void fimc_set_window(struct fimc_context *ctx,
 static void fimc_src_set_size(struct fimc_context *ctx,
 			      struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg;
 
 	DRM_DEV_DEBUG_KMS(ctx->dev, "hsize[%d]vsize[%d]\n", real_width,
@@ -843,7 +843,7 @@ static void fimc_set_scaler(struct fimc_context *ctx, struct fimc_scaler *sc)
 static void fimc_dst_set_size(struct fimc_context *ctx,
 			     struct exynos_drm_ipp_buffer *buf)
 {
-	unsigned int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	unsigned int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 	u32 cfg, cfg_ext;
 
 	DRM_DEV_DEBUG_KMS(ctx->dev, "hsize[%d]vsize[%d]\n", real_width,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 8d0a929..561597b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -795,7 +795,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
 	unsigned long val, size, offset;
 	unsigned int last_x, last_y, buf_offsize, line_size;
 	unsigned int win = plane->index;
-	unsigned int cpp = fb->format->cpp[0];
+	unsigned int cpp = fb->format->bpp[0] / 8;
 	unsigned int pitch = fb->pitches[0];
 
 	if (ctx->suspended)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 1e4b21c..a15e2d9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -579,7 +579,7 @@ static void gsc_src_set_size(struct gsc_context *ctx,
 	cfg &= ~(GSC_SRCIMG_HEIGHT_MASK |
 		GSC_SRCIMG_WIDTH_MASK);
 
-	cfg |= (GSC_SRCIMG_WIDTH(buf->buf.pitch[0] / buf->format->cpp[0]) |
+	cfg |= (GSC_SRCIMG_WIDTH(buf->buf.pitch[0] / buf->format->bpp[0] / 8) |
 		GSC_SRCIMG_HEIGHT(buf->buf.height));
 
 	gsc_write(cfg, GSC_SRCIMG_SIZE);
@@ -881,7 +881,7 @@ static void gsc_dst_set_size(struct gsc_context *ctx,
 	/* original size */
 	cfg = gsc_read(GSC_DSTIMG_SIZE);
 	cfg &= ~(GSC_DSTIMG_HEIGHT_MASK | GSC_DSTIMG_WIDTH_MASK);
-	cfg |= GSC_DSTIMG_WIDTH(buf->buf.pitch[0] / buf->format->cpp[0]) |
+	cfg |= GSC_DSTIMG_WIDTH(buf->buf.pitch[0] / buf->format->bpp[0] / 8) |
 	       GSC_DSTIMG_HEIGHT(buf->buf.height);
 	gsc_write(cfg, GSC_DSTIMG_SIZE);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
index d45bfab..14c728e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
@@ -475,7 +475,7 @@ static int exynos_drm_ipp_check_size_limits(struct exynos_drm_ipp_buffer *buf,
 	enum drm_ipp_size_id id = rotate ? IPP_LIMIT_ROTATED : IPP_LIMIT_AREA;
 	struct drm_ipp_limit l;
 	struct drm_exynos_ipp_limit_val *lh = &l.h, *lv = &l.v;
-	int real_width = buf->buf.pitch[0] / buf->format->cpp[0];
+	int real_width = buf->buf.pitch[0] / buf->format->bpp[0] / 8;
 
 	if (!limits)
 		return 0;
@@ -570,8 +570,8 @@ static int exynos_drm_ipp_check_format(struct exynos_drm_ipp_task *task,
 			     DIV_ROUND_UP(buf->buf.width, buf->format->hsub);
 
 		if (buf->buf.pitch[i] == 0)
-			buf->buf.pitch[i] = width * buf->format->cpp[i];
-		if (buf->buf.pitch[i] < width * buf->format->cpp[i])
+			buf->buf.pitch[i] = width * buf->format->bpp[i] / 8;
+		if (buf->buf.pitch[i] < width * buf->format->bpp[i] / 8)
 			return -EINVAL;
 		if (!buf->buf.gem_id[i])
 			return -ENOENT;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index 8ebad27..8d1da0f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -139,7 +139,7 @@ static void rotator_src_set_buf(struct rot_context *rot,
 
 	/* Set buffer size configuration */
 	val = ROT_SET_BUF_SIZE_H(buf->buf.height) |
-	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->cpp[0]);
+	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->bpp[0] / 8);
 	rot_write(val, ROT_SRC_BUF_SIZE);
 
 	/* Set crop image position configuration */
@@ -187,7 +187,7 @@ static void rotator_dst_set_buf(struct rot_context *rot,
 
 	/* Set buffer size configuration */
 	val = ROT_SET_BUF_SIZE_H(buf->buf.height) |
-	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->cpp[0]);
+	      ROT_SET_BUF_SIZE_W(buf->buf.pitch[0] / buf->format->bpp[0] / 8);
 	rot_write(val, ROT_DST_BUF_SIZE);
 
 	/* Set crop image position configuration */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
index 9af0964..c9ad312 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
@@ -166,7 +166,7 @@ static inline void scaler_set_src_span(struct scaler_context *scaler,
 	u32 val;
 
 	val = SCALER_SRC_SPAN_SET_Y_SPAN(src_buf->buf.pitch[0] /
-		src_buf->format->cpp[0]);
+		src_buf->format->bpp[0] / 8);
 
 	if (src_buf->format->num_planes > 1)
 		val |= SCALER_SRC_SPAN_SET_C_SPAN(src_buf->buf.pitch[1]);
@@ -229,7 +229,7 @@ static inline void scaler_set_dst_span(struct scaler_context *scaler,
 	u32 val;
 
 	val = SCALER_DST_SPAN_SET_Y_SPAN(dst_buf->buf.pitch[0] /
-		dst_buf->format->cpp[0]);
+		dst_buf->format->bpp[0] / 8);
 
 	if (dst_buf->format->num_planes > 1)
 		val |= SCALER_DST_SPAN_SET_C_SPAN(dst_buf->buf.pitch[1]);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 7b24338f..015dbab 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -646,7 +646,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
 
 	/* translate dma address base s.t. the source image offset is zero */
 	dma_addr = exynos_drm_fb_dma_addr(fb, 0)
-		+ (state->src.x * fb->format->cpp[0])
+		+ (state->src.x * fb->format->bpp[0] / 8)
 		+ (state->src.y * fb->pitches[0]);
 
 	spin_lock_irqsave(&ctx->reg_slock, flags);
@@ -657,7 +657,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
 
 	/* setup geometry */
 	mixer_reg_write(ctx, MXR_GRAPHIC_SPAN(win),
-			fb->pitches[0] / fb->format->cpp[0]);
+			fb->pitches[0] / fb->format->bpp[0] / 8);
 
 	val  = MXR_GRP_WH_WIDTH(state->src.w);
 	val |= MXR_GRP_WH_HEIGHT(state->src.h);
-- 
2.7.4




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-23 12:38   ` Sandy Huang
  (?)
@ 2019-09-23 12:53   ` Ville Syrjälä
  2019-09-23 13:05       ` sandy.huang
  -1 siblings, 1 reply; 27+ messages in thread
From: Ville Syrjälä @ 2019-09-23 12:53 UTC (permalink / raw)
  To: Sandy Huang
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter, linux-kernel

On Mon, Sep 23, 2019 at 08:38:50PM +0800, Sandy Huang wrote:
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index 3feeaa3..5fe89e9 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -266,6 +266,21 @@ extern "C" {
>  #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>  
>  /*
> + * 2 plane YCbCr 10bit
> + * index 0 = Y plane, [9:0] Y
> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
> + * or
> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian

What does "little endian" even mean for these?

> + */
> +
> +#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
> +#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
> +#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
> +#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
> +#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
> +#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
> +
> +/*
>   * 3 plane YCbCr
>   * index 0: Y plane, [7:0] Y
>   * index 1: Cb plane, [7:0] Cb
> -- 
> 2.7.4
> 
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 00/36] Add support 10bit yuv format
  2019-09-23 12:38 ` Sandy Huang
@ 2019-09-23 13:03   ` Daniel Vetter
  -1 siblings, 0 replies; 27+ messages in thread
From: Daniel Vetter @ 2019-09-23 13:03 UTC (permalink / raw)
  To: Sandy Huang
  Cc: Matthias Brugger, moderated list:ARM/Mediatek SoC support,
	Linux ARM, dri-devel

On Mon, Sep 23, 2019 at 2:51 PM Sandy Huang <hjc@rock-chips.com> wrote:
>
> This series of patches is to add 2 plane YCbCr 10bit format
> support, but now the drm_format_info.cpp[3] unit is BytePerPlane,
> when we add define 10bit YUV format, here have some problems.
> So we change cpp to bpp, use unit BitPerPlane to describe the data
> format.

Wrong direction, we don't want more users of the old legacy cpp values
in the format structure. Instead if we want new stuff, add/extend
functions which can extract all kinds of interesting computed value
from the drm_format_info structure. See all the functions in
drm_fourcc.h.
-Daniel

>
> Sandy Huang (36):
>   drm/fourcc: Add 2 plane YCbCr 10bit format support
>   drm/rockchip: use bpp instead of cpp for drm_format_info
>   drm/i915: use bpp instead of cpp for drm_format_info
>   drm: exynos: use bpp instead of cpp for drm_format_info
>   drm/sun4i: use bpp instead of cpp for drm_format_info
>   drm/amd: use bpp instead of cpp for drm_format_info
>   drm/gma500: use bpp instead of cpp for drm_format_info
>   drm/msm: use bpp instead of cpp for drm_format_info
>   dm/vmwgfx: use bpp instead of cpp for drm_format_info
>   drm/arm: use bpp instead of cpp for drm_format_info
>   drm/armada: use bpp instead of cpp for drm_format_info
>   drm/radeon: use bpp instead of cpp for drm_format_info
>   drm/nouveau: use bpp instead of cpp for drm_format_info
>   drm/tegra: use bpp instead of cpp for drm_format_info
>   drm/mediatek: use bpp instead of cpp for drm_format_info
>   drm/tilcdc: use bpp instead of cpp for drm_format_info
>   drm/zte: use bpp instead of cpp for drm_format_info
>   drm/xen: use bpp instead of cpp for drm_format_info
>   drm/vkms: use bpp instead of cpp for drm_format_info
>   drm/ast: use bpp instead of cpp for drm_format_info
>   drm/vc4: use bpp instead of cpp for drm_format_info
>   drm/atmel-hlcdc: use bpp instead of cpp for drm_format_info
>   drm/cirrus: use bpp instead of cpp for drm_format_info
>   drm/hisilicon: use bpp instead of cpp for drm_format_info
>   drm/imx: use bpp instead of cpp for drm_format_info
>   drm/vboxvideo: use bpp instead of cpp for drm_format_info
>   drm/pl111: use bpp instead of cpp for drm_format_info
>   drm/qxl: use bpp instead of cpp for drm_format_info
>   drm/ingenic: use bpp instead of cpp for drm_format_info
>   drm/sti: use bpp instead of cpp for drm_format_info
>   drm/stm: use bpp instead of cpp for drm_format_info
>   drm/mcde: use bpp instead of cpp for drm_format_info
>   drm/mgag200: use bpp instead of cpp for drm_format_info
>   drm/tve200: use bpp instead of cpp for drm_format_info
>   drm/udl: use bpp instead of cpp for drm_format_info
>   drm/omapdrm: use bpp instead of cpp for drm_format_info
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c             |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c             |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c             |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c              |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c              |   2 +-
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |   6 +-
>  .../drm/arm/display/komeda/komeda_framebuffer.c    |   2 +-
>  drivers/gpu/drm/arm/malidp_hw.c                    |   2 +-
>  drivers/gpu/drm/arm/malidp_planes.c                |   2 +-
>  drivers/gpu/drm/armada/armada_fbdev.c              |   2 +-
>  drivers/gpu/drm/armada/armada_plane.c              |   6 +-
>  drivers/gpu/drm/ast/ast_mode.c                     |   8 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c    |   2 +-
>  drivers/gpu/drm/cirrus/cirrus.c                    |  10 +-
>  drivers/gpu/drm/drm_client.c                       |   4 +-
>  drivers/gpu/drm/drm_fb_helper.c                    |   8 +-
>  drivers/gpu/drm/drm_format_helper.c                |   4 +-
>  drivers/gpu/drm/drm_fourcc.c                       | 172 +++++++++++----------
>  drivers/gpu/drm/drm_framebuffer.c                  |   2 +-
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c      |   4 +-
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c         |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c          |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_fimc.c           |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c           |   2 +-
>  drivers/gpu/drm/exynos/exynos_drm_gsc.c            |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_ipp.c            |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_rotator.c        |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_scaler.c         |   4 +-
>  drivers/gpu/drm/exynos/exynos_mixer.c              |   4 +-
>  drivers/gpu/drm/gma500/framebuffer.c               |   4 +-
>  drivers/gpu/drm/gma500/gma_display.c               |   4 +-
>  drivers/gpu/drm/gma500/mdfld_intel_display.c       |   6 +-
>  drivers/gpu/drm/gma500/oaktrail_crtc.c             |   4 +-
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c     |   6 +-
>  drivers/gpu/drm/i915/display/intel_atomic_plane.c  |   2 +-
>  drivers/gpu/drm/i915/display/intel_display.c       |  28 ++--
>  drivers/gpu/drm/i915/display/intel_fbc.c           |   8 +-
>  drivers/gpu/drm/i915/display/intel_fbdev.c         |   6 +-
>  drivers/gpu/drm/i915/display/intel_sprite.c        |   4 +-
>  drivers/gpu/drm/i915/i915_debugfs.c                |   4 +-
>  drivers/gpu/drm/i915/intel_pm.c                    |  28 ++--
>  drivers/gpu/drm/imx/ipuv3-plane.c                  |   8 +-
>  drivers/gpu/drm/ingenic/ingenic-drm.c              |   2 +-
>  drivers/gpu/drm/mcde/mcde_display.c                |   4 +-
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c              |   2 +-
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c           |   2 +-
>  drivers/gpu/drm/mgag200/mgag200_mode.c             |  16 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c           |   4 +-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c          |   2 +-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c           |   2 +-
>  drivers/gpu/drm/msm/msm_fb.c                       |   2 +-
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c            |   7 +-
>  drivers/gpu/drm/nouveau/dispnv50/base507c.c        |   4 +-
>  drivers/gpu/drm/nouveau/dispnv50/ovly507e.c        |   2 +-
>  drivers/gpu/drm/omapdrm/omap_fb.c                  |   8 +-
>  drivers/gpu/drm/pl111/pl111_display.c              |   2 +-
>  drivers/gpu/drm/qxl/qxl_draw.c                     |   2 +-
>  drivers/gpu/drm/radeon/atombios_crtc.c             |  10 +-
>  drivers/gpu/drm/radeon/r100.c                      |   4 +-
>  drivers/gpu/drm/radeon/radeon_display.c            |   6 +-
>  drivers/gpu/drm/radeon/radeon_fb.c                 |   2 +-
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c        |  14 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_fb.c         |   2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c        |   4 +-
>  drivers/gpu/drm/sti/sti_gdp.c                      |   2 +-
>  drivers/gpu/drm/stm/ltdc.c                         |   2 +-
>  drivers/gpu/drm/sun4i/sun8i_ui_layer.c             |   2 +-
>  drivers/gpu/drm/sun4i/sun8i_vi_layer.c             |   2 +-
>  drivers/gpu/drm/tegra/dc.c                         |   2 +-
>  drivers/gpu/drm/tegra/drm.c                        |   2 +-
>  drivers/gpu/drm/tegra/fb.c                         |   2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c               |   2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_plane.c              |   2 +-
>  drivers/gpu/drm/tve200/tve200_display.c            |   2 +-
>  drivers/gpu/drm/udl/udl_fb.c                       |   4 +-
>  drivers/gpu/drm/vboxvideo/vbox_mode.c              |   2 +-
>  drivers/gpu/drm/vc4/vc4_plane.c                    |  10 +-
>  drivers/gpu/drm/vkms/vkms_plane.c                  |   2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_fb.c                 |   4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c                |   4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c               |   4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c               |   2 +-
>  drivers/gpu/drm/xen/xen_drm_front_kms.c            |   2 +-
>  drivers/gpu/drm/zte/zx_plane.c                     |   4 +-
>  include/drm/drm_fourcc.h                           |   4 +-
>  include/uapi/drm/drm_fourcc.h                      |  15 ++
>  86 files changed, 299 insertions(+), 277 deletions(-)
>
> --
> 2.7.4
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 00/36] Add support 10bit yuv format
@ 2019-09-23 13:03   ` Daniel Vetter
  0 siblings, 0 replies; 27+ messages in thread
From: Daniel Vetter @ 2019-09-23 13:03 UTC (permalink / raw)
  To: Sandy Huang
  Cc: Matthias Brugger, moderated list:ARM/Mediatek SoC support,
	Linux ARM, dri-devel

On Mon, Sep 23, 2019 at 2:51 PM Sandy Huang <hjc@rock-chips.com> wrote:
>
> This series of patches is to add 2 plane YCbCr 10bit format
> support, but now the drm_format_info.cpp[3] unit is BytePerPlane,
> when we add define 10bit YUV format, here have some problems.
> So we change cpp to bpp, use unit BitPerPlane to describe the data
> format.

Wrong direction, we don't want more users of the old legacy cpp values
in the format structure. Instead if we want new stuff, add/extend
functions which can extract all kinds of interesting computed value
from the drm_format_info structure. See all the functions in
drm_fourcc.h.
-Daniel

>
> Sandy Huang (36):
>   drm/fourcc: Add 2 plane YCbCr 10bit format support
>   drm/rockchip: use bpp instead of cpp for drm_format_info
>   drm/i915: use bpp instead of cpp for drm_format_info
>   drm: exynos: use bpp instead of cpp for drm_format_info
>   drm/sun4i: use bpp instead of cpp for drm_format_info
>   drm/amd: use bpp instead of cpp for drm_format_info
>   drm/gma500: use bpp instead of cpp for drm_format_info
>   drm/msm: use bpp instead of cpp for drm_format_info
>   dm/vmwgfx: use bpp instead of cpp for drm_format_info
>   drm/arm: use bpp instead of cpp for drm_format_info
>   drm/armada: use bpp instead of cpp for drm_format_info
>   drm/radeon: use bpp instead of cpp for drm_format_info
>   drm/nouveau: use bpp instead of cpp for drm_format_info
>   drm/tegra: use bpp instead of cpp for drm_format_info
>   drm/mediatek: use bpp instead of cpp for drm_format_info
>   drm/tilcdc: use bpp instead of cpp for drm_format_info
>   drm/zte: use bpp instead of cpp for drm_format_info
>   drm/xen: use bpp instead of cpp for drm_format_info
>   drm/vkms: use bpp instead of cpp for drm_format_info
>   drm/ast: use bpp instead of cpp for drm_format_info
>   drm/vc4: use bpp instead of cpp for drm_format_info
>   drm/atmel-hlcdc: use bpp instead of cpp for drm_format_info
>   drm/cirrus: use bpp instead of cpp for drm_format_info
>   drm/hisilicon: use bpp instead of cpp for drm_format_info
>   drm/imx: use bpp instead of cpp for drm_format_info
>   drm/vboxvideo: use bpp instead of cpp for drm_format_info
>   drm/pl111: use bpp instead of cpp for drm_format_info
>   drm/qxl: use bpp instead of cpp for drm_format_info
>   drm/ingenic: use bpp instead of cpp for drm_format_info
>   drm/sti: use bpp instead of cpp for drm_format_info
>   drm/stm: use bpp instead of cpp for drm_format_info
>   drm/mcde: use bpp instead of cpp for drm_format_info
>   drm/mgag200: use bpp instead of cpp for drm_format_info
>   drm/tve200: use bpp instead of cpp for drm_format_info
>   drm/udl: use bpp instead of cpp for drm_format_info
>   drm/omapdrm: use bpp instead of cpp for drm_format_info
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c             |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c             |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c             |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c              |   2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c              |   2 +-
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |   6 +-
>  .../drm/arm/display/komeda/komeda_framebuffer.c    |   2 +-
>  drivers/gpu/drm/arm/malidp_hw.c                    |   2 +-
>  drivers/gpu/drm/arm/malidp_planes.c                |   2 +-
>  drivers/gpu/drm/armada/armada_fbdev.c              |   2 +-
>  drivers/gpu/drm/armada/armada_plane.c              |   6 +-
>  drivers/gpu/drm/ast/ast_mode.c                     |   8 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c    |   2 +-
>  drivers/gpu/drm/cirrus/cirrus.c                    |  10 +-
>  drivers/gpu/drm/drm_client.c                       |   4 +-
>  drivers/gpu/drm/drm_fb_helper.c                    |   8 +-
>  drivers/gpu/drm/drm_format_helper.c                |   4 +-
>  drivers/gpu/drm/drm_fourcc.c                       | 172 +++++++++++----------
>  drivers/gpu/drm/drm_framebuffer.c                  |   2 +-
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c      |   4 +-
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c         |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c          |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_fimc.c           |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c           |   2 +-
>  drivers/gpu/drm/exynos/exynos_drm_gsc.c            |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_ipp.c            |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_rotator.c        |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_scaler.c         |   4 +-
>  drivers/gpu/drm/exynos/exynos_mixer.c              |   4 +-
>  drivers/gpu/drm/gma500/framebuffer.c               |   4 +-
>  drivers/gpu/drm/gma500/gma_display.c               |   4 +-
>  drivers/gpu/drm/gma500/mdfld_intel_display.c       |   6 +-
>  drivers/gpu/drm/gma500/oaktrail_crtc.c             |   4 +-
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c     |   6 +-
>  drivers/gpu/drm/i915/display/intel_atomic_plane.c  |   2 +-
>  drivers/gpu/drm/i915/display/intel_display.c       |  28 ++--
>  drivers/gpu/drm/i915/display/intel_fbc.c           |   8 +-
>  drivers/gpu/drm/i915/display/intel_fbdev.c         |   6 +-
>  drivers/gpu/drm/i915/display/intel_sprite.c        |   4 +-
>  drivers/gpu/drm/i915/i915_debugfs.c                |   4 +-
>  drivers/gpu/drm/i915/intel_pm.c                    |  28 ++--
>  drivers/gpu/drm/imx/ipuv3-plane.c                  |   8 +-
>  drivers/gpu/drm/ingenic/ingenic-drm.c              |   2 +-
>  drivers/gpu/drm/mcde/mcde_display.c                |   4 +-
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c              |   2 +-
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c           |   2 +-
>  drivers/gpu/drm/mgag200/mgag200_mode.c             |  16 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c           |   4 +-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c          |   2 +-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c           |   2 +-
>  drivers/gpu/drm/msm/msm_fb.c                       |   2 +-
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c            |   7 +-
>  drivers/gpu/drm/nouveau/dispnv50/base507c.c        |   4 +-
>  drivers/gpu/drm/nouveau/dispnv50/ovly507e.c        |   2 +-
>  drivers/gpu/drm/omapdrm/omap_fb.c                  |   8 +-
>  drivers/gpu/drm/pl111/pl111_display.c              |   2 +-
>  drivers/gpu/drm/qxl/qxl_draw.c                     |   2 +-
>  drivers/gpu/drm/radeon/atombios_crtc.c             |  10 +-
>  drivers/gpu/drm/radeon/r100.c                      |   4 +-
>  drivers/gpu/drm/radeon/radeon_display.c            |   6 +-
>  drivers/gpu/drm/radeon/radeon_fb.c                 |   2 +-
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c        |  14 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_fb.c         |   2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c        |   4 +-
>  drivers/gpu/drm/sti/sti_gdp.c                      |   2 +-
>  drivers/gpu/drm/stm/ltdc.c                         |   2 +-
>  drivers/gpu/drm/sun4i/sun8i_ui_layer.c             |   2 +-
>  drivers/gpu/drm/sun4i/sun8i_vi_layer.c             |   2 +-
>  drivers/gpu/drm/tegra/dc.c                         |   2 +-
>  drivers/gpu/drm/tegra/drm.c                        |   2 +-
>  drivers/gpu/drm/tegra/fb.c                         |   2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c               |   2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_plane.c              |   2 +-
>  drivers/gpu/drm/tve200/tve200_display.c            |   2 +-
>  drivers/gpu/drm/udl/udl_fb.c                       |   4 +-
>  drivers/gpu/drm/vboxvideo/vbox_mode.c              |   2 +-
>  drivers/gpu/drm/vc4/vc4_plane.c                    |  10 +-
>  drivers/gpu/drm/vkms/vkms_plane.c                  |   2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_fb.c                 |   4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c                |   4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c               |   4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c               |   2 +-
>  drivers/gpu/drm/xen/xen_drm_front_kms.c            |   2 +-
>  drivers/gpu/drm/zte/zx_plane.c                     |   4 +-
>  include/drm/drm_fourcc.h                           |   4 +-
>  include/uapi/drm/drm_fourcc.h                      |  15 ++
>  86 files changed, 299 insertions(+), 277 deletions(-)
>
> --
> 2.7.4
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-23 12:53   ` Ville Syrjälä
@ 2019-09-23 13:05       ` sandy.huang
  0 siblings, 0 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-23 13:05 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter, linux-kernel


在 2019/9/23 上午5:53, Ville Syrjälä 写道:
> On Mon, Sep 23, 2019 at 08:38:50PM +0800, Sandy Huang wrote:
>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>> index 3feeaa3..5fe89e9 100644
>> --- a/include/uapi/drm/drm_fourcc.h
>> +++ b/include/uapi/drm/drm_fourcc.h
>> @@ -266,6 +266,21 @@ extern "C" {
>>   #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>   
>>   /*
>> + * 2 plane YCbCr 10bit
>> + * index 0 = Y plane, [9:0] Y
>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>> + * or
>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
> What does "little endian" even mean for these?

It's Inherited from the following define, the difference is 8bit and 10bit.

/*
  * 2 plane YCbCr
  * index 0 = Y plane, [7:0] Y
  * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
  * or
  * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
  */
#define DRM_FORMAT_NV12        fourcc_code('N', 'V', '1', '2') /* 2x2 
subsampled Cr:Cb plane */
#define DRM_FORMAT_NV21        fourcc_code('N', 'V', '2', '1') /* 2x2 
subsampled Cb:Cr plane */
#define DRM_FORMAT_NV16        fourcc_code('N', 'V', '1', '6') /* 2x1 
subsampled Cr:Cb plane */
#define DRM_FORMAT_NV61        fourcc_code('N', 'V', '6', '1') /* 2x1 
subsampled Cb:Cr plane */
#define DRM_FORMAT_NV24        fourcc_code('N', 'V', '2', '4') /* 
non-subsampled Cr:Cb plane */
#define DRM_FORMAT_NV42        fourcc_code('N', 'V', '4',


>
>> + */
>> +
>> +#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
>> +#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
>> +#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
>> +
>> +/*
>>    * 3 plane YCbCr
>>    * index 0: Y plane, [7:0] Y
>>    * index 1: Cb plane, [7:0] Cb
>> -- 
>> 2.7.4
>>
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
@ 2019-09-23 13:05       ` sandy.huang
  0 siblings, 0 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-23 13:05 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Maxime Ripard, linux-kernel, dri-devel, David Airlie, Sean Paul


在 2019/9/23 上午5:53, Ville Syrjälä 写道:
> On Mon, Sep 23, 2019 at 08:38:50PM +0800, Sandy Huang wrote:
>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>> index 3feeaa3..5fe89e9 100644
>> --- a/include/uapi/drm/drm_fourcc.h
>> +++ b/include/uapi/drm/drm_fourcc.h
>> @@ -266,6 +266,21 @@ extern "C" {
>>   #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>   
>>   /*
>> + * 2 plane YCbCr 10bit
>> + * index 0 = Y plane, [9:0] Y
>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>> + * or
>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
> What does "little endian" even mean for these?

It's Inherited from the following define, the difference is 8bit and 10bit.

/*
  * 2 plane YCbCr
  * index 0 = Y plane, [7:0] Y
  * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
  * or
  * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
  */
#define DRM_FORMAT_NV12        fourcc_code('N', 'V', '1', '2') /* 2x2 
subsampled Cr:Cb plane */
#define DRM_FORMAT_NV21        fourcc_code('N', 'V', '2', '1') /* 2x2 
subsampled Cb:Cr plane */
#define DRM_FORMAT_NV16        fourcc_code('N', 'V', '1', '6') /* 2x1 
subsampled Cr:Cb plane */
#define DRM_FORMAT_NV61        fourcc_code('N', 'V', '6', '1') /* 2x1 
subsampled Cb:Cr plane */
#define DRM_FORMAT_NV24        fourcc_code('N', 'V', '2', '4') /* 
non-subsampled Cr:Cb plane */
#define DRM_FORMAT_NV42        fourcc_code('N', 'V', '4',


>
>> + */
>> +
>> +#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
>> +#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
>> +#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
>> +
>> +/*
>>    * 3 plane YCbCr
>>    * index 0: Y plane, [7:0] Y
>>    * index 1: Cb plane, [7:0] Cb
>> -- 
>> 2.7.4
>>
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-23 12:38   ` Sandy Huang
  (?)
  (?)
@ 2019-09-23 13:06   ` Daniel Vetter
  2019-09-24  6:46     ` sandy.huang
  -1 siblings, 1 reply; 27+ messages in thread
From: Daniel Vetter @ 2019-09-23 13:06 UTC (permalink / raw)
  To: Sandy Huang
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Linux Kernel Mailing List

On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
>
> The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
> 10bit YUV format, here have some problem.
> So we change cpp to bpp, use unit BitPerPlane to describe the data
> format.
>
> Signed-off-by: Sandy Huang <hjc@rock-chips.com>

Whatever the layout you have for these (it's not really defined in
your patch here down to the level of detail we want) I think this
should be described with the block_h/w and char_per_block
functionality. Not by extending the legacy and depcrecated cpp
somehow.
-Daniel

> ---
>  drivers/gpu/drm/drm_client.c        |   4 +-
>  drivers/gpu/drm/drm_fb_helper.c     |   8 +-
>  drivers/gpu/drm/drm_format_helper.c |   4 +-
>  drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
>  drivers/gpu/drm/drm_framebuffer.c   |   2 +-
>  include/drm/drm_fourcc.h            |   4 +-
>  include/uapi/drm/drm_fourcc.h       |  15 ++++
>  7 files changed, 115 insertions(+), 94 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
> index d9a2e36..a36ffbe 100644
> --- a/drivers/gpu/drm/drm_client.c
> +++ b/drivers/gpu/drm/drm_client.c
> @@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
>
>         dumb_args.width = width;
>         dumb_args.height = height;
> -       dumb_args.bpp = info->cpp[0] * 8;
> +       dumb_args.bpp = info->bpp[0];
>         ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
>         if (ret)
>                 goto err_delete;
> @@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
>         int ret;
>
>         info = drm_format_info(format);
> -       fb_req.bpp = info->cpp[0] * 8;
> +       fb_req.bpp = info->bpp[0];
>         fb_req.depth = info->depth;
>         fb_req.width = width;
>         fb_req.height = height;
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index a7ba5b4..b30e782 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
>                                           struct drm_clip_rect *clip)
>  {
>         struct drm_framebuffer *fb = fb_helper->fb;
> -       unsigned int cpp = fb->format->cpp[0];
> +       unsigned int cpp = fb->format->bpp[0] / 8;
>         size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
>         void *src = fb_helper->fbdev->screen_buffer + offset;
>         void *dst = fb_helper->buffer->vaddr + offset;
> @@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
>          * Changes struct fb_var_screeninfo are currently not pushed back
>          * to KMS, hence fail if different settings are requested.
>          */
> -       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
> +       if (var->bits_per_pixel != fb->format->bpp[0] ||
>             var->xres > fb->width || var->yres > fb->height ||
>             var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
>                 DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
>                           "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
>                           var->xres, var->yres, var->bits_per_pixel,
>                           var->xres_virtual, var->yres_virtual,
> -                         fb->width, fb->height, fb->format->cpp[0] * 8);
> +                         fb->width, fb->height, fb->format->bpp[0]);
>                 return -EINVAL;
>         }
>
> @@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
>         info->pseudo_palette = fb_helper->pseudo_palette;
>         info->var.xres_virtual = fb->width;
>         info->var.yres_virtual = fb->height;
> -       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
> +       info->var.bits_per_pixel = fb->format->bpp[0];
>         info->var.accel_flags = FB_ACCELF_TEXT;
>         info->var.xoffset = 0;
>         info->var.yoffset = 0;
> diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
> index 0897cb9..eea3afb 100644
> --- a/drivers/gpu/drm/drm_format_helper.c
> +++ b/drivers/gpu/drm/drm_format_helper.c
> @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
>  void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
>                    struct drm_rect *clip)
>  {
> -       unsigned int cpp = fb->format->cpp[0];
> +       unsigned int cpp = fb->format->bpp[0] / 8;
>         size_t len = (clip->x2 - clip->x1) * cpp;
>         unsigned int y, lines = clip->y2 - clip->y1;
>
> @@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
>                            struct drm_framebuffer *fb,
>                            struct drm_rect *clip)
>  {
> -       unsigned int cpp = fb->format->cpp[0];
> +       unsigned int cpp = fb->format->bpp[0] / 8;
>         unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
>         size_t len = (clip->x2 - clip->x1) * cpp;
>         unsigned int y, lines = clip->y2 - clip->y1;
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index c630064..071dc07 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
> -               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> -               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
> -               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
> -               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> -               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> -               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> -               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> -               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> -               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> -               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> -               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> -               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> -               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_C8,              .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> +               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> +               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
> +               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
> +               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
> +               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
> +               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> +               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> +               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> +               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> +               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> +               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>                 { .format = DRM_FORMAT_Y0L0,            .depth = 0,  .num_planes = 1,
>                   .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
>                   .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 0b72468..7b29e97 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
>         r->height = fb->height;
>         r->width = fb->width;
>         r->depth = fb->format->depth;
> -       r->bpp = fb->format->cpp[0] * 8;
> +       r->bpp = fb->format->bpp[0];
>         r->pitch = fb->pitches[0];
>
>         /* GET_FB() is an unprivileged ioctl so we must not return a
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index 306d1ef..021358d 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -73,12 +73,12 @@ struct drm_format_info {
>                 /**
>                  * @cpp:
>                  *
> -                * Number of bytes per pixel (per plane), this is aliased with
> +                * Number of bits per pixel (per plane), this is aliased with
>                  * @char_per_block. It is deprecated in favour of using the
>                  * triplet @char_per_block, @block_w, @block_h for better
>                  * describing the pixel format.
>                  */
> -               u8 cpp[3];
> +               u8 bpp[3];
>
>                 /**
>                  * @char_per_block:
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index 3feeaa3..5fe89e9 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -266,6 +266,21 @@ extern "C" {
>  #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>
>  /*
> + * 2 plane YCbCr 10bit
> + * index 0 = Y plane, [9:0] Y
> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
> + * or
> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
> + */
> +
> +#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
> +#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
> +#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
> +#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
> +#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
> +#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
> +
> +/*
>   * 3 plane YCbCr
>   * index 0: Y plane, [7:0] Y
>   * index 1: Cb plane, [7:0] Cb
> --
> 2.7.4
>
>
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-23 13:05       ` sandy.huang
@ 2019-09-23 18:30         ` Ville Syrjälä
  -1 siblings, 0 replies; 27+ messages in thread
From: Ville Syrjälä @ 2019-09-23 18:30 UTC (permalink / raw)
  To: sandy.huang
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter, linux-kernel

On Mon, Sep 23, 2019 at 06:05:22AM -0700, sandy.huang wrote:
> 
> 在 2019/9/23 上午5:53, Ville Syrjälä 写道:
> > On Mon, Sep 23, 2019 at 08:38:50PM +0800, Sandy Huang wrote:
> >> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> >> index 3feeaa3..5fe89e9 100644
> >> --- a/include/uapi/drm/drm_fourcc.h
> >> +++ b/include/uapi/drm/drm_fourcc.h
> >> @@ -266,6 +266,21 @@ extern "C" {
> >>   #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
> >>   
> >>   /*
> >> + * 2 plane YCbCr 10bit
> >> + * index 0 = Y plane, [9:0] Y
> >> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
> >> + * or
> >> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
> > What does "little endian" even mean for these?
> 
> It's Inherited from the following define, the difference is 8bit and 10bit.
> /*
>   * 2 plane YCbCr
>   * index 0 = Y plane, [7:0] Y
>   * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
>   * or
>   * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
>   */
> #define DRM_FORMAT_NV12        fourcc_code('N', 'V', '1', '2') /* 2x2 
> subsampled Cr:Cb plane */
> #define DRM_FORMAT_NV21        fourcc_code('N', 'V', '2', '1') /* 2x2 
> subsampled Cb:Cr plane */
> #define DRM_FORMAT_NV16        fourcc_code('N', 'V', '1', '6') /* 2x1 
> subsampled Cr:Cb plane */
> #define DRM_FORMAT_NV61        fourcc_code('N', 'V', '6', '1') /* 2x1 
> subsampled Cb:Cr plane */
> #define DRM_FORMAT_NV24        fourcc_code('N', 'V', '2', '4') /* 
> non-subsampled Cr:Cb plane */
> #define DRM_FORMAT_NV42        fourcc_code('N', 'V', '4',

Something not aligned to bytes can't have its endianness defined the
same way as these. Just doesn't make sense.

>
> 
> 
> >
> >> + */
> >> +
> >> +#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
> >> +#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
> >> +#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
> >> +
> >> +/*
> >>    * 3 plane YCbCr
> >>    * index 0: Y plane, [7:0] Y
> >>    * index 1: Cb plane, [7:0] Cb
> >> -- 
> >> 2.7.4
> >>
> >>
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
@ 2019-09-23 18:30         ` Ville Syrjälä
  0 siblings, 0 replies; 27+ messages in thread
From: Ville Syrjälä @ 2019-09-23 18:30 UTC (permalink / raw)
  To: sandy.huang
  Cc: Maxime Ripard, linux-kernel, dri-devel, David Airlie, Sean Paul

On Mon, Sep 23, 2019 at 06:05:22AM -0700, sandy.huang wrote:
> 
> 在 2019/9/23 上午5:53, Ville Syrjälä 写道:
> > On Mon, Sep 23, 2019 at 08:38:50PM +0800, Sandy Huang wrote:
> >> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> >> index 3feeaa3..5fe89e9 100644
> >> --- a/include/uapi/drm/drm_fourcc.h
> >> +++ b/include/uapi/drm/drm_fourcc.h
> >> @@ -266,6 +266,21 @@ extern "C" {
> >>   #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
> >>   
> >>   /*
> >> + * 2 plane YCbCr 10bit
> >> + * index 0 = Y plane, [9:0] Y
> >> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
> >> + * or
> >> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
> > What does "little endian" even mean for these?
> 
> It's Inherited from the following define, the difference is 8bit and 10bit.
> /*
>   * 2 plane YCbCr
>   * index 0 = Y plane, [7:0] Y
>   * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
>   * or
>   * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
>   */
> #define DRM_FORMAT_NV12        fourcc_code('N', 'V', '1', '2') /* 2x2 
> subsampled Cr:Cb plane */
> #define DRM_FORMAT_NV21        fourcc_code('N', 'V', '2', '1') /* 2x2 
> subsampled Cb:Cr plane */
> #define DRM_FORMAT_NV16        fourcc_code('N', 'V', '1', '6') /* 2x1 
> subsampled Cr:Cb plane */
> #define DRM_FORMAT_NV61        fourcc_code('N', 'V', '6', '1') /* 2x1 
> subsampled Cb:Cr plane */
> #define DRM_FORMAT_NV24        fourcc_code('N', 'V', '2', '4') /* 
> non-subsampled Cr:Cb plane */
> #define DRM_FORMAT_NV42        fourcc_code('N', 'V', '4',

Something not aligned to bytes can't have its endianness defined the
same way as these. Just doesn't make sense.

>
> 
> 
> >
> >> + */
> >> +
> >> +#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
> >> +#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
> >> +#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
> >> +
> >> +/*
> >>    * 3 plane YCbCr
> >>    * index 0: Y plane, [7:0] Y
> >>    * index 1: Cb plane, [7:0] Cb
> >> -- 
> >> 2.7.4
> >>
> >>
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-23 13:06   ` Daniel Vetter
@ 2019-09-24  6:46     ` sandy.huang
  2019-09-24  7:00         ` sandy.huang
                         ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-24  6:46 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Linux Kernel Mailing List


在 2019/9/23 下午9:06, Daniel Vetter 写道:
> On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
>> The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
>> 10bit YUV format, here have some problem.
>> So we change cpp to bpp, use unit BitPerPlane to describe the data
>> format.
>>
>> Signed-off-by: Sandy Huang <hjc@rock-chips.com>
> Whatever the layout you have for these (it's not really defined in
> your patch here down to the level of detail we want) I think this
> should be described with the block_h/w and char_per_block
> functionality. Not by extending the legacy and depcrecated cpp
> somehow.
> -Daniel

Hi Daniel,

It seems the char_per_block and block_h/w can't describing the following 
data format:

/*
  * 2x2 subsampled Cr:Cb plane 10 bits per channel
  * index 0 = Y plane, [9:0]
  * index 1 = Cr:Cb plane, [19:0] Cr:x:Cb:x [19:0]
  */

>> ---
>>   drivers/gpu/drm/drm_client.c        |   4 +-
>>   drivers/gpu/drm/drm_fb_helper.c     |   8 +-
>>   drivers/gpu/drm/drm_format_helper.c |   4 +-
>>   drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
>>   drivers/gpu/drm/drm_framebuffer.c   |   2 +-
>>   include/drm/drm_fourcc.h            |   4 +-
>>   include/uapi/drm/drm_fourcc.h       |  15 ++++
>>   7 files changed, 115 insertions(+), 94 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
>> index d9a2e36..a36ffbe 100644
>> --- a/drivers/gpu/drm/drm_client.c
>> +++ b/drivers/gpu/drm/drm_client.c
>> @@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
>>
>>          dumb_args.width = width;
>>          dumb_args.height = height;
>> -       dumb_args.bpp = info->cpp[0] * 8;
>> +       dumb_args.bpp = info->bpp[0];
>>          ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
>>          if (ret)
>>                  goto err_delete;
>> @@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
>>          int ret;
>>
>>          info = drm_format_info(format);
>> -       fb_req.bpp = info->cpp[0] * 8;
>> +       fb_req.bpp = info->bpp[0];
>>          fb_req.depth = info->depth;
>>          fb_req.width = width;
>>          fb_req.height = height;
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
>> index a7ba5b4..b30e782 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
>>                                            struct drm_clip_rect *clip)
>>   {
>>          struct drm_framebuffer *fb = fb_helper->fb;
>> -       unsigned int cpp = fb->format->cpp[0];
>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>          size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
>>          void *src = fb_helper->fbdev->screen_buffer + offset;
>>          void *dst = fb_helper->buffer->vaddr + offset;
>> @@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
>>           * Changes struct fb_var_screeninfo are currently not pushed back
>>           * to KMS, hence fail if different settings are requested.
>>           */
>> -       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
>> +       if (var->bits_per_pixel != fb->format->bpp[0] ||
>>              var->xres > fb->width || var->yres > fb->height ||
>>              var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
>>                  DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
>>                            "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
>>                            var->xres, var->yres, var->bits_per_pixel,
>>                            var->xres_virtual, var->yres_virtual,
>> -                         fb->width, fb->height, fb->format->cpp[0] * 8);
>> +                         fb->width, fb->height, fb->format->bpp[0]);
>>                  return -EINVAL;
>>          }
>>
>> @@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
>>          info->pseudo_palette = fb_helper->pseudo_palette;
>>          info->var.xres_virtual = fb->width;
>>          info->var.yres_virtual = fb->height;
>> -       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
>> +       info->var.bits_per_pixel = fb->format->bpp[0];
>>          info->var.accel_flags = FB_ACCELF_TEXT;
>>          info->var.xoffset = 0;
>>          info->var.yoffset = 0;
>> diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
>> index 0897cb9..eea3afb 100644
>> --- a/drivers/gpu/drm/drm_format_helper.c
>> +++ b/drivers/gpu/drm/drm_format_helper.c
>> @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
>>   void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
>>                     struct drm_rect *clip)
>>   {
>> -       unsigned int cpp = fb->format->cpp[0];
>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>          unsigned int y, lines = clip->y2 - clip->y1;
>>
>> @@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
>>                             struct drm_framebuffer *fb,
>>                             struct drm_rect *clip)
>>   {
>> -       unsigned int cpp = fb->format->cpp[0];
>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>          unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>          unsigned int y, lines = clip->y2 - clip->y1;
>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>> index c630064..071dc07 100644
>> --- a/drivers/gpu/drm/drm_fourcc.c
>> +++ b/drivers/gpu/drm/drm_fourcc.c
>> @@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>> -               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> -               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> -               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> -               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> -               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> -               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> -               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> -               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> -               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_C8,              .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>> +               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>> +               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> +               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> +               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> +               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>> +               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>> +               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>                  { .format = DRM_FORMAT_Y0L0,            .depth = 0,  .num_planes = 1,
>>                    .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
>>                    .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
>> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
>> index 0b72468..7b29e97 100644
>> --- a/drivers/gpu/drm/drm_framebuffer.c
>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>> @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
>>          r->height = fb->height;
>>          r->width = fb->width;
>>          r->depth = fb->format->depth;
>> -       r->bpp = fb->format->cpp[0] * 8;
>> +       r->bpp = fb->format->bpp[0];
>>          r->pitch = fb->pitches[0];
>>
>>          /* GET_FB() is an unprivileged ioctl so we must not return a
>> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
>> index 306d1ef..021358d 100644
>> --- a/include/drm/drm_fourcc.h
>> +++ b/include/drm/drm_fourcc.h
>> @@ -73,12 +73,12 @@ struct drm_format_info {
>>                  /**
>>                   * @cpp:
>>                   *
>> -                * Number of bytes per pixel (per plane), this is aliased with
>> +                * Number of bits per pixel (per plane), this is aliased with
>>                   * @char_per_block. It is deprecated in favour of using the
>>                   * triplet @char_per_block, @block_w, @block_h for better
>>                   * describing the pixel format.
>>                   */
>> -               u8 cpp[3];
>> +               u8 bpp[3];
>>
>>                  /**
>>                   * @char_per_block:
>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>> index 3feeaa3..5fe89e9 100644
>> --- a/include/uapi/drm/drm_fourcc.h
>> +++ b/include/uapi/drm/drm_fourcc.h
>> @@ -266,6 +266,21 @@ extern "C" {
>>   #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>
>>   /*
>> + * 2 plane YCbCr 10bit
>> + * index 0 = Y plane, [9:0] Y
>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>> + * or
>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
>> + */
>> +
>> +#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
>> +#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
>> +#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
>> +#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
>> +
>> +/*
>>    * 3 plane YCbCr
>>    * index 0: Y plane, [7:0] Y
>>    * index 1: Cb plane, [7:0] Cb
>> --
>> 2.7.4
>>
>>
>>
>



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-23 18:30         ` Ville Syrjälä
  (?)
@ 2019-09-24  6:47         ` sandy.huang
  -1 siblings, 0 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-24  6:47 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter, linux-kernel


在 2019/9/24 上午2:30, Ville Syrjälä 写道:
> On Mon, Sep 23, 2019 at 06:05:22AM -0700, sandy.huang wrote:
>> 在 2019/9/23 上午5:53, Ville Syrjälä 写道:
>>> On Mon, Sep 23, 2019 at 08:38:50PM +0800, Sandy Huang wrote:
>>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>>> index 3feeaa3..5fe89e9 100644
>>>> --- a/include/uapi/drm/drm_fourcc.h
>>>> +++ b/include/uapi/drm/drm_fourcc.h
>>>> @@ -266,6 +266,21 @@ extern "C" {
>>>>    #define DRM_FORMAT_P016		fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>>>    
>>>>    /*
>>>> + * 2 plane YCbCr 10bit
>>>> + * index 0 = Y plane, [9:0] Y
>>>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>>>> + * or
>>>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
>>> What does "little endian" even mean for these?
>> It's Inherited from the following define, the difference is 8bit and 10bit.
>> /*
>>    * 2 plane YCbCr
>>    * index 0 = Y plane, [7:0] Y
>>    * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
>>    * or
>>    * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
>>    */
>> #define DRM_FORMAT_NV12        fourcc_code('N', 'V', '1', '2') /* 2x2
>> subsampled Cr:Cb plane */
>> #define DRM_FORMAT_NV21        fourcc_code('N', 'V', '2', '1') /* 2x2
>> subsampled Cb:Cr plane */
>> #define DRM_FORMAT_NV16        fourcc_code('N', 'V', '1', '6') /* 2x1
>> subsampled Cr:Cb plane */
>> #define DRM_FORMAT_NV61        fourcc_code('N', 'V', '6', '1') /* 2x1
>> subsampled Cb:Cr plane */
>> #define DRM_FORMAT_NV24        fourcc_code('N', 'V', '2', '4') /*
>> non-subsampled Cr:Cb plane */
>> #define DRM_FORMAT_NV42        fourcc_code('N', 'V', '4',
> Something not aligned to bytes can't have its endianness defined the
> same way as these. Just doesn't make sense.


Get it ,thanks.

>>
>>
>>>> + */
>>>> +
>>>> +#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV21_10	fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
>>>> +#define DRM_FORMAT_NV16_10	fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV61_10	fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
>>>> +#define DRM_FORMAT_NV24_10	fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV42_10	fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
>>>> +
>>>> +/*
>>>>     * 3 plane YCbCr
>>>>     * index 0: Y plane, [7:0] Y
>>>>     * index 1: Cb plane, [7:0] Cb
>>>> -- 
>>>> 2.7.4
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-24  6:46     ` sandy.huang
@ 2019-09-24  7:00         ` sandy.huang
  2019-09-24 10:12       ` Ayan Halder
  2019-09-25 11:23       ` Daniel Vetter
  2 siblings, 0 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-24  7:00 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Maxime Ripard, Linux Kernel Mailing List, dri-devel,
	David Airlie, Sean Paul


在 2019/9/24 下午2:46, sandy.huang 写道:
>
> 在 2019/9/23 下午9:06, Daniel Vetter 写道:
>> On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
>>> The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
>>> 10bit YUV format, here have some problem.
>>> So we change cpp to bpp, use unit BitPerPlane to describe the data
>>> format.
>>>
>>> Signed-off-by: Sandy Huang <hjc@rock-chips.com>
>> Whatever the layout you have for these (it's not really defined in
>> your patch here down to the level of detail we want) I think this
>> should be described with the block_h/w and char_per_block
>> functionality. Not by extending the legacy and depcrecated cpp
>> somehow.
>> -Daniel
>
> Hi Daniel,
>
> It seems the char_per_block and block_h/w can't describing the 
> following data format:
>
> /*
>  * 2x2 subsampled Cr:Cb plane 10 bits per channel
>  * index 0 = Y plane, [9:0]
>  * index 1 = Cr:Cb plane, [19:0] Cr:x:Cb:x [19:0]
>  */
>
sorry, the data layout is like this.

/*
  * 2x2 subsampled Cr:Cb plane 10 bits per channel
  * index 0 = Y plane, [9:0]
  * index 1 = Cr:Cb plane, [19:0]
  */

/*
  * 2x2 subsampled Cb:Cr plane 10 bits per channel
  * index 0 = Y plane, [9:0]
  * index 1 = Cb:Cr plane, [19:0]
  */

>>> ---
>>>   drivers/gpu/drm/drm_client.c        |   4 +-
>>>   drivers/gpu/drm/drm_fb_helper.c     |   8 +-
>>>   drivers/gpu/drm/drm_format_helper.c |   4 +-
>>>   drivers/gpu/drm/drm_fourcc.c        | 172 
>>> +++++++++++++++++++-----------------
>>>   drivers/gpu/drm/drm_framebuffer.c   |   2 +-
>>>   include/drm/drm_fourcc.h            |   4 +-
>>>   include/uapi/drm/drm_fourcc.h       |  15 ++++
>>>   7 files changed, 115 insertions(+), 94 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_client.c 
>>> b/drivers/gpu/drm/drm_client.c
>>> index d9a2e36..a36ffbe 100644
>>> --- a/drivers/gpu/drm/drm_client.c
>>> +++ b/drivers/gpu/drm/drm_client.c
>>> @@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev 
>>> *client, u32 width, u32 height, u
>>>
>>>          dumb_args.width = width;
>>>          dumb_args.height = height;
>>> -       dumb_args.bpp = info->cpp[0] * 8;
>>> +       dumb_args.bpp = info->bpp[0];
>>>          ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
>>>          if (ret)
>>>                  goto err_delete;
>>> @@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct 
>>> drm_client_buffer *buffer,
>>>          int ret;
>>>
>>>          info = drm_format_info(format);
>>> -       fb_req.bpp = info->cpp[0] * 8;
>>> +       fb_req.bpp = info->bpp[0];
>>>          fb_req.depth = info->depth;
>>>          fb_req.width = width;
>>>          fb_req.height = height;
>>> diff --git a/drivers/gpu/drm/drm_fb_helper.c 
>>> b/drivers/gpu/drm/drm_fb_helper.c
>>> index a7ba5b4..b30e782 100644
>>> --- a/drivers/gpu/drm/drm_fb_helper.c
>>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>>> @@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct 
>>> drm_fb_helper *fb_helper,
>>>                                            struct drm_clip_rect *clip)
>>>   {
>>>          struct drm_framebuffer *fb = fb_helper->fb;
>>> -       unsigned int cpp = fb->format->cpp[0];
>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>          size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
>>>          void *src = fb_helper->fbdev->screen_buffer + offset;
>>>          void *dst = fb_helper->buffer->vaddr + offset;
>>> @@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct 
>>> fb_var_screeninfo *var,
>>>           * Changes struct fb_var_screeninfo are currently not 
>>> pushed back
>>>           * to KMS, hence fail if different settings are requested.
>>>           */
>>> -       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
>>> +       if (var->bits_per_pixel != fb->format->bpp[0] ||
>>>              var->xres > fb->width || var->yres > fb->height ||
>>>              var->xres_virtual > fb->width || var->yres_virtual > 
>>> fb->height) {
>>>                  DRM_DEBUG("fb requested width/height/bpp can't fit 
>>> in current fb "
>>>                            "request %dx%d-%d (virtual %dx%d) > 
>>> %dx%d-%d\n",
>>>                            var->xres, var->yres, var->bits_per_pixel,
>>>                            var->xres_virtual, var->yres_virtual,
>>> -                         fb->width, fb->height, fb->format->cpp[0] 
>>> * 8);
>>> +                         fb->width, fb->height, fb->format->bpp[0]);
>>>                  return -EINVAL;
>>>          }
>>>
>>> @@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct 
>>> fb_info *info,
>>>          info->pseudo_palette = fb_helper->pseudo_palette;
>>>          info->var.xres_virtual = fb->width;
>>>          info->var.yres_virtual = fb->height;
>>> -       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
>>> +       info->var.bits_per_pixel = fb->format->bpp[0];
>>>          info->var.accel_flags = FB_ACCELF_TEXT;
>>>          info->var.xoffset = 0;
>>>          info->var.yoffset = 0;
>>> diff --git a/drivers/gpu/drm/drm_format_helper.c 
>>> b/drivers/gpu/drm/drm_format_helper.c
>>> index 0897cb9..eea3afb 100644
>>> --- a/drivers/gpu/drm/drm_format_helper.c
>>> +++ b/drivers/gpu/drm/drm_format_helper.c
>>> @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect 
>>> *clip,
>>>   void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer 
>>> *fb,
>>>                     struct drm_rect *clip)
>>>   {
>>> -       unsigned int cpp = fb->format->cpp[0];
>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>>
>>> @@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void 
>>> *vaddr,
>>>                             struct drm_framebuffer *fb,
>>>                             struct drm_rect *clip)
>>>   {
>>> -       unsigned int cpp = fb->format->cpp[0];
>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>          unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>> diff --git a/drivers/gpu/drm/drm_fourcc.c 
>>> b/drivers/gpu/drm/drm_fourcc.c
>>> index c630064..071dc07 100644
>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>> @@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGB332,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGR233,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGB565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGR565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGB888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGR888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_YUV410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV12,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV21,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV16,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV61,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV24,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV42,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUYV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVYU,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_UYVY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_VYUY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_VUY888,          .depth = 0,  
>>> .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_AYUV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_Y210,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_Y212,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_Y216,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_Y410,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_Y412,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_Y416,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> +               { .format = DRM_FORMAT_C8,              .depth = 8,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGB332,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGR233,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGB565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGR565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGB888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGR888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_YUV410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV12,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV21,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV16,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV61,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV24,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV42,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUYV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVYU,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_UYVY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_VYUY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_VUY888,          .depth = 0,  
>>> .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_AYUV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_Y210,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_Y212,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_Y216,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_Y410,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_Y412,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_Y416,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>>                  { .format = DRM_FORMAT_Y0L0, .depth = 0,  
>>> .num_planes = 1,
>>>                    .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 
>>> 0 }, .block_h = { 2, 0, 0 },
>>>                    .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv 
>>> = true },
>>> diff --git a/drivers/gpu/drm/drm_framebuffer.c 
>>> b/drivers/gpu/drm/drm_framebuffer.c
>>> index 0b72468..7b29e97 100644
>>> --- a/drivers/gpu/drm/drm_framebuffer.c
>>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>>> @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
>>>          r->height = fb->height;
>>>          r->width = fb->width;
>>>          r->depth = fb->format->depth;
>>> -       r->bpp = fb->format->cpp[0] * 8;
>>> +       r->bpp = fb->format->bpp[0];
>>>          r->pitch = fb->pitches[0];
>>>
>>>          /* GET_FB() is an unprivileged ioctl so we must not return a
>>> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
>>> index 306d1ef..021358d 100644
>>> --- a/include/drm/drm_fourcc.h
>>> +++ b/include/drm/drm_fourcc.h
>>> @@ -73,12 +73,12 @@ struct drm_format_info {
>>>                  /**
>>>                   * @cpp:
>>>                   *
>>> -                * Number of bytes per pixel (per plane), this is 
>>> aliased with
>>> +                * Number of bits per pixel (per plane), this is 
>>> aliased with
>>>                   * @char_per_block. It is deprecated in favour of 
>>> using the
>>>                   * triplet @char_per_block, @block_w, @block_h for 
>>> better
>>>                   * describing the pixel format.
>>>                   */
>>> -               u8 cpp[3];
>>> +               u8 bpp[3];
>>>
>>>                  /**
>>>                   * @char_per_block:
>>> diff --git a/include/uapi/drm/drm_fourcc.h 
>>> b/include/uapi/drm/drm_fourcc.h
>>> index 3feeaa3..5fe89e9 100644
>>> --- a/include/uapi/drm/drm_fourcc.h
>>> +++ b/include/uapi/drm/drm_fourcc.h
>>> @@ -266,6 +266,21 @@ extern "C" {
>>>   #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', 
>>> '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>>
>>>   /*
>>> + * 2 plane YCbCr 10bit
>>> + * index 0 = Y plane, [9:0] Y
>>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>>> + * or
>>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
>>> + */
>>> +
>>> +#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 
>>> 2x2 subsampled Cr:Cb plane */
>>> +#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 
>>> 2x2 subsampled Cb:Cr plane */
>>> +#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 
>>> 2x1 subsampled Cr:Cb plane */
>>> +#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 
>>> 2x1 subsampled Cb:Cr plane */
>>> +#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* 
>>> non-subsampled Cr:Cb plane */
>>> +#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* 
>>> non-subsampled Cb:Cr plane */
>>> +
>>> +/*
>>>    * 3 plane YCbCr
>>>    * index 0: Y plane, [7:0] Y
>>>    * index 1: Cb plane, [7:0] Cb
>>> -- 
>>> 2.7.4
>>>
>>>
>>>
>>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
@ 2019-09-24  7:00         ` sandy.huang
  0 siblings, 0 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-24  7:00 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Maxime Ripard, David Airlie, Sean Paul,
	Linux Kernel Mailing List, dri-devel


在 2019/9/24 下午2:46, sandy.huang 写道:
>
> 在 2019/9/23 下午9:06, Daniel Vetter 写道:
>> On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
>>> The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
>>> 10bit YUV format, here have some problem.
>>> So we change cpp to bpp, use unit BitPerPlane to describe the data
>>> format.
>>>
>>> Signed-off-by: Sandy Huang <hjc@rock-chips.com>
>> Whatever the layout you have for these (it's not really defined in
>> your patch here down to the level of detail we want) I think this
>> should be described with the block_h/w and char_per_block
>> functionality. Not by extending the legacy and depcrecated cpp
>> somehow.
>> -Daniel
>
> Hi Daniel,
>
> It seems the char_per_block and block_h/w can't describing the 
> following data format:
>
> /*
>  * 2x2 subsampled Cr:Cb plane 10 bits per channel
>  * index 0 = Y plane, [9:0]
>  * index 1 = Cr:Cb plane, [19:0] Cr:x:Cb:x [19:0]
>  */
>
sorry, the data layout is like this.

/*
  * 2x2 subsampled Cr:Cb plane 10 bits per channel
  * index 0 = Y plane, [9:0]
  * index 1 = Cr:Cb plane, [19:0]
  */

/*
  * 2x2 subsampled Cb:Cr plane 10 bits per channel
  * index 0 = Y plane, [9:0]
  * index 1 = Cb:Cr plane, [19:0]
  */

>>> ---
>>>   drivers/gpu/drm/drm_client.c        |   4 +-
>>>   drivers/gpu/drm/drm_fb_helper.c     |   8 +-
>>>   drivers/gpu/drm/drm_format_helper.c |   4 +-
>>>   drivers/gpu/drm/drm_fourcc.c        | 172 
>>> +++++++++++++++++++-----------------
>>>   drivers/gpu/drm/drm_framebuffer.c   |   2 +-
>>>   include/drm/drm_fourcc.h            |   4 +-
>>>   include/uapi/drm/drm_fourcc.h       |  15 ++++
>>>   7 files changed, 115 insertions(+), 94 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_client.c 
>>> b/drivers/gpu/drm/drm_client.c
>>> index d9a2e36..a36ffbe 100644
>>> --- a/drivers/gpu/drm/drm_client.c
>>> +++ b/drivers/gpu/drm/drm_client.c
>>> @@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev 
>>> *client, u32 width, u32 height, u
>>>
>>>          dumb_args.width = width;
>>>          dumb_args.height = height;
>>> -       dumb_args.bpp = info->cpp[0] * 8;
>>> +       dumb_args.bpp = info->bpp[0];
>>>          ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
>>>          if (ret)
>>>                  goto err_delete;
>>> @@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct 
>>> drm_client_buffer *buffer,
>>>          int ret;
>>>
>>>          info = drm_format_info(format);
>>> -       fb_req.bpp = info->cpp[0] * 8;
>>> +       fb_req.bpp = info->bpp[0];
>>>          fb_req.depth = info->depth;
>>>          fb_req.width = width;
>>>          fb_req.height = height;
>>> diff --git a/drivers/gpu/drm/drm_fb_helper.c 
>>> b/drivers/gpu/drm/drm_fb_helper.c
>>> index a7ba5b4..b30e782 100644
>>> --- a/drivers/gpu/drm/drm_fb_helper.c
>>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>>> @@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct 
>>> drm_fb_helper *fb_helper,
>>>                                            struct drm_clip_rect *clip)
>>>   {
>>>          struct drm_framebuffer *fb = fb_helper->fb;
>>> -       unsigned int cpp = fb->format->cpp[0];
>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>          size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
>>>          void *src = fb_helper->fbdev->screen_buffer + offset;
>>>          void *dst = fb_helper->buffer->vaddr + offset;
>>> @@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct 
>>> fb_var_screeninfo *var,
>>>           * Changes struct fb_var_screeninfo are currently not 
>>> pushed back
>>>           * to KMS, hence fail if different settings are requested.
>>>           */
>>> -       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
>>> +       if (var->bits_per_pixel != fb->format->bpp[0] ||
>>>              var->xres > fb->width || var->yres > fb->height ||
>>>              var->xres_virtual > fb->width || var->yres_virtual > 
>>> fb->height) {
>>>                  DRM_DEBUG("fb requested width/height/bpp can't fit 
>>> in current fb "
>>>                            "request %dx%d-%d (virtual %dx%d) > 
>>> %dx%d-%d\n",
>>>                            var->xres, var->yres, var->bits_per_pixel,
>>>                            var->xres_virtual, var->yres_virtual,
>>> -                         fb->width, fb->height, fb->format->cpp[0] 
>>> * 8);
>>> +                         fb->width, fb->height, fb->format->bpp[0]);
>>>                  return -EINVAL;
>>>          }
>>>
>>> @@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct 
>>> fb_info *info,
>>>          info->pseudo_palette = fb_helper->pseudo_palette;
>>>          info->var.xres_virtual = fb->width;
>>>          info->var.yres_virtual = fb->height;
>>> -       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
>>> +       info->var.bits_per_pixel = fb->format->bpp[0];
>>>          info->var.accel_flags = FB_ACCELF_TEXT;
>>>          info->var.xoffset = 0;
>>>          info->var.yoffset = 0;
>>> diff --git a/drivers/gpu/drm/drm_format_helper.c 
>>> b/drivers/gpu/drm/drm_format_helper.c
>>> index 0897cb9..eea3afb 100644
>>> --- a/drivers/gpu/drm/drm_format_helper.c
>>> +++ b/drivers/gpu/drm/drm_format_helper.c
>>> @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect 
>>> *clip,
>>>   void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer 
>>> *fb,
>>>                     struct drm_rect *clip)
>>>   {
>>> -       unsigned int cpp = fb->format->cpp[0];
>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>>
>>> @@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void 
>>> *vaddr,
>>>                             struct drm_framebuffer *fb,
>>>                             struct drm_rect *clip)
>>>   {
>>> -       unsigned int cpp = fb->format->cpp[0];
>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>          unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>> diff --git a/drivers/gpu/drm/drm_fourcc.c 
>>> b/drivers/gpu/drm/drm_fourcc.c
>>> index c630064..071dc07 100644
>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>> @@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGB332,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGR233,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGB565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGR565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGB888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGR888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> -               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> -               { .format = DRM_FORMAT_YUV410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUV444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVU444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV12,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV21,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV16,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV61,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV24,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_NV42,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YUYV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_YVYU,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_UYVY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_VYUY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_VUY888,          .depth = 0,  
>>> .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_AYUV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_Y210,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_Y212,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_Y216,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_Y410,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_Y412,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_Y416,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> -               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  
>>> .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> -               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = 
>>> true },
>>> +               { .format = DRM_FORMAT_C8,              .depth = 8,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGB332,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGR233,          .depth = 8,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGB565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGR565,          .depth = 16, 
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGB888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGR888,          .depth = 24, 
>>> .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, 
>>> .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, 
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>> +               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, 
>>> .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, 
>>> .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true },
>>> +               { .format = DRM_FORMAT_YUV410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU410,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU411,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU420,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU422,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUV444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVU444,          .depth = 0,  
>>> .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV12,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV21,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV16,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV61,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV24,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV42,            .depth = 0,  
>>> .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  
>>> .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YUYV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_YVYU,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_UYVY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_VYUY,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_VUY888,          .depth = 0,  
>>> .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_AYUV,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_Y210,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_Y212,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_Y216,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_Y410,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_Y412,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_Y416,            .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, 
>>> .has_alpha = true, .is_yuv = true },
>>> +               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  
>>> .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>> +               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  
>>> .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv 
>>> = true },
>>>                  { .format = DRM_FORMAT_Y0L0, .depth = 0,  
>>> .num_planes = 1,
>>>                    .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 
>>> 0 }, .block_h = { 2, 0, 0 },
>>>                    .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv 
>>> = true },
>>> diff --git a/drivers/gpu/drm/drm_framebuffer.c 
>>> b/drivers/gpu/drm/drm_framebuffer.c
>>> index 0b72468..7b29e97 100644
>>> --- a/drivers/gpu/drm/drm_framebuffer.c
>>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>>> @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
>>>          r->height = fb->height;
>>>          r->width = fb->width;
>>>          r->depth = fb->format->depth;
>>> -       r->bpp = fb->format->cpp[0] * 8;
>>> +       r->bpp = fb->format->bpp[0];
>>>          r->pitch = fb->pitches[0];
>>>
>>>          /* GET_FB() is an unprivileged ioctl so we must not return a
>>> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
>>> index 306d1ef..021358d 100644
>>> --- a/include/drm/drm_fourcc.h
>>> +++ b/include/drm/drm_fourcc.h
>>> @@ -73,12 +73,12 @@ struct drm_format_info {
>>>                  /**
>>>                   * @cpp:
>>>                   *
>>> -                * Number of bytes per pixel (per plane), this is 
>>> aliased with
>>> +                * Number of bits per pixel (per plane), this is 
>>> aliased with
>>>                   * @char_per_block. It is deprecated in favour of 
>>> using the
>>>                   * triplet @char_per_block, @block_w, @block_h for 
>>> better
>>>                   * describing the pixel format.
>>>                   */
>>> -               u8 cpp[3];
>>> +               u8 bpp[3];
>>>
>>>                  /**
>>>                   * @char_per_block:
>>> diff --git a/include/uapi/drm/drm_fourcc.h 
>>> b/include/uapi/drm/drm_fourcc.h
>>> index 3feeaa3..5fe89e9 100644
>>> --- a/include/uapi/drm/drm_fourcc.h
>>> +++ b/include/uapi/drm/drm_fourcc.h
>>> @@ -266,6 +266,21 @@ extern "C" {
>>>   #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', 
>>> '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>>
>>>   /*
>>> + * 2 plane YCbCr 10bit
>>> + * index 0 = Y plane, [9:0] Y
>>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>>> + * or
>>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
>>> + */
>>> +
>>> +#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 
>>> 2x2 subsampled Cr:Cb plane */
>>> +#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 
>>> 2x2 subsampled Cb:Cr plane */
>>> +#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 
>>> 2x1 subsampled Cr:Cb plane */
>>> +#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 
>>> 2x1 subsampled Cb:Cr plane */
>>> +#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* 
>>> non-subsampled Cr:Cb plane */
>>> +#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* 
>>> non-subsampled Cb:Cr plane */
>>> +
>>> +/*
>>>    * 3 plane YCbCr
>>>    * index 0: Y plane, [7:0] Y
>>>    * index 1: Cb plane, [7:0] Cb
>>> -- 
>>> 2.7.4
>>>
>>>
>>>
>>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-24  6:46     ` sandy.huang
  2019-09-24  7:00         ` sandy.huang
@ 2019-09-24 10:12       ` Ayan Halder
  2019-09-25  8:09           ` sandy.huang
  2019-09-25 11:23       ` Daniel Vetter
  2 siblings, 1 reply; 27+ messages in thread
From: Ayan Halder @ 2019-09-24 10:12 UTC (permalink / raw)
  To: sandy.huang
  Cc: Maxime Ripard, Linux Kernel Mailing List, dri-devel,
	David Airlie, nd, Sean Paul

On Tue, Sep 24, 2019 at 02:46:09PM +0800, sandy.huang wrote:

Hi Sandy,
> 
> 在 2019/9/23 下午9:06, Daniel Vetter 写道:
> >On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
> >>The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
> >>10bit YUV format, here have some problem.
> >>So we change cpp to bpp, use unit BitPerPlane to describe the data
> >>format.
> >>
> >>Signed-off-by: Sandy Huang <hjc@rock-chips.com>
> >Whatever the layout you have for these (it's not really defined in
> >your patch here down to the level of detail we want) I think this
> >should be described with the block_h/w and char_per_block
> >functionality. Not by extending the legacy and depcrecated cpp
> >somehow.
> >-Daniel
> 
> Hi Daniel,
> 
> It seems the char_per_block and block_h/w can't describing the following
> data format:
> 
> /*
>  * 2x2 subsampled Cr:Cb plane 10 bits per channel
>  * index 0 = Y plane, [9:0]
>  * index 1 = Cr:Cb plane, [19:0] Cr:x:Cb:x [19:0]
>  */
In that case, you can follow the same route which we took for
describing formats like DRM_FORMAT_VUY101010, DRM_FORMAT_YUV420_8BIT,
DRM_FORMAT_YUV420_10BIT ie define cpp as {0, 0, 0} and in your
vendor driver have a function similar to malidp_format_get_bpp().

It does not look nice to me to change all the formats described
in cpp to bpp for just one vendor specific format.

Thanks,
Ayan

> >>---
> >>  drivers/gpu/drm/drm_client.c        |   4 +-
> >>  drivers/gpu/drm/drm_fb_helper.c     |   8 +-
> >>  drivers/gpu/drm/drm_format_helper.c |   4 +-
> >>  drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
> >>  drivers/gpu/drm/drm_framebuffer.c   |   2 +-
> >>  include/drm/drm_fourcc.h            |   4 +-
> >>  include/uapi/drm/drm_fourcc.h       |  15 ++++
> >>  7 files changed, 115 insertions(+), 94 deletions(-)
> >>
> >>diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
> >>index d9a2e36..a36ffbe 100644
> >>--- a/drivers/gpu/drm/drm_client.c
> >>+++ b/drivers/gpu/drm/drm_client.c
> >>@@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
> >>
> >>         dumb_args.width = width;
> >>         dumb_args.height = height;
> >>-       dumb_args.bpp = info->cpp[0] * 8;
> >>+       dumb_args.bpp = info->bpp[0];
> >>         ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
> >>         if (ret)
> >>                 goto err_delete;
> >>@@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
> >>         int ret;
> >>
> >>         info = drm_format_info(format);
> >>-       fb_req.bpp = info->cpp[0] * 8;
> >>+       fb_req.bpp = info->bpp[0];
> >>         fb_req.depth = info->depth;
> >>         fb_req.width = width;
> >>         fb_req.height = height;
> >>diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> >>index a7ba5b4..b30e782 100644
> >>--- a/drivers/gpu/drm/drm_fb_helper.c
> >>+++ b/drivers/gpu/drm/drm_fb_helper.c
> >>@@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
> >>                                           struct drm_clip_rect *clip)
> >>  {
> >>         struct drm_framebuffer *fb = fb_helper->fb;
> >>-       unsigned int cpp = fb->format->cpp[0];
> >>+       unsigned int cpp = fb->format->bpp[0] / 8;
> >>         size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
> >>         void *src = fb_helper->fbdev->screen_buffer + offset;
> >>         void *dst = fb_helper->buffer->vaddr + offset;
> >>@@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
> >>          * Changes struct fb_var_screeninfo are currently not pushed back
> >>          * to KMS, hence fail if different settings are requested.
> >>          */
> >>-       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
> >>+       if (var->bits_per_pixel != fb->format->bpp[0] ||
> >>             var->xres > fb->width || var->yres > fb->height ||
> >>             var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
> >>                 DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
> >>                           "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
> >>                           var->xres, var->yres, var->bits_per_pixel,
> >>                           var->xres_virtual, var->yres_virtual,
> >>-                         fb->width, fb->height, fb->format->cpp[0] * 8);
> >>+                         fb->width, fb->height, fb->format->bpp[0]);
> >>                 return -EINVAL;
> >>         }
> >>
> >>@@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
> >>         info->pseudo_palette = fb_helper->pseudo_palette;
> >>         info->var.xres_virtual = fb->width;
> >>         info->var.yres_virtual = fb->height;
> >>-       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
> >>+       info->var.bits_per_pixel = fb->format->bpp[0];
> >>         info->var.accel_flags = FB_ACCELF_TEXT;
> >>         info->var.xoffset = 0;
> >>         info->var.yoffset = 0;
> >>diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
> >>index 0897cb9..eea3afb 100644
> >>--- a/drivers/gpu/drm/drm_format_helper.c
> >>+++ b/drivers/gpu/drm/drm_format_helper.c
> >>@@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
> >>  void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
> >>                    struct drm_rect *clip)
> >>  {
> >>-       unsigned int cpp = fb->format->cpp[0];
> >>+       unsigned int cpp = fb->format->bpp[0] / 8;
> >>         size_t len = (clip->x2 - clip->x1) * cpp;
> >>         unsigned int y, lines = clip->y2 - clip->y1;
> >>
> >>@@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
> >>                            struct drm_framebuffer *fb,
> >>                            struct drm_rect *clip)
> >>  {
> >>-       unsigned int cpp = fb->format->cpp[0];
> >>+       unsigned int cpp = fb->format->bpp[0] / 8;
> >>         unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
> >>         size_t len = (clip->x2 - clip->x1) * cpp;
> >>         unsigned int y, lines = clip->y2 - clip->y1;
> >>diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> >>index c630064..071dc07 100644
> >>--- a/drivers/gpu/drm/drm_fourcc.c
> >>+++ b/drivers/gpu/drm/drm_fourcc.c
> >>@@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>-               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>-               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>-               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_C8,              .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >>+               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >>+               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >>+               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >>                 { .format = DRM_FORMAT_Y0L0,            .depth = 0,  .num_planes = 1,
> >>                   .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
> >>                   .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
> >>diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> >>index 0b72468..7b29e97 100644
> >>--- a/drivers/gpu/drm/drm_framebuffer.c
> >>+++ b/drivers/gpu/drm/drm_framebuffer.c
> >>@@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
> >>         r->height = fb->height;
> >>         r->width = fb->width;
> >>         r->depth = fb->format->depth;
> >>-       r->bpp = fb->format->cpp[0] * 8;
> >>+       r->bpp = fb->format->bpp[0];
> >>         r->pitch = fb->pitches[0];
> >>
> >>         /* GET_FB() is an unprivileged ioctl so we must not return a
> >>diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> >>index 306d1ef..021358d 100644
> >>--- a/include/drm/drm_fourcc.h
> >>+++ b/include/drm/drm_fourcc.h
> >>@@ -73,12 +73,12 @@ struct drm_format_info {
> >>                 /**
> >>                  * @cpp:
> >>                  *
> >>-                * Number of bytes per pixel (per plane), this is aliased with
> >>+                * Number of bits per pixel (per plane), this is aliased with
> >>                  * @char_per_block. It is deprecated in favour of using the
> >>                  * triplet @char_per_block, @block_w, @block_h for better
> >>                  * describing the pixel format.
> >>                  */
> >>-               u8 cpp[3];
> >>+               u8 bpp[3];
> >>
> >>                 /**
> >>                  * @char_per_block:
> >>diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> >>index 3feeaa3..5fe89e9 100644
> >>--- a/include/uapi/drm/drm_fourcc.h
> >>+++ b/include/uapi/drm/drm_fourcc.h
> >>@@ -266,6 +266,21 @@ extern "C" {
> >>  #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
> >>
> >>  /*
> >>+ * 2 plane YCbCr 10bit
> >>+ * index 0 = Y plane, [9:0] Y
> >>+ * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
> >>+ * or
> >>+ * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
> >>+ */
> >>+
> >>+#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
> >>+#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
> >>+#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
> >>+#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
> >>+#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
> >>+#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
> >>+
> >>+/*
> >>   * 3 plane YCbCr
> >>   * index 0: Y plane, [7:0] Y
> >>   * index 1: Cb plane, [7:0] Cb
> >>--
> >>2.7.4
> >>
> >>
> >>
> >
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-24 10:12       ` Ayan Halder
@ 2019-09-25  8:09           ` sandy.huang
  0 siblings, 0 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-25  8:09 UTC (permalink / raw)
  To: Ayan Halder
  Cc: Daniel Vetter, Maxime Ripard, Linux Kernel Mailing List,
	dri-devel, David Airlie, Sean Paul, nd


在 2019/9/24 下午6:12, Ayan Halder 写道:
> On Tue, Sep 24, 2019 at 02:46:09PM +0800, sandy.huang wrote:
>
> Hi Sandy,
>> 在 2019/9/23 下午9:06, Daniel Vetter 写道:
>>> On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
>>>> The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
>>>> 10bit YUV format, here have some problem.
>>>> So we change cpp to bpp, use unit BitPerPlane to describe the data
>>>> format.
>>>>
>>>> Signed-off-by: Sandy Huang <hjc@rock-chips.com>
>>> Whatever the layout you have for these (it's not really defined in
>>> your patch here down to the level of detail we want) I think this
>>> should be described with the block_h/w and char_per_block
>>> functionality. Not by extending the legacy and depcrecated cpp
>>> somehow.
>>> -Daniel
>> Hi Daniel,
>>
>> It seems the char_per_block and block_h/w can't describing the following
>> data format:
>>
>> /*
>>   * 2x2 subsampled Cr:Cb plane 10 bits per channel
>>   * index 0 = Y plane, [9:0]
>>   * index 1 = Cr:Cb plane, [19:0] Cr:x:Cb:x [19:0]
>>   */
> In that case, you can follow the same route which we took for
> describing formats like DRM_FORMAT_VUY101010, DRM_FORMAT_YUV420_8BIT,
> DRM_FORMAT_YUV420_10BIT ie define cpp as {0, 0, 0} and in your
> vendor driver have a function similar to malidp_format_get_bpp().
>
> It does not look nice to me to change all the formats described
> in cpp to bpp for just one vendor specific format.
>
> Thanks,
> Ayan

Hi Ayan and Daniel.

     thanks for your suggestion, i have send new pathes for rockchip 
10bit yuv format support.

>
>>>> ---
>>>>   drivers/gpu/drm/drm_client.c        |   4 +-
>>>>   drivers/gpu/drm/drm_fb_helper.c     |   8 +-
>>>>   drivers/gpu/drm/drm_format_helper.c |   4 +-
>>>>   drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
>>>>   drivers/gpu/drm/drm_framebuffer.c   |   2 +-
>>>>   include/drm/drm_fourcc.h            |   4 +-
>>>>   include/uapi/drm/drm_fourcc.h       |  15 ++++
>>>>   7 files changed, 115 insertions(+), 94 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
>>>> index d9a2e36..a36ffbe 100644
>>>> --- a/drivers/gpu/drm/drm_client.c
>>>> +++ b/drivers/gpu/drm/drm_client.c
>>>> @@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
>>>>
>>>>          dumb_args.width = width;
>>>>          dumb_args.height = height;
>>>> -       dumb_args.bpp = info->cpp[0] * 8;
>>>> +       dumb_args.bpp = info->bpp[0];
>>>>          ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
>>>>          if (ret)
>>>>                  goto err_delete;
>>>> @@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
>>>>          int ret;
>>>>
>>>>          info = drm_format_info(format);
>>>> -       fb_req.bpp = info->cpp[0] * 8;
>>>> +       fb_req.bpp = info->bpp[0];
>>>>          fb_req.depth = info->depth;
>>>>          fb_req.width = width;
>>>>          fb_req.height = height;
>>>> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
>>>> index a7ba5b4..b30e782 100644
>>>> --- a/drivers/gpu/drm/drm_fb_helper.c
>>>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>>>> @@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
>>>>                                            struct drm_clip_rect *clip)
>>>>   {
>>>>          struct drm_framebuffer *fb = fb_helper->fb;
>>>> -       unsigned int cpp = fb->format->cpp[0];
>>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>>          size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
>>>>          void *src = fb_helper->fbdev->screen_buffer + offset;
>>>>          void *dst = fb_helper->buffer->vaddr + offset;
>>>> @@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
>>>>           * Changes struct fb_var_screeninfo are currently not pushed back
>>>>           * to KMS, hence fail if different settings are requested.
>>>>           */
>>>> -       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
>>>> +       if (var->bits_per_pixel != fb->format->bpp[0] ||
>>>>              var->xres > fb->width || var->yres > fb->height ||
>>>>              var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
>>>>                  DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
>>>>                            "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
>>>>                            var->xres, var->yres, var->bits_per_pixel,
>>>>                            var->xres_virtual, var->yres_virtual,
>>>> -                         fb->width, fb->height, fb->format->cpp[0] * 8);
>>>> +                         fb->width, fb->height, fb->format->bpp[0]);
>>>>                  return -EINVAL;
>>>>          }
>>>>
>>>> @@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
>>>>          info->pseudo_palette = fb_helper->pseudo_palette;
>>>>          info->var.xres_virtual = fb->width;
>>>>          info->var.yres_virtual = fb->height;
>>>> -       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
>>>> +       info->var.bits_per_pixel = fb->format->bpp[0];
>>>>          info->var.accel_flags = FB_ACCELF_TEXT;
>>>>          info->var.xoffset = 0;
>>>>          info->var.yoffset = 0;
>>>> diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
>>>> index 0897cb9..eea3afb 100644
>>>> --- a/drivers/gpu/drm/drm_format_helper.c
>>>> +++ b/drivers/gpu/drm/drm_format_helper.c
>>>> @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
>>>>   void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
>>>>                     struct drm_rect *clip)
>>>>   {
>>>> -       unsigned int cpp = fb->format->cpp[0];
>>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>>>
>>>> @@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
>>>>                             struct drm_framebuffer *fb,
>>>>                             struct drm_rect *clip)
>>>>   {
>>>> -       unsigned int cpp = fb->format->cpp[0];
>>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>>          unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
>>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>>>> index c630064..071dc07 100644
>>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>>> @@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_C8,              .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>>                  { .format = DRM_FORMAT_Y0L0,            .depth = 0,  .num_planes = 1,
>>>>                    .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
>>>>                    .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
>>>> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
>>>> index 0b72468..7b29e97 100644
>>>> --- a/drivers/gpu/drm/drm_framebuffer.c
>>>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>>>> @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
>>>>          r->height = fb->height;
>>>>          r->width = fb->width;
>>>>          r->depth = fb->format->depth;
>>>> -       r->bpp = fb->format->cpp[0] * 8;
>>>> +       r->bpp = fb->format->bpp[0];
>>>>          r->pitch = fb->pitches[0];
>>>>
>>>>          /* GET_FB() is an unprivileged ioctl so we must not return a
>>>> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
>>>> index 306d1ef..021358d 100644
>>>> --- a/include/drm/drm_fourcc.h
>>>> +++ b/include/drm/drm_fourcc.h
>>>> @@ -73,12 +73,12 @@ struct drm_format_info {
>>>>                  /**
>>>>                   * @cpp:
>>>>                   *
>>>> -                * Number of bytes per pixel (per plane), this is aliased with
>>>> +                * Number of bits per pixel (per plane), this is aliased with
>>>>                   * @char_per_block. It is deprecated in favour of using the
>>>>                   * triplet @char_per_block, @block_w, @block_h for better
>>>>                   * describing the pixel format.
>>>>                   */
>>>> -               u8 cpp[3];
>>>> +               u8 bpp[3];
>>>>
>>>>                  /**
>>>>                   * @char_per_block:
>>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>>> index 3feeaa3..5fe89e9 100644
>>>> --- a/include/uapi/drm/drm_fourcc.h
>>>> +++ b/include/uapi/drm/drm_fourcc.h
>>>> @@ -266,6 +266,21 @@ extern "C" {
>>>>   #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>>>
>>>>   /*
>>>> + * 2 plane YCbCr 10bit
>>>> + * index 0 = Y plane, [9:0] Y
>>>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>>>> + * or
>>>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
>>>> + */
>>>> +
>>>> +#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
>>>> +#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
>>>> +#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
>>>> +
>>>> +/*
>>>>    * 3 plane YCbCr
>>>>    * index 0: Y plane, [7:0] Y
>>>>    * index 1: Cb plane, [7:0] Cb
>>>> --
>>>> 2.7.4
>>>>
>>>>
>>>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
@ 2019-09-25  8:09           ` sandy.huang
  0 siblings, 0 replies; 27+ messages in thread
From: sandy.huang @ 2019-09-25  8:09 UTC (permalink / raw)
  To: Ayan Halder
  Cc: Maxime Ripard, Linux Kernel Mailing List, dri-devel,
	David Airlie, nd, Sean Paul


在 2019/9/24 下午6:12, Ayan Halder 写道:
> On Tue, Sep 24, 2019 at 02:46:09PM +0800, sandy.huang wrote:
>
> Hi Sandy,
>> 在 2019/9/23 下午9:06, Daniel Vetter 写道:
>>> On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
>>>> The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
>>>> 10bit YUV format, here have some problem.
>>>> So we change cpp to bpp, use unit BitPerPlane to describe the data
>>>> format.
>>>>
>>>> Signed-off-by: Sandy Huang <hjc@rock-chips.com>
>>> Whatever the layout you have for these (it's not really defined in
>>> your patch here down to the level of detail we want) I think this
>>> should be described with the block_h/w and char_per_block
>>> functionality. Not by extending the legacy and depcrecated cpp
>>> somehow.
>>> -Daniel
>> Hi Daniel,
>>
>> It seems the char_per_block and block_h/w can't describing the following
>> data format:
>>
>> /*
>>   * 2x2 subsampled Cr:Cb plane 10 bits per channel
>>   * index 0 = Y plane, [9:0]
>>   * index 1 = Cr:Cb plane, [19:0] Cr:x:Cb:x [19:0]
>>   */
> In that case, you can follow the same route which we took for
> describing formats like DRM_FORMAT_VUY101010, DRM_FORMAT_YUV420_8BIT,
> DRM_FORMAT_YUV420_10BIT ie define cpp as {0, 0, 0} and in your
> vendor driver have a function similar to malidp_format_get_bpp().
>
> It does not look nice to me to change all the formats described
> in cpp to bpp for just one vendor specific format.
>
> Thanks,
> Ayan

Hi Ayan and Daniel.

     thanks for your suggestion, i have send new pathes for rockchip 
10bit yuv format support.

>
>>>> ---
>>>>   drivers/gpu/drm/drm_client.c        |   4 +-
>>>>   drivers/gpu/drm/drm_fb_helper.c     |   8 +-
>>>>   drivers/gpu/drm/drm_format_helper.c |   4 +-
>>>>   drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
>>>>   drivers/gpu/drm/drm_framebuffer.c   |   2 +-
>>>>   include/drm/drm_fourcc.h            |   4 +-
>>>>   include/uapi/drm/drm_fourcc.h       |  15 ++++
>>>>   7 files changed, 115 insertions(+), 94 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
>>>> index d9a2e36..a36ffbe 100644
>>>> --- a/drivers/gpu/drm/drm_client.c
>>>> +++ b/drivers/gpu/drm/drm_client.c
>>>> @@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
>>>>
>>>>          dumb_args.width = width;
>>>>          dumb_args.height = height;
>>>> -       dumb_args.bpp = info->cpp[0] * 8;
>>>> +       dumb_args.bpp = info->bpp[0];
>>>>          ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
>>>>          if (ret)
>>>>                  goto err_delete;
>>>> @@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
>>>>          int ret;
>>>>
>>>>          info = drm_format_info(format);
>>>> -       fb_req.bpp = info->cpp[0] * 8;
>>>> +       fb_req.bpp = info->bpp[0];
>>>>          fb_req.depth = info->depth;
>>>>          fb_req.width = width;
>>>>          fb_req.height = height;
>>>> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
>>>> index a7ba5b4..b30e782 100644
>>>> --- a/drivers/gpu/drm/drm_fb_helper.c
>>>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>>>> @@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
>>>>                                            struct drm_clip_rect *clip)
>>>>   {
>>>>          struct drm_framebuffer *fb = fb_helper->fb;
>>>> -       unsigned int cpp = fb->format->cpp[0];
>>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>>          size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
>>>>          void *src = fb_helper->fbdev->screen_buffer + offset;
>>>>          void *dst = fb_helper->buffer->vaddr + offset;
>>>> @@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
>>>>           * Changes struct fb_var_screeninfo are currently not pushed back
>>>>           * to KMS, hence fail if different settings are requested.
>>>>           */
>>>> -       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
>>>> +       if (var->bits_per_pixel != fb->format->bpp[0] ||
>>>>              var->xres > fb->width || var->yres > fb->height ||
>>>>              var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
>>>>                  DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
>>>>                            "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
>>>>                            var->xres, var->yres, var->bits_per_pixel,
>>>>                            var->xres_virtual, var->yres_virtual,
>>>> -                         fb->width, fb->height, fb->format->cpp[0] * 8);
>>>> +                         fb->width, fb->height, fb->format->bpp[0]);
>>>>                  return -EINVAL;
>>>>          }
>>>>
>>>> @@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
>>>>          info->pseudo_palette = fb_helper->pseudo_palette;
>>>>          info->var.xres_virtual = fb->width;
>>>>          info->var.yres_virtual = fb->height;
>>>> -       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
>>>> +       info->var.bits_per_pixel = fb->format->bpp[0];
>>>>          info->var.accel_flags = FB_ACCELF_TEXT;
>>>>          info->var.xoffset = 0;
>>>>          info->var.yoffset = 0;
>>>> diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
>>>> index 0897cb9..eea3afb 100644
>>>> --- a/drivers/gpu/drm/drm_format_helper.c
>>>> +++ b/drivers/gpu/drm/drm_format_helper.c
>>>> @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
>>>>   void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
>>>>                     struct drm_rect *clip)
>>>>   {
>>>> -       unsigned int cpp = fb->format->cpp[0];
>>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>>>
>>>> @@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
>>>>                             struct drm_framebuffer *fb,
>>>>                             struct drm_rect *clip)
>>>>   {
>>>> -       unsigned int cpp = fb->format->cpp[0];
>>>> +       unsigned int cpp = fb->format->bpp[0] / 8;
>>>>          unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
>>>>          size_t len = (clip->x2 - clip->x1) * cpp;
>>>>          unsigned int y, lines = clip->y2 - clip->y1;
>>>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>>>> index c630064..071dc07 100644
>>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>>> @@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> -               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> -               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> -               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_C8,              .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
>>>> +               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
>>>> +               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>> +               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
>>>>                  { .format = DRM_FORMAT_Y0L0,            .depth = 0,  .num_planes = 1,
>>>>                    .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
>>>>                    .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
>>>> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
>>>> index 0b72468..7b29e97 100644
>>>> --- a/drivers/gpu/drm/drm_framebuffer.c
>>>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>>>> @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
>>>>          r->height = fb->height;
>>>>          r->width = fb->width;
>>>>          r->depth = fb->format->depth;
>>>> -       r->bpp = fb->format->cpp[0] * 8;
>>>> +       r->bpp = fb->format->bpp[0];
>>>>          r->pitch = fb->pitches[0];
>>>>
>>>>          /* GET_FB() is an unprivileged ioctl so we must not return a
>>>> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
>>>> index 306d1ef..021358d 100644
>>>> --- a/include/drm/drm_fourcc.h
>>>> +++ b/include/drm/drm_fourcc.h
>>>> @@ -73,12 +73,12 @@ struct drm_format_info {
>>>>                  /**
>>>>                   * @cpp:
>>>>                   *
>>>> -                * Number of bytes per pixel (per plane), this is aliased with
>>>> +                * Number of bits per pixel (per plane), this is aliased with
>>>>                   * @char_per_block. It is deprecated in favour of using the
>>>>                   * triplet @char_per_block, @block_w, @block_h for better
>>>>                   * describing the pixel format.
>>>>                   */
>>>> -               u8 cpp[3];
>>>> +               u8 bpp[3];
>>>>
>>>>                  /**
>>>>                   * @char_per_block:
>>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>>> index 3feeaa3..5fe89e9 100644
>>>> --- a/include/uapi/drm/drm_fourcc.h
>>>> +++ b/include/uapi/drm/drm_fourcc.h
>>>> @@ -266,6 +266,21 @@ extern "C" {
>>>>   #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
>>>>
>>>>   /*
>>>> + * 2 plane YCbCr 10bit
>>>> + * index 0 = Y plane, [9:0] Y
>>>> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
>>>> + * or
>>>> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
>>>> + */
>>>> +
>>>> +#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
>>>> +#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
>>>> +#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
>>>> +#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
>>>> +
>>>> +/*
>>>>    * 3 plane YCbCr
>>>>    * index 0: Y plane, [7:0] Y
>>>>    * index 1: Cb plane, [7:0] Cb
>>>> --
>>>> 2.7.4
>>>>
>>>>
>>>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support
  2019-09-24  6:46     ` sandy.huang
  2019-09-24  7:00         ` sandy.huang
  2019-09-24 10:12       ` Ayan Halder
@ 2019-09-25 11:23       ` Daniel Vetter
  2 siblings, 0 replies; 27+ messages in thread
From: Daniel Vetter @ 2019-09-25 11:23 UTC (permalink / raw)
  To: sandy.huang
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Linux Kernel Mailing List

On Tue, Sep 24, 2019 at 8:46 AM sandy.huang <hjc@rock-chips.com> wrote:
>
>
> 在 2019/9/23 下午9:06, Daniel Vetter 写道:
> > On Mon, Sep 23, 2019 at 2:40 PM Sandy Huang <hjc@rock-chips.com> wrote:
> >> The drm_format_info.cpp[3] unit is BytePerPlane, when we add define
> >> 10bit YUV format, here have some problem.
> >> So we change cpp to bpp, use unit BitPerPlane to describe the data
> >> format.
> >>
> >> Signed-off-by: Sandy Huang <hjc@rock-chips.com>
> > Whatever the layout you have for these (it's not really defined in
> > your patch here down to the level of detail we want) I think this
> > should be described with the block_h/w and char_per_block
> > functionality. Not by extending the legacy and depcrecated cpp
> > somehow.
> > -Daniel
>
> Hi Daniel,
>
> It seems the char_per_block and block_h/w can't describing the following
> data format:
>
> /*
>   * 2x2 subsampled Cr:Cb plane 10 bits per channel
>   * index 0 = Y plane, [9:0]
>   * index 1 = Cr:Cb plane, [19:0] Cr:x:Cb:x [19:0]
>   */

We can't allocate individual bits, buffers are always at least byte
aligned. And once you have that, you can actually do that.

Or maybe this is a lot more funnier format, which has aven
non-byte-aligned strides. Which would be rather surprising.

Anyway either needs a lot more comments, or just need to use the
infrastructure we have already. E.g. for your case: 4 pixels with 10
bits each gives you 5*8 = 40 bits of 5 bytes. So you very much can
describe this format accurately with the block layout stuff, with a
block size of 4 pixels wide and 1 pixel height and a byte size per
block of 5 bytes. Similar for the others.
-Daniel

>
> >> ---
> >>   drivers/gpu/drm/drm_client.c        |   4 +-
> >>   drivers/gpu/drm/drm_fb_helper.c     |   8 +-
> >>   drivers/gpu/drm/drm_format_helper.c |   4 +-
> >>   drivers/gpu/drm/drm_fourcc.c        | 172 +++++++++++++++++++-----------------
> >>   drivers/gpu/drm/drm_framebuffer.c   |   2 +-
> >>   include/drm/drm_fourcc.h            |   4 +-
> >>   include/uapi/drm/drm_fourcc.h       |  15 ++++
> >>   7 files changed, 115 insertions(+), 94 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
> >> index d9a2e36..a36ffbe 100644
> >> --- a/drivers/gpu/drm/drm_client.c
> >> +++ b/drivers/gpu/drm/drm_client.c
> >> @@ -263,7 +263,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
> >>
> >>          dumb_args.width = width;
> >>          dumb_args.height = height;
> >> -       dumb_args.bpp = info->cpp[0] * 8;
> >> +       dumb_args.bpp = info->bpp[0];
> >>          ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
> >>          if (ret)
> >>                  goto err_delete;
> >> @@ -366,7 +366,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
> >>          int ret;
> >>
> >>          info = drm_format_info(format);
> >> -       fb_req.bpp = info->cpp[0] * 8;
> >> +       fb_req.bpp = info->bpp[0];
> >>          fb_req.depth = info->depth;
> >>          fb_req.width = width;
> >>          fb_req.height = height;
> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> >> index a7ba5b4..b30e782 100644
> >> --- a/drivers/gpu/drm/drm_fb_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> >> @@ -382,7 +382,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
> >>                                            struct drm_clip_rect *clip)
> >>   {
> >>          struct drm_framebuffer *fb = fb_helper->fb;
> >> -       unsigned int cpp = fb->format->cpp[0];
> >> +       unsigned int cpp = fb->format->bpp[0] / 8;
> >>          size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
> >>          void *src = fb_helper->fbdev->screen_buffer + offset;
> >>          void *dst = fb_helper->buffer->vaddr + offset;
> >> @@ -1320,14 +1320,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
> >>           * Changes struct fb_var_screeninfo are currently not pushed back
> >>           * to KMS, hence fail if different settings are requested.
> >>           */
> >> -       if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
> >> +       if (var->bits_per_pixel != fb->format->bpp[0] ||
> >>              var->xres > fb->width || var->yres > fb->height ||
> >>              var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
> >>                  DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
> >>                            "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
> >>                            var->xres, var->yres, var->bits_per_pixel,
> >>                            var->xres_virtual, var->yres_virtual,
> >> -                         fb->width, fb->height, fb->format->cpp[0] * 8);
> >> +                         fb->width, fb->height, fb->format->bpp[0]);
> >>                  return -EINVAL;
> >>          }
> >>
> >> @@ -1678,7 +1678,7 @@ static void drm_fb_helper_fill_var(struct fb_info *info,
> >>          info->pseudo_palette = fb_helper->pseudo_palette;
> >>          info->var.xres_virtual = fb->width;
> >>          info->var.yres_virtual = fb->height;
> >> -       info->var.bits_per_pixel = fb->format->cpp[0] * 8;
> >> +       info->var.bits_per_pixel = fb->format->bpp[0];
> >>          info->var.accel_flags = FB_ACCELF_TEXT;
> >>          info->var.xoffset = 0;
> >>          info->var.yoffset = 0;
> >> diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
> >> index 0897cb9..eea3afb 100644
> >> --- a/drivers/gpu/drm/drm_format_helper.c
> >> +++ b/drivers/gpu/drm/drm_format_helper.c
> >> @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip,
> >>   void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
> >>                     struct drm_rect *clip)
> >>   {
> >> -       unsigned int cpp = fb->format->cpp[0];
> >> +       unsigned int cpp = fb->format->bpp[0] / 8;
> >>          size_t len = (clip->x2 - clip->x1) * cpp;
> >>          unsigned int y, lines = clip->y2 - clip->y1;
> >>
> >> @@ -63,7 +63,7 @@ void drm_fb_memcpy_dstclip(void __iomem *dst, void *vaddr,
> >>                             struct drm_framebuffer *fb,
> >>                             struct drm_rect *clip)
> >>   {
> >> -       unsigned int cpp = fb->format->cpp[0];
> >> +       unsigned int cpp = fb->format->bpp[0] / 8;
> >>          unsigned int offset = clip_offset(clip, fb->pitches[0], cpp);
> >>          size_t len = (clip->x2 - clip->x1) * cpp;
> >>          unsigned int y, lines = clip->y2 - clip->y1;
> >> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> >> index c630064..071dc07 100644
> >> --- a/drivers/gpu/drm/drm_fourcc.c
> >> +++ b/drivers/gpu/drm/drm_fourcc.c
> >> @@ -157,89 +157,95 @@ 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 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> -               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> -               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> -               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_C8,              .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_RGB332,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_BGR233,          .depth = 8,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_XRGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_XBGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_RGBX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_BGRX4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_ARGB4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_ABGR4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_RGBA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_BGRA4444,        .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_XRGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_XBGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_RGBX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_BGRX5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_ARGB1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_ABGR1555,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_RGBA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_BGRA5551,        .depth = 15, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_RGB565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_BGR565,          .depth = 16, .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_RGB888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_BGR888,          .depth = 24, .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_XRGB8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_XBGR8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_RGBX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_BGRX8888,        .depth = 24, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_RGB565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_BGR565_A8,       .depth = 24, .num_planes = 2, .cpp = { 16, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_XRGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_XBGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_RGBX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_BGRX1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_ARGB2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_ABGR2101010,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_RGBA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_BGRA1010102,     .depth = 30, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_ARGB8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_ABGR8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_RGBA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_BGRA8888,        .depth = 32, .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_XRGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_XBGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1 },
> >> +               { .format = DRM_FORMAT_ARGB16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_ABGR16161616F,   .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_RGB888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_BGR888_A8,       .depth = 32, .num_planes = 2, .cpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_XRGB8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_XBGR8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_RGBX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_BGRX8888_A8,     .depth = 32, .num_planes = 2, .cpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
> >> +               { .format = DRM_FORMAT_YUV410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YVU410,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 4, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YUV411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YVU411,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 4, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YUV420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YVU420,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 2, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YUV422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YVU422,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YUV444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YVU444,          .depth = 0,  .num_planes = 3, .cpp = { 8, 8, 8 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV12,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV21,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV16,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV61,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV24,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV42,            .depth = 0,  .num_planes = 2, .cpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV12_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV21_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV16_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV61_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV24_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_NV42_10,         .depth = 0,  .num_planes = 2, .cpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YUYV,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_YVYU,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_UYVY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_VYUY,            .depth = 0,  .num_planes = 1, .cpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_XYUV8888,        .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_VUY888,          .depth = 0,  .num_planes = 1, .cpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_AYUV,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_Y210,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_Y212,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_Y216,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_Y410,            .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_Y412,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_Y416,            .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_XVYU2101010,     .depth = 0,  .num_planes = 1, .cpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_XVYU12_16161616, .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >> +               { .format = DRM_FORMAT_XVYU16161616,    .depth = 0,  .num_planes = 1, .cpp = { 8, 0, 0 },  .hsub = 1, .vsub = 1, .is_yuv = true },
> >>                  { .format = DRM_FORMAT_Y0L0,            .depth = 0,  .num_planes = 1,
> >>                    .char_per_block = { 8, 0, 0 }, .block_w = { 2, 0, 0 }, .block_h = { 2, 0, 0 },
> >>                    .hsub = 2, .vsub = 2, .has_alpha = true, .is_yuv = true },
> >> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> >> index 0b72468..7b29e97 100644
> >> --- a/drivers/gpu/drm/drm_framebuffer.c
> >> +++ b/drivers/gpu/drm/drm_framebuffer.c
> >> @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev,
> >>          r->height = fb->height;
> >>          r->width = fb->width;
> >>          r->depth = fb->format->depth;
> >> -       r->bpp = fb->format->cpp[0] * 8;
> >> +       r->bpp = fb->format->bpp[0];
> >>          r->pitch = fb->pitches[0];
> >>
> >>          /* GET_FB() is an unprivileged ioctl so we must not return a
> >> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> >> index 306d1ef..021358d 100644
> >> --- a/include/drm/drm_fourcc.h
> >> +++ b/include/drm/drm_fourcc.h
> >> @@ -73,12 +73,12 @@ struct drm_format_info {
> >>                  /**
> >>                   * @cpp:
> >>                   *
> >> -                * Number of bytes per pixel (per plane), this is aliased with
> >> +                * Number of bits per pixel (per plane), this is aliased with
> >>                   * @char_per_block. It is deprecated in favour of using the
> >>                   * triplet @char_per_block, @block_w, @block_h for better
> >>                   * describing the pixel format.
> >>                   */
> >> -               u8 cpp[3];
> >> +               u8 bpp[3];
> >>
> >>                  /**
> >>                   * @char_per_block:
> >> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> >> index 3feeaa3..5fe89e9 100644
> >> --- a/include/uapi/drm/drm_fourcc.h
> >> +++ b/include/uapi/drm/drm_fourcc.h
> >> @@ -266,6 +266,21 @@ extern "C" {
> >>   #define DRM_FORMAT_P016                fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
> >>
> >>   /*
> >> + * 2 plane YCbCr 10bit
> >> + * index 0 = Y plane, [9:0] Y
> >> + * index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
> >> + * or
> >> + * index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
> >> + */
> >> +
> >> +#define DRM_FORMAT_NV12_10     fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV21_10     fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
> >> +#define DRM_FORMAT_NV16_10     fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV61_10     fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
> >> +#define DRM_FORMAT_NV24_10     fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
> >> +#define DRM_FORMAT_NV42_10     fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
> >> +
> >> +/*
> >>    * 3 plane YCbCr
> >>    * index 0: Y plane, [7:0] Y
> >>    * index 1: Cb plane, [7:0] Cb
> >> --
> >> 2.7.4
> >>
> >>
> >>
> >
>
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2019-09-25 11:24 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 12:38 [PATCH 00/36] Add support 10bit yuv format Sandy Huang
2019-09-23 12:38 ` Sandy Huang
2019-09-23 12:38 ` [PATCH 01/36] drm/fourcc: Add 2 plane YCbCr 10bit format support Sandy Huang
2019-09-23 12:38   ` Sandy Huang
2019-09-23 12:53   ` Ville Syrjälä
2019-09-23 13:05     ` sandy.huang
2019-09-23 13:05       ` sandy.huang
2019-09-23 18:30       ` Ville Syrjälä
2019-09-23 18:30         ` Ville Syrjälä
2019-09-24  6:47         ` sandy.huang
2019-09-23 13:06   ` Daniel Vetter
2019-09-24  6:46     ` sandy.huang
2019-09-24  7:00       ` sandy.huang
2019-09-24  7:00         ` sandy.huang
2019-09-24 10:12       ` Ayan Halder
2019-09-25  8:09         ` sandy.huang
2019-09-25  8:09           ` sandy.huang
2019-09-25 11:23       ` Daniel Vetter
2019-09-23 12:38 ` [PATCH 02/36] drm/rockchip: use bpp instead of cpp for drm_format_info Sandy Huang
2019-09-23 12:38   ` Sandy Huang
2019-09-23 12:38   ` Sandy Huang
2019-09-23 12:38 ` [PATCH 03/36] drm/i915: " Sandy Huang
2019-09-23 12:38 ` [PATCH 04/36] drm: exynos: " Sandy Huang
2019-09-23 12:38   ` Sandy Huang
2019-09-23 12:38   ` Sandy Huang
2019-09-23 13:03 ` [PATCH 00/36] Add support 10bit yuv format Daniel Vetter
2019-09-23 13:03   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.