psieg / Lightpack

Lightpack and Prismatik open repository
GNU General Public License v3.0
1.57k stars 189 forks source link

Flickering on Linux Mint 20.2 Cinnamon #488

Open RafaelKr opened 3 years ago

RafaelKr commented 3 years ago

Hi, I've been expiriencing some flickering on my Linux Mint 20.2 Cinnamon.

image

I think it's similar as described in #325 I used the build from https://github.com/psieg/Lightpack/issues/325#issuecomment-619396283 to debug and noticed the flickering comes from frames like this: frame_116

I created a zip archive with some more frames (13-120). The following frames are similar to the one shown above (116): 57, 65, 68, 107, 116, 119

I mostly notice it when watching fullscreen movies, but it also happens when not in fullscreen.

BTW the build I used is also "laggy" as described in https://github.com/psieg/Lightpack/issues/325#issuecomment-619409110, but the other builds didn't produce frames in /tmp/priz

Edit: I already had this behavior with the default settings but tried to tweak it. Currently I use the following settings: Baud rate 256000, 117 LEDs, Grab interval 18ms

I don't have this flickering on Windows.

zomfg commented 3 years ago

try this

RafaelKr commented 3 years ago

The problem persists unfortunately. What kind of build is that? The download link looks interesting as it has 5.11.2.24 in the path but the version in the filename is 5.11.2.29. Also it says Prismatik: 5.11.2.29 rev. 9e0d7edd in the terminal.

zomfg commented 3 years ago

it's master with semi random x11 tweaks anything different in logs?

how about this one?

RafaelKr commented 3 years ago

Are there special log files or just the terminal output?

18:54:42:568 Debug: using qt5ct plugin
/home/rafael/coding/playground/Prismatik/main.conf
Unportable version
Configuration directory: /home/rafael/.Prismatik
18:54:42:593 Debug: Prismatik: 5.11.2.29 rev. 9e0d7edd
18:54:42:593 Debug: Build with Qt verison: 5.12.8
18:54:42:593 Debug: Qt version currently in use: 5.12.8
18:54:42:593 Debug: Running on: "Linux Mint 20.2"
18:54:42:602 Debug: D-Bus system tray: yes
18:54:42:718 Debug: Start main event loop: lightpackApp.exec();
18:54:42:767 Warning: void GrabManager::onGrabApplyBlueLightReductionChanged(bool) could not create Blue Light Reduction client
18:54:42:786 Critical: virtual bool X11Grabber::reallocate(const QList<ScreenInfo>&) failed attach

It's still flickering. Not sure if it's Prismatiks fault. Could also be related to the Cinnamon DE.

Can you reproduce it on your side? Maybe when booting the Live system of Linux Mint? Can be run by just downloading the ISO and put it on a bootable USB device: https://linuxmint.com/edition.php?id=288 BTW there is this great OSS project named ventoy to create bootable USB devices. You then can just copy ISO files onto it and select which ISO you want to boot.

If you want I can try to reproduce it on the live system.

zomfg commented 3 years ago

Are there special log files or just the terminal output?

terminal is fine

It's still flickering. Not sure if it's Prismatiks fault. Could also be related to the Cinnamon DE.

hard to say, the common thing seems to be nvidia gpu (which i don't have access to) on intel igpu and in vms it works fine on my side and i tried different distros over time

RafaelKr commented 3 years ago

You're last build leaves the Arduino (or better the /dev/ttyUSB0) in a "device or resource busy" state. I have to relogin to make it work again.

Interestingly the latest release flickering is bright flashes. With Prismatik_5.11.2.29_xsync_b I sometimes get dark flashes.

If you want we can chat on Discord (or something similiar). We can debug the source code directly on my PC.

Edit: nvm, I also have some black flashes with the latest release.

zomfg commented 3 years ago

nah I have no idea what I'm doing with X11, at this point I'm just looking at similar (to Software/grab/X11Grabber.cpp) code snippets and trying very minor differences (they are all pretty much the same), and at this point I don't know... try anything related to vsync in drivers/DE/compositor

RafaelKr commented 3 years ago

I just tried out Hyperion and get the same flashing there. It seems to be even worse. Also Prismatik was easier to setup and I prefer how Prismatik displays the colors.

zomfg commented 3 years ago

yeah it has pretty much the same x11 capture code you could also try SSR and see if you get bad frames with x11

RafaelKr commented 3 years ago

Thanks for the suggestion. There are also bad frames in ssr recordings.

Google led me to this thread saying the inbuilt cinnamon recorder doesn't have the flicker problem. I found the source code to it here: https://github.com/linuxmint/cinnamon/blob/master/src/cinnamon-recorder.c

I'll also try if I can find similar settings he used in his xorg.conf working with my NVIDIA card in the next days.

zomfg commented 3 years ago

Google led me to this thread saying the inbuilt cinnamon recorder doesn't have the flicker problem. I found the source code to it here: https://github.com/linuxmint/cinnamon/blob/master/src/cinnamon-recorder.c

built on GDK...probably too high level for the purpose

I'll also try if I can find similar settings he used in his xorg.conf working with my NVIDIA card in the next days.

your best bet for now, that same reddit thread mentioned nvidia setting (flipping) also similar thing here MaartenBaert/ssr#888 if even big projects such as ffmpeg and OBS (as per that reddit thread) have trouble with this, it's probably not a simple/possible universal fix...

RafaelKr commented 3 years ago

@zomfg There is also the possibility to grab the screen directly with Qt. Do you know why this project uses an X11 grabber instead of using the Qt way of grabbing the screen?

https://doc.qt.io/qt-5/qscreen.html#grabWindow

With the following you should be able to grab one screen:

QScreen *screen = QGuiApplication::primaryScreen();
QPixmap pixmap = screen->grabWindow(0);

and you would be able to do this for every screen.

If there is nothing speaking against this method (so if you didn't try that yet) I MAYBE can try if I can get a basic PoC grabber working using that method. Probably I'll never find the time to do it in the near future, but maybe I do - don't know yet.

zomfg commented 3 years ago

Prismatik (and a lot of others) uses XShm for fast capture under X11, I don't think Qt does the next best thing is probably whatever is native to the GPU (nvfbc etc) also don't know much about wayland situation these days