Skip to content

Commit

Permalink
drm: set fbs on vt restore
Browse files Browse the repository at this point in the history
thanks @ikalco
  • Loading branch information
vaxerski committed Jul 2, 2024
1 parent f770d88 commit 4ca125d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,35 @@ void Aquamarine::CDRMBackend::restoreAfterVT() {
.test = false,
};

if (c->output->state->state().mode && c->output->state->state().mode->modeInfo.has_value())
data.modeInfo = *c->output->state->state().mode->modeInfo;
auto& STATE = c->output->state->state();

if (STATE.mode && STATE.mode->modeInfo.has_value())
data.modeInfo = *STATE.mode->modeInfo;
else
data.calculateMode(c);

if (STATE.buffer) {
SP<CDRMFB> drmFB;
auto buf = STATE.buffer;
bool isNew = false;

drmFB = CDRMFB::create(buf, self, &isNew);

if (!drmFB)
backend->log(AQ_LOG_ERROR, "drm: Buffer failed to import to KMS");

if (!isNew && primary && drmFB)
drmFB->reimport();

data.mainFB = drmFB;
}

if (c->crtc->pendingCursor)
data.cursorFB = c->crtc->pendingCursor;

if (data.cursorFB && data.cursorFB->buffer->dmabuf().modifier == DRM_FORMAT_MOD_INVALID)
data.cursorFB = nullptr;

backend->log(AQ_LOG_DEBUG,
std::format("drm: Restoring crtc {} with clock {} hdisplay {} vdisplay {} vrefresh {}", c->crtc->id, data.modeInfo.clock, data.modeInfo.hdisplay,
data.modeInfo.vdisplay, data.modeInfo.vrefresh));
Expand Down

0 comments on commit 4ca125d

Please sign in to comment.