LGFae / swww

A Solution to your Wayland Wallpaper Woes
GNU General Public License v3.0
2.37k stars 70 forks source link

Considerable GPU usage during switching animation #255

Open SchrodingerZhu opened 7 months ago

SchrodingerZhu commented 7 months ago

image

I set swww to change the wallpaper every 30 seconds. And it successfully make my both cards busy.

#!/bin/bash

# This script will randomly go through the files of a directory, setting it
# up as the wallpaper at regular intervals
#
# NOTE: this script is in bash (not posix shell), because the RANDOM variable
# we use is not defined in posix

if [[ $# -lt 1 ]] || [[ ! -d $1   ]]; then
        echo "Usage:
        $0 <dir containing images>"
        exit 1
fi

# Edit below to control the images transition
export SWWW_TRANSITION_FPS=60
export SWWW_TRANSITION_STEP=2

# This controls (in seconds) when to switch to the next image
INTERVAL=30

while true; do
        find "$1" -type f \
                | while read -r img; do
                        echo "$((RANDOM % 1000)):$img"
                done \
                | sort -n | cut -d':' -f2- \
                | while read -r img; do
                        swww img "$img"
                        sleep $INTERVAL
                done
done

BTW, I found this when I was playing DDNet with swww running in the background. It freezes the game every 30 seconds.

SchrodingerZhu commented 7 months ago

Wallpapers are from https://github.com/RumiAxolotl/hyprland-config/tree/main/wallpapers. They are not huge pics.

LGFae commented 7 months ago

We do not use the GPU in any capacity in swww. All the animations and transitions are done with the CPU. The work you observe in the GPU must be inside the compositor's renderer.

Seeing as you have an NVIDIA card, there's probably some shenanigans abound. There should be no world where the GPU is doing more work than the CPU. The GPU literally just needs to display a static image at every frame. Its work is trivial.

shot-codes commented 5 months ago

I experience this as well, alongside framedrop across the board during the animation with hyprland, running on intel integrated graphics. If I disable opacity and blur then it improves, but I still experience some frame drop.

Perhaps the GPU usage could come from all of blur updates as the background changes. Whats odd is my setup performed just fine some months ago, after a week or so not on the computer it was there. I suppose its also possible I just hadn't noticed it before but doubtful.

shot-codes commented 5 months ago

https://github.com/LGFae/swww/issues/233#issuecomment-2015516580 -- swww-daemon --format xrgb seems to solve my framerate issue.