Port Workspace::supportInformation() to AbstractOutput
This commit is contained in:
parent
1b2e8437ac
commit
9bf6e2bd68
3 changed files with 13 additions and 52 deletions
|
@ -15,8 +15,6 @@
|
|||
#include <workspace.h>
|
||||
#include <config-kwin.h>
|
||||
#include "platform.h"
|
||||
#include "wayland_server.h"
|
||||
#include "abstract_wayland_output.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -185,36 +183,6 @@ int Screens::physicalDpiY(int screen) const
|
|||
return size(screen).height() / physicalSize(screen).height() * qreal(25.4);
|
||||
}
|
||||
|
||||
bool Screens::isVrrCapable(int screen) const
|
||||
{
|
||||
#ifdef KWIN_UNIT_TEST
|
||||
Q_UNUSED(screen);
|
||||
return false;
|
||||
#else
|
||||
if (auto output = findOutput(screen)) {
|
||||
if (auto waylandoutput = dynamic_cast<AbstractWaylandOutput*>(output)) {
|
||||
return waylandoutput->capabilities() & AbstractWaylandOutput::Capability::Vrr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
RenderLoop::VrrPolicy Screens::vrrPolicy(int screen) const
|
||||
{
|
||||
#ifdef KWIN_UNIT_TEST
|
||||
Q_UNUSED(screen);
|
||||
return RenderLoop::VrrPolicy::Never;
|
||||
#else
|
||||
if (auto output = findOutput(screen)) {
|
||||
if (auto waylandOutput = dynamic_cast<AbstractWaylandOutput *>(output)) {
|
||||
return waylandOutput->vrrPolicy();
|
||||
}
|
||||
}
|
||||
return RenderLoop::VrrPolicy::Never;
|
||||
#endif
|
||||
}
|
||||
|
||||
int Screens::number(const QPoint &pos) const
|
||||
{
|
||||
// TODO: Do something about testScreens and other tests that use MockScreens.
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
// KWin includes
|
||||
#include <kwinglobals.h>
|
||||
#include <renderloop.h>
|
||||
// KDE includes
|
||||
#include <KConfig>
|
||||
#include <KSharedConfig>
|
||||
|
@ -111,15 +110,6 @@ public:
|
|||
int physicalDpiX(int screen) const;
|
||||
int physicalDpiY(int screen) const;
|
||||
|
||||
/**
|
||||
* @returns @c true if the @p screen is capable of variable refresh rate and if the platform can use it
|
||||
*/
|
||||
bool isVrrCapable(int screen) const;
|
||||
/**
|
||||
* @returns the vrr policy of the @p screen
|
||||
*/
|
||||
RenderLoop::VrrPolicy vrrPolicy(int screen) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void countChanged(int previousCount, int newCount);
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// kwin libs
|
||||
#include <kwinglplatform.h>
|
||||
// kwin
|
||||
#include "abstract_output.h"
|
||||
#include "abstract_wayland_output.h"
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
#include "activities.h"
|
||||
#endif
|
||||
|
@ -1614,23 +1614,26 @@ QString Workspace::supportInformation() const
|
|||
support.append(QStringLiteral(" yes\n"));
|
||||
else
|
||||
support.append(QStringLiteral(" no\n"));
|
||||
support.append(QStringLiteral("Number of Screens: %1\n\n").arg(screens()->count()));
|
||||
for (int i=0; i<screens()->count(); ++i) {
|
||||
const QRect geo = screens()->geometry(i);
|
||||
const QVector<AbstractOutput *> outputs = kwinApp()->platform()->enabledOutputs();
|
||||
support.append(QStringLiteral("Number of Screens: %1\n\n").arg(outputs.count()));
|
||||
for (int i = 0; i < outputs.count(); ++i) {
|
||||
const auto output = outputs[i];
|
||||
const QRect geo = outputs[i]->geometry();
|
||||
support.append(QStringLiteral("Screen %1:\n").arg(i));
|
||||
support.append(QStringLiteral("---------\n"));
|
||||
support.append(QStringLiteral("Name: %1\n").arg(screens()->name(i)));
|
||||
support.append(QStringLiteral("Name: %1\n").arg(output->name()));
|
||||
support.append(QStringLiteral("Geometry: %1,%2,%3x%4\n")
|
||||
.arg(geo.x())
|
||||
.arg(geo.y())
|
||||
.arg(geo.width())
|
||||
.arg(geo.height()));
|
||||
support.append(QStringLiteral("Scale: %1\n").arg(screens()->scale(i)));
|
||||
support.append(QStringLiteral("Refresh Rate: %1\n").arg(screens()->refreshRate(i)));
|
||||
if (waylandServer()) {
|
||||
support.append(QStringLiteral("Scale: %1\n").arg(output->scale()));
|
||||
support.append(QStringLiteral("Refresh Rate: %1\n").arg(output->refreshRate()));
|
||||
const auto waylandOutput = qobject_cast<AbstractWaylandOutput *>(output);
|
||||
if (waylandOutput) {
|
||||
QString vrr = QStringLiteral("incapable");
|
||||
if (screens()->isVrrCapable(i)) {
|
||||
switch(screens()->vrrPolicy(i)) {
|
||||
if (waylandOutput->capabilities() & AbstractWaylandOutput::Capability::Vrr) {
|
||||
switch (waylandOutput->vrrPolicy()) {
|
||||
case RenderLoop::VrrPolicy::Never:
|
||||
vrr = QStringLiteral("never");
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue