From 3c118519e60fff4244323b71e4a7840a52367135 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 8 Jul 2024 21:22:56 +0200 Subject: [PATCH] drm: reimport cursor fb on multigpu --- src/backend/drm/DRM.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index dc6435d..9d84a0b 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -1325,6 +1325,8 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { if (connector->crtc->pendingCursor) data.cursorFB = connector->crtc->pendingCursor; + else + data.cursorFB = connector->crtc->cursor->front; if (data.cursorFB) { // verify cursor format. This might be wrong on NVIDIA where linear buffers @@ -1369,7 +1371,8 @@ bool Aquamarine::CDRMOutput::setCursor(SP buffer, const Vector2D& hotsp setCursorVisible(false); else { cursorHotspot = hotspot; - auto fb = CDRMFB::create(buffer, backend); + bool isNew = false; + auto fb = CDRMFB::create(buffer, backend, &isNew); if (!fb) { backend->backend->log(AQ_LOG_ERROR, "drm: Cursor buffer failed to import to KMS"); return false; @@ -1380,6 +1383,13 @@ bool Aquamarine::CDRMOutput::setCursor(SP buffer, const Vector2D& hotsp connector->crtc->pendingCursor = fb; cursorVisible = true; + + if (!isNew && backend->primary) { + // this is not a new buffer, and we are not on a primary GPU, which means + // this buffer lives on the primary. We need to re-import it to update + // the contents that have possibly (probably) changed + fb->reimport(); + } } needsFrame = true;