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(); virtual bool locked();
Hyprutils::Math::Vector2D size; Hyprutils::Math::Vector2D size;
bool opaque = false; bool opaque = false;
bool lockedByBackend = false;
CAttachmentManager attachments; CAttachmentManager attachments;
struct { struct {
Hyprutils::Signal::CSignal destroy; Hyprutils::Signal::CSignal destroy;
Hyprutils::Signal::CSignal backendRelease;
} events; } events;
private: private:

View file

@ -1236,6 +1236,11 @@ void Aquamarine::SDRMConnector::applyCommit(const SDRMConnectorCommitData& data)
if (crtc->cursor && data.cursorFB) if (crtc->cursor && data.cursorFB)
crtc->cursor->back = 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(); pendingCursorFB.reset();
if (output->state->state().committed & COutputState::AQ_OUTPUT_STATE_MODE) 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() { void Aquamarine::SDRMConnector::onPresent() {
crtc->primary->last = crtc->primary->front; crtc->primary->last = crtc->primary->front;
crtc->primary->front = crtc->primary->back; 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) { if (crtc->cursor) {
crtc->cursor->last = crtc->cursor->front; crtc->cursor->last = crtc->cursor->front;
crtc->cursor->front = crtc->cursor->back; 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();
}
} }
} }