Screen tearing problem on tx2

Hi everyone
We encounter a problem very similar to https://devtalk.nvidia.com/default/topic/1042939/jetson-tx2/video-tearing-how-to-set-xv_sync_to_vblank-in-nvidia_drv-so/2
Due to startup time reason, we do not start lightdm . We only start a Xorg and a Qt application(qv4l2) but there is screen tearing
We did the following test
test1:
1.sudo service lightdm stop
2.sudo /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
3.gst-launch-1.0 filesrc location=/home/nvidia/tearing-test.mp4 ! decodebin ! videoconvert ! textoverlay font-desc=“Sans, 12” ! xvimagesink
4.screen tearing on display
test2:
1.sudo service lightdm stop
2.sudo /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
3.gst-launch-1.0 filesrc location=/home/nvidia/tearing-test.mp4 ! decodebin ! videoconvert ! textoverlay font-desc=“Sans, 12” ! nvoverlaysink
4.No screen tearing on display!
test3:
1.sudo service lightdm stop
2.sudo /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
3.run qv4l2 and open a camera
4.screen tearing on display

Our question:
1.why there is screen teariing when using nvoverlaysink , but xvimagesink  not?
2.we will write a app similar to qv4l2, read video from camera and display it, how could we avoid the screen tearing without start lightdm?

Hi,
We run below commands on r28.2.1 and do not see the issue.

$ sudo service lightdm stop
sudo /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
$ gst-launch-1.0 filesrc location= /home/nvidia/tegra_multimedia_api/data/Video/sample_outdoor_car_1080p_10fps.h264 ! h264parse ! omxh264dec ! videoconvert ! textoverlay font-desc="Sans, 12" ! xvimagesink

Since xvimagesink is 3rdparty plugin, we suggest you use nvoverlaysink or nveglglessink.

$ gst-launch-1.0 filesrc location= /home/nvidia/tegra_multimedia_api/data/Video/sample_outdoor_car_1080p_10fps.h264 ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw ! textoverlay font-desc="Sans, 12" ! nvvidconv ! nvegltransform ! nveglglessink

A relevant post:
https://devtalk.nvidia.com/default/topic/1042939/jetson-tx2/video-tearing-how-to-set-xv_sync_to_vblank-in-nvidia_drv-so/post/5291536/#5291536

Hi DaneLLL
We have tested on jetapck3.2.1 L4T r28.2.1 with your command :

$ sudo service lightdm stop
sudo /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
$ gst-launch-1.0 filesrc location= /home/nvidia/tearing-test.mp4 ! h264parse ! omxh264dec ! videoconvert ! textoverlay font-desc="Sans, 12" ! xvimagesink
  But we can see severely screen tearing as the following image show:

  We also did the following test:
  1. write a qt app with QGLWidget read the tearing-test.h264 and show, it still has the same problem

  Could you give us some advise, thanks !

here is our tearing test video :
url: https://pan.baidu.com/s/16tvWOQ_JUKiZYxv7caWbig
password: ka5v

Can you please try nveglglessink?
xvimagesink is a 3rdparty plugin.

Hi DaneLLL
Thank your for reply.By using nveglglessink or nvoverlaysink there is no screen tearing but unfortunately our problem could not be solved by using nveglglessink. Our product use a Qt based program not gstreamer, we found the screen tearing issue and then use gstreamer just to test and try to find some clues.Now we have the follwing question:
1.Where we could the source code of nvoverlaysink ? We want to find some clues.
2.We have set the VSYNC in QGLwidget but without effect, is there anything we can do in the framebuffer driver layer?
3.Is there anything we can do in the Xorg layer(Xorg.conf etc.)?

Hi DaneLLL
Sorry for the previous post, we foud nveglglessink still have screen tearing problem and the tearing occurs at the same position of the screen.Follwing is our test result:
1.

gst-launch-1.0 filesrc location=/home/nvidia/tearing-test.mp4 ! decodebin ! videoconvert ! textoverlay font-desc="Sans, 12" ! nvoverlaysink
 No screen tearing
gst-launch-1.0 filesrc location=/home/nvidia/tearing-test.mp4 ! decodebin ! videoconvert ! textoverlay font-desc="Sans, 12" ! xvimagesink
 Screen tearing and the tearing positon moving periodically
gst-launch-1.0 filesrc location=/home/nvidia/tearing-test.mp4 ! decodebin ! videoconvert ! textoverlay font-desc="Sans, 12" ! nveglglessink
Screen tearing at the same postion

Hi,
Please run with speficic omxh264dec:

$ gst-launch-1.0 filesrc location=/home/nvidia/tearing-test.mp4 ! qtdemux ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw ! textoverlay font-desc="Sans, 12" ! nvvidconv ! nvegltransform ! nveglglessink

If the issue can be reproduced, please attach tearing-test.mp4 so that we can try it on r28.2.1.

Qt and xvimagesink are from 3rdparty and hope others can help you out.

Hi DaneLLL
Thank you for help,this issue can be reproduced by the following command:

in serial console:
sudo service lightdm stop
sudo /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch

in another console:
export DISPLAY=:0
gst-launch-1.0 filesrc location=/home/nvidia/tearing-test.mp4 ! qtdemux ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw ! textoverlay font-desc="Sans, 12" ! nvvidconv ! nvegltransform ! nveglglessink

We are in china, we upload the test video on baidu net disk, if you can not download the file, please let us know, we will try other way. Thanks very much for your help!

url: https://pan.baidu.com/s/16tvWOQ_JUKiZYxv7caWbig

password: ka5v

Hi liukejob,

We can’t access baidu page.
Please help upload on other side. Thanks!

1 Like

Hi carolyuu
Thanks very much for your reply, we upload the file to github: https://github.com/liukejob/tx2-tearing-test.git
If you still could not download the file please let us know, thanks for your help

Hi liukejob,

Please add below line in /etc/X11/xorg.conf:

Option "ForceFullCompositionPipeline" "on"

Reboot device and test again. Thanks!

Hi carolyuu
Thanks for your reply, Now for one camera image collection the nveglglessink, xvimagesink and qv4l2 have no screen tearing issuse.
Our use case is to collect 10 camera data, and do some image fusion algorithm, we found that there is still some randomly screen tearing problem.Could you give us some guidance of how to debug this problem? Thanks!

Hi liukejob,

If you are not stop lightdm and just run the command, can you reproduce tearing issue?

Thanks!

Hi carolyuu
Thanks very much for your help. We foud that with lightdm startup screen tearing does not occur even if the xrog.conf file is not modified. we open 10 gstreamer to display the tearing-test.mp4 with xvimagesink no screen tearing is found.

Hi,
The default bsp is with lightdm on and we don’t have much experience in running the system with lightdm off.
Please check if there is other options which can be added into xorf.conf to help your case.
Other users may share experiences.