<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>495287</bug_id>
          
          <creation_ts>2024-10-24 08:38:49 +0000</creation_ts>
          <short_desc>PipeWire Screen Capture Freezes Fullscreen Target Applications</short_desc>
          <delta_ts>2025-02-10 20:43:21 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>screencasting</component>
          <version>6.2.5</version>
          <rep_platform>Arch Linux</rep_platform>
          <op_sys>Other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="dream">dreamsyntax</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>itsforspam99</cc>
    
    <cc>jc40477</cc>
    
    <cc>kocelfc</cc>
    
    <cc>light.bed3900</cc>
    
    <cc>linx.system.adm</cc>
    
    <cc>nate</cc>
    
    <cc>postnozet</cc>
    
    <cc>richmond-robinson</cc>
    
    <cc>traceydick</cc>
    
    <cc>ttthwvezrjdmeldtud</cc>
    
    <cc>xaver.hugl</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/kwin/-/commit/45a5d8844b36404334301f5da6e75f1a345e0c80</cf_commitlink>
          <cf_versionfixedin>6.3.0</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2368787</commentid>
    <comment_count>0</comment_count>
    <who name="dream">dreamsyntax</who>
    <bug_when>2024-10-24 08:38:49 +0000</bug_when>
    <thetext>SUMMARY
Performing a PipeWire screen capture that invokes Portal is freezing the targeted Window if a Window is selected rather than the whole screen, but only for devices with two GPUs where the secondary GPU is being used to render the target Window. kwin 6.1.2 does not have the issue. All newer versions experience this bug.

STEPS TO REPRODUCE
On a computer with two GPUs (such as a laptop) running Wayland (iGPU &amp; dGPU) with &quot;obs-studio&quot; installed...
1. Launch any fullscreen application where the secondary GPU will be used (ex use prime-run). In my own tests, I use dolphin-emu, pick my dGPU in Graphics configuration, use Vulkan as backend, launch a process, then Alt+Enter to full screen the application.
2. Launch OBS Studio
3. Create a new source &quot;Screen Capture (PipeWire)&quot;
4. Open this source and select &quot;Open Selector&quot;
5. When Portal appears, select &quot;Windows&quot; and select your fullscreen application.
6. Immediately the target application should freeze/halt - no frames will be generated. Triggering focus/unfocus on the window with alt-tab will sometimes unfreeze the application.
7. Close OBS / stop the PipeWire capture - the application will unfreeze.

OBSERVED RESULT
An OBS PipeWire &apos;Windows&apos; capture freezes target applications if on Wayland with dGPU on kwin 6.2.2

EXPECTED RESULT
An OBS PipeWire &apos;Windows&apos; capture properly can view the window, and the target application is not frozen. kwin 6.1.2 is the last version where this works as expected.

SOFTWARE/OS VERSIONS
Operating System: CachyOS Linux
KDE Plasma Version: 6.2.2
KDE Frameworks Version: 6.7.0
Qt Version: 6.8.0
Kernel Version: 6.6.57-2-cachyos-lts (64-bit)
Graphics Platform: Wayland
Processors: 32 × 13th Gen Intel® Core™ i9-13900HX
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® Graphics (iGPU) &amp; NVIDIA GeForce RTX 4080 (dGPU)

ADDITIONAL INFORMATION
I noticed another user reported the exact same issue on an unrelated forum. I did not see this reported on KDE bugtracker, which led me to opening this.
https://forum.endeavouros.com/t/screen-freezing-in-fullscreen-apps-using-prime-run/61880

It is worth noting additionally similar weird behavior was observed on kwin versions 6.1.3-6.2.0 on a Desktop with one GPU. Though the freezing occurred if a target application would hide the mouse cursor. At one point the freezing was flipped to only occur if the mouse was shown, and not freeze when hidden. However I can not reproduce any such freezing for single GPU case as of 6.2.2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2369334</commentid>
    <comment_count>1</comment_count>
    <who name="Oleh">postnozet</who>
    <bug_when>2024-10-26 09:39:32 +0000</bug_when>
    <thetext>I have exactly the same issue, but on PC with one GPU

Additionally freezing does not occur if I do one of these:
1. Drag OBS Studio window (or other capture app) to the another monitor
2. Enable HDR or change color profile in KDE settings

My setup:
CPU - Ryzen 5600X
GPU - Radeon 6800XT
KDE Plasma version - 6.2.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2370059</commentid>
    <comment_count>2</comment_count>
    <who name="WheatMcGrass">richmond-robinson</who>
    <bug_when>2024-10-29 01:10:17 +0000</bug_when>
    <thetext>I can confirm that I can reproduce the same issue, though on a system with only one GPU.
Occurs when capturing a window with OBS and with Vesktop.

# Specs:
Operating System: Fedora Linux 40
KDE Plasma Version: 6.2.2
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.11.4-201.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 31.2 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2372455</commentid>
    <comment_count>3</comment_count>
    <who name="dream">dreamsyntax</who>
    <bug_when>2024-11-07 00:05:06 +0000</bug_when>
    <thetext>Confirmed issue persists on kwin 6.2.3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2381677</commentid>
    <comment_count>4</comment_count>
    <who name="Jonah Jones">jc40477</who>
    <bug_when>2024-12-16 01:29:45 +0000</bug_when>
    <thetext>I&apos;m experiencing this issue also while trying to stream a game on discord or with obs. 

I can capture the full desktop or windowed applications fine, and the application is still responsive if I run it in gamescope. Let me know if there&apos;s any debug or additional info that&apos;d be helpful to provide

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.12.4-zen 
Graphics Platform: Wayland
Graphics: NVIDIA GeForce RTX 3080</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2383363</commentid>
    <comment_count>5</comment_count>
    <who name="dream">dreamsyntax</who>
    <bug_when>2024-12-22 21:08:59 +0000</bug_when>
    <thetext>Kwin version 6.2.4-4 still has the same problem too.

I also notice on single GPU (my desktop) I am running into similar issues when capturing a Window directly if the app hides the mouse cursor.
The target window will be frozen (not just in the recording- the actual application) while the Window is being captured and the mouse hides itself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2386777</commentid>
    <comment_count>6</comment_count>
    <who name="dream">dreamsyntax</who>
    <bug_when>2025-01-04 05:30:48 +0000</bug_when>
    <thetext>Reproduced in 6.2.5-2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2387336</commentid>
    <comment_count>7</comment_count>
    <who name="">ttthwvezrjdmeldtud</who>
    <bug_when>2025-01-07 01:35:44 +0000</bug_when>
    <thetext>Experiencing this bug too, specifically with VESKTOP (Flatpack).

Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.12.7-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 7600 6-Core Processor
Memory: 30.5 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 4060/PCIe/SSE2
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: B650M C V2-Y1
System Version: -CF</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2387877</commentid>
    <comment_count>8</comment_count>
    <who name="">light.bed3900</who>
    <bug_when>2025-01-08 23:58:03 +0000</bug_when>
    <thetext>I&apos;m also experiencing this on my single-GPU system. It seems to only occur when capturing a specific window via PipeWire - other methods of capture (e.g. PipeWire full screen capture, OBS Game Capture), function as expected. 

Operating System: Nobara Linux 41
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.12.7-200.fsync.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 5950X 16-Core Processor
Memory: 31.2 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 4090/PCIe/SSE2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2388114</commentid>
    <comment_count>9</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2025-01-09 18:48:38 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6980</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2388364</commentid>
    <comment_count>10</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2025-01-10 13:43:30 +0000</bug_when>
    <thetext>Git commit b1031ea63eaa8c9bf5c70157d1b6bf8eb0f5a74a by Xaver Hugl.
Committed on 10/01/2025 at 12:36.
Pushed by zamundaaa into branch &apos;master&apos;.

plugins/screencast: call ItemRenderer::begin/endFrame

The OpenGL renderer references the explicit sync release points for client buffers
during rendering, and releases them in endFrame. If endFrame never gets called though
(for example because we&apos;re doing direct scanout) then the release points never get
signaled, and the client very quickly runs out of buffers to use and freezes.

M  +2    -2    src/plugins/screencast/windowscreencastsource.cpp

https://invent.kde.org/plasma/kwin/-/commit/b1031ea63eaa8c9bf5c70157d1b6bf8eb0f5a74a</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2388453</commentid>
    <comment_count>11</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2025-01-10 17:38:05 +0000</bug_when>
    <thetext>Git commit 45a5d8844b36404334301f5da6e75f1a345e0c80 by Xaver Hugl.
Committed on 10/01/2025 at 13:45.
Pushed by zamundaaa into branch &apos;Plasma/6.3&apos;.

plugins/screencast: call ItemRenderer::begin/endFrame

The OpenGL renderer references the explicit sync release points for client buffers
during rendering, and releases them in endFrame. If endFrame never gets called though
(for example because we&apos;re doing direct scanout) then the release points never get
signaled, and the client very quickly runs out of buffers to use and freezes.


(cherry picked from commit b1031ea63eaa8c9bf5c70157d1b6bf8eb0f5a74a)

Co-authored-by: Xaver Hugl &lt;xaver.hugl@gmail.com&gt;

M  +2    -2    src/plugins/screencast/windowscreencastsource.cpp

https://invent.kde.org/plasma/kwin/-/commit/45a5d8844b36404334301f5da6e75f1a345e0c80</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2396575</commentid>
    <comment_count>12</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2025-02-10 20:43:21 +0000</bug_when>
    <thetext>*** Bug 499776 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>