Skip to contentSkip to conversation

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

DISCUSSION Piotr Oniszczuk 4 participants 7 messages Dec 24, 2023 – Dec 27, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi *

I have well working video decoding + rendering to drm planes on rk3568.

On rk3566 however video playback gives mr green screen.
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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#1 lore raw

Hi Piotr:

Quoted 5 lines · Piotr Oniszczuk

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.

Quoted 8 lines

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.

Quoted 8 lines

Isn't that 3566 should have dedicated variant code to deal with 3566 limitations mentioned by Andy?

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

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

#2 lore raw

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.

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +28 -28
@@ -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@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————————————

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +87 -1

100 lines not on this page · raw message

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

---------------------------------------k3566 dir state log:
root@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@Myth-Frontend-4610eb297888:~ # ---------------------------------------k3566 dir state log:

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

Quoted 4 lines

Wiadomość napisana przez Andy Yan <[email protected]> w dniu 25.12.2023, o godz. 02:40:

Hi Piotr:

Quoted 17 lines
Quoted 3 lines · Piotr Oniszczuk

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.

Quoted 9 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

#3 lore raw

Hi Piotr,

Quoted 4 lines · Piotr Oniszczuk

Andy,

Thx for looking on this!

Quoted 8 lines

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

Yes, it is a cool project, I run it on rk3566-box-demo for a while last year.

Quoted 419 lines

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.

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +28 -28
@@ -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@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————————————

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +87 -1
@@ -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@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
Quoted 7 lines

connector[51]: HDMI-A-1
crtc=video_port0
self_refresh_aware=0
max_requested_bpc=16
colorspace=Default
root@Myth-Frontend-4610eb297888:~ # ---------------------------------------k3566 dir state log:

The dri/state dump already indicates the root case of the problem:

For rk3566/rk3568, the Cluster windows only support AFBC based RGB or YUV format, linear formats(such as NV12 you used for Cluster0-win0 on rk3566) are not supported, these linear formats are only support by Esmart(RGB/YUV),smart(RGB only) windows.

Compared with rk3568 you use, the NV12 is committed to Esmart1, and XRGB UI is committed to Esmart0.
But on rk3566, there are only three windows/plane you can use, if you can only decoder linear NV12, it should be committed to Esmart0, and use Smart0 for UI.

But when the vop2 drivers first lands, it mistakenly add linear formats(NV12/NV16) to Cluster windows format lists, this will mislead user space.

I have a patch series to fix this that already be merged in linux 6.7[0]

Feel free to let me know if you still have problem.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=01d5a75370a60c3a8d691347ae6ebb2a9f8dc44a

Quoted 28 lines

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

Quoted 4 lines

Wiadomość napisana przez Andy Yan <[email protected]> w dniu 25.12.2023, o godz. 02:40:

Hi Piotr:

Quoted 17 lines
Quoted 3 lines · Piotr Oniszczuk

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.

Quoted 9 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Quoted 4 lines

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

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

#4 lore raw

Andy,

pls see inline

Quoted 14 lines

Wiadomość napisana przez Andy Yan <[email protected]> w dniu 26.12.2023, o godz. 02:41:

Hi Piotr,

Quoted 8 lines · Piotr Oniszczuk

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

Quoted 1 line

Yes, it is a cool project, I run it on rk3566-box-demo for a while last year.

Many thx for kind words!

Quoted 18 lines
Quoted 4 lines

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:

The dri/state dump already indicates the root case of the problem:

For rk3566/rk3568, the Cluster windows only support AFBC based RGB or YUV format, linear formats(such as NV12 you used for Cluster0-win0 on rk3566) are not supported, these linear formats are only support by Esmart(RGB/YUV),smart(RGB only) windows.

Compared with rk3568 you use, the NV12 is committed to Esmart1, and XRGB UI is committed to Esmart0.
But on rk3566, there are only three windows/plane you can use, if you can only decoder linear NV12, it should be committed to Esmart0, and use Smart0 for UI.

Quoted 8 lines

But when the vop2 drivers first lands, it mistakenly add linear formats(NV12/NV16) to Cluster windows format lists, this will mislead user space.

I have a patch series to fix this that already be merged in linux 6.7[0]

Feel free to let me know if you still have problem.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=01d5a75370a60c3a8d691347ae6ebb2a9f8dc44a

Perfect.

Above patch + vop2_win_data rk3568_vop_win_data[] reordering to:

Esmart1-win0
Esmart0-win0
Smart0-win0
Smart1-win0
Cluster0-win0
Cluster1-win0

makes Kodi and MythTV working out-of-box with EGL DMAbuf and DRM planes HW decoded video rendering :-)

So with your help we have single 6.6.8 kernel offering EGL DMAbuf and DRM planes HW decoded video rendering on rk3328/rk3399/rk3566/rk3568/H6/H313/H616/H618/rpi3/rpi4

once again: many thx

(p.s: it looks like only thing missing in 356x to be perfect open-source multimedia soc is: lack of rkvdec2 for hevc/vp9 hw decoding. Are there any plans from rock-chips to help foss to bring-up mainline kernel support for rkvdec2?)

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

#5 lore raw

Hi Piortr,

On 2023/12/26 19:22, Piotr Oniszczuk wrote:
...

Quoted 11 lines

Perfect.

Above patch + vop2_win_data rk3568_vop_win_data[] reordering to:

Esmart1-win0
Esmart0-win0
Smart0-win0
Smart1-win0
Cluster0-win0
Cluster1-win0

Quoted 7 lines

makes Kodi and MythTV working out-of-box with EGL DMAbuf and DRM planes HW decoded video rendering :-)

So with your help we have single 6.6.8 kernel offering EGL DMAbuf and DRM planes HW decoded video rendering on rk3328/rk3399/rk3566/rk3568/H6/H313/H616/H618/rpi3/rpi4

once again: many thx

(p.s: it looks like only thing missing in 356x to be perfect open-source multimedia soc is: lack of rkvdec2 for hevc/vp9 hw decoding. Are there any plans from rock-chips to help foss to bring-up mainline kernel support for rkvdec2?)

Rockchip do not have plan to add rkvdec2 driver for mainline kernel, since rockchip vendor SDK does not use V4L2 based solution for video encoder/decoder. For rkvdec, rockchip has already totally open source for both kernel driver and userspace mpp driver, people can understand how it works if anyone interested in it. If developers would like to port the driver for mainline kernel, it's welcome and if you have any questions about the hardware during porting the driver, we can help to answer.

Thanks,
- Kever

Quoted 7 lines

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

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

#6 lore raw
Quoted 19 lines · Kever Yang

On 2023/12/26 19:22, Piotr Oniszczuk wrote:
...

Quoted 17 lines

Perfect.

Above patch + vop2_win_data rk3568_vop_win_data[] reordering to:

Esmart1-win0
Esmart0-win0
Smart0-win0
Smart1-win0
Cluster0-win0
Cluster1-win0

makes Kodi and MythTV working out-of-box with EGL DMAbuf and DRM planes HW decoded video rendering :-)

So with your help we have single 6.6.8 kernel offering EGL DMAbuf and DRM planes HW decoded video rendering on rk3328/rk3399/rk3566/rk3568/H6/H313/H616/H618/rpi3/rpi4

once again: many thx

Quoted 8 lines
Quoted 1 line

(p.s: it looks like only thing missing in 356x to be perfect open-source multimedia soc is: lack of rkvdec2 for hevc/vp9 hw decoding. Are there any plans from rock-chips to help foss to bring-up mainline kernel support for rkvdec2?)

Rockchip do not have plan to add rkvdec2 driver for mainline kernel, since rockchip vendor SDK does not use V4L2 based solution for video encoder/decoder.
For rkvdec, rockchip has already totally open source for both kernel driver and userspace mpp driver, people can understand how it works if anyone interested in it.

This is awesome. Though, could you, please, send the links to the actual official source code repositories, simply because there seems to be quite a few of such repositories, which becomes confusing rather quickly?

Quoted 3 lines

If developers would like to port the driver for mainline kernel, it's welcome and if you have any questions about the hardware during porting the driver, we can help to answer.

This is also awesome, thank you very much.

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