Video tearing: how to set XV_SYNC_TO_VBLANK in nvidia_drv.so

We can’t use nvoverlaysink on two HDMI monitors. One of the monitors turns all red if we do.

Please add Option “TegraReserveDisplayBandwidth” “false” to your xorg.conf for the red screen issue. It is a known issue discussed in many threads.

Section "Device"
    Identifier  "Tegra0"
    Driver      "nvidia"
# Allow X server to be started even if no display devices are connected.
    Option      "AllowEmptyInitialConfiguration" "true"
    Option "TegraReserveDisplayBandwidth" "false"

EndSection

Or you can just disable lightdm for good since the red screen issue comes from lightdm.

Hi unninair & cobrien,

Confirmed we can run the video with two hdmi output without tearing issue.
List our test steps for you reference.

  1. Add Option “TegraReserveDisplayBandwidth” “false” to your xorg.conf (#22 Wayne’s command)
  2. sudo service lightdm restart
  3. Set win_mask
#cd /sys/class/graphics/fb0
# echo 4 > blank
# echo 0x0 > device/win_mask
# echo 0x3 > device/win_mask
# echo 0 > blank   
#cd /sys/class/graphics/fb1
# echo 4 > blank
# echo 0x0 > device/win_mask
# echo 0xc > device/win_mask
# echo 0 > blank
  1. Run below commands
gst-launch-1.0 filesrc location=file3.ts ! tsdemux ! h264parse ! omxh264dec ! nvoverlaysink display-id=0
gst-launch-1.0 filesrc location=file3.ts ! tsdemux ! h264parse ! omxh264dec ! nvoverlaysink display-id=1

Yes, this is correct. We are now able to run nvoverlaysink on all 3 monitors (We
have 2xHDMI and one DSI -> HDMI output). We are running without the window mananger,
and this approach gives us good video quality on all monitors. Running 3 hd, 1 sd,
and 2x videotestsrc (6 streams total) cpu load is very low, 12% total.

Running without lightdm+compiz we would get tearing due to sync to
vblank problems with all video/image sink elements except nvoverlaysink.
Running with lightdm+compiz we would not get tearing but the cpu load
was high and the video jerky due to (we believe) compiz compositing window
manager data transfer.

Thank you for all the help.

More here:

https://devtalk.nvidia.com/default/topic/1042576/problem-with-nvoverlaysink-on-3rd-display-and-with-textoverlay/#5293703

Note that this required us to upgrade from

Tegra186_Linux_R28.1.0_aarch64.tbz2
Tegra_Linux_Sample-Root-Filesystem_R28.1.0_aarch64.tbz2

To

Tegra186_Linux_R28.2.1_aarch64.tbz2
Tegra_Linux_Sample-Root-Filesystem_R28.2.1_aarch64.tbz2

And adding

Option "TegraReserveDisplayBandwidth" "false" to  xorg.conf

To solve the red screen problem when using 2x nvoverlaysink

The version can be checked in xorg.log.

[    55.307] (II) NVIDIA dlloader X Driver  28.2.1  Release Build  (integ_stage_rel)  (buildbrain@mobile-u64-773)  Thu May 17 00:16:09 PDT 2018

Note that the nvoverlaysink seems to use direct frame buffer access, so it will
run without Xorg or lightdm. We are investigating implementing the system this way,
which maximizes the number of xoverlaysink instances that can run (6). This will
provide 1 quad and 2 single stream displays, which is the customer requirement.

Again, thanks for the help.

Cary

Now that the tearing is completely eliminated, another phenomenon has surfaced. When the camera/video is panning from side to side we see jerkiness of the whole image, like it missed a frame or something. This goes away if we enable the SYNC flag - however this adds a few seconds of latency. Is there a way to address this?

Could you share a simple program or other way that can reproduce your issue? If this is not tearing issue anymore, could you file a new topic for it?