Bug 499372

Summary: kclockd wakes up the dGPU and keeps it on after sounding a timer alert
Product: [Applications] KClock Reporter: Valeri <v19930312>
Component: GeneralAssignee: Devin Lin <espidev>
Status: REPORTED ---    
Severity: normal CC: hanyoung, liujustin604
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Valeri 2025-02-01 00:10:51 UTC
SUMMARY
On an AMD iGPU + Nvidia dGPU setup when a timer goes off dGPU wakes up and won't power off until kclockd is killed.

STEPS TO REPRODUCE
1. Set a timer
2. Wait for it to go off
3. Dismiss the alarm

OBSERVED RESULT
The dGPU wakes up and does not go back to powered down state; manually stopping kclockd fixes the issue.

EXPECTED RESULT
The dGPU remains powered down the entire time

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION
I've suspected this may be somehow related to libva-nvidia-driver, but the issue persists after removing the packet in question.
Comment 1 liujustin604 2025-07-08 02:36:29 UTC
This problem has been annoying me for a bit so I tried investigate the problem
the issue is with QMediaPlayer, it wakes the dGPU

MRE:

#include <QCoreApplication>
#include <QMediaPlayer>
#include <QAudioOutput>
#include <QDebug>
#include <QUrl>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    
    QMediaPlayer player;

    return a.exec();
}


liujustin604@fedora:~/misc/kclock$ cd build
liujustin604@fedora:~/misc/kclock/build$ cat /sys/bus/pci/devices/0000:64:00.0/power/runtime_status
suspended
liujustin604@fedora:~/misc/kclock/build$ ./test_player &
[1] 79418
liujustin604@fedora:~/misc/kclock/build$ qt.multimedia.ffmpeg: Using Qt multimedia with FFmpeg version 7.1.1 GPL version 3 or later

liujustin604@fedora:~/misc/kclock/build$ cat /sys/bus/pci/devices/0000:64:00.0/power/runtime_status
active
liujustin604@fedora:~/misc/kclock/build$ pkill test_player
liujustin604@fedora:~/misc/kclock/build$ 
[1]+  Terminated              ./test_player
liujustin604@fedora:~/misc/kclock/build$ cat /sys/bus/pci/devices/0000:64:00.0/power/runtime_status
suspended
Comment 2 Devin Lin 2025-07-08 04:40:28 UTC
Hello, thank you for doing some detective work here! I unfortunately don't have a hybrid GPU setup to be able to test this.

This is worrying, it might a bug then with QMediaPlayer? Timers currently play their notification sounds through KNotifications, so this could be a broader issue for any other app that plays notification sounds. 

Can any of you having this issue please try playing a video with Dragon Player (KDE app) and see if it also has this issue? It also uses QMediaPlayer.
Comment 3 hanyoung 2025-07-08 13:32:59 UTC
> Timers currently play their notification sounds through KNotifications, so this could be a broader issue for any other app that plays notification sounds.

I think we use QMediaPlayer for both Alarm and Timer?
Comment 4 liujustin604 2025-07-08 21:59:10 UTC
Dragon player does not seem to wake up the dgpu, at least not this version:
Dragon Player: 25.04.3
KDE Frameworks: 6.15.0
Qt: Using 6.9.1 and built against 6.9.1
Fedora Linux 42 (KDE Plasma Desktop Edition) (Wayland)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.15.4-cachyos1.fc42.x86_64

also yes in alarmplayer.cpp a QMediaPlayer is created

incase you needed it, CMakeLists.txt for test_player:

cmake_minimum_required(VERSION 3.16)
project(TestPlayer)

find_package(Qt6 COMPONENTS Core Multimedia REQUIRED)

add_executable(test_player test_player.cpp)

target_link_libraries(test_player Qt6::Core Qt6::Multimedia)

set(CMAKE_AUTOMOC ON)