ros2 / rviz

ROS 3D Robot Visualizer
BSD 3-Clause Clear License
302 stars 213 forks source link

rviz2 major screen flickering/tearing #1079

Open fprott opened 1 year ago

fprott commented 1 year ago

Hello,

As the following video shows I experience a critical bug with rviz2. The screen is flickering/tearing even when not displaying any data. This will happen even if I don't resize!

Basically as soon as I start rviz2 I get the following flickering only inside the 3D scene (not the surrounding tools!).

https://github.com/ros2/rviz/assets/24491505/f4c81b15-5d3f-4149-a52a-ae4f48401249

This is NOT a monitor issue, this recording was not filmed off the monitor but I used a screen-grabbing software.

Now it appears to be a frame rate issue. When I play around with the frame rate, then save that option and then restart rviz the bug will no longer appear till I resize or switch out of the window in any way. I suspect that on the time of resizing rviz forgets the frame rate?

So I suspect the problem is that Compositor is at fault. It turns out that if I unset the option "Allow applications to block compositing", as seen in the attached screenshot, the problem will no longer appear till the window is resized. So Compositor can't properly work?

image

Anyway, with this remedy I can make RVIZ2 barely usable but it is not really a good experience. Without it this is totally system breaking and might cause epilepsy or something.

My specs: ros: iron cpu: i9-13900HX monitor: ASUS VG34V gpu: NVIDIA GeForce RTX 4080 Laptop GPU/PCIe/SSE2 VGA compatible controller: NVIDIA Corporation Device 27e0 (rev a1) NVRM version: NVIDIA UNIX x86_64 Kernel Module 530.41.03 Thu Mar 16 19:48:20 UTC 2023

sloretz commented 1 year ago

Does this happen with any other OpenGL windows? It seems like something that might be a bug with wayland or X11 or the QT version on the system.

mw46d commented 9 months ago

Same problem:-( CPU: i9-13980HX GPU: NVIDIA GPU NVIDIA RTX 2000 Ada Generation Laptop GPU Kubuntu 22.04 & Humble fully updated (running X-server) Nvidia driver: 545.29.06

glmark2 (defaults to Mesa/Intel GPU) works fine __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glmark2 (to force the nvidia GLX/GL implementation) works as well

rviz2 and __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia rviz2 both show the flickering:-(

With LD_DEBUG=files ..., you can actually see, which shared libraries are loaded 'during startup' of the process;-)

Addition 20240201: Can anybody seeing this problem check if they have 'screen scaling' enabled?! For me, when I have QT_SCREEN_SCALE_FACTORS=eDP-1=1.75;DP-1-1.3=1.75;DP-1-0=1.75;DP-1-1=1.75;DP-1-2=1.75;DP-1-3=1.75;HDMI-1-0=1.75; in the environment, rviz2 flickers. But starting a new shell, un-setting QT_SCREEN_SCALE_FACTORS and starting rviz2 in there, I did not see the flickering yet. That would point to some QT issue ?! But with a sample of one, it's hard to know:-(

Maybe https://github.com/flameshot-org/flameshot/issues/564#issuecomment-1466427552 is related?!

DerProfessor commented 8 months ago

For me it works to set QT_SCREEN_SCALE_FACTORS=1 before running rviz2. This seems to be related to #1052.

mw46d commented 8 months ago

Yeah;-) or setting it to '1' archives the same thing. No scaling for HighRes monitors. I created a little rviz2 script, so I don't forget;-)

#!/usr/bin/bash

unset QT_SCREEN_SCALE_FACTORS
exec /opt/ros/$ROS_DISTRO/bin/rviz2 "$@"
macmacal commented 8 months ago

I had similar flickering problems on Kubuntu 22.04 on laptop Lenovo Legion Pro7 (Ryzen 9 7945HX RTX 4080).

After disabling the integrated AMD graphics I run into a problem with the global scale on Qt applications (which seems related to this issue). To overcome this I just set the global scale to the minimal value above 100% (i.e. 106,25%):

image

After that modifications RViz2 was still working fine, until some system update for Plasma / ROS Humble packages.

For me it works to set QT_SCREEN_SCALE_FACTORS=1 before running rviz2. This seems to be related to #1052.

This works like a charm, many thanks!

TheRealBeef commented 5 months ago

Interestingly, I have the same issue, but it persists regardless of the DPI setting for me. I also tried setting via commandline the QT_SCREEN_SCALE_FACTORS=1 and also unsetting the scale factors as well.

I'm running Ubuntu 22.04 on a laptop with Nvidia GPU and this happens both in Mate and in KDE desktops although with KDE I can do what's in the original post and stop compositing so it doesn't flicker so long as I don't alter the size of the windows (not sure yet how to do that in Mate).

It flickers not just the world visualization but also any images that are displayed in their own boxes as well.

Frank1126lin commented 5 months ago

Same issue, adjust the display setting screen scale to 1, that problem fixed. But the words get too small to see clearly.

themightyoarfish commented 1 month ago

Same issue with an ubuntu mate install, QT_SCREEN_SCALE_FACTORS=1 did not do anything. Unsetting QT_SCALE_FACTOR solves it, but then UI is too small.