tildearrow / kwin-lowlatency

archived - X11 full-screen unredirection and lots'a settings for KWin
373 stars 10 forks source link

feature request: use existing window rules to block unredirect for defined applications #27

Closed aufkrawall closed 2 years ago

aufkrawall commented 5 years ago

It would be nice if it was possible to exclude single programs/windows from auto unredirect, e.g. media players for smooth OSD pop ups etc.

With KWin's given feature set, it is already possible to create rules to prevent single applications from turning off the compositor. Perhaps auto-unredirect could simply honor them as well?

That being said: When a window is unredirected and I press the media volume control buttons of my keyboard, the volume OSD triggers the compositing to be temporarily enabled. This allows transparency and an animation, however it also creates stutter when composting turns on and off. Would it be possible to implement an option to keep compositing also entirely turned off in such situations? It supposedly can also cause issues with FreeSync like flickering.

tildearrow commented 5 years ago

Will be done

aufkrawall commented 5 years ago

Thanks a lot! Really amazing what you achieve for KWin.

tildearrow commented 5 years ago

Please test b76a58f8e. I have added this feature but need you to confirm this works.

aufkrawall commented 5 years ago

Tested in mpv and works like a charm, no more stutter when I press my keyboard media buttons. Fantastic! :)

Perhaps the rule "force fullscreen unredirection: yes" on the other hand could also force compositing to stay disabled for transparent OSDs like the volume slider?

tildearrow commented 5 years ago

Perhaps the rule "force fullscreen unredirection: yes" on the other hand could also force compositing to stay disabled for transparent OSDs like the volume slider?

Then OSD items would be invisible (which of course you don't want) because that's not how fullscreen unredirection works. When an application is unredirected, it sort of "takes over" the X server (and the compositor as well), preventing any other client from being overlaid.

aufkrawall commented 5 years ago

Hm, but it works with Compton.

tildearrow commented 5 years ago

Then you could use the block compositing approach instead, which achieves this. Note that by doing so there will be a delay to re-enabling compositing, since KWin is much more complex than Compton.

But I wonder: Why would you want a volume OSD element to be un-composited if you only see it for a few seconds?

aufkrawall commented 5 years ago

Block compositing unfortunately is very annoying when alt + tabbing, as you manually have to switch it all the time.

The problem of the OSD element composited is that when it disappears, there is a frametime spike of several dozens, if not hundreds of milliseconds, so really nasty stutter. You can test that with vkquake by moving the camera via the arrow keys and then press the raise/lower volume button on your keyboard, if present. Rendering basically stops for a short time, while it remains totally fluid without compositing.

Compton by default also keeps compositing enabled with that overlay when using unredir-if-possible. But you can define rules to make it exclude window types for this, e.g.

wintypes: { normal: {redir-ignore=true;} }

(The Plasma overlay window is declared as "normal" window type for whatever reason).

tildearrow commented 4 years ago

There is a possibility that this needs to be ported to 5.17..

sarthak96 commented 4 years ago

@tildearrow I've ported the patch to 5.18. Currently, full screen videos stutter to the point of becoming unusable on gsync(variable refresh rate) displays with compositing suspended/disabled, adding a window rule fixes this

tildearrow commented 4 years ago

Works. Thank you.

aufkrawall commented 2 years ago

Does this need to be rewritten for the current version? It would probably make sense to exclude popular applications that don't trigger page flipping (likely ~everything with typical Qt/GTK UIs) by default.

tildearrow commented 2 years ago

...yup, exactly! It's time to do this...