Skip to content

Commit

Permalink
drm: reimport cursor fb on multigpu
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Jul 8, 2024
1 parent 157f067 commit 3c11851
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1369,7 +1371,8 @@ bool Aquamarine::CDRMOutput::setCursor(SP<IBuffer> 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;
Expand All @@ -1380,6 +1383,13 @@ bool Aquamarine::CDRMOutput::setCursor(SP<IBuffer> 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;
Expand Down

0 comments on commit 3c11851

Please sign in to comment.