emersion / libliftoff

Lightweight KMS plane library
MIT License
75 stars 7 forks source link

Prioritize layers that get updated more frequently #22

Open mupuf opened 4 years ago

mupuf commented 4 years ago

When using damages to perform composition, we can easily prevent doing any work for regions that did not change.

This means that if we have to chose between putting a layer on a plane which is seldom updated, or one that is updated all the time, we should choose the latter as it would lead to the least amount of blits.

One thing to consider is that if the layer is partially under another one, we will need to have the top layer also allocated to a plane in order to bring this benefit.

Thoughts?

emersion commented 4 years ago

Note to self: "updated" can mean that the FBID is changed, but can also mean that CRTC{X,Y,W,H} is changed. In both cases, we want to put the layer on a plane.

emersion commented 4 years ago

We also need to figure out when the priority of a layer changes, to re-allocate planes (taking priority into account). However we don't want to re-allocate too often.

Maybe we could detect when the priority ordering between layers changes (e.g. when a layer gains a priority higher than the next layer). I'm a little bit worried about back-and-forth situations where we needlessly reallocate.