Commit 691ce566 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

platforms/drm: Query cursor capabilities per individual gpu

We should not assume that the cursor capabilities are shared by all DRM
devices.
parent 29fbe27f
......@@ -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);
......
......@@ -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
......
......@@ -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();
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment