vop2: 3566 vs 3568: green screen on 3566; on 3568 all ok...

Piotr Oniszczuk piotr.oniszczuk at gmail.com
Mon Dec 25 04:14:14 PST 2023


Andy,

Thx for looking on this!

Before passing dri state logs - let me give some context why i’m asking here for help.

I’m developing 2 distros with goal to offer user convenient run of multimedia players (Kodi and MythTV): appliance and general distro.
Goal is out of box run of Kodi/MythTV in 2 rendering modes: EGL DAMBuf and DRM direct planes.

Currently i have out-of-box (no any SoC specific configs in Kodi/MythTV) for: rk3328/rk3399/H6/H313/H616/rpi3/rpi4.
Issues ia have are with: rk3566 and rk3568
 
Vanilla 6.6.8 kernel on 3568 not offers me well working out-of-box Kodi/MythTV in DRM direct planes - but i was able to patch vop2 to get such out-of-box operation (pls see patch below).

I have also issue with 3566 - where i also developed patch (also see below) - but i’m not able to get 3566 fully working (EGL DMAbuf is ok; in DRM Planes GUI is ok, but video playback gives part screen green part black; green/black border is vibrantly changing at playback)

Logs:

Pls find patch & DRI state logs from mainline 6.6.8 kernel with my vop2 patch applied:

1. rk3568: with patch like below 3568 works well out-of-box in EGL DAMBuf and DRM direct planes

—————————————patch begin————————————

This moves least capable "smart" planes declared first to end.
It workarounds issue of invisibe osd n drm_planes mode.

--- linux-6.6.1/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c	2023-11-15 13:27:45.063377031 +0100
+++ linux-6.6.1/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c	2023-11-15 13:14:23.825053113 +0100
@@ -140,33 +140,7 @@
  * @TODO describe the wind like cpu-map dt nodes;
  */
 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),
-		.format_modifiers = format_modifiers,
-		.layer_sel_id = 3,
-		.supported_rotations = DRM_MODE_REFLECT_Y,
-		.type = DRM_PLANE_TYPE_PRIMARY,
-		.max_upscale_factor = 8,
-		.max_downscale_factor = 8,
-		.dly = { 20, 47, 41 },
-	}, {
-		.name = "Smart1-win0",
-		.phys_id = ROCKCHIP_VOP2_SMART1,
-		.formats = formats_win_lite,
-		.nformats = ARRAY_SIZE(formats_win_lite),
-		.format_modifiers = format_modifiers,
-		.base = 0x1e00,
-		.layer_sel_id = 7,
-		.supported_rotations = DRM_MODE_REFLECT_Y,
-		.type = DRM_PLANE_TYPE_PRIMARY,
-		.max_upscale_factor = 8,
-		.max_downscale_factor = 8,
-		.dly = { 20, 47, 41 },
-	}, {
+    {
 		.name = "Esmart1-win0",
 		.phys_id = ROCKCHIP_VOP2_ESMART1,
 		.formats = formats_win_full_10bit_yuyv,
@@ -222,7 +196,33 @@
 		.max_downscale_factor = 4,
 		.dly = { 0, 27, 21 },
 		.feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
-	},
+	}, {
+		.name = "Smart0-win0",
+		.phys_id = ROCKCHIP_VOP2_SMART0,
+		.base = 0x1c00,
+		.formats = formats_win_lite,
+		.nformats = ARRAY_SIZE(formats_win_lite),
+		.format_modifiers = format_modifiers,
+		.layer_sel_id = 3,
+		.supported_rotations = DRM_MODE_REFLECT_Y,
+		.type = DRM_PLANE_TYPE_PRIMARY,
+		.max_upscale_factor = 8,
+		.max_downscale_factor = 8,
+		.dly = { 20, 47, 41 },
+	}, {
+		.name = "Smart1-win0",
+		.phys_id = ROCKCHIP_VOP2_SMART1,
+		.formats = formats_win_lite,
+		.nformats = ARRAY_SIZE(formats_win_lite),
+		.format_modifiers = format_modifiers,
+		.base = 0x1e00,
+		.layer_sel_id = 7,
+		.supported_rotations = DRM_MODE_REFLECT_Y,
+		.type = DRM_PLANE_TYPE_PRIMARY,
+		.max_upscale_factor = 8,
+		.max_downscale_factor = 8,
+		.dly = { 20, 47, 41 },
+	}
 };

 static const struct vop2_data rk3528_vop = { 

—————————————patch end————————————     

---------------------------------------k3568 dir state log:
cat /sys/kernel/debug/dri/0/state
plane[31]: Esmart1-win0
        crtc=video_port0
        fb=82
                allocated by = mythfrontend
                refcount=2
                format=NV12 little-endian (0x3231564e)
                modifier=0x0
                size=1920x1080
                layers:
                        size[0]=1920x1080
                        pitch[0]=1920
                        offset[0]=0
                        obj[0]:
                                name=0
                                refcount=3
                                start=00000000
                                size=3657728
                                imported=yes
                        size[1]=960x540
                        pitch[1]=1920
                        offset[1]=2088960
                        obj[1]:
                                name=0
                                refcount=3
                                start=00000000
                                size=3657728
                                imported=yes
        crtc-pos=1920x1080+0+0
        src-pos=1920.000000x1080.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[37]: Esmart0-win0
        crtc=video_port0
        fb=76
                allocated by = mythfrontend
                refcount=2
                format=AR24 little-endian (0x34325241)
                modifier=0x0
                size=1920x1080
                layers:
                        size[0]=1920x1080
                        pitch[0]=7680
                        offset[0]=0
                        obj[0]:
                                name=0
                                refcount=3
                                start=00000000
                                size=8294400
                                imported=no
        crtc-pos=1920x1080+0+0
        src-pos=1920.000000x1080.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=1
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[43]: Cluster0-win0
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=2
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[49]: Cluster1-win0
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=3
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[55]: Smart0-win0
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=4
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[61]: Smart1-win0
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=5
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
crtc[67]: video_port0
        enable=1
        active=1
        self_refresh_active=0
        planes_changed=1
        mode_changed=0
        active_changed=0
        connectors_changed=0
        color_mgmt_changed=0
        plane_mask=3
        connector_mask=1
        encoder_mask=1
        mode: "1920x1080": 50 148500 1920 2448 2492 2640 1080 1084 1089 1125 0x40 0x5
connector[69]: HDMI-A-1
        crtc=video_port0
        self_refresh_aware=0
        max_requested_bpc=16
        colorspace=Default
root at Myth-Frontend-62f0f2b13dc0:~ #
---------------------------------------k3568 dir state log:






On rk3566: with patch below i have:
- out-of-box working GUI & video playback in EGL DMAbuf
- out-of-box working GUI ok but video playback is half-green in DRM planes

—————————————patch begin————————————
--- linux-6.6.8/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c	2023-12-25 12:33:35.686676731 +0100
+++ linux-6.6.8/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c	2023-12-23 14:40:48.986679895 +0100
@@ -139,6 +139,92 @@
  *
  * @TODO describe the wind like cpu-map dt nodes;
  */
+static const struct vop2_win_data rk3566_vop_win_data[] = {
+    {
+		.name = "Smart0-win0",
+		.phys_id = ROCKCHIP_VOP2_SMART0,
+		.base = 0x1c00,
+		.formats = formats_win_lite,
+		.nformats = ARRAY_SIZE(formats_win_lite),
+		.format_modifiers = format_modifiers,
+		.layer_sel_id = 3,
+		.supported_rotations = DRM_MODE_REFLECT_Y,
+		.type = DRM_PLANE_TYPE_PRIMARY,
+		.max_upscale_factor = 8,
+		.max_downscale_factor = 8,
+		.dly = { 20, 47, 41 },
+	}, {
+		.name = "Smart1-win0",
+		.phys_id = ROCKCHIP_VOP2_SMART1,
+		.formats = formats_win_lite,
+		.nformats = ARRAY_SIZE(formats_win_lite),
+		.format_modifiers = format_modifiers,
+		.base = 0x1e00,
+		.layer_sel_id = 7,
+		.supported_rotations = DRM_MODE_REFLECT_Y,
+		.type = DRM_PLANE_TYPE_PRIMARY,
+		.max_upscale_factor = 8,
+		.max_downscale_factor = 8,
+		.dly = { 20, 47, 41 },
+	}, {
+		.name = "Cluster0-win0",
+		.phys_id = ROCKCHIP_VOP2_CLUSTER0,
+		.base = 0x1000,
+		.formats = formats_win_full_10bit,
+		.nformats = ARRAY_SIZE(formats_win_full_10bit),
+		.format_modifiers = format_modifiers_afbc,
+		.layer_sel_id = 0,
+		.supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
+					DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
+		.max_upscale_factor = 4,
+		.max_downscale_factor = 4,
+		.dly = { 0, 27, 21 },
+		.type = DRM_PLANE_TYPE_OVERLAY,
+		.feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
+	}, {
+		.name = "Cluster1-win0",
+		.phys_id = ROCKCHIP_VOP2_CLUSTER1,
+		.base = 0x1200,
+		.formats = formats_win_full_10bit,
+		.nformats = ARRAY_SIZE(formats_win_full_10bit),
+		.format_modifiers = format_modifiers_afbc,
+		.layer_sel_id = 1,
+		.supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
+					DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
+		.type = DRM_PLANE_TYPE_OVERLAY,
+		.max_upscale_factor = 4,
+		.max_downscale_factor = 4,
+		.dly = { 0, 27, 21 },
+		.feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
+	}, {
+		.name = "Esmart1-win0",
+		.phys_id = ROCKCHIP_VOP2_ESMART1,
+		.formats = formats_win_full_10bit_yuyv,
+		.nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv),
+		.format_modifiers = format_modifiers,
+		.base = 0x1a00,
+		.layer_sel_id = 6,
+		.supported_rotations = DRM_MODE_REFLECT_Y,
+		.type = DRM_PLANE_TYPE_PRIMARY,
+		.max_upscale_factor = 8,
+		.max_downscale_factor = 8,
+		.dly = { 20, 47, 41 },
+	}, {
+		.name = "Esmart0-win0",
+		.phys_id = ROCKCHIP_VOP2_ESMART0,
+		.formats = formats_win_full_10bit_yuyv,
+		.nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv),
+		.format_modifiers = format_modifiers,
+		.base = 0x1800,
+		.layer_sel_id = 2,
+		.supported_rotations = DRM_MODE_REFLECT_Y,
+		.type = DRM_PLANE_TYPE_PRIMARY,
+		.max_upscale_factor = 8,
+		.max_downscale_factor = 8,
+		.dly = { 20, 47, 41 },
+	}
+};
+
 static const struct vop2_win_data rk3568_vop_win_data[] = {
     {
 		.name = "Esmart1-win0",
@@ -240,7 +326,7 @@
 	.max_input = { 4096, 2304 },
 	.max_output = { 4096, 2304 },
 	.vp = rk3568_vop_video_ports,
-	.win = rk3568_vop_win_data,
+	.win = rk3566_vop_win_data,
 	.win_size = ARRAY_SIZE(rk3568_vop_win_data),
 	.soc_id = 3566,
 };
—————————————patch end————————————


---------------------------------------k3566 dir state log:
root at Myth-Frontend-4610eb297888:~ # cat /sys/kernel/debug/dri/0/state
plane[31]: Smart0-win0
        crtc=video_port0
        fb=53
                allocated by = [fbcon]
                refcount=2
                format=XR24 little-endian (0x34325258)
                modifier=0x0
                size=1920x1080
                layers:
                        size[0]=1920x1080
                        pitch[0]=7680
                        offset[0]=0
                        obj[0]:
                                name=1
                                refcount=4
                                start=00100004
                                size=8294400
                                imported=no
        crtc-pos=1920x1080+0+0
        src-pos=1920.000000x1080.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[37]: Cluster0-win0
        crtc=video_port0
        fb=67
                allocated by = mythfrontend
                refcount=2
                format=NV12 little-endian (0x3231564e)
                modifier=0x0
                size=1920x1080
                layers:
                        size[0]=1920x1080
                        pitch[0]=1920
                        offset[0]=0
                        obj[0]:
                                name=0
                                refcount=3
                                start=00000000
                                size=3657728
                                imported=yes
                        size[1]=960x540
                        pitch[1]=1920
                        offset[1]=2088960
                        obj[1]:
                                name=0
                                refcount=3
                                start=00000000
                                size=3657728
                                imported=yes
        crtc-pos=1920x1080+0+0
        src-pos=1920.000000x1080.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=2
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[43]: Esmart0-win0
        crtc=video_port0
        fb=57
                allocated by = mythfrontend
                refcount=2
                format=AR24 little-endian (0x34325241)
                modifier=0x0
                size=1920x1080
                layers:
                        size[0]=1920x1080
                        pitch[0]=7680
                        offset[0]=0
                        obj[0]:
                                name=0
                                refcount=3
                                start=00000000
                                size=8294400
                                imported=no
        crtc-pos=1920x1080+0+0
        src-pos=1920.000000x1080.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=1
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
crtc[49]: video_port0
        enable=1
        active=1
        self_refresh_active=0
        planes_changed=1
        mode_changed=0
        active_changed=0
        connectors_changed=0
        color_mgmt_changed=0
        plane_mask=7
        connector_mask=1
        encoder_mask=1
        mode: "1920x1080": 50 148500 1920 2448 2492 2640 1080 1084 1089 1125 0x40 0x5
connector[51]: HDMI-A-1
        crtc=video_port0
        self_refresh_aware=0
        max_requested_bpc=16
        colorspace=Default
root at Myth-Frontend-4610eb297888:~ #
---------------------------------------k3566 dir state log:

pls let me know if any other info is needed to move forward with this….



> Wiadomość napisana przez Andy Yan <andy.yan at rock-chips.com> w dniu 25.12.2023, o godz. 02:40:
> 
> Hi Piotr:
> 
> On 12/24/23 20:37, Piotr Oniszczuk wrote:
>> Hi *
>> I have well working video decoding + rendering to drm planes on rk3568.
>> On rk3566 however video playback gives mr green screen.
> 
> Please confirm that the video data you rendering to drm is afbc or non-afbc?
> Please also run command "cat /sys/kernel/debug/dri/0/state" and upload the output when you get green screen on rk3036
> For the convenience of comparison, please also give the dri/0/state when you playback the same video on rk3568.
>> Looking on 6.6.8 vop2 sources i see e.g. rk3568_vop_win_data[] is common for 3566 and 3568.
>> I recall however Andy Yan (rockchip) said:
>> "But take care that the vop on rk3566 has a special limitation: there are three windows(Cluster1/Esmart1/Smart1) that have a mirror lock, that means they can't be programmed framebuffer address independently , they can only share framebuffer address with Cluster0/Esmart0/Smart0”.
>> I suspect my 3566 green video issue is somehow result of "too" common vop2 code for 3566 & 3568 variants.
>> Isn't that 3566 should have dedicated variant code to deal with 3566 limitations mentioned by Andy?
>> _______________________________________________
>> Linux-rockchip mailing list
>> Linux-rockchip at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-rockchip




More information about the Linux-rockchip mailing list