Bug 464800

Summary: krfb pw framebuffer screen record will make kwin_wayland eat 1 cpu core
Product: [Applications] krfb Reporter: azurit3
Component: generalAssignee: George Goldberg <grundleborg>
Status: REPORTED ---    
Severity: normal CC: aleixpol, nate
Priority: NOR Keywords: wayland-only
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description azurit3 2023-01-25 15:12:34 UTC
My HTPC with a J5005-ITX motherboard has a Pentium Silver J5005 CPU.
I notice when krfb pw-framebuffer is screen recording, if I open some application or play some video that changes the desktop content, it will make kwin_wayland process eat 1 cpu core redrawing. if this is normal cpu usage, it would be nice an option to reduce cpu usage for a lower video quality.

I installed vaapi and vulkan drivers that should help with encoding.
# vainfo
Trying display: wayland
vainfo: VA-API version: 1.17 (libva 2.17.1)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.0 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
Comment 1 Aleix Pol 2023-01-25 15:52:57 UTC
Which version of krfb are you running? Under which distribution?

Do you see a similar problem if screen sharing with e.g. OBS or the web browser?
Comment 2 Vlad Zahorodnii 2023-01-26 09:47:45 UTC
.
Comment 3 azurit3 2023-01-26 11:43:16 UTC
(In reply to Aleix Pol from comment #1)
> Which version of krfb are you running? Under which distribution?
> 
> Do you see a similar problem if screen sharing with e.g. OBS or the web
> browser?

Archlinux and krfb version 22.12.1
Using https://mozilla.github.io/webrtc-landing/gum_test.html Screen capture, kwin_wayland will use less CPU than krfb pw that will eat 1 cpu core, but I notice firefox using more CPU distributed by the 4 cpu cores, perhaps firefox will encode video too.
It's a krfb bug?
Comment 4 Vlad Zahorodnii 2023-01-27 09:36:29 UTC
> It's a krfb bug?

Yes, it sounds like krfb doesn't use dmabuf, so kwin has to fall back to shm, which is cpu intensive.