mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 02:35:59 +01:00
drm: adjust drmfb storage
This commit is contained in:
parent
6cfa0652c8
commit
aa0c2157e8
2 changed files with 15 additions and 10 deletions
|
@ -54,7 +54,7 @@ namespace Aquamarine {
|
|||
struct SDRMLayer {
|
||||
// we expect the consumers to use double-buffering, so we keep the 2 last FBs around. If any of these goes out of
|
||||
// scope, the DRM FB will be destroyed, but the IBuffer will stay, as long as it's ref'd somewhere.
|
||||
Hyprutils::Memory::CSharedPointer<CDRMFB> front /* currently displaying */, back;
|
||||
Hyprutils::Memory::CSharedPointer<CDRMFB> front /* currently displaying */, back /* submitted */, last /* keep just in case */;
|
||||
Hyprutils::Memory::CWeakPointer<CDRMBackend> backend;
|
||||
};
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace Aquamarine {
|
|||
uint32_t id = 0;
|
||||
uint32_t initialID = 0;
|
||||
|
||||
Hyprutils::Memory::CSharedPointer<CDRMFB> front /* currently displaying */, back /* submitted */;
|
||||
Hyprutils::Memory::CSharedPointer<CDRMFB> front /* currently displaying */, back /* submitted */, last /* keep just in case */;
|
||||
Hyprutils::Memory::CWeakPointer<CDRMBackend> backend;
|
||||
Hyprutils::Memory::CWeakPointer<SDRMPlane> self;
|
||||
std::vector<SDRMFormat> formats;
|
||||
|
|
|
@ -894,12 +894,9 @@ bool Aquamarine::SDRMConnector::commitState(const SDRMConnectorCommitData& data)
|
|||
}
|
||||
|
||||
void Aquamarine::SDRMConnector::applyCommit(const SDRMConnectorCommitData& data) {
|
||||
crtc->primary->back = crtc->primary->front;
|
||||
crtc->primary->front = data.mainFB;
|
||||
if (crtc->cursor) {
|
||||
crtc->cursor->back = crtc->cursor->front;
|
||||
crtc->cursor->front = data.cursorFB;
|
||||
}
|
||||
crtc->primary->back = data.mainFB;
|
||||
if (crtc->cursor)
|
||||
crtc->cursor->back = data.cursorFB;
|
||||
|
||||
pendingCursorFB.reset();
|
||||
|
||||
|
@ -912,7 +909,12 @@ 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->cursor) {
|
||||
crtc->cursor->last = crtc->cursor->front;
|
||||
crtc->cursor->front = crtc->cursor->back;
|
||||
}
|
||||
}
|
||||
|
||||
Aquamarine::CDRMOutput::~CDRMOutput() {
|
||||
|
@ -1004,11 +1006,14 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
|
|||
auto buf = STATE.buffer;
|
||||
// try to find the buffer in its layer
|
||||
if (connector->crtc->primary->back && connector->crtc->primary->back->buffer == buf) {
|
||||
backend->backend->log(AQ_LOG_TRACE, "drm: CRTC's back buffer matches committed :D");
|
||||
backend->backend->log(AQ_LOG_TRACE, "drm: CRTC's back buffer matches committed");
|
||||
drmFB = connector->crtc->primary->back;
|
||||
} else if (connector->crtc->primary->front && connector->crtc->primary->front->buffer == buf) {
|
||||
backend->backend->log(AQ_LOG_TRACE, "drm: CRTC's front buffer matches committed");
|
||||
drmFB = connector->crtc->primary->front;
|
||||
} else if (connector->crtc->primary->last && connector->crtc->primary->last->buffer == buf) {
|
||||
backend->backend->log(AQ_LOG_TRACE, "drm: CRTC's last buffer matches committed :D"); // best case scenario and what is expected
|
||||
drmFB = connector->crtc->primary->last;
|
||||
}
|
||||
|
||||
if (!drmFB)
|
||||
|
|
Loading…
Reference in a new issue