drm: Use introspection to print enums
Removes a bit of code and allows to list the supported transformations on the same line, which is useful to be able to grep over the output.
This commit is contained in:
parent
a7b922bfce
commit
03b12d1dfc
2 changed files with 13 additions and 10 deletions
|
@ -112,21 +112,19 @@ bool DrmPlane::initProps()
|
||||||
initProp(j, properties.data(), rotationNames);
|
initProp(j, properties.data(), rotationNames);
|
||||||
m_supportedTransformations = Transformations();
|
m_supportedTransformations = Transformations();
|
||||||
|
|
||||||
auto checkSupport = [j, this] (uint64_t value, Transformation t, const QString &name) {
|
auto checkSupport = [j, this] (uint64_t value, Transformation t) {
|
||||||
if (propHasEnum(j, value)) {
|
if (propHasEnum(j, value)) {
|
||||||
qCDebug(KWIN_DRM) << name;
|
|
||||||
m_supportedTransformations |= t;
|
m_supportedTransformations |= t;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
qCDebug(KWIN_DRM).nospace() << "Supported Transformations on plane " << m_id << ":";
|
checkSupport(0, Transformation::Rotate0);
|
||||||
checkSupport(0, Transformation::Rotate0, "rotate-0");
|
checkSupport(1, Transformation::Rotate90);
|
||||||
checkSupport(1, Transformation::Rotate90, "rotate-90");
|
checkSupport(2, Transformation::Rotate180);
|
||||||
checkSupport(2, Transformation::Rotate180, "rotate-180");
|
checkSupport(3, Transformation::Rotate270);
|
||||||
checkSupport(3, Transformation::Rotate270, "rotate-270");
|
checkSupport(4, Transformation::ReflectX);
|
||||||
checkSupport(4, Transformation::ReflectX, "reflect-x");
|
checkSupport(5, Transformation::ReflectY);
|
||||||
checkSupport(5, Transformation::ReflectY, "reflect-y");
|
|
||||||
qCDebug(KWIN_DRM) << "";
|
|
||||||
|
|
||||||
|
qCDebug(KWIN_DRM) << "Supported Transformations on plane" << m_id << "are" << m_supportedTransformations;
|
||||||
} else {
|
} else {
|
||||||
initProp(j, properties.data());
|
initProp(j, properties.data());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "drm_object.h"
|
#include "drm_object.h"
|
||||||
|
|
||||||
|
#include <qobjectdefs.h>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -30,6 +31,7 @@ class DrmBuffer;
|
||||||
|
|
||||||
class DrmPlane : public DrmObject
|
class DrmPlane : public DrmObject
|
||||||
{
|
{
|
||||||
|
Q_GADGET
|
||||||
public:
|
public:
|
||||||
DrmPlane(uint32_t plane_id, int fd);
|
DrmPlane(uint32_t plane_id, int fd);
|
||||||
|
|
||||||
|
@ -50,6 +52,7 @@ public:
|
||||||
Rotation,
|
Rotation,
|
||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
|
Q_ENUM(PropertyIndex)
|
||||||
|
|
||||||
enum class TypeIndex {
|
enum class TypeIndex {
|
||||||
Overlay = 0,
|
Overlay = 0,
|
||||||
|
@ -57,6 +60,7 @@ public:
|
||||||
Cursor,
|
Cursor,
|
||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
|
Q_ENUM(TypeIndex)
|
||||||
|
|
||||||
enum class Transformation {
|
enum class Transformation {
|
||||||
Rotate0 = 1 << 0,
|
Rotate0 = 1 << 0,
|
||||||
|
@ -66,6 +70,7 @@ public:
|
||||||
ReflectX = 1 << 4,
|
ReflectX = 1 << 4,
|
||||||
ReflectY = 1 << 5
|
ReflectY = 1 << 5
|
||||||
};
|
};
|
||||||
|
Q_ENUM(Transformation)
|
||||||
Q_DECLARE_FLAGS(Transformations, Transformation);
|
Q_DECLARE_FLAGS(Transformations, Transformation);
|
||||||
|
|
||||||
bool atomicInit() override;
|
bool atomicInit() override;
|
||||||
|
|
Loading…
Reference in a new issue