From f6029c3dbdfb49ebdd5fc3cab82380581a169ac9 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 7 Apr 2020 13:22:38 +0200 Subject: [PATCH] debugging: Simplify printing DrmObjects through QDebug Summary: Print automatically a few properties as well as the type, so it's easier to read debug information. Test Plan: Debugged a fix with it Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D28641 --- plugins/platforms/drm/drm_object.cpp | 5 +++++ plugins/platforms/drm/drm_object.h | 1 + 2 files changed, 6 insertions(+) diff --git a/plugins/platforms/drm/drm_object.cpp b/plugins/platforms/drm/drm_object.cpp index 2aff328ff3..5a5793b5f4 100644 --- a/plugins/platforms/drm/drm_object.cpp +++ b/plugins/platforms/drm/drm_object.cpp @@ -184,3 +184,8 @@ void DrmObject::Property::initEnumMap(drmModePropertyRes *prop) } } + +QDebug& operator<<(QDebug& s, const KWin::DrmObject* obj) +{ + return s.nospace() << "DrmObject(" << obj->id() << ", output:" << obj->output() << ", fd: "<< obj->fd() << ')'; +} diff --git a/plugins/platforms/drm/drm_object.h b/plugins/platforms/drm/drm_object.h index 80084c516a..c3eb387537 100644 --- a/plugins/platforms/drm/drm_object.h +++ b/plugins/platforms/drm/drm_object.h @@ -149,3 +149,4 @@ private: } +QDebug& operator<<(QDebug& stream, const KWin::DrmObject*);