Skip to content

Commit 4ca125d

Browse files
committed
drm: set fbs on vt restore
thanks @ikalco
1 parent f770d88 commit 4ca125d

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/backend/drm/DRM.cpp

+26-2
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,35 @@ void Aquamarine::CDRMBackend::restoreAfterVT() {
271271
.test = false,
272272
};
273273

274-
if (c->output->state->state().mode && c->output->state->state().mode->modeInfo.has_value())
275-
data.modeInfo = *c->output->state->state().mode->modeInfo;
274+
auto& STATE = c->output->state->state();
275+
276+
if (STATE.mode && STATE.mode->modeInfo.has_value())
277+
data.modeInfo = *STATE.mode->modeInfo;
276278
else
277279
data.calculateMode(c);
278280

281+
if (STATE.buffer) {
282+
SP<CDRMFB> drmFB;
283+
auto buf = STATE.buffer;
284+
bool isNew = false;
285+
286+
drmFB = CDRMFB::create(buf, self, &isNew);
287+
288+
if (!drmFB)
289+
backend->log(AQ_LOG_ERROR, "drm: Buffer failed to import to KMS");
290+
291+
if (!isNew && primary && drmFB)
292+
drmFB->reimport();
293+
294+
data.mainFB = drmFB;
295+
}
296+
297+
if (c->crtc->pendingCursor)
298+
data.cursorFB = c->crtc->pendingCursor;
299+
300+
if (data.cursorFB && data.cursorFB->buffer->dmabuf().modifier == DRM_FORMAT_MOD_INVALID)
301+
data.cursorFB = nullptr;
302+
279303
backend->log(AQ_LOG_DEBUG,
280304
std::format("drm: Restoring crtc {} with clock {} hdisplay {} vdisplay {} vrefresh {}", c->crtc->id, data.modeInfo.clock, data.modeInfo.hdisplay,
281305
data.modeInfo.vdisplay, data.modeInfo.vrefresh));

0 commit comments

Comments
 (0)