Skip to content

Commit

Permalink
buffer: add backendLock
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Jul 19, 2024
1 parent 9d7c69c commit 35e00a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/aquamarine/buffer/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();
}
}
}

Expand Down

0 comments on commit 35e00a4

Please sign in to comment.