libkwineffects: move x server version query to xcb utils

master
Xaver Hugl 1 year ago
parent 05a389c3b3
commit ed02051a4a

@ -155,7 +155,6 @@ void GLPlatformTest::testPriorDetect()
QCOMPARE(gl->glslVersion(), Version());
QCOMPARE(gl->mesaVersion(), Version());
QCOMPARE(gl->galliumVersion(), Version());
QCOMPARE(gl->serverVersion(), Version());
QCOMPARE(gl->driverVersion(), Version());
QCOMPARE(gl->driver(), Driver_Unknown);
@ -255,7 +254,6 @@ void GLPlatformTest::testDetect()
QCOMPARE(gl->glslVersion(), readVersion(settingsGroup, "GLSLVersion"));
QCOMPARE(gl->mesaVersion(), readVersion(settingsGroup, "MesaVersion"));
QCOMPARE(gl->galliumVersion(), readVersion(settingsGroup, "GalliumVersion"));
QCOMPARE(gl->serverVersion(), Version());
QEXPECT_FAIL("amd-catalyst-radeonhd-7700M-3.1.13399", "Detects GL version instead of driver version", Continue);
QCOMPARE(gl->driverVersion(), readVersion(settingsGroup, "DriverVersion"));

@ -30,19 +30,6 @@ namespace KWin
std::unique_ptr<GLPlatform> GLPlatform::s_platform;
static Version getXServerVersion()
{
if (xcb_connection_t *c = connection()) {
auto setup = xcb_get_setup(c);
const QByteArray vendorName(xcb_setup_vendor(setup), xcb_setup_vendor_length(setup));
if (vendorName.contains("X.Org")) {
const int release = setup->release_number;
return Version(release / 10000000, (release / 100000) % 100, (release / 1000) % 100);
}
}
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)
{
@ -791,8 +778,6 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
}
}
m_serverVersion = getXServerVersion();
if (m_supportsGLSL) {
// Parse the GLSL version
m_glsl_version = (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
@ -1158,9 +1143,6 @@ void GLPlatform::printResults() const
}
// if (galliumVersion() > 0)
// print("Gallium version:", versionToString(m_galliumVersion));
if (serverVersion().isValid()) {
print(QByteArrayLiteral("X server version:"), m_serverVersion.toByteArray());
}
print(QByteArrayLiteral("Requires strict binding:"), !m_looseBinding ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
print(QByteArrayLiteral("GLSL shaders:"), m_supportsGLSL ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
@ -1208,11 +1190,6 @@ Version GLPlatform::galliumVersion() const
return m_galliumVersion;
}
Version GLPlatform::serverVersion() const
{
return m_serverVersion;
}
Version GLPlatform::driverVersion() const
{
if (isMesaDriver()) {

@ -226,16 +226,6 @@ public:
*/
Version galliumVersion() const;
/**
* Returns the X server version.
*
* Note that the version number changed from 7.2 to 1.3 in the first release
* following the doupling of the X server from the katamari.
*
* For non X.org servers, this method returns 0.
*/
Version serverVersion() const;
/**
* Returns the driver version.
*
@ -431,7 +421,6 @@ private:
Version m_mesaVersion;
Version m_driverVersion;
Version m_galliumVersion;
Version m_serverVersion;
bool m_looseBinding : 1;
bool m_supportsGLSL : 1;
bool m_textureNPOT : 1;

@ -10,6 +10,7 @@
#include "libkwineffects/kwinglobals.h"
#include "libkwineffects/kwinxcb.h"
#include "libkwineffects/version.h"
#include "main.h"
#include "utils/c_ptr.h"
@ -2079,6 +2080,19 @@ inline uint8_t Shm::pixmapFormat() const
return m_pixmapFormat;
}
inline static Version xServerVersion()
{
if (xcb_connection_t *c = connection()) {
auto setup = xcb_get_setup(c);
const QByteArray vendorName(xcb_setup_vendor(setup), xcb_setup_vendor_length(setup));
if (vendorName.contains("X.Org")) {
const int release = setup->release_number;
return Version(release / 10000000, (release / 100000) % 100, (release / 1000) % 100);
}
}
return Version(0, 0, 0);
}
} // namespace X11
} // namespace KWin

@ -1796,8 +1796,8 @@ QString Workspace::supportInformation() const
if (platform->isMesaDriver()) {
support.append(QStringLiteral("Mesa version: ") + platform->mesaVersion().toString() + QStringLiteral("\n"));
}
if (platform->serverVersion().isValid()) {
support.append(QStringLiteral("X server version: ") + platform->serverVersion().toString() + QStringLiteral("\n"));
if (auto xVersion = Xcb::xServerVersion(); xVersion.isValid()) {
support.append(QStringLiteral("X server version: ") + xVersion.toString() + QStringLiteral("\n"));
}
if (auto kernelVersion = linuxKernelVersion(); kernelVersion.isValid()) {
support.append(QStringLiteral("Linux kernel version: ") + kernelVersion.toString() + QStringLiteral("\n"));

Loading…
Cancel
Save