backend/drm: fix cursor hotspot enablement for virtualized drivers
DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT can only be set after DRM_CLIENT_CAP_ATOMIC has been enabled.
This commit is contained in:
parent
9a74d70ba4
commit
bd2728fac1
1 changed files with 15 additions and 9 deletions
|
@ -131,17 +131,20 @@ void DrmGpu::initDrmResources()
|
|||
{
|
||||
// try atomic mode setting
|
||||
bool isEnvVarSet = false;
|
||||
const bool supportsVmCursorHotspot = drmSetClientCap(m_fd, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0;
|
||||
const bool noAMS = qEnvironmentVariableIntValue("KWIN_DRM_NO_AMS", &isEnvVarSet) != 0 && isEnvVarSet;
|
||||
if (m_isVirtualMachine && !supportsVmCursorHotspot && !isEnvVarSet) {
|
||||
qCWarning(KWIN_DRM, "Atomic Mode Setting disabled on GPU %s because of cursor offset issues in virtual machines", qPrintable(m_drmDevice->path()));
|
||||
} else if (noAMS) {
|
||||
bool noAMS = qEnvironmentVariableIntValue("KWIN_DRM_NO_AMS", &isEnvVarSet) != 0 && isEnvVarSet;
|
||||
if (noAMS) {
|
||||
qCWarning(KWIN_DRM) << "Atomic Mode Setting requested off via environment variable. Using legacy mode on GPU" << this;
|
||||
} else if (drmSetClientCap(m_fd, DRM_CLIENT_CAP_ATOMIC, 1) != 0) {
|
||||
qCWarning(KWIN_DRM) << "drmSetClientCap for Atomic Mode Setting failed. Using legacy mode on GPU" << this;
|
||||
} else {
|
||||
} else if (drmSetClientCap(m_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0) {
|
||||
if (m_isVirtualMachine) {
|
||||
// ATOMIC must be set before attemping CURSOR_PLANE_HOTSPOT
|
||||
if (drmSetClientCap(m_fd, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) != 0) {
|
||||
qCWarning(KWIN_DRM, "Atomic Mode Setting disabled on GPU %s because of cursor offset issues in virtual machines", qPrintable(m_drmDevice->path()));
|
||||
drmSetClientCap(m_fd, DRM_CLIENT_CAP_ATOMIC, 0);
|
||||
noAMS = true;
|
||||
}
|
||||
}
|
||||
DrmUniquePtr<drmModePlaneRes> planeResources(drmModeGetPlaneResources(m_fd));
|
||||
if (planeResources) {
|
||||
if (planeResources && !noAMS) {
|
||||
qCDebug(KWIN_DRM) << "Using Atomic Mode Setting on gpu" << this;
|
||||
qCDebug(KWIN_DRM) << "Number of planes on GPU" << this << ":" << planeResources->count_planes;
|
||||
// create the plane objects
|
||||
|
@ -159,7 +162,10 @@ void DrmGpu::initDrmResources()
|
|||
} else {
|
||||
qCWarning(KWIN_DRM) << "Failed to get plane resources. Falling back to legacy mode on GPU " << this;
|
||||
}
|
||||
} else {
|
||||
qCWarning(KWIN_DRM) << "drmSetClientCap for Atomic Mode Setting failed. Using legacy mode on GPU" << this;
|
||||
}
|
||||
|
||||
m_atomicModeSetting = !m_planes.empty();
|
||||
|
||||
DrmUniquePtr<drmModeRes> resources(drmModeGetResources(m_fd));
|
||||
|
|
Loading…
Reference in a new issue