platforms/drm: Query cursor capabilities per individual gpu

We should not assume that the cursor capabilities are shared by all DRM
devices.
This commit is contained in:
Vlad Zahorodnii 2020-10-12 22:27:53 +03:00
parent 29fbe27ffc
commit 691ce56627
4 changed files with 15 additions and 18 deletions

View file

@ -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);

View file

@ -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

View file

@ -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();

View file

@ -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;