Skip to content

Draft: Preparations for wp_transaction and delayed surface commits

Vlad Zahorodnii requested to merge work/move-pointer-constraints-state into master

This is needed to implement the wp_transaction protocol and delayed surface commits in general. The latter can be useful for explicit sync.

  • Figure out how to manage attached surface state. There are always two states - current and pending. With sub-surfaces and the wp_transactions protocol, we may sometimes copy(?) or move(?) the pending state to a cached state queue.

Idea 0:

  • Define the SurfaceAttachedState as follows

    class SurfaceAttachedState
    {
    public:
        virtual ~SurfaceAttachedState() {}
    
        virtual SurfaceAttachedState *allocate() = 0;
        virtual void copyInto(SurfaceAttachedState *other) const = 0;
        virtual void moveInto(SurfaceAttachedState *other) = 0;
    };

    When we want to move the pending state to the cached state queue do

    SurfaceState *cached;
    pending->moveInto(cached);
    cachedQueue.enqueue(cached);
    
    // in SurfaceState::moveInto(SurfaceState *other)
    if (layerSurfaceV1) {
        if (!other->layerSurfaceV1) {
            other->layerSurfaceV1.reset(layerSurfaceV1->allocate());
        }
        layerSurfaceV1->moveInto(other->layerSurfaceV1);
    }

    When the pending state is applied, we just move the state from pending to current. In order to emit *Changed signals, we may need to make a copy of the current state before moving pending state into it.

Idea N+1: ??

Edited by Vlad Zahorodnii

Merge request reports

Loading