backends/drm: fix KWIN_DRM_NO_AMS env var
It currently makes the session not start at all
This commit is contained in:
parent
e5ca5df0c5
commit
15993fa6bb
1 changed files with 8 additions and 8 deletions
|
@ -83,11 +83,7 @@ DrmGpu::DrmGpu(DrmBackend *backend, const QString &devNode, int fd, dev_t device
|
||||||
m_socketNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
|
m_socketNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
|
||||||
connect(m_socketNotifier, &QSocketNotifier::activated, this, &DrmGpu::dispatchEvents);
|
connect(m_socketNotifier, &QSocketNotifier::activated, this, &DrmGpu::dispatchEvents);
|
||||||
|
|
||||||
// trying to activate Atomic Mode Setting (this means also Universal Planes)
|
|
||||||
static const bool atomicModesetting = !qEnvironmentVariableIsSet("KWIN_DRM_NO_AMS");
|
|
||||||
if (atomicModesetting) {
|
|
||||||
initDrmResources();
|
initDrmResources();
|
||||||
}
|
|
||||||
|
|
||||||
m_leaseDevice = new KWaylandServer::DrmLeaseDeviceV1Interface(waylandServer()->display(), [this]{
|
m_leaseDevice = new KWaylandServer::DrmLeaseDeviceV1Interface(waylandServer()->display(), [this]{
|
||||||
char *path = drmGetDeviceNameFromFd2(m_fd);
|
char *path = drmGetDeviceNameFromFd2(m_fd);
|
||||||
|
@ -152,7 +148,13 @@ clockid_t DrmGpu::presentationClock() const
|
||||||
void DrmGpu::initDrmResources()
|
void DrmGpu::initDrmResources()
|
||||||
{
|
{
|
||||||
// try atomic mode setting
|
// try atomic mode setting
|
||||||
if (drmSetClientCap(m_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0) {
|
bool tmp = false;
|
||||||
|
bool noAMS = qEnvironmentVariableIntValue("KWIN_DRM_NO_AMS", &tmp) != 0 && tmp;
|
||||||
|
if (noAMS) {
|
||||||
|
qCWarning(KWIN_DRM) << "Atomic Mode Setting requested off via environment variable. Using legacy mode on GPU" << m_devNode;
|
||||||
|
} 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" << m_devNode;
|
||||||
|
} else {
|
||||||
DrmScopedPointer<drmModePlaneRes> planeResources(drmModeGetPlaneResources(m_fd));
|
DrmScopedPointer<drmModePlaneRes> planeResources(drmModeGetPlaneResources(m_fd));
|
||||||
if (planeResources) {
|
if (planeResources) {
|
||||||
qCDebug(KWIN_DRM) << "Using Atomic Mode Setting on gpu" << m_devNode;
|
qCDebug(KWIN_DRM) << "Using Atomic Mode Setting on gpu" << m_devNode;
|
||||||
|
@ -174,8 +176,6 @@ void DrmGpu::initDrmResources()
|
||||||
} else {
|
} else {
|
||||||
qCWarning(KWIN_DRM) << "Failed to get plane resources. Falling back to legacy mode on GPU " << m_devNode;
|
qCWarning(KWIN_DRM) << "Failed to get plane resources. Falling back to legacy mode on GPU " << m_devNode;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
qCWarning(KWIN_DRM) << "drmSetClientCap for Atomic Mode Setting failed. Using legacy mode on GPU" << m_devNode;
|
|
||||||
}
|
}
|
||||||
m_atomicModeSetting = !m_planes.isEmpty();
|
m_atomicModeSetting = !m_planes.isEmpty();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue