GhostNaN / mpvpaper

A video wallpaper program for wlroots based wayland compositors.
GNU General Public License v3.0
765 stars 24 forks source link

mpvpaper dropping entire frame #73

Closed Linkachus17 closed 3 months ago

Linkachus17 commented 3 months ago

Often times when mpvpaper will drop the entire frame for no reason few second after it's running. Is the video file too big for mpvpaper to handle? (~50mb) or is there incorrect Wayland configuration? (like kernel config) Restarting mpvpaper can fix the issue but then again I have to kill mpvpaper and start mpvpaper many times before it can run just fine Just for testing since mpvpaper uses mpv, I ran the video on mpv and mpv has no issue playing the video

V: 00:00:00 / 00:00:19 (3%)[*] MPV is ready to render the next frame for eDP-1
[*] MPV is ready to render the next frame for eDP-1
[*] MPV is ready to render the next frame for eDP-1
[*] MPV is ready to render the next frame for eDP-1
V: 00:00:03 / 00:00:19 (17%) Dropped: 174
[*] Exiting mpvpaper
[!] Failed to quit mpv
GhostNaN commented 3 months ago

Often times when mpvpaper will drop the entire frame for no reason few second after it's running.

This looks exactly like the issue I saw when I was experimenting with getting the NVIDIA GPU proprietary driver to work. Although, I thought I was able to work around that issue with this: https://github.com/GhostNaN/mpvpaper/commit/408092d371fd1ec772d5297da429540520d77ba6 One thing is clear, because of the "Failed to quit mpv" error. That means the render loop must of got stalled and it's likely that there's more to do on how the polling is done.

Is the video file too big for mpvpaper to handle?

No. In almost all cases if it can run on mpv normally, it should run about the same with mpvpaper.

or is there incorrect Wayland configuration? (like kernel config)

I have no idea what you are referring to, but it's very unlikely the kernel is involved.

I need more info. What GPU and driver are you running? Are you sure you are running the latest version or master branch? What WM (Window Manager) or DM (Display Manager) are you using?

Linkachus17 commented 3 months ago

Sorry for not providing system info before, and yes I am currently using the latest version of mpvpaper (as of the day I report) OS: Arch Linux Kernel: 6.9.7-arch1-1 GPU: NVIDIA GTX 1660Ti Mobile WM: Hyprland

GhostNaN commented 3 months ago

I can't seem to replicate this issue on a laptop that has a NVIDIA GPU. I sort of understand why it's happening, but it's hard to find a fix or even a workaround when I'm flying blind here. NVIDIA pro drivers have always been troublesome because how they differ from the open source ones.

With all that being said I may have found a fix that I would like for you to try. Please compile and run below: mpvpaper_fix.zip I added wl_display_prepare_read() and wl_display_cancel_read() per instructions from: https://wayland.freedesktop.org/docs/html/apb.html#Client-classwl__display_1a30a9c4f020f3e77581c7a81ecdb4913d

Also just curious, is this only happening to 1 video or all the videos you play?

Linkachus17 commented 3 months ago

Still same. Although I wanna blame Hyprland because it run just fine until I start moving my mouse, that's when mpvpaper start to dropping frames. Tried on other videos, also same result Can't make a video how it happen atm because my portal is a little broken

GhostNaN commented 3 months ago

Although I wanna blame Hyprland because it run just fine until I start moving my mouse

The good news is that's easy to test. You could run Hyprland with a near blank config. Or try running Sway, as that is also wlroots based.

That way you could see if it's a setup issue or a WM issue.

Linkachus17 commented 3 months ago

So I tried using Sway with default config, and mpvpaper runs just fine with no drops. Meanwhile Hyprland with also default config still have this frame dropping issue on mpvpaper

GhostNaN commented 3 months ago

I was able to replicate the issue by running mpvpaper with prime-run on Hyprland. It took a while, but I believe this is now solved with this commit: https://github.com/GhostNaN/mpvpaper/commit/ec48b980401c3dad4e3d6e8ac2f0e5dc3fdebaf5

Go ahead and compile from master and report back please.

Linkachus17 commented 3 months ago

Okay, seems like the new commit fixed the issue on Hyprland

GhostNaN commented 3 months ago

Glad to hear that!

Hopefully that's the last I'll hear of NVIDIA cards not working...