Skip to contentSkip to conversation

Some cleanup of vop2 driver

PATCH Applied Andy Yan 4 participants 8 messages Oct 13, 2023 – Oct 18, 2023

Subsystems (4)
lore
Share & tools
lore

Andy Yan

author maintainer
#0 lore raw

v2 cover Some cleanup of vop2 driver

From: Andy Yan <[email protected]>

This is a preparation for the upcoming support for rk3588 vop. Patch 1 remove unused struct
Patch 2 remove NR_LAYERS macro to support more layers on rk3588 Patch 3 are plane format fix
Patch 4 is a format rename

Changes in v2:
- split rename to another patch

Andy Yan (4):
drm/rockchip: remove unused struct in vop2 drm/rockchip: remove NR_LAYERS macro on vop2 drm/rockchip: fix the plane format defination of rk3568/6 drm/rockchip: rename windows format for vop2

 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c |  6 +--
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h |  3 --
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 52 +++++++++++---------
 3 files changed, 30 insertions(+), 31 deletions(-)
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v2 1/4 drm/rockchip: remove unused struct in vop2

From: Andy Yan <[email protected]>

These structs are undefined and un used.

Fixes 604be85547ce ("drm/rockchip: Add VOP2 driver")

---

(no changes since v1)

 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 3 ---
 2 files changed, 5 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +0 -2
index 583df4d22f7e..3c524ca23d53 100644
@@ -160,7 +160,6 @@ struct vop2_video_port {
 	struct vop2 *vop2;
 	struct clk *dclk;
 	unsigned int id;
-	const struct vop2_video_port_regs *regs;
 	const struct vop2_video_port_data *data;
 
 	struct completion dsp_hold_completion;
@@ -2274,7 +2273,6 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 		vp = &vop2->vps[i];
 		vp->vop2 = vop2;
 		vp->id = vp_data->id;
-		vp->regs = vp_data->regs;
 		vp->data = vp_data;
 
 		snprintf(dclk_name, sizeof(dclk_name), "dclk_vp%d", vp->id);
drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +0 -3
index f1234a151130..56fd31e05238 100644
@@ -134,16 +134,13 @@ struct vop2_video_port_data {
 	u16 cubic_lut_len;
 	struct vop_rect max_output;
 	const u8 pre_scan_max_dly[4];
-	const struct vop2_video_port_regs *regs;
 	unsigned int offset;
 };
 
 struct vop2_data {
 	u8 nr_vps;
-	const struct vop2_ctrl *ctrl;
 	const struct vop2_win_data *win;
 	const struct vop2_video_port_data *vp;
-	const struct vop_csc_table *csc_table;
 	struct vop_rect max_input;
 	struct vop_rect max_output;
 
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH v2 2/4 drm/rockchip: remove NR_LAYERS macro on vop2

In reply to Andy Yan

From: Andy Yan <[email protected]>

There are 8 layers on rk3588, so a fix defined macro is not appropriate.

---

(no changes since v1)

 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +1 -3
index 3c524ca23d53..57c05c6b246c 100644
@@ -2251,8 +2251,6 @@ static struct vop2_video_port *find_vp_without_primary(struct vop2 *vop2)
 	return NULL;
 }
 
-#define NR_LAYERS 6
-
 static int vop2_create_crtcs(struct vop2 *vop2)
 {
 	const struct vop2_data *vop2_data = vop2->data;
@@ -2371,7 +2369,7 @@ static int vop2_create_crtcs(struct vop2 *vop2)
 		struct vop2_video_port *vp = &vop2->vps[i];
 
 		if (vp->crtc.port)
-			vp->nlayers = NR_LAYERS / nvps;
+			vp->nlayers = vop2_data->win_size / nvps;
 	}
 
 	return 0;
Signature · 1 line
2.34.1
author maintainer
#3 lore raw

PATCH v2 3/4 drm/rockchip: fix the plane format defination of rk3568/6

In reply to Andy Yan

From: Andy Yan <[email protected]>

Add the missing 10 bit RGB format for cluster window. The cluster windows on rk3568/6 only support afbc format, so change the linear yuv format NV12/16/24 to non-Linear YUV420_8BIT/YUV420_10BIT/YUYV/Y210.

Add NV15 for esmart windows.

Also add some comments.

---

Changes in v2:
- split rename to another patch

 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +14 -8
index 62b573f282a7..05aee588e8c9 100644
@@ -16,6 +16,10 @@
 #include "rockchip_drm_vop2.h"
 
 static const uint32_t formats_win_full_10bit[] = {
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_ARGB2101010,
+	DRM_FORMAT_XBGR2101010,
+	DRM_FORMAT_ABGR2101010,
 	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_ARGB8888,
 	DRM_FORMAT_XBGR8888,
@@ -24,9 +28,10 @@ static const uint32_t formats_win_full_10bit[] = {
 	DRM_FORMAT_BGR888,
 	DRM_FORMAT_RGB565,
 	DRM_FORMAT_BGR565,
-	DRM_FORMAT_NV12,
-	DRM_FORMAT_NV16,
-	DRM_FORMAT_NV24,
+	DRM_FORMAT_YUV420_8BIT, /* yuv420_8bit non-Linear mode only */
+	DRM_FORMAT_YUV420_10BIT, /* yuv420_10bit non-Linear mode only */
+	DRM_FORMAT_YUYV, /* yuv422_8bit non-Linear mode only*/
+	DRM_FORMAT_Y210, /* yuv422_10bit non-Linear mode only */
 };
 
 static const uint32_t formats_win_full_10bit_yuyv[] = {
@@ -38,11 +43,12 @@ static const uint32_t formats_win_full_10bit_yuyv[] = {
 	DRM_FORMAT_BGR888,
 	DRM_FORMAT_RGB565,
 	DRM_FORMAT_BGR565,
-	DRM_FORMAT_NV12,
-	DRM_FORMAT_NV16,
-	DRM_FORMAT_NV24,
-	DRM_FORMAT_YVYU,
-	DRM_FORMAT_VYUY,
+	DRM_FORMAT_NV12, /* yuv420_8bit linear mode, 2 plane */
+	DRM_FORMAT_NV15, /* yuv420_10bit linear mode, 2 plane, no padding */
+	DRM_FORMAT_NV16, /* yuv422_8bit linear mode, 2 plane */
+	DRM_FORMAT_NV24, /* yuv444_8bit linear mode, 2 plane */
+	DRM_FORMAT_YVYU, /* yuv422_8bit[YVYU] linear mode */
+	DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */
 };
 
 static const uint32_t formats_win_lite[] = {
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 3/4] drm/rockchip: fix the plane format defination of rk3568/6

Hi Andy,

Quoted 26 lines · Andy Yan

From: Andy Yan <[email protected]>

Add the missing 10 bit RGB format for cluster window. The cluster windows on rk3568/6 only support afbc format, so change the linear yuv format NV12/16/24 to non-Linear YUV420_8BIT/YUV420_10BIT/YUYV/Y210.

Add NV15 for esmart windows.

Also add some comments.

---

Changes in v2:
- split rename to another patch

 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +0 -0
index 62b573f282a7..05aee588e8c9 100644

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c line 22

Quoted 7 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +4 -0
@@ -16,6 +16,10 @@
 #include "rockchip_drm_vop2.h"
 
 static const uint32_t formats_win_full_10bit[] = {
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_ARGB2101010,
+	DRM_FORMAT_XBGR2101010,
+	DRM_FORMAT_ABGR2101010,

atomic_check() will fail for these formats due to missing support for these formats in the vop2 driver. Support for these formats should be added to vop2 driver before being exposed as a supported pixel format.

vop2_convert_format() return -EINVAL for these and below formats.

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c static const uint32_t formats_win_full_10bit[] = { · line 32

Quoted 12 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +2 -3
 	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_ARGB8888,
 	DRM_FORMAT_XBGR8888,
@@ -24,9 +28,10 @@ static const uint32_t formats_win_full_10bit[] = {
 	DRM_FORMAT_BGR888,
 	DRM_FORMAT_RGB565,
 	DRM_FORMAT_BGR565,
-	DRM_FORMAT_NV12,
-	DRM_FORMAT_NV16,
-	DRM_FORMAT_NV24,
+	DRM_FORMAT_YUV420_8BIT, /* yuv420_8bit non-Linear mode only */
+	DRM_FORMAT_YUV420_10BIT, /* yuv420_10bit non-Linear mode only */

Same for YUV420_8BIT and YUV420_10BIT.

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c static const uint32_t formats_win_full_10bit[] = { · line 34

Quoted 2 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +2 -0
+	DRM_FORMAT_YUYV, /* yuv422_8bit non-Linear mode only*/
+	DRM_FORMAT_Y210, /* yuv422_10bit non-Linear mode only */

Same for Y210.

Quoted 4 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +0 -0
 };
 
 static const uint32_t formats_win_full_10bit_yuyv[] = {

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c static const uint32_t formats_win_full_10bit_yuyv[] = { · line 47

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +2 -5
@@ -38,11 +43,12 @@ static const uint32_t formats_win_full_10bit_yuyv[] = {
 	DRM_FORMAT_BGR888,
 	DRM_FORMAT_RGB565,
 	DRM_FORMAT_BGR565,
-	DRM_FORMAT_NV12,
-	DRM_FORMAT_NV16,
-	DRM_FORMAT_NV24,
-	DRM_FORMAT_YVYU,
-	DRM_FORMAT_VYUY,
+	DRM_FORMAT_NV12, /* yuv420_8bit linear mode, 2 plane */
+	DRM_FORMAT_NV15, /* yuv420_10bit linear mode, 2 plane, no padding */

Same for NV15.

Regards,
Jonas

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c static const uint32_t formats_win_full_10bit_yuyv[] = { · line 54

Quoted 7 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +4 -0
+	DRM_FORMAT_NV16, /* yuv422_8bit linear mode, 2 plane */
+	DRM_FORMAT_NV24, /* yuv444_8bit linear mode, 2 plane */
+	DRM_FORMAT_YVYU, /* yuv422_8bit[YVYU] linear mode */
+	DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */
 };
 
 static const uint32_t formats_win_lite[] = {

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#5 lore raw

Re: [PATCH v2 3/4] drm/rockchip: fix the plane format defination of rk3568/6

Hi Jonas:

Quoted 40 lines · Jonas Karlman

Hi Andy,

Quoted 26 lines · Andy Yan

From: Andy Yan <[email protected]>

Add the missing 10 bit RGB format for cluster window. The cluster windows on rk3568/6 only support afbc format, so change the linear yuv format NV12/16/24 to non-Linear YUV420_8BIT/YUV420_10BIT/YUYV/Y210.

Add NV15 for esmart windows.

Also add some comments.

---

Changes in v2:
- split rename to another patch

  drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 22 +++++++++++++-------
  1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +0 -0
index 62b573f282a7..05aee588e8c9 100644

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c line 22

Quoted 7 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +4 -0
@@ -16,6 +16,10 @@
  #include "rockchip_drm_vop2.h"
 
  static const uint32_t formats_win_full_10bit[] = {
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_ARGB2101010,
+	DRM_FORMAT_XBGR2101010,
+	DRM_FORMAT_ABGR2101010,

atomic_check() will fail for these formats due to missing support for these formats in the vop2 driver. Support for these formats should be added to vop2 driver before being exposed as a supported pixel format.

Quoted 1 line

vop2_convert_format() return -EINVAL for these and below formats.

Thanks for catching this, I fixed it in v3, Add have  all the added  afbc format  tested on my rk3566-box-demo board.

Quoted 45 lines

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c static const uint32_t formats_win_full_10bit[] = { · line 32

Quoted 13 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +2 -3
  	DRM_FORMAT_XRGB8888,
  	DRM_FORMAT_ARGB8888,
  	DRM_FORMAT_XBGR8888,
@@ -24,9 +28,10 @@ static const uint32_t formats_win_full_10bit[] = {
  	DRM_FORMAT_BGR888,
  	DRM_FORMAT_RGB565,
  	DRM_FORMAT_BGR565,
-	DRM_FORMAT_NV12,
-	DRM_FORMAT_NV16,
-	DRM_FORMAT_NV24,
+	DRM_FORMAT_YUV420_8BIT, /* yuv420_8bit non-Linear mode only */
+	DRM_FORMAT_YUV420_10BIT, /* yuv420_10bit non-Linear mode only */

Same for YUV420_8BIT and YUV420_10BIT.

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c static const uint32_t formats_win_full_10bit[] = { · line 34

Quoted 2 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +2 -0
+	DRM_FORMAT_YUYV, /* yuv422_8bit non-Linear mode only*/
+	DRM_FORMAT_Y210, /* yuv422_10bit non-Linear mode only */

Same for Y210.

Quoted 4 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +0 -0
  };
 
  static const uint32_t formats_win_full_10bit_yuyv[] = {

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c static const uint32_t formats_win_full_10bit_yuyv[] = { · line 47

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +2 -5
@@ -38,11 +43,12 @@ static const uint32_t formats_win_full_10bit_yuyv[] = {
  	DRM_FORMAT_BGR888,
  	DRM_FORMAT_RGB565,
  	DRM_FORMAT_BGR565,
-	DRM_FORMAT_NV12,
-	DRM_FORMAT_NV16,
-	DRM_FORMAT_NV24,
-	DRM_FORMAT_YVYU,
-	DRM_FORMAT_VYUY,
+	DRM_FORMAT_NV12, /* yuv420_8bit linear mode, 2 plane */
+	DRM_FORMAT_NV15, /* yuv420_10bit linear mode, 2 plane, no padding */

Same for NV15.

Regards,
Jonas

Quoted 7 lines
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +4 -0
+	DRM_FORMAT_NV16, /* yuv422_8bit linear mode, 2 plane */
+	DRM_FORMAT_NV24, /* yuv444_8bit linear mode, 2 plane */
+	DRM_FORMAT_YVYU, /* yuv422_8bit[YVYU] linear mode */
+	DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */
  };
 
  static const uint32_t formats_win_lite[] = {
author maintainer
#6 lore raw

PATCH v2 4/4 drm/rockchip: rename windows format for vop2

In reply to Andy Yan

From: Andy Yan <[email protected]>

formats_win_full_10bit is for cluster window, formats_win_full_10bit_yuyv is for rk356x esmart, rk3588 esmart window will support more format.
formats_win_lite is for smart window.

Rename it based the windows type may let meaning is clearer

---

(no changes since v1)

 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 30 ++++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +15 -15
index 05aee588e8c9..574cb013639e 100644
@@ -15,7 +15,7 @@
 
 #include "rockchip_drm_vop2.h"
 
-static const uint32_t formats_win_full_10bit[] = {
+static const uint32_t formats_cluster[] = {
 	DRM_FORMAT_XRGB2101010,
 	DRM_FORMAT_ARGB2101010,
 	DRM_FORMAT_XBGR2101010,
@@ -34,7 +34,7 @@ static const uint32_t formats_win_full_10bit[] = {
 	DRM_FORMAT_Y210, /* yuv422_10bit non-Linear mode only */
 };
 
-static const uint32_t formats_win_full_10bit_yuyv[] = {
+static const uint32_t formats_rk356x_esmart[] = {
 	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_ARGB8888,
 	DRM_FORMAT_XBGR8888,
@@ -51,7 +51,7 @@ static const uint32_t formats_win_full_10bit_yuyv[] = {
 	DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */
 };
 
-static const uint32_t formats_win_lite[] = {
+static const uint32_t formats_smart[] = {
 	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_ARGB8888,
 	DRM_FORMAT_XBGR8888,
@@ -150,8 +150,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
 		.name = "Smart0-win0",
 		.phys_id = ROCKCHIP_VOP2_SMART0,
 		.base = 0x1c00,
-		.formats = formats_win_lite,
-		.nformats = ARRAY_SIZE(formats_win_lite),
+		.formats = formats_smart,
+		.nformats = ARRAY_SIZE(formats_smart),
 		.format_modifiers = format_modifiers,
 		.layer_sel_id = 3,
 		.supported_rotations = DRM_MODE_REFLECT_Y,
@@ -162,8 +162,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
 	}, {
 		.name = "Smart1-win0",
 		.phys_id = ROCKCHIP_VOP2_SMART1,
-		.formats = formats_win_lite,
-		.nformats = ARRAY_SIZE(formats_win_lite),
+		.formats = formats_smart,
+		.nformats = ARRAY_SIZE(formats_smart),
 		.format_modifiers = format_modifiers,
 		.base = 0x1e00,
 		.layer_sel_id = 7,
@@ -175,8 +175,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
 	}, {
 		.name = "Esmart1-win0",
 		.phys_id = ROCKCHIP_VOP2_ESMART1,
-		.formats = formats_win_full_10bit_yuyv,
-		.nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv),
+		.formats = formats_rk356x_esmart,
+		.nformats = ARRAY_SIZE(formats_rk356x_esmart),
 		.format_modifiers = format_modifiers,
 		.base = 0x1a00,
 		.layer_sel_id = 6,
@@ -188,8 +188,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
 	}, {
 		.name = "Esmart0-win0",
 		.phys_id = ROCKCHIP_VOP2_ESMART0,
-		.formats = formats_win_full_10bit_yuyv,
-		.nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv),
+		.formats = formats_rk356x_esmart,
+		.nformats = ARRAY_SIZE(formats_rk356x_esmart),
 		.format_modifiers = format_modifiers,
 		.base = 0x1800,
 		.layer_sel_id = 2,
@@ -202,8 +202,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
 		.name = "Cluster0-win0",
 		.phys_id = ROCKCHIP_VOP2_CLUSTER0,
 		.base = 0x1000,
-		.formats = formats_win_full_10bit,
-		.nformats = ARRAY_SIZE(formats_win_full_10bit),
+		.formats = formats_cluster,
+		.nformats = ARRAY_SIZE(formats_cluster),
 		.format_modifiers = format_modifiers_afbc,
 		.layer_sel_id = 0,
 		.supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
@@ -217,8 +217,8 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
 		.name = "Cluster1-win0",
 		.phys_id = ROCKCHIP_VOP2_CLUSTER1,
 		.base = 0x1200,
-		.formats = formats_win_full_10bit,
-		.nformats = ARRAY_SIZE(formats_win_full_10bit),
+		.formats = formats_cluster,
+		.nformats = ARRAY_SIZE(formats_cluster),
 		.format_modifiers = format_modifiers_afbc,
 		.layer_sel_id = 1,
 		.supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
Signature · 1 line
2.34.1
maintainer Applied
#7 lore raw

Re: (subset) [PATCH v2 0/4] Some cleanup of vop2 driver

In reply to Andy Yan
Quoted 9 lines · Andy Yan

From: Andy Yan <[email protected]>

This is a preparation for the upcoming support for rk3588 vop. Patch 1 remove unused struct
Patch 2 remove NR_LAYERS macro to support more layers on rk3588 Patch 3 are plane format fix
Patch 4 is a format rename

[...]

Applied, thanks!

[1/4] drm/rockchip: remove unused struct in vop2

      commit: ac1c11c23fc51c1ba51a3ed586df40ffe6b1de35
[2/4] drm/rockchip: remove NR_LAYERS macro on vop2
      commit: dc00748adcf03d754bf43035c668bc5b20fb6597

So I've picked up the pretty straight-forward patches for now.

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>