diff --git a/plugins/platforms/drm/drm_backend.cpp b/plugins/platforms/drm/drm_backend.cpp index 6ec846c939..9995b82e11 100644 --- a/plugins/platforms/drm/drm_backend.cpp +++ b/plugins/platforms/drm/drm_backend.cpp @@ -480,21 +480,6 @@ void DrmBackend::initCursor() } } ); - uint64_t capability = 0; - QSize cursorSize; - cursorSize.setWidth(64); - for (auto gpu : m_gpus) { - if (drmGetCap(gpu->fd(), DRM_CAP_CURSOR_WIDTH, &capability) == 0) { - cursorSize.setWidth(capability); - } - } - cursorSize.setHeight(64); - for (auto gpu : m_gpus) { - if (drmGetCap(gpu->fd(), DRM_CAP_CURSOR_HEIGHT, &capability) == 0) { - cursorSize.setHeight(capability); - } - } - m_cursorSize = cursorSize; // now we have screens and can set cursors, so start tracking connect(Cursors::self(), &Cursors::currentCursorChanged, this, &DrmBackend::updateCursor); connect(Cursors::self(), &Cursors::positionChanged, this, &DrmBackend::moveCursor); diff --git a/plugins/platforms/drm/drm_backend.h b/plugins/platforms/drm/drm_backend.h index 9e84dd41de..d9c9ee1f2e 100644 --- a/plugins/platforms/drm/drm_backend.h +++ b/plugins/platforms/drm/drm_backend.h @@ -132,7 +132,6 @@ private: bool m_deleteBufferAfterPageFlip; bool m_cursorEnabled = false; - QSize m_cursorSize; int m_pageFlipsPending = 0; bool m_active = false; #if HAVE_EGL_STREAMS diff --git a/plugins/platforms/drm/drm_gpu.cpp b/plugins/platforms/drm/drm_gpu.cpp index 9eeecca708..1f062780e9 100644 --- a/plugins/platforms/drm/drm_gpu.cpp +++ b/plugins/platforms/drm/drm_gpu.cpp @@ -34,7 +34,19 @@ namespace KWin DrmGpu::DrmGpu(DrmBackend *backend, QByteArray devNode, int fd, int drmId) : m_backend(backend), m_devNode(devNode), m_fd(fd), m_drmId(drmId), m_atomicModeSetting(false), m_useEglStreams(false), m_gbmDevice(nullptr) { - + uint64_t capability = 0; + + if (drmGetCap(fd, DRM_CAP_CURSOR_WIDTH, &capability) == 0) { + m_cursorSize.setWidth(capability); + } else { + m_cursorSize.setWidth(64); + } + + if (drmGetCap(fd, DRM_CAP_CURSOR_HEIGHT, &capability) == 0) { + m_cursorSize.setHeight(capability); + } else { + m_cursorSize.setHeight(64); + } } DrmGpu::~DrmGpu() @@ -229,7 +241,7 @@ bool DrmGpu::updateOutputs() delete output; continue; } - if (!output->initCursor(m_backend->m_cursorSize)) { + if (!output->initCursor(m_cursorSize)) { m_backend->setSoftWareCursor(true); } qCDebug(KWIN_DRM) << "Found new output with uuid" << output->uuid(); diff --git a/plugins/platforms/drm/drm_gpu.h b/plugins/platforms/drm/drm_gpu.h index 9df8a73c06..21dec50644 100644 --- a/plugins/platforms/drm/drm_gpu.h +++ b/plugins/platforms/drm/drm_gpu.h @@ -89,6 +89,7 @@ private: DrmBackend* const m_backend; const QByteArray m_devNode; + QSize m_cursorSize; const int m_fd; const int m_drmId; bool m_atomicModeSetting;