Drm kms interface , bad resolution issues

Hello,

Relating to this previous post : How to check EDID with DRM interface. Wrong/bad output resolution

I create this new topic.

Regarding the change of the resolution, it works , that means when I check the output properties of my display ( a TV for test ) , I have the right resolution.

But when I test the playback of a video , it remains not smooth , and When I test again with “modetest”, I discover this :

  • For example, the resolutions availables on my display are :

#0 3840x2160 30.00 3840 4016 4104 4400 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: preferred, driver
#1 4096x2160 30.00 4096 4184 4272 4400 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
#2 4096x2160 29.97 4096 4184 4272 4400 2160 2168 2178 2250 296703 flags: phsync, pvsync; type: driver
#3 4096x2160 25.00 4096 5064 5152 5280 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
#4 4096x2160 24.00 4096 5116 5204 5500 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
#5 4096x2160 23.98 4096 5116 5204 5500 2160 2168 2178 2250 296703 flags: phsync, pvsync; type: driver
#6 3840x2160 29.97 3840 4016 4104 4400 2160 2168 2178 2250 296703 flags: phsync, pvsync; type: driver
#7 3840x2160 25.00 3840 4896 4984 5280 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
#8 3840x2160 24.00 3840 5116 5204 5500 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
#9 3840x2160 23.98 3840 5116 5204 5500 2160 2168 2178 2250 296703 flags: phsync, pvsync; type: driver
#10 1920x1080 60.00 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver
#11 1920x1080 59.94 1920 2008 2052 2200 1080 1084 1089 1125 148352 flags: phsync, pvsync; type: driver

  • if I choose 3840@2160@24 ( the one I want ) : modetest -s 148:#8 , I have on the output :

root@apalis-imx8-06980672:~# modetest -s 148:#8
trying to open device ‘imx-drm’…done
[ 1403.047173] cdns-mhdp-imx 56268000.hdmi: 0,ff,ff,ff,ff,ff,ff,0
setting mode 3840x2160-24.00Hz on connectors 148, crtc 38
[ 1403.265112] [drm] Mode: 3840x2160p297000
[ 1403.299604] [drm] Pixel clock: 297000 KHz, character clock: 297000, bpc is 8-bit.
[ 1403.309689] [drm] VCO frequency is 2970000 KHz
[ 1403.368852] [drm] Sink Not Support SCDC
failed to set gamma: Function not implemented

[ 1436.429947] [drm] Mode: 3840x2160p297000
[ 1436.464120] [drm] Pixel clock: 297000 KHz, character clock: 297000, bpc is 8-bit.
[ 1436.474769] [drm] VCO frequency is 2970000 KHz
[ 1436.534455] [drm] Sink Not Support SCDC

We can see settings mode = 3840x2160-24.00Hz, that’s the mode I want, but the kernel message ( drm section ) says : 3840x2160p297000

  • if I choose 3840x2160@30 : modetest -s 148:#0 , I have on the output :

root@apalis-imx8-06980672:~# modetest -s 148:#0
trying to open device ‘imx-drm’…done
[ 1563.169699] cdns-mhdp-imx 56268000.hdmi: 0,ff,ff,ff,ff,ff,ff,0
setting mode 3840x2160-30.00Hz on connectors 148, crtc 38
[ 1563.387242] [drm] Mode: 3840x2160p297000
[ 1563.426034] [drm] Pixel clock: 297000 KHz, character clock: 297000, bpc is 8-bit.
[ 1563.440242] [drm] VCO frequency is 2970000 KHz
[ 1563.503868] [drm] Sink Not Support SCDC
failed to set gamma: Function not implemented

exactly the same kernel [drm] message.

The output resolution on my display seems correct, but the video playback is very jerky , @24 or @30 , same result, it works well only with a @60 mode.

It is a video that has a framerate of 24 frames, so I should be smooth in any mode @24. I guess that other modes than @60 are not well supported.

Hi @f.mazur ,

First of all, we would like to understand, why the @60 setting is not suitable for your project?

As we understand the video that you have is 24 fps and you want to display it ideally on a 24fps monitor setting. Anyway, it seems like the issue disappears when you use the 60fps configuration.

Can you confirm that we understood this correctly?

Best Regards
Kevin

Hello,

On previous projects, we had observed that a framerate @60 is worse than a framerate @24 for a completely smooth video playback. This can be explained easily : a video from a movie is 24fps ( 41.6 ms per frame ). If this video is displayed with any framerate different than 24, because the player do not perfom any interpolation , some frames are duplicated and the consequence is that appears jerky.

This is accentuated with a TV that interpolate to upscale the framerate ( 120Hz / 200Hz etc… ).

If the output mode is @60 this is acceptable but we can see this. If the output mode is @30 , the video is very jerky. With a native output mode of @24, the video is completely smooth.

On this new project, we have several issues with the h264/h265 4k playback with gstreamer. Video is jerky, etc. So we try many solutions to improve the video smoothness. One of this improvement is to be able to fix the output framerate with any mode , including 4k@24. We observed that not only the video is not completely smooth , but also it is worse than 4K@60 ( it is not normal ).

Hope my explanation was clear.

So, to answer exactly to your question :

  • 4K60 works well ( not completely smooth ) but we have issues with 4k/h265 contents, it plays not well with gstreamer , and with integration gstreamer qmlglsink → Qt QML app, it is very jerky with high cpu consumption
  • 4K24 : works bad, even just with gstreamer ( normally , it should be perfectly smooth, as on our previous projects, and as any player with 24fps mode )

Hi @f.mazur!

Thanks for the more detailed explanation. This is what we thought.

Could you please share the pipeline and the video that you are using? So we can try to reproduce your issue on our side.

Furthermore, it would be helpful to know the exact hardware version that you are using (both module and carrier board) and BSP version (cat /etc/os-release and cat /etc/issue)

Best regards,

Best regards,

Hello,

Here is the pipeline :
gst-launch-1.0 -vvv playbin uri=http://172.17.0.171/video/rev.mkv flags=83 video_sink=kmssink

But, we are working with a customized linux image, based on your reference multimedia image , but with a new version of gstreamer with a correct hardware decoder ( the one from nxp works very bad ).

root@apalis-imx8-06980672:~# cat /etc/os-release
ID=pga-multimedia
NAME=“PGA multimedia image based on TDX xwayland”
VERSION=“5.4.0-devel-20220224103541+build.0 (dunfell)”
VERSION_ID=5.4.0-devel-20220224103541-build.0
PRETTY_NAME=“PGA multimedia image based on TDX xwayland 5.4.0-devel-20220224103541+build.0 (dunfell)”

root@apalis-imx8-06980672:~# cat /etc/issue
PGA multimedia image based on TDX xwayland 5.4.0-devel-20220224103541+build.0 (dunfell) \n \l
Apalis-iMX8_PGA-Multimedia-Image

gstreamer version is :

root@apalis-imx8-06980672:~# gst-launch-1.0 --version
gst-launch-1.0 version 1.18.2
GStreamer 1.18.2
Unknown package origin
root@apalis-imx8-06980672:~#

the decoder ( specially rewritten for imx8, the nxp version don’t work ) : GstImxVpuDecH265
imxvpudech265-0

I can share with you the complete pipeline ( svg file ) if you want it ( I cannot attach it here, it don’t work , it is a svg file generated from the dot file generated by gstreamer )

I will try this afternoon the same process ( but with a different pipeline, this one doesn’t exist on the reference multimedia image ) on the toradex reference multimedia image without any modification, I am pretty sure that I will have the same behaviour.

Just launch a video in 3840x2160@60 , and another in 3840x2160@24 ( change the resolution with the tdxargs parameters on uboot env )

ok, I have just tried with your toradex reference multimedia image ( 5.5.0 )

The issue is the same.

Because the h265 decoder works bad ( especially in 4k ), please try with a fullHD h264 content. The result is the same.

Here is the pipeline used :

gst-launch-1.0 -vvv souphttpsrc location=http://172.17.0.171/video/hell.mkv ! matroskademux name=demux demux. ! h264parse ! queue ! v4l2h264dec ! queue ! imxvideoconvert_g2d ! autovideosink

if you set weston ( because drmkms dont work with the toradex reference multimedia image ) with the correct mode, you will see the issue.

In my example : the_100.mkv is a FullHD h264 content, with a 24fps framerate

  • mode=1920x1080@60 : smooth
  • mode=3840x2160@60 : smooth
  • mode=3840x2160@24 : jerky

Here are the full info of the media : hell mediainfo - Pastebin.com

gst-discoverer version :

root@apalis-imx8-06980672:~# gst-discoverer-1.0 http://172.17.0.171/video/hell.mkv
Analyzing http://172.17.0.171/video/hell.mkv

====== AIUR: 4.5.7 build on Nov 13 2020 08:36:18. ======
Core: MKVPARSER_01.08.08 build on Oct 13 2020 05:39:34
file: /usr/lib/imx-mm/parser/lib_mkv_parser_arm_elinux.so.3.1

Track 00 [audio_0] Enabled
    Duration: 1:42:19.936000000
    Language: fre
Mime:
    audio/x-ac3, channels=(int)6, rate=(int)48000, bitrate=(int)448000, codec_data=(buffer)21b0


Track 01 [subtitle_0] Enabled
    Duration: 1:42:19.936000000
    Language: und
Mime:
    text/x-raw, format=(string)pango-markup


Track 02 [video_0] Enabled
    Duration: 1:42:19.936000000
    Language: eng
Mime:
    video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)avc, width=(int)1920, height=(int)800, framerate=(fraction)23/1, codec_data=(buffer)01640029ffe1001867640029acd98078065b011000003e90000bb808f18319a001000668e9787cb22c


Track 03 [audio_1] Enabled
    Duration: 1:42:19.936000000
    Language: eng
Mime:
    audio/x-dts, channels=(int)6, rate=(int)48000, bitrate=(int)1508999

Done discovering http://172.17.0.171/video/hell.mkv
Analyzing URI timed out

Hi @f.mazur

Sorry for the delay.

From your pipeline, you are using an element that is not available by default and streams the video from a source over the network. Is that right?

Do you see the same issue if you playback the same video locally?

Best regards,