libkwineffects: move linux kernel version query out of GLPlatform
It has nothing to do with OpenGL
This commit is contained in:
parent
e0c7878357
commit
a5df88b0de
7 changed files with 34 additions and 33 deletions
|
@ -12,6 +12,7 @@
|
|||
#include "libkwineffects/glplatform.h"
|
||||
#include "pointer_input.h"
|
||||
#include "scene/workspacescene.h"
|
||||
#include "utils/kernel.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
@ -92,7 +93,7 @@ private:
|
|||
void ScreencastingTest::init()
|
||||
{
|
||||
// TODO: Remove this when CI is updated to ubuntu 22.04 or something with a newer kernel.
|
||||
const Version kernelVersion = GLPlatform::instance()->kernelVersion();
|
||||
const Version kernelVersion = linuxKernelVersion();
|
||||
if (kernelVersion.major() == 5 && kernelVersion.minor() <= 4) {
|
||||
QSKIP("drmPrimeFDToHandle() randomly fails");
|
||||
return;
|
||||
|
|
|
@ -156,7 +156,6 @@ void GLPlatformTest::testPriorDetect()
|
|||
QCOMPARE(gl->mesaVersion(), Version());
|
||||
QCOMPARE(gl->galliumVersion(), Version());
|
||||
QCOMPARE(gl->serverVersion(), Version());
|
||||
QCOMPARE(gl->kernelVersion(), Version());
|
||||
QCOMPARE(gl->driverVersion(), Version());
|
||||
|
||||
QCOMPARE(gl->driver(), Driver_Unknown);
|
||||
|
|
|
@ -43,17 +43,6 @@ static Version getXServerVersion()
|
|||
return Version(0, 0, 0);
|
||||
}
|
||||
|
||||
static Version getKernelVersion()
|
||||
{
|
||||
struct utsname name;
|
||||
uname(&name);
|
||||
|
||||
if (qstrcmp(name.sysname, "Linux") == 0) {
|
||||
return Version::parseString(name.release);
|
||||
}
|
||||
return Version(0, 0, 0);
|
||||
}
|
||||
|
||||
// Extracts the portion of a string that matches a regular expression
|
||||
static QString extract(const QString &text, const QString &pattern)
|
||||
{
|
||||
|
@ -817,7 +806,6 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
|
|||
}
|
||||
|
||||
m_serverVersion = getXServerVersion();
|
||||
m_kernelVersion = getKernelVersion();
|
||||
|
||||
if (m_supportsGLSL) {
|
||||
// Parse the GLSL version
|
||||
|
@ -1187,9 +1175,6 @@ void GLPlatform::printResults() const
|
|||
if (serverVersion().isValid()) {
|
||||
print(QByteArrayLiteral("X server version:"), versionToString8(m_serverVersion));
|
||||
}
|
||||
if (kernelVersion().isValid()) {
|
||||
print(QByteArrayLiteral("Linux kernel version:"), versionToString8(m_kernelVersion));
|
||||
}
|
||||
|
||||
print(QByteArrayLiteral("Requires strict binding:"), !m_looseBinding ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
|
||||
print(QByteArrayLiteral("GLSL shaders:"), m_supportsGLSL ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
|
||||
|
@ -1242,11 +1227,6 @@ Version GLPlatform::serverVersion() const
|
|||
return m_serverVersion;
|
||||
}
|
||||
|
||||
Version GLPlatform::kernelVersion() const
|
||||
{
|
||||
return m_kernelVersion;
|
||||
}
|
||||
|
||||
Version GLPlatform::driverVersion() const
|
||||
{
|
||||
if (isMesaDriver()) {
|
||||
|
|
|
@ -236,13 +236,6 @@ public:
|
|||
*/
|
||||
Version serverVersion() const;
|
||||
|
||||
/**
|
||||
* Returns the Linux kernel version.
|
||||
*
|
||||
* If the kernel is not a Linux kernel, this method returns 0.
|
||||
*/
|
||||
Version kernelVersion() const;
|
||||
|
||||
/**
|
||||
* Returns the driver version.
|
||||
*
|
||||
|
@ -404,7 +397,6 @@ public:
|
|||
* @see driverVersion
|
||||
* @see mesaVersion
|
||||
* @see galliumVersion
|
||||
* @see kernelVersion
|
||||
* @see serverVersion
|
||||
*/
|
||||
static QString versionToString(const Version &version);
|
||||
|
@ -464,7 +456,6 @@ private:
|
|||
Version m_driverVersion;
|
||||
Version m_galliumVersion;
|
||||
Version m_serverVersion;
|
||||
Version m_kernelVersion;
|
||||
bool m_looseBinding : 1;
|
||||
bool m_supportsGLSL : 1;
|
||||
bool m_textureNPOT : 1;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <config-kwin.h>
|
||||
// kwin
|
||||
#include "libkwineffects/kwinglobals.h"
|
||||
#include "libkwineffects/version.h"
|
||||
// Qt
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
|
|
28
src/utils/kernel.h
Normal file
28
src/utils/kernel.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#pragma once
|
||||
#include "libkwineffects/version.h"
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
inline static Version linuxKernelVersion()
|
||||
{
|
||||
struct utsname name;
|
||||
uname(&name);
|
||||
|
||||
if (qstrcmp(name.sysname, "Linux") == 0) {
|
||||
return Version::parseString(name.release);
|
||||
}
|
||||
return Version(0, 0, 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -54,6 +54,7 @@
|
|||
#include "placementtracker.h"
|
||||
#include "tiles/tilemanager.h"
|
||||
#include "useractions.h"
|
||||
#include "utils/kernel.h"
|
||||
#include "utils/xcbutils.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "was_user_interaction_x11_filter.h"
|
||||
|
@ -1798,8 +1799,8 @@ QString Workspace::supportInformation() const
|
|||
if (platform->serverVersion().isValid()) {
|
||||
support.append(QStringLiteral("X server version: ") + GLPlatform::versionToString(platform->serverVersion()) + QStringLiteral("\n"));
|
||||
}
|
||||
if (platform->kernelVersion().isValid()) {
|
||||
support.append(QStringLiteral("Linux kernel version: ") + GLPlatform::versionToString(platform->kernelVersion()) + QStringLiteral("\n"));
|
||||
if (auto kernelVersion = linuxKernelVersion(); kernelVersion.isValid()) {
|
||||
support.append(QStringLiteral("Linux kernel version: ") + GLPlatform::versionToString(kernelVersion) + QStringLiteral("\n"));
|
||||
}
|
||||
|
||||
support.append(QStringLiteral("Direct rendering: "));
|
||||
|
|
Loading…
Reference in a new issue