Skip to content
This repository was archived by the owner on Oct 25, 2021. It is now read-only.
This repository was archived by the owner on Oct 25, 2021. It is now read-only.

Removal of layer properties #45

@ghost

Description

Problem statement

Issue 1

When a layer is de-allocated from a plane the properties are not reset to some default value. That can mean that on next allocation another layer gets allocated to that same plane with a subset of properties not putting other properties in a valid initial state.

Example: alpha property

  • Layer L1 is allocated to plane P and sets alpha to 0.1.
  • On next allocation L1 is allocated to another layer and some layer L2 not featuring the alpha property is allocated to P.
  • Because L2 does not have the alpha property the alpha stays at 0.1, although it should be 1 for L2.

Issue 2

Once a property has been set on a plane it is static as in not removable anymore. Every later layer to plane association must take these properties into account making less optimal layer to plane associations likely over time.

Example: alpha property

  • There is a primary plane and one overlay plane. The overlay plane supports the alpha property, the primary doesn't.
  • Layer L1 is to be allocated. The continuous buffer stream on L1 could be allocated to any of the two planes.
  • But L1 is faded in starting with alpha = 0. libliftoff determines that L1 is put on the overlay plane as only this one supports alpha.
  • The alpha of L1 is changed over time from 0 to 1.
  • Now an additional layer L2 is to be allocated. L2 can only be allocated to the overlay plane because of buffer formats.
  • Although L1 could be put now on the primary plane it won't since the alpha property is still set to some value and L2 can't be put on the primary plane alike. Therefore the layer allocation fails.

The only current way to make a layer less specific in the set of its properties is to destroy and recreate it again (but in this case we do struggle with issue 1 again). I would argue it makes the API more intuitive if there is a way to "remove" properties again from a layer instead of only destroying the whole layer.

Solution plan

I have some ideas how to solve these issues but before formulating it out I would like to get some feedback if the two issues above are indeed problematic or if I overlooked something.

Introduce a plane property defunct state

When a property P of a plane PL was previously set in allocations A1...AN with N > 0 and is not any more set at the next allocation AN+1 property P goes into a defunct state. That means at allocation AN+1 property P is "reset" to its default value if such a default exists for property P. For that plane PL is forced into the next atomic commit independent of its allocation in AN+1.

Introduce a layer property default setter

The default value of property P used above for the plane property defunct state must be set explicitly. For that the compositor can call a function

liftoff_layer_set_property_with_default(struct liftoff_layer *layer, 
                                        const char *name,
                                        uint64_t value,
                                        uint64_t default)

Introduce wrappers for common properties

That default setter above is cumbersome. For common properties there should be wrappers that call liftoff_layer_set_property_with_default with the correct default values. For example for alpha:

liftoff_layer_set_property_alpha(struct liftoff_layer *layer, uint64_t value)

Introduce a property remove function

For upcoming allocations layer L can have a property removed by calling some function on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions