Rafostar / clapper

Level up your video experience with a modern and user-friendly media player.
https://rafostar.github.io/clapper/
GNU General Public License v3.0
714 stars 34 forks source link

Clapper does not set an opaque region (or unsets it) #343

Open rmader opened 1 year ago

rmader commented 1 year ago

In short: this is a performance issue that forces compositors like Mutter to do extra work when displaying the app. It can be tested in Gnome-Shell by alt+f2 -> lg -> "Flags" -> "OPAQUE_REGION".

You'll see that the Clapper window will get a purple overlay, while it should have a green one. This might be related to a similar issue in Console. image

Would love to see it fixed :)

Related:

Rafostar commented 1 year ago

Hi. Let me start with saying that I haven't tried if this is still an issue in GTK4 (not tested this anymore recently), but this (removing background) was done on purpose. Back then GTK4 renderer did not have any textures overlapping/visibility detection making it redraw background for each video frame. Removing background reduced time spend on GPU draws by almost half making it able to play videos at higher framerates on weak GPUs in especially fullscreen (tested on Atom z3785 tablet). So unless situation changed, the overhead on the GTK4 side (by redrawing fully covered app background for each frame) was much bigger then overhead on the compositor side.

rmader commented 1 year ago

Off, that sounds pretty bad - I couldn't find any gtk issue off-hand, do you recall if this was raised upstream?

Rafostar commented 1 year ago

do you recall if this was raised upstream?

Since I was able to workaround this by setting CSS background to "none", I kinda went with it then. I myself did not report this upstream under assumption that this is just how their renderer works. Did not expect "OPAQUE_REGION" flags to be unset by simply editing CSS :man_shrugging:

I will probably need to check if nowadays this performance problem is still there.

Rafostar commented 7 months ago

I assume the current behavior will break GtkGraphicsOffload once that is implemented here (or at least make it inefficient), no?

I will try to tackle and test your issue together with implementing GtkGraphicsOffload, which will be next thing to do after #374 is done and merged. Sorry it takes this long, but I have been really busy with reworking Clapper guts for a while.