Direct Scanout not working on Hybrid Laptop (AMD/Nvidia)

Description

So Direct Scanout is not working on KDE/Gnome when you use dGPU Nvidia to render the game, but works on igpu (radeon) but it works fine If i have Intel IGPU and Nvidia DGPU, only not working with AMD Configuration

More information is here

Regression

Works with Intel/Nvidia configuration but doesn’t work for Amd/Nvidia configuration

Step for reproduction

1- Run the game on Nvidia dgpu (prime-run) on the laptop with amd igpu

2- qdbus org.kde.KWin /KWin showDebugConsole Type this in console, maybe qdbus6 for newer system

3- Go to effects tab and enable showcompositing

4- Check if the Compositing on top right goes away or no, if no mean direct scanout not working

5- Work when the game is run on igpu

System information

╰─❮ inxi -GSC -xx
System:
  Host: syntist-laptop Kernel: 6.19.3-2-cachyos arch: x86_64 bits: 64
    compiler: clang v: 21.1.8
  Desktop: KDE Plasma v: 6.6.0 tk: Qt v: N/A wm: kwin_wayland dm: SDDM
    Distro: CachyOS base: Arch Linux
CPU:
  Info: 6-core model: AMD Ryzen 5 6600H with Radeon Graphics bits: 64
    type: MT MCP arch: Zen 3+ rev: 1 cache: L1: 384 KiB L2: 3 MiB L3: 16 MiB
  Speed (MHz): avg: 3676 min/max: 413/4566 boost: enabled cores: 1: 3676
    2: 3676 3: 3676 4: 3676 5: 3676 6: 3676 7: 3676 8: 3676 9: 3676 10: 3676
    11: 3676 12: 3676 bogomips: 79050
  Flags-basic: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a
    ssse3 svm
Graphics:
  Device-1: NVIDIA GA107M [GeForce RTX 3050 Mobile] vendor: Lenovo
    driver: nvidia v: 590.48.01 arch: Ampere pcie: speed: 16 GT/s lanes: 8
    ports: active: none empty: HDMI-A-1 bus-ID: 01:00.0 chip-ID: 10de:25a2
  Device-2: Advanced Micro Devices [AMD/ATI] Rembrandt [Radeon 680M]
    vendor: Lenovo driver: amdgpu v: kernel arch: RDNA-2 pcie: speed: 16 GT/s
    lanes: 16 ports: active: DP-2,eDP-1 empty: DP-1, DP-3, DP-4, DP-5, DP-6,
    DP-7, DP-8, Writeback-1 bus-ID: 06:00.0 chip-ID: 1002:1681 temp: 56.0 C
  Device-3: Chicony Integrated Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 bus-ID: 1-3:2 chip-ID: 04f2:b6c2
  Display: wayland server: X.org v: 1.21.1.21 with: Xwayland v: 24.1.9
    compositor: kwin_wayland driver: gpu: amdgpu d-rect: 4480x2520 display-ID: 0
  Monitor-1: DP-2 pos: primary,top-left model: Acer EI322QUR res: 2560x1440
    hz: 165 dpi: 93 diag: 806mm (31.7")
  Monitor-2: eDP-1 pos: bottom-r model: Lenovo 0x9059 res: 1920x1080 hz: 120
    dpi: 142 diag: 395mm (15.5")
  API: EGL v: 1.5 platforms: device: 0 drv: nvidia device: 1 drv: radeonsi
    device: 3 drv: swrast gbm: drv: kms_swrast surfaceless: drv: nvidia wayland:
    drv: radeonsi x11: drv: radeonsi inactive: device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 26.1.0-devel
    glx-v: 1.4 direct-render: yes renderer: AMD Radeon 660M (radeonsi rembrandt
    ACO DRM 3.64 6.19.3-2-cachyos) device-ID: 1002:1681 display-ID: :0.0
  API: Vulkan v: 1.4.341 surfaces: N/A device: 0 type: integrated-gpu
    driver: mesa radv device-ID: 1002:1681 device: 1 type: discrete-gpu
    driver: nvidia device-ID: 10de:25a2 device: 2 type: cpu
    driver: mesa llvmpipe device-ID: 10005:0000
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
    de: kscreen-console,kscreen-doctor gpu: lact, nvidia-settings, nvidia-smi,
    radeontop wl: wayland-info x11: xdpyinfo, xprop, xrandr

Also created an issue on the kernel side,

because according to the comment on Mesa suggested direct scanout is handle on kernel level so it can be the issue on kernel.

Update on the Mesa Bug report, Xaver suggesting it on the side of nvidia driver. So need to be fixed on nvidia side.