mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-12-22 16:09:47 +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 {
|
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
|
// 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.
|
// 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;
|
Hyprutils::Memory::CWeakPointer<CDRMBackend> backend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace Aquamarine {
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
uint32_t initialID = 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<CDRMBackend> backend;
|
||||||
Hyprutils::Memory::CWeakPointer<SDRMPlane> self;
|
Hyprutils::Memory::CWeakPointer<SDRMPlane> self;
|
||||||
std::vector<SDRMFormat> formats;
|
std::vector<SDRMFormat> formats;
|
||||||
|
|
|
@ -894,12 +894,9 @@ bool Aquamarine::SDRMConnector::commitState(const SDRMConnectorCommitData& data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aquamarine::SDRMConnector::applyCommit(const SDRMConnectorCommitData& data) {
|
void Aquamarine::SDRMConnector::applyCommit(const SDRMConnectorCommitData& data) {
|
||||||
crtc->primary->back = crtc->primary->front;
|
crtc->primary->back = data.mainFB;
|
||||||
crtc->primary->front = data.mainFB;
|
if (crtc->cursor)
|
||||||
if (crtc->cursor) {
|
crtc->cursor->back = data.cursorFB;
|
||||||
crtc->cursor->back = crtc->cursor->front;
|
|
||||||
crtc->cursor->front = data.cursorFB;
|
|
||||||
}
|
|
||||||
|
|
||||||
pendingCursorFB.reset();
|
pendingCursorFB.reset();
|
||||||
|
|
||||||
|
@ -912,7 +909,12 @@ void Aquamarine::SDRMConnector::rollbackCommit(const SDRMConnectorCommitData& da
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aquamarine::SDRMConnector::onPresent() {
|
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() {
|
Aquamarine::CDRMOutput::~CDRMOutput() {
|
||||||
|
@ -1004,11 +1006,14 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
|
||||||
auto buf = STATE.buffer;
|
auto buf = STATE.buffer;
|
||||||
// try to find the buffer in its layer
|
// try to find the buffer in its layer
|
||||||
if (connector->crtc->primary->back && connector->crtc->primary->back->buffer == buf) {
|
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;
|
drmFB = connector->crtc->primary->back;
|
||||||
} else if (connector->crtc->primary->front && connector->crtc->primary->front->buffer == buf) {
|
} 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");
|
backend->backend->log(AQ_LOG_TRACE, "drm: CRTC's front buffer matches committed");
|
||||||
drmFB = connector->crtc->primary->front;
|
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)
|
if (!drmFB)
|
||||||
|
|
Loading…
Reference in a new issue