Skip to contentSkip to conversation

Add some yuv 10bit support

PATCH In review Sandy Huang 5 participants 21 messages Sep 26, 2019 – Nov 8, 2019

Subsystems (4)
lore
Share & tools
lore

Sandy Huang

author maintainer
#0 lore raw

v2 cover Add some yuv 10bit support

These series patches is to add some new format supported by some rockchip socs, include:
RK3288/RK3228/RK3328/RK3368/RK3399

these new format layout as following rule:
2 plane YCbCr
index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10 or
index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

v2:
1. add describe for new format;
2. use block formats to describe new format;

Sandy Huang (3):
drm: Add some new format DRM_FORMAT_NVXX_10 drm/rockchip: Add rockchip_vop_get_offset to get offset drm/rockchip: Add support 10bit yuv format

 drivers/gpu/drm/drm_fourcc.c                | 18 +++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 77 +++++++++++++++++++++++++----
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h |  1 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c |  2 +
 include/uapi/drm/drm_fourcc.h               | 14 ++++++
 5 files changed, 103 insertions(+), 9 deletions(-)
Signature · 8 lines
2.7.4



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#1 lore raw

PATCH v2 1/3 drm: Add some new format DRM_FORMAT_NVXX_10

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
 drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
 include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
 2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +18 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
 		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
 		{ .format = DRM_FORMAT_P210,		.depth = 0,
 		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
 		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,
include/uapi/drm/drm_fourcc.h +14 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
 #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
 /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10
+ */
+#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 */
+
+/*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
  * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
Signature · 1 line
2.7.4
#2 lore raw

Re: [v2,1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 17 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
 drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
 include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
 2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +0 -0
index c630064..ccd78a3 100644

drivers/gpu/drm/drm_fourcc.c const struct drm_format_info *__drm_format_info(u32 format) · line 265

Quoted 5 lines
drivers/gpu/drm/drm_fourcc.c +2 -0
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
 		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },

Hi Sandy:

Their is a problem here for char_per_block size of plane[0]:

Since: 5 * 8 != 4 * 4 * 10;

Seems you mis-set the block_w/h, per your block size the block is 2x2, and it should be:

.char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2, 2, 0 },

Best Regards:
James

Quoted 34 lines
drivers/gpu/drm/drm_fourcc.c +16 -0
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
 		{ .format = DRM_FORMAT_P210,		.depth = 0,
 		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
 		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,
include/uapi/drm/drm_fourcc.h +7 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
 #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
 /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10
+ */
+#define DRM_FORMAT_NV12_10	fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */

include/uapi/drm/drm_fourcc.h extern "C" { · line 257

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +7 -0
+#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 */
+
+/*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
  * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

In reply to Sandy Huang
Quoted 46 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
 drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
 include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
 2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +18 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
 		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
 		{ .format = DRM_FORMAT_P210,		.depth = 0,
 		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
 		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644

include/uapi/drm/drm_fourcc.h extern "C" { · line 245

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +5 -0
@@ -238,6 +238,20 @@ extern "C" {
 #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
 /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

Quoted 21 lines
include/uapi/drm/drm_fourcc.h +9 -0
+ */
+#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 */
+
+/*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
  * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
Signature · 8 lines
2.7.4



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel
author maintainer
#4 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Hi ville syrjala,

Quoted 60 lines · Ville Syrjälä
Quoted 46 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
  drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
  include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
  2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +18 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
  		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
  		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
  		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
  		{ .format = DRM_FORMAT_P210,		.depth = 0,
  		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
  		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644

include/uapi/drm/drm_fourcc.h extern "C" { · line 245

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +5 -0
@@ -238,6 +238,20 @@ extern "C" {
  #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
  /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
 * 2 plane YCbCr
 * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10  little endian
 * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10  little endian
 * or
 * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10  little endian */

Is this description ok?

Quoted 17 lines
Quoted 17 lines
include/uapi/drm/drm_fourcc.h +9 -0
+ */
+#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 */
+
+/*
   * 2 plane YCbCr MSB aligned
   * index 0 = Y plane, [15:0] Y:x [10:6] little endian
   * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
Signature · 1 line
2.7.4
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 77 lines · sandy.huang

Hi ville syrjala,

Quoted 60 lines · Ville Syrjälä
Quoted 46 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
  drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
  include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
  2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +18 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
  		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
  		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
  		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
  		{ .format = DRM_FORMAT_P210,		.depth = 0,
  		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
  		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644

include/uapi/drm/drm_fourcc.h extern "C" { · line 245

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +5 -0
@@ -238,6 +238,20 @@ extern "C" {
  #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
  /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
 * 2 plane YCbCr
 * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10  little endian
 * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
 * or
 * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
 */

Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

Quoted 23 lines
Quoted 22 lines
Quoted 22 lines
include/uapi/drm/drm_fourcc.h +9 -0
+ */
+#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 */
+
+/*
   * 2 plane YCbCr MSB aligned
   * index 0 = Y plane, [15:0] Y:x [10:6] little endian
   * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
Signature · 8 lines
2.7.4



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel
author maintainer
#6 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 78 lines · Ville Syrjälä
Quoted 77 lines · sandy.huang

Hi ville syrjala,

Quoted 60 lines · Ville Syrjälä
Quoted 46 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
   drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
   include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
   2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +18 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
   		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
   		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
   		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
   		{ .format = DRM_FORMAT_P210,		.depth = 0,
   		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
   		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644

include/uapi/drm/drm_fourcc.h extern "C" { · line 245

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +5 -0
@@ -238,6 +238,20 @@ extern "C" {
   #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
   /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
 * 2 plane YCbCr
 * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10  little endian
 * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
 * or
 * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
 */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
include/uapi/drm/drm_fourcc.h +9 -0
+ */
+#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 */
+
+/*
    * 2 plane YCbCr MSB aligned
    * index 0 = Y plane, [15:0] Y:x [10:6] little endian
    * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
Signature · 1 line
2.7.4
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#7 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

        { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 14 lines
Quoted 5 lines

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes = 2, +          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and it should be:
  .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2, 2, 0 },

Best Regards:
James

Quoted 129 lines · sandy.huang
Quoted 92 lines · Ville Syrjälä
Quoted 91 lines · sandy.huang

Hi ville syrjala,

Quoted 74 lines · Ville Syrjälä
Quoted 64 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
   drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++

   2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +4 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info 
 *__drm_format_info(u32 format)
            { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes = 2,
              .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
              .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  
 .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, 
 .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  

.num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +3 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
    #define DRM_FORMAT_NV42        fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
       /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 
Quoted 4 lines

10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*

    * 2 plane YCbCr MSB aligned
    * index 0 = Y plane, [15:0] Y:x [10:6] little endian
    * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines

        { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)

Then:

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Thanks
James

Quoted 49 lines

          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h = { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line

            .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines

            .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line

  .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 149 lines
Quoted 147 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
   drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++

   2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +0 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)

           { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes = 2,
             .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
             .hsub = 2, .vsub = 2, .is_yuv = true}, +        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true}, +        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true}, +        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true}, +        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true}, +        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true}, +        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true}, { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
    #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*

    * 2 plane YCbCr MSB aligned
    * index 0 = Y plane, [15:0] Y:x [10:6] little endian
    * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#9 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 24 lines · james qian wang (Arm Technology China)
Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from
you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this
format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines

        { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)
Quoted 6 lines

Then:

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Thanks
James

Hi James,

If the block_w is 2 pixel, one line size at block is 2*10 bit %8 != 0,  although we use block to describe this format, but actually the data is still stored one line by one line, still need 4 pixel aligned. so i think here need use 4pixel*2line for per block,

Thanks,

sandy.huang.

Quoted 186 lines
Quoted 186 lines

          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line

            .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines

            .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line

  .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 136 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
    drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
    include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
    2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +1 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)
            { .format = DRM_FORMAT_P016,        .depth =
 0,  .num_planes = 2,
              .char_per_block = { 2, 4, 0 }, .block_w = {
 1, 0, 0 }, .block_h = { 1, 0, 0 },
              .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth =

0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0,
0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
    #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*
     * 2 plane YCbCr MSB aligned
     * index 0 = Y plane, [15:0] Y:x [10:6] little endian
     * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x

[10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 28 lines · sandy.huang
Quoted 26 lines · james qian wang (Arm Technology China)
Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from
you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this
format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines

        { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)

Then:

Quoted 8 lines
Quoted 4 lines

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Thanks
James

Hi James,

If the block_w is 2 pixel, one line size at block is 2*10 bit %8 != 0,

Hi Sandy:
you got a mistake here, the bpp of UV plane is 20, 10bit Cb + 10 bit Cr.

Quoted 3 lines

although we use block to describe this format, but actually the data is still stored one line by one line, still need 4 pixel aligned. so i think here need use 4pixel*2line for per block

I think this is your hardware specific requirement.

Thanks
James

Quoted 201 lines

Thanks,

sandy.huang.

Quoted 195 lines
Quoted 195 lines

          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line

            .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines

            .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line

  .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 145 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
    drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
    include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
    2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +1 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)
            { .format = DRM_FORMAT_P016,        .depth =
 0,  .num_planes = 2,
              .char_per_block = { 2, 4, 0 }, .block_w = {
 1, 0, 0 }, .block_h = { 1, 0, 0 },
              .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth =

0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0,
0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
    #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*
     * 2 plane YCbCr MSB aligned
     * index 0 = Y plane, [15:0] Y:x [10:6] little endian
     * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x

[10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#11 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 30 lines · james qian wang (Arm Technology China)
Quoted 29 lines · sandy.huang
Quoted 28 lines · james qian wang (Arm Technology China)
Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from
you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this
format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines

        { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)

Then:

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Thanks
James

Hi James,

If the block_w is 2 pixel, one line size at block is 2*10 bit %8 != 0,

Hi Sandy:
you got a mistake here, the bpp of UV plane is 20, 10bit Cb + 10 bit Cr.

here is for y plane.

Quoted 7 lines
Quoted 3 lines

although we use block to describe this format, but actually the data is still stored one line by one line, still need 4 pixel aligned. so i think here need use 4pixel*2line for per block

I think this is your hardware specific requirement.

Thanks
James

yes, this is a new format first used at rockchip platform.

Thanks,

sandy.huang

Quoted 188 lines
Quoted 188 lines

Thanks,

sandy.huang.

Quoted 184 lines
Quoted 184 lines

          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line

            .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines

            .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line

  .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 136 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
     drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
     include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
     2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +1 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)
             { .format = DRM_FORMAT_P016,        .depth =
 0,  .num_planes = 2,
               .char_per_block = { 2, 4, 0 }, .block_w = {
 1, 0, 0 }, .block_h = { 1, 0, 0 },
               .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth =

0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0,
0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
     #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*
      * 2 plane YCbCr MSB aligned
      * index 0 = Y plane, [15:0] Y:x [10:6] little endian
      * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x

[10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 32 lines · sandy.huang
Quoted 30 lines · james qian wang (Arm Technology China)
Quoted 29 lines · sandy.huang
Quoted 28 lines · james qian wang (Arm Technology China)
Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from
you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this
format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines

        { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)

Then:

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Thanks
James

Hi James,

If the block_w is 2 pixel, one line size at block is 2*10 bit %8 != 0,

Hi Sandy:
you got a mistake here, the bpp of UV plane is 20, 10bit Cb + 10 bit Cr.

here is for y plane.

Sorry, Are we talking about the block size calcaltion here ?

block_size = block_w * block_h * plane_bpp

for you Y plane a 2x2 block is: 2 x 2 * 10 bpp = 40bits

And the block info is for computing the minimum pitch, and don't consider the specific hardware alignment here.

see: drm_format_info_min_pitch()

If you hardware need alignment, you need to put that consideration into your specific driver.

James.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

although we use block to describe this format, but actually the data is still stored one line by one line, still need 4 pixel aligned. so i think here need use 4pixel*2line for per block

I think this is your hardware specific requirement.

Thanks
James

Quoted 204 lines

yes, this is a new format first used at rockchip platform.

Thanks,

sandy.huang

Quoted 196 lines
Quoted 196 lines

Thanks,

sandy.huang.

Quoted 192 lines
Quoted 192 lines

          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line

            .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines

            .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line

  .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 144 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
     drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
     include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
     2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +1 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)
             { .format = DRM_FORMAT_P016,        .depth =
 0,  .num_planes = 2,
               .char_per_block = { 2, 4, 0 }, .block_w = {
 1, 0, 0 }, .block_h = { 1, 0, 0 },
               .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth =

0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0,
0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
     #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*
      * 2 plane YCbCr MSB aligned
      * index 0 = Y plane, [15:0] Y:x [10:6] little endian
      * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x

[10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#13 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Hi, james, ville syrjala, david,

Quoted 49 lines · james qian wang (Arm Technology China)
Quoted 31 lines · sandy.huang
Quoted 30 lines · james qian wang (Arm Technology China)
Quoted 29 lines · sandy.huang
Quoted 28 lines · james qian wang (Arm Technology China)
Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from
you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this
format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines
           { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2,
             .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h

= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)

Then:

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Thanks
James

Hi James,

If the block_w is 2 pixel, one line size at block is 2*10 bit %8 != 0,

Hi Sandy:
you got a mistake here, the bpp of UV plane is 20, 10bit Cb + 10 bit Cr.

here is for y plane.

Sorry, Are we talking about the block size calcaltion here ?

block_size = block_w * block_h * plane_bpp

for you Y plane a 2x2 block is: 2 x 2 * 10 bpp = 40bits

And the block info is for computing the minimum pitch, and don't consider the specific hardware alignment here.

Quoted 6 lines

see: drm_format_info_min_pitch()

If you hardware need alignment, you need to put that consideration into your specific driver.

James.

Hi david and ville syrjala,

    Do you have any Suggestions?

    James think Y plane 2x2 block size is enough to describe this format, but i prefer to use 4x2 block size, this can include the alignment message.

just like the malidp_de_plane_check()@malidp_plane.c have the following  code, here use the block size to check alignment.

    block_w = drm_format_info_block_width(fb->format, 0);
    block_h = drm_format_info_block_height(fb->format, 0);
    if (fb->width % block_w || fb->height % block_h) { DRM_DEBUG_KMS("Buffer width/height needs to be a multiple of tile sizes"); return -EINVAL;
    }
    if ((state->src_x >> 16) % block_w || (state->src_y >> 16) % block_h) { DRM_DEBUG_KMS("Plane src_x/src_y needs to be a multiple of tile sizes"); return -EINVAL;
    }

can you give me some suggestions?

thanks,

sandy.huang

Quoted 202 lines
Quoted 202 lines
Quoted 8 lines
Quoted 4 lines

although we use block to describe this format, but actually the data is still stored one line by one line, still need 4 pixel aligned. so i think here need use 4pixel*2line for per block

I think this is your hardware specific requirement.

Thanks
James

yes, this is a new format first used at rockchip platform.

Thanks,

sandy.huang

Quoted 187 lines
Quoted 187 lines

Thanks,

sandy.huang.

Quoted 183 lines
Quoted 183 lines
             .hsub = 2, .vsub = 2, .is_yuv = true},
           { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2,
             .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h

= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line
               .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines
               .hsub = 2, .vsub = 2, .is_yuv = true},

+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line
     .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 136 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
      drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
      include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
      2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +1 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)
              { .format = DRM_FORMAT_P016,        .depth =
 0,  .num_planes = 2,
                .char_per_block = { 2, 4, 0 }, .block_w = {
 1, 0, 0 }, .block_h = { 1, 0, 0 },
                .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth =

0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0,
0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
      #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*
       * 2 plane YCbCr MSB aligned
       * index 0 = Y plane, [15:0] Y:x [10:6] little endian
       * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x

[10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#14 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 82 lines · sandy.huang

Hi, james, ville syrjala, david,

Quoted 49 lines · james qian wang (Arm Technology China)
Quoted 31 lines · sandy.huang
Quoted 30 lines · james qian wang (Arm Technology China)
Quoted 29 lines · sandy.huang
Quoted 28 lines · james qian wang (Arm Technology China)
Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from
you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this
format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines
           { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2,
             .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h

= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)

Then:

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Thanks
James

Hi James,

If the block_w is 2 pixel, one line size at block is 2*10 bit %8 != 0,

Hi Sandy:
you got a mistake here, the bpp of UV plane is 20, 10bit Cb + 10 bit Cr.

here is for y plane.

Sorry, Are we talking about the block size calcaltion here ?

block_size = block_w * block_h * plane_bpp

for you Y plane a 2x2 block is: 2 x 2 * 10 bpp = 40bits

And the block info is for computing the minimum pitch, and don't consider the specific hardware alignment here.

Quoted 6 lines

see: drm_format_info_min_pitch()

If you hardware need alignment, you need to put that consideration into your specific driver.

James.

Hi david and ville syrjala,

    Do you have any Suggestions?

    James think Y plane 2x2 block size is enough to describe this format, but i prefer to use 4x2 block size, this can include the alignment message.

just like the malidp_de_plane_check()@malidp_plane.c have the following code, here use the block size to check alignment.

    block_w = drm_format_info_block_width(fb->format, 0); block_h = drm_format_info_block_height(fb->format, 0);
    if (fb->width % block_w || fb->height % block_h) { DRM_DEBUG_KMS("Buffer width/height needs to be a multiple of tile sizes");
        return -EINVAL;
    }
    if ((state->src_x >> 16) % block_w || (state->src_y >> 16) % block_h) { DRM_DEBUG_KMS("Plane src_x/src_y needs to be a multiple of tile sizes");
        return -EINVAL;
    }

Quoted 5 lines

can you give me some suggestions?

thanks,

sandy.huang

Well, you think I'm trying to spite you.

but the alignment 4 for NV12-10bpp do have risk, please consider the existing code:

framebuffer_check()

{
        ...
	for (i = 0; i < info->num_planes; i++) {
		unsigned int width = fb_plane_width(r->width, info, i);
		unsigned int height = fb_plane_height(r->height, info, i);
		unsigned int block_size = info->char_per_block[i];
		u64 min_pitch = drm_format_info_min_pitch(info, i, width);

                ...

                /* NOTE NOTE:
                 * this check may failed for NV12-10 if someone's alignment lower
                 * that 4 */

		if (block_size && r->pitches[i] < min_pitch) {
			DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i);
			return -EINVAL;
		}

}

james

Quoted 202 lines
Quoted 202 lines
Quoted 202 lines
Quoted 8 lines
Quoted 4 lines

although we use block to describe this format, but actually the data is still stored one line by one line, still need 4 pixel aligned. so i think here need use 4pixel*2line for per block

I think this is your hardware specific requirement.

Thanks
James

yes, this is a new format first used at rockchip platform.

Thanks,

sandy.huang

Quoted 187 lines
Quoted 187 lines

Thanks,

sandy.huang.

Quoted 183 lines
Quoted 183 lines
             .hsub = 2, .vsub = 2, .is_yuv = true},
           { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2,
             .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h

= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line
               .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines
               .hsub = 2, .vsub = 2, .is_yuv = true},

+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line
     .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 136 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
      drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
      include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
      2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +1 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)
              { .format = DRM_FORMAT_P016,        .depth =
 0,  .num_planes = 2,
                .char_per_block = { 2, 4, 0 }, .block_w = {
 1, 0, 0 }, .block_h = { 1, 0, 0 },
                .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth =

0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0,
0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
      #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*
       * 2 plane YCbCr MSB aligned
       * index 0 = Y plane, [15:0] Y:x [10:6] little endian
       * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x

[10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#15 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

In reply to sandy.huang
Quoted 82 lines · sandy.huang

Hi, james, ville syrjala, david,

Quoted 49 lines · james qian wang (Arm Technology China)
Quoted 31 lines · sandy.huang
Quoted 30 lines · james qian wang (Arm Technology China)
Quoted 29 lines · sandy.huang
Quoted 28 lines · james qian wang (Arm Technology China)
Quoted 12 lines · sandy.huang

Hi james.qian.wang,

    Thank for you remind, fou some unknow reason, i miss the the mail from
you:(, i get this message from https://patchwork.kernel.org/patch/11161937/

sorry about that.

    About the format block describe, I also found some unreasonable,  this
format need 2 line aligned, so the block_h need to sed as 2, and the char_per_block need set as w * h * 10 for y plane, and w * h * 2 * 10 for uv plane, so the following describe maybe more correct, thanks.

Quoted 4 lines
           { .format = DRM_FORMAT_NV12_10,        .depth = 0, .num_planes = 2,
             .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h

= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},

Hi Sandy:
I think for such NV12 YUV-422 (hsub = 2, vsub = 2) 2x2 subsampled format the block size can be:

the Y plane:  2x2;
The UV plane: 1x2; (H direction sample 1 Cb and 1Cr, V direction 2 lines got 2)

Then:

.char_per_block = {5, 5, 0} block_w = {2, 1, 0}. block_h = {2, 2, 0};

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Thanks
James

Hi James,

If the block_w is 2 pixel, one line size at block is 2*10 bit %8 != 0,

Hi Sandy:
you got a mistake here, the bpp of UV plane is 20, 10bit Cb + 10 bit Cr.

here is for y plane.

Sorry, Are we talking about the block size calcaltion here ?

block_size = block_w * block_h * plane_bpp

for you Y plane a 2x2 block is: 2 x 2 * 10 bpp = 40bits

And the block info is for computing the minimum pitch, and don't consider the specific hardware alignment here.

Quoted 6 lines

see: drm_format_info_min_pitch()

If you hardware need alignment, you need to put that consideration into your specific driver.

James.

Hi david and ville syrjala,

    Do you have any Suggestions?

    James think Y plane 2x2 block size is enough to describe this format, but i prefer to use 4x2 block size, this can include the alignment message.

just like the malidp_de_plane_check()@malidp_plane.c have the following code, here use the block size to check alignment.

    block_w = drm_format_info_block_width(fb->format, 0); block_h = drm_format_info_block_height(fb->format, 0);
    if (fb->width % block_w || fb->height % block_h) { DRM_DEBUG_KMS("Buffer width/height needs to be a multiple of tile sizes");
        return -EINVAL;
    }
    if ((state->src_x >> 16) % block_w || (state->src_y >> 16) % block_h) { DRM_DEBUG_KMS("Plane src_x/src_y needs to be a multiple of tile sizes");
        return -EINVAL;
    }

Quoted 1 line

can you give me some suggestions?

For the linear layout (i.e. modifier == 0) the blocks are meant to be laid out one after the other, linearly, in memory. If you have some additional hw alignment constraint then that should be checked in the driver.

If you have some tiling on top, then that should be encoded in a different modifier (which can then set its own block sizes, and have its own rules for how they're laid out in memory).

Taking this all together I think what we want here is a 1x4 Y block and a 1x2 UV block size in pixels. The sub-sampling is expressed in hsub/vsub for the UV plane, we don't align the block-sizes two 2 rows to encode that (see all the other yuv planar formats for examples).
-Daniel

Quoted 221 lines

thanks,

sandy.huang

Quoted 202 lines
Quoted 202 lines
Quoted 8 lines
Quoted 4 lines

although we use block to describe this format, but actually the data is still stored one line by one line, still need 4 pixel aligned. so i think here need use 4pixel*2line for per block

I think this is your hardware specific requirement.

Thanks
James

yes, this is a new format first used at rockchip platform.

Thanks,

sandy.huang

Quoted 187 lines
Quoted 187 lines

Thanks,

sandy.huang.

Quoted 183 lines
Quoted 183 lines
             .hsub = 2, .vsub = 2, .is_yuv = true},
           { .format = DRM_FORMAT_NV21_10,        .depth = 0, .num_planes = 2,
             .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h

= { 2, 2, 0 },
          .hsub = 2, .vsub = 2, .is_yuv = true},
        { .format = DRM_FORMAT_NV16_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV61_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 2, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV24_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},
        { .format = DRM_FORMAT_NV42_10,        .depth = 0, .num_planes = 2, .char_per_block = { 10, 10, 0 }, .block_w = { 4, 2, 0 }, .block_h
= { 2, 2, 0 },
          .hsub = 1, .vsub = 1, .is_yuv = true},

Quoted 1 line
Quoted 1 line

          { .format = DRM_FORMAT_P016,        .depth = 0,  .num_planes =

2,

Quoted 1 line
Quoted 1 line
               .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 },

.block_h = { 1, 0, 0 },

Quoted 2 lines
Quoted 2 lines
               .hsub = 2, .vsub = 2, .is_yuv = true},

+        { .format = DRM_FORMAT_NV12_10,        .depth = 0,  .num_planes

= 2,

Quoted 1 line
Quoted 1 line

+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 },

.block_h = { 4, 4, 0 },

Quoted 4 lines

Hi Sandy:
Their is a problem here for char_per_block size of plane[0]:
Since: 5 * 8 != 4 * 4 * 10;
Seems you mis-set the block_w/h, per your block size the block is 2x2, and

it should be:

Quoted 1 line
     .char_per_block = { 5, 10, 0 }, .block_w = { 2, 2, 0 }, .block_h = { 2,

2, 0 },

Quoted 2 lines

Best Regards:
James

Quoted 136 lines · sandy.huang
Quoted 98 lines · Ville Syrjälä
Quoted 97 lines · sandy.huang

Hi ville syrjala,

Quoted 80 lines · Ville Syrjälä
Quoted 66 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
      drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
      include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
      2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +1 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info
 *__drm_format_info(u32 format)
              { .format = DRM_FORMAT_P016,        .depth =
 0,  .num_planes = 2,
                .char_per_block = { 2, 4, 0 }, .block_w = {
 1, 0, 0 }, .block_h = { 1, 0, 0 },
                .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV12_10,        .depth =

0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV21_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 2, .is_yuv = true},
+        { .format = DRM_FORMAT_NV16_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV61_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 2, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV24_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
+        { .format = DRM_FORMAT_NV42_10,        .depth = 0,  .num_planes = 2,
+          .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+          .hsub = 1, .vsub = 1, .is_yuv = true},
           { .format = DRM_FORMAT_P210,        .depth = 0, .num_planes = 2, .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0,
0 }, .hsub = 2,

include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
      #define DRM_FORMAT_NV42        fourcc_code('N', 'V',

'4', '2') /* non-subsampled Cb:Cr plane */

Quoted 8 lines

      /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10

So now you're defining it as some kind of byte aligned block. With that specifying endianness would now make sense since otherwise this tells us absolutely nothing about the memory layout.

Quoted 4 lines

So I'd either do that, or go back to not specifying anything and use some weasel words like "mamory layout is implementation defined" which of course means no one can use it for anything that involves any kind of cross vendor stuff.

/*
   * 2 plane YCbCr
   * index 0 = Y plane, [39: 0] Y3:Y2:Y1:Y0 10:10:10:10 little endian
   * index 1 = Cb:Cr plane, [79: 0] Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0
10:10:10:10:10:10:10:10  little endian
   * or
   * index 1 = Cr:Cb plane, [79: 0] Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0
10:10:10:10:10:10:10:10  little endian
   */

Quoted 6 lines
Quoted 1 line

Is this description ok?

Seems OK to me, if it actually describes the format correctly.

Though I'm not sure why the CbCr is defines as an 80bit block and Y has a 40bit block. 40bits should be enough for CbCr as well.

well, this is taken into account yuv444,  4 y point corresponding with 4 uv point.

if only describes the layout memory, here can change to 40bit block.

thanks.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

+ */
+#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 */

include/uapi/drm/drm_fourcc.h +2 -0
+
+/*
       * 2 plane YCbCr MSB aligned
       * index 0 = Y plane, [15:0] Y:x [10:6] little endian
       * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x

[10:6:10:6] little endian

Signature · 1 line
2.7.4
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

In reply to Sandy Huang
Quoted 31 lines · Sandy Huang

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
 drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
 include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
 2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
 		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },

drivers/gpu/drm/drm_fourcc.c const struct drm_format_info *__drm_format_info(u32 format) · line 284

Quoted 10 lines
drivers/gpu/drm/drm_fourcc.c +7 -0
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
 		{ .format = DRM_FORMAT_P210,		.depth = 0,
 		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
 		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,

Yup this is what I had in mind with using the block stuff to describe your new 10bit yuv formats. Thanks for respining.

Once we've nailed the exact bit description of the format precisely this can be merged imo.
-Daniel

Quoted 30 lines
include/uapi/drm/drm_fourcc.h +14 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
 #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
 /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10
+ */
+#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 */
+
+/*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
  * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#17 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Hi Daniel, Sandy,

Am Mittwoch, 9. Oktober 2019, 16:50:08 CET schrieb Daniel Vetter:

Quoted 46 lines · Sandy Huang
Quoted 31 lines

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
 drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
 include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
 2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
 		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },

drivers/gpu/drm/drm_fourcc.c const struct drm_format_info *__drm_format_info(u32 format) · line 284

Quoted 10 lines
drivers/gpu/drm/drm_fourcc.c +7 -0
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
 		{ .format = DRM_FORMAT_P210,		.depth = 0,
 		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
 		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,

Yup this is what I had in mind with using the block stuff to describe your new 10bit yuv formats. Thanks for respining.

Quoted 2 lines

Once we've nailed the exact bit description of the format precisely this can be merged imo.

I just saw this series still sitting in my inbox, so was wondering about the "once we've nailed the exact bit description..." and what is missing for that.

Thanks
Heiko

Quoted 17 lines
Quoted 17 lines
include/uapi/drm/drm_fourcc.h +9 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
 #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
 /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10
+ */
+#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 */
Quoted 10 lines

include/uapi/drm/drm_fourcc.h extern "C" { · line 257

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +5 -0
+#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 */
+
+/*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
  * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#18 lore raw

Re: [PATCH v2 1/3] drm: Add some new format DRM_FORMAT_NVXX_10

Quoted 49 lines · Heiko Stübner

Hi Daniel, Sandy,

Am Mittwoch, 9. Oktober 2019, 16:50:08 CET schrieb Daniel Vetter:

Quoted 46 lines · Sandy Huang
Quoted 31 lines

These new format is supported by some rockchip socs:

DRM_FORMAT_NV12_10/DRM_FORMAT_NV21_10
DRM_FORMAT_NV16_10/DRM_FORMAT_NV61_10
DRM_FORMAT_NV24_10/DRM_FORMAT_NV42_10

---
 drivers/gpu/drm/drm_fourcc.c  | 18 ++++++++++++++++++
 include/uapi/drm/drm_fourcc.h | 14 ++++++++++++++
 2 files changed, 32 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index c630064..ccd78a3 100644
@@ -261,6 +261,24 @@ const struct drm_format_info *__drm_format_info(u32 format)
 		{ .format = DRM_FORMAT_P016,		.depth = 0,  .num_planes = 2,
 		  .char_per_block = { 2, 4, 0 }, .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 },
 		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV12_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV21_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 2, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV16_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV61_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },

drivers/gpu/drm/drm_fourcc.c const struct drm_format_info *__drm_format_info(u32 format) · line 284

Quoted 10 lines
drivers/gpu/drm/drm_fourcc.c +7 -0
+		  .hsub = 2, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV24_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
+		{ .format = DRM_FORMAT_NV42_10,		.depth = 0,  .num_planes = 2,
+		  .char_per_block = { 5, 10, 0 }, .block_w = { 4, 4, 0 }, .block_h = { 4, 4, 0 },
+		  .hsub = 1, .vsub = 1, .is_yuv = true},
 		{ .format = DRM_FORMAT_P210,		.depth = 0,
 		  .num_planes = 2, .char_per_block = { 2, 4, 0 },
 		  .block_w = { 1, 0, 0 }, .block_h = { 1, 0, 0 }, .hsub = 2,

Yup this is what I had in mind with using the block stuff to describe your new 10bit yuv formats. Thanks for respining.

Quoted 5 lines
Quoted 2 lines

Once we've nailed the exact bit description of the format precisely this can be merged imo.

I just saw this series still sitting in my inbox, so was wondering about the "once we've nailed the exact bit description..." and what is missing for that.

Since my name is on this mail ... what I meant here is that in principle I'm ok, but someone else needs to check that we've documented all the details properly. And once that review is done they or you can also merge it. From my side not going to dig more into this, we have tons of reviewers/committers.
-Daniel

Quoted 36 lines

Thanks
Heiko

Quoted 27 lines
Quoted 25 lines
include/uapi/drm/drm_fourcc.h +14 -0
index 3feeaa3..08e2221 100644
@@ -238,6 +238,20 @@ extern "C" {
 #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
 /*
+ * 2 plane YCbCr
+ * index 0 = Y plane, Y3:Y2:Y1:Y0 10:10:10:10
+ * index 1 = Cb:Cr plane, Cb3:Cr3:Cb2:Cr2:Cb1:Cr1:Cb0:Cr0 10:10:10:10:10:10:10:10
+ * or
+ * index 1 = Cr:Cb plane, Cr3:Cb3:Cr2:Cb2:Cr1:Cb1:Cr0:Cb0 10:10:10:10:10:10:10:10
+ */
+#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 */
+
+/*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
  * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#19 lore raw

PATCH v2 2/3 drm/rockchip: Add rockchip_vop_get_offset to get offset

In reply to Sandy Huang

Add rockchip_vop_get_offset to get offset, this can compatible legacy and block_h/w format describe.

---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 61 ++++++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 9 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +52 -9
index 2f821c5..ce74218 100644
@@ -249,6 +249,56 @@ static bool has_rb_swapped(uint32_t format)
 	}
 }
 
+static u32 rockchip_vop_get_offset(struct drm_plane_state *state, u8 plane)
+{
+	const struct drm_format_info *info;
+	struct drm_rect *src = &state->src;
+	struct drm_framebuffer *fb = state->fb;
+	u32 format = fb->format->format;
+	u8 h_div = 1, v_div = 1;
+	u32 block_w, block_h, block_size, block_start_y, num_hblocks;
+	u32 sample_x, sample_y;
+	u32 offset;
+
+	info = drm_format_info(format);
+	if (!info || plane >= info->num_planes)
+		return 0;
+
+	if (plane > 0) {
+		h_div = fb->format->hsub;
+		v_div = fb->format->vsub;
+	}
+
+	switch (format) {
+	case DRM_FORMAT_NV12_10:
+	case DRM_FORMAT_NV21_10:
+	case DRM_FORMAT_NV16_10:
+	case DRM_FORMAT_NV61_10:
+	case DRM_FORMAT_NV24_10:
+	case DRM_FORMAT_NV42_10:
+		block_w = drm_format_info_block_width(fb->format, plane);
+		block_h = drm_format_info_block_height(fb->format, plane);
+		block_size = fb->format->char_per_block[plane];
+
+		sample_x = (src->x1 >> 16) / h_div;
+		sample_y = (src->y1 >> 16) / v_div;
+		block_start_y = (sample_y / block_h) * block_h;
+		num_hblocks = sample_x / block_w;
+
+		offset = fb->pitches[plane] * block_start_y;
+		offset += block_size * num_hblocks;
+
+		break;
+	default:
+		offset = (src->x1 >> 16) * fb->format->cpp[plane] / h_div;
+		offset += (src->y1 >> 16) * fb->pitches[plane] / v_div;
+
+		break;
+	}
+
+	return offset;
+}
+
 static enum vop_data_format vop_convert_format(uint32_t format)
 {
 	switch (format) {
@@ -832,8 +882,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->y1 >> 16) * fb->pitches[0];
+	offset = rockchip_vop_get_offset(state, 0);
 	dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];
 
 	/*
@@ -857,16 +906,10 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 		    (state->rotation & DRM_MODE_REFLECT_X) ? 1 : 0);
 
 	if (is_yuv) {
-		int hsub = fb->format->hsub;
-		int vsub = fb->format->vsub;
-		int bpp = fb->format->cpp[1];
-
 		uv_obj = fb->obj[1];
 		rk_uv_obj = to_rockchip_obj(uv_obj);
 
-		offset = (src->x1 >> 16) * bpp / hsub;
-		offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
-
+		offset = rockchip_vop_get_offset(state, 1);
 		dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
 		VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4));
 		VOP_WIN_SET(vop, win, uv_mst, dma_addr);
Signature · 1 line
2.7.4
author maintainer
#20 lore raw

PATCH v2 3/3 drm/rockchip: Add support 10bit yuv format

In reply to Sandy Huang

Add support 10bit yuv format display for rockchip some socs, include:

    RK3288/RK3228/RK3328/RK3368/RK3399
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 16 ++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h |  1 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c |  2 ++
 3 files changed, 19 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +16 -0
index ce74218..4b87d88 100644
@@ -249,6 +249,21 @@ static bool has_rb_swapped(uint32_t format)
 	}
 }
 
+static bool is_10bit_yuv(uint32_t format)
+{
+	switch (format) {
+	case DRM_FORMAT_NV12_10:
+	case DRM_FORMAT_NV21_10:
+	case DRM_FORMAT_NV16_10:
+	case DRM_FORMAT_NV61_10:
+	case DRM_FORMAT_NV24_10:
+	case DRM_FORMAT_NV42_10:
+		return true;
+	default:
+		return false;
+	}
+}
+
 static u32 rockchip_vop_get_offset(struct drm_plane_state *state, u8 plane)
 {
 	const struct drm_format_info *info;
@@ -913,6 +928,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 		dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
 		VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4));
 		VOP_WIN_SET(vop, win, uv_mst, dma_addr);
+		VOP_WIN_SET(vop, win, fmt_10, is_10bit_yuv(fb->format->format));
 
 		for (i = 0; i < NUM_YUV2YUV_COEFFICIENTS; i++) {
 			VOP_WIN_YUV2YUV_COEFFICIENT_SET(vop,
drivers/gpu/drm/rockchip/rockchip_drm_vop.h +1 -0
index 2149a889..adc2b0b5 100644
@@ -133,6 +133,7 @@ struct vop_win_phy {
 	struct vop_reg gate;
 	struct vop_reg format;
 	struct vop_reg rb_swap;
+	struct vop_reg fmt_10;
 	struct vop_reg act_info;
 	struct vop_reg dsp_info;
 	struct vop_reg dsp_st;
drivers/gpu/drm/rockchip/rockchip_vop_reg.c +2 -0
index d1494be..732e535 100644
@@ -544,6 +544,7 @@ static const struct vop_win_phy rk3288_win01_data = {
 	.nformats = ARRAY_SIZE(formats_win_full),
 	.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
 	.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
+	.fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
 	.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
 	.act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
 	.dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0),
@@ -674,6 +675,7 @@ static const struct vop_win_phy rk3368_win01_data = {
 	.nformats = ARRAY_SIZE(formats_win_full),
 	.enable = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 0),
 	.format = VOP_REG(RK3368_WIN0_CTRL0, 0x7, 1),
+	.fmt_10 = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 4),
 	.rb_swap = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 12),
 	.x_mir_en = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 21),
 	.y_mir_en = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 22),
Signature · 8 lines
2.7.4



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel