Draft: Preparations for wp_transaction and delayed surface commits
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
andpending
. With sub-surfaces and the wp_transactions protocol, we may sometimes copy(?) or move(?) thepending
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 doSurfaceState *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
tocurrent
. 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