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);
|
||||
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)) {
|
||||
qCDebug(KWIN_DRM) << name;
|
||||
m_supportedTransformations |= t;
|
||||
}
|
||||
};
|
||||
qCDebug(KWIN_DRM).nospace() << "Supported Transformations on plane " << m_id << ":";
|
||||
checkSupport(0, Transformation::Rotate0, "rotate-0");
|
||||
checkSupport(1, Transformation::Rotate90, "rotate-90");
|
||||
checkSupport(2, Transformation::Rotate180, "rotate-180");
|
||||
checkSupport(3, Transformation::Rotate270, "rotate-270");
|
||||
checkSupport(4, Transformation::ReflectX, "reflect-x");
|
||||
checkSupport(5, Transformation::ReflectY, "reflect-y");
|
||||
qCDebug(KWIN_DRM) << "";
|
||||
checkSupport(0, Transformation::Rotate0);
|
||||
checkSupport(1, Transformation::Rotate90);
|
||||
checkSupport(2, Transformation::Rotate180);
|
||||
checkSupport(3, Transformation::Rotate270);
|
||||
checkSupport(4, Transformation::ReflectX);
|
||||
checkSupport(5, Transformation::ReflectY);
|
||||
|
||||
qCDebug(KWIN_DRM) << "Supported Transformations on plane" << m_id << "are" << m_supportedTransformations;
|
||||
} else {
|
||||
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 <qobjectdefs.h>
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
namespace KWin
|
||||
|
@ -30,6 +31,7 @@ class DrmBuffer;
|
|||
|
||||
class DrmPlane : public DrmObject
|
||||
{
|
||||
Q_GADGET
|
||||
public:
|
||||
DrmPlane(uint32_t plane_id, int fd);
|
||||
|
||||
|
@ -50,6 +52,7 @@ public:
|
|||
Rotation,
|
||||
Count
|
||||
};
|
||||
Q_ENUM(PropertyIndex)
|
||||
|
||||
enum class TypeIndex {
|
||||
Overlay = 0,
|
||||
|
@ -57,6 +60,7 @@ public:
|
|||
Cursor,
|
||||
Count
|
||||
};
|
||||
Q_ENUM(TypeIndex)
|
||||
|
||||
enum class Transformation {
|
||||
Rotate0 = 1 << 0,
|
||||
|
@ -66,6 +70,7 @@ public:
|
|||
ReflectX = 1 << 4,
|
||||
ReflectY = 1 << 5
|
||||
};
|
||||
Q_ENUM(Transformation)
|
||||
Q_DECLARE_FLAGS(Transformations, Transformation);
|
||||
|
||||
bool atomicInit() override;
|
||||
|
|
Loading…
Reference in a new issue