buffer: add backendLock

This commit is contained in:
Vaxry 2024-07-19 11:29:50 +02:00
parent 9d7c69cde2
commit 35e00a4a9d
2 changed files with 17 additions and 1 deletions

View file

@ -62,12 +62,14 @@ namespace Aquamarine {
virtual bool locked();
Hyprutils::Math::Vector2D size;
bool opaque = false;
bool opaque = false;
bool lockedByBackend = false;
CAttachmentManager attachments;
struct {
Hyprutils::Signal::CSignal destroy;
Hyprutils::Signal::CSignal backendRelease;
} events;
private:

View file

@ -1236,6 +1236,11 @@ void Aquamarine::SDRMConnector::applyCommit(const SDRMConnectorCommitData& data)
if (crtc->cursor && data.cursorFB)
crtc->cursor->back = data.cursorFB;
if (data.mainFB)
data.mainFB->buffer->lockedByBackend = true;
if (crtc->cursor && data.cursorFB)
data.cursorFB->buffer->lockedByBackend = true;
pendingCursorFB.reset();
if (output->state->state().committed & COutputState::AQ_OUTPUT_STATE_MODE)
@ -1253,9 +1258,18 @@ void Aquamarine::SDRMConnector::rollbackCommit(const SDRMConnectorCommitData& da
void Aquamarine::SDRMConnector::onPresent() {
crtc->primary->last = crtc->primary->front;
crtc->primary->front = crtc->primary->back;
if (crtc->primary->last && crtc->primary->last->buffer) {
crtc->primary->last->buffer->lockedByBackend = false;
crtc->primary->last->buffer->events.backendRelease.emit();
}
if (crtc->cursor) {
crtc->cursor->last = crtc->cursor->front;
crtc->cursor->front = crtc->cursor->back;
if (crtc->cursor->last && crtc->cursor->last->buffer) {
crtc->cursor->last->buffer->lockedByBackend = false;
crtc->cursor->last->buffer->events.backendRelease.emit();
}
}
}