platforms/drm: make debug logging less verbose
This commit is contained in:
parent
5246408660
commit
1e572a4299
6 changed files with 43 additions and 48 deletions
|
@ -41,9 +41,39 @@ bool DrmObject::initProps()
|
|||
return false;
|
||||
}
|
||||
if (KWIN_DRM().isDebugEnabled() && m_gpu->atomicModeSetting()) {
|
||||
for (int i = 0; i < m_propertyDefinitions.count(); i++) {
|
||||
if (!m_props[i]) {
|
||||
qCDebug(KWIN_DRM) << "Could not find property" << m_propertyDefinitions[i].name;
|
||||
auto debug = QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, KWIN_DRM().categoryName()).debug().nospace();
|
||||
switch(m_objectType) {
|
||||
case DRM_MODE_OBJECT_CONNECTOR:
|
||||
debug << "Connector ";
|
||||
break;
|
||||
case DRM_MODE_OBJECT_CRTC:
|
||||
debug << "Crtc ";
|
||||
break;
|
||||
case DRM_MODE_OBJECT_PLANE:
|
||||
debug << "Plane ";
|
||||
break;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
debug << m_id << " has properties ";
|
||||
for (int i = 0; i < m_props.count(); i++) {
|
||||
if (i > 0) {
|
||||
debug << ", ";
|
||||
}
|
||||
const auto &prop = m_props[i];
|
||||
if (prop) {
|
||||
debug << prop->name() << "=";
|
||||
if (m_propertyDefinitions[i].enumNames.isEmpty()) {
|
||||
debug << prop->current();
|
||||
} else {
|
||||
if (prop->current() < static_cast<uint64_t>(prop->enumMap().count())) {
|
||||
debug << prop->enumNames()[prop->enumMap()[prop->current()]];
|
||||
} else {
|
||||
debug << "invalid value: " << prop->current();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
debug << m_propertyDefinitions[i].name << " not found";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +164,6 @@ bool DrmObject::updateProperties()
|
|||
m_props[propIndex]->setCurrent(properties->prop_values[drmPropIndex]);
|
||||
}
|
||||
} else {
|
||||
qCDebug(KWIN_DRM, "Found property %s with value %lu", def.name.data(), properties->prop_values[drmPropIndex]);
|
||||
m_props[propIndex] = new Property(m_gpu, prop.data(), properties->prop_values[drmPropIndex], def.enumNames, blob);
|
||||
}
|
||||
found = true;
|
||||
|
@ -165,7 +194,6 @@ DrmObject::Property::Property(DrmGpu *gpu, drmModePropertyRes *prop, uint64_t va
|
|||
, m_gpu(gpu)
|
||||
{
|
||||
if (!enumNames.isEmpty()) {
|
||||
qCDebug(KWIN_DRM) << m_propName << " can have enums:" << enumNames;
|
||||
m_enumNames = enumNames;
|
||||
initEnumMap(prop);
|
||||
}
|
||||
|
@ -300,9 +328,6 @@ void DrmObject::Property::initEnumMap(drmModePropertyRes *prop)
|
|||
const int nameCount = m_enumNames.size();
|
||||
m_enumMap.resize(nameCount);
|
||||
|
||||
qCDebug(KWIN_DRM).nospace() << "Available are " << prop->count_enums <<
|
||||
" enums. Query their runtime values:";
|
||||
|
||||
for (int i = 0; i < prop->count_enums; i++) {
|
||||
struct drm_mode_property_enum *en = &prop->enums[i];
|
||||
int j = 0;
|
||||
|
@ -317,24 +342,9 @@ void DrmObject::Property::initEnumMap(drmModePropertyRes *prop)
|
|||
}
|
||||
|
||||
if (j < nameCount) {
|
||||
qCDebug(KWIN_DRM).nospace() << "Enum '" << en->name
|
||||
<< "': runtime-value = " << en->value;
|
||||
m_enumMap[j] = en->value;
|
||||
}
|
||||
}
|
||||
|
||||
if (KWIN_DRM().isDebugEnabled()) {
|
||||
for (int i = 0; i < m_enumMap.size(); i++) {
|
||||
if (m_current == m_enumMap[i]) {
|
||||
// TODO: This does not work with bitmask properties, because from kernel we get the
|
||||
// values for some reason as the shift distance instead of the full value.
|
||||
// See: https://github.com/torvalds/linux/blob/6794862a/drivers/
|
||||
// gpu/drm/drm_blend.c#L267
|
||||
qCDebug(KWIN_DRM) << "=>" << m_propName
|
||||
<< "with mapped enum value" << m_enumNames[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -83,15 +83,11 @@ public:
|
|||
|
||||
void initEnumMap(drmModePropertyRes *prop);
|
||||
|
||||
/**
|
||||
* For properties of enum type the enum map identifies the kernel runtime values,
|
||||
* which must be queried beforehand.
|
||||
*
|
||||
* @param n the index to the enum
|
||||
* @return the runtime enum value corresponding with enum index @param n
|
||||
*/
|
||||
uint64_t enumMap(int n) const {
|
||||
return m_enumMap[n]; // TODO: test on index out of bounds?
|
||||
QVector<QByteArray> enumNames() const {
|
||||
return m_enumNames;
|
||||
}
|
||||
QVector<uint64_t> enumMap() const {
|
||||
return m_enumMap;
|
||||
}
|
||||
bool hasEnum(uint64_t value) const {
|
||||
return m_enumMap.contains(value);
|
||||
|
|
|
@ -74,7 +74,6 @@ bool DrmConnector::init()
|
|||
if (!m_conn || !m_conn->count_modes) {
|
||||
return false;
|
||||
}
|
||||
qCDebug(KWIN_DRM) << "Creating connector" << id();
|
||||
|
||||
if (!initProps()) {
|
||||
return false;
|
||||
|
|
|
@ -34,7 +34,6 @@ bool DrmCrtc::init()
|
|||
if (!m_crtc) {
|
||||
return false;
|
||||
}
|
||||
qCDebug(KWIN_DRM) << "Init for CRTC:" << pipeIndex() << "id:" << id();
|
||||
return initProps();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ DrmPlane::DrmPlane(DrmGpu *gpu, uint32_t planeId)
|
|||
|
||||
bool DrmPlane::init()
|
||||
{
|
||||
qCDebug(KWIN_DRM) << "Atomic init for plane:" << id();
|
||||
DrmScopedPointer<drmModePlane> p(drmModeGetPlane(gpu()->fd(), id()));
|
||||
|
||||
if (!p) {
|
||||
|
@ -121,7 +120,7 @@ DrmPlane::TypeIndex DrmPlane::type()
|
|||
return TypeIndex::Overlay;
|
||||
}
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(TypeIndex::Count); i++) {
|
||||
if (property->enumMap(i) == property->current()) {
|
||||
if (property->enumMap()[i] == property->current()) {
|
||||
return TypeIndex(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -409,6 +409,10 @@ bool EglGbmBackend::initBufferConfigs()
|
|||
// Query some configuration parameters, to show in debug log.
|
||||
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_NATIVE_VISUAL_ID, &gbmFormat);
|
||||
|
||||
if (!m_gpu->isFormatSupported(gbmFormat)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Query number of bits for color channel
|
||||
EGLint blueSize, redSize, greenSize, alphaSize;
|
||||
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_RED_SIZE, &redSize);
|
||||
|
@ -416,18 +420,6 @@ bool EglGbmBackend::initBufferConfigs()
|
|||
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_BLUE_SIZE, &blueSize);
|
||||
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_ALPHA_SIZE, &alphaSize);
|
||||
|
||||
if (KWIN_DRM().isDebugEnabled()) {
|
||||
// GBM formats are declared as FOURCC code (integer from ASCII chars, so use this fact).
|
||||
char gbmFormatStr[sizeof(EGLint) + 1] = {0};
|
||||
memcpy(gbmFormatStr, &gbmFormat, sizeof(EGLint));
|
||||
qCDebug(KWIN_DRM) << " EGL config #" << i << " has GBM FOURCC format:" << gbmFormatStr
|
||||
<< "; color sizes (RGBA order):"
|
||||
<< redSize << greenSize << blueSize << alphaSize;
|
||||
}
|
||||
|
||||
if (!m_gpu->isFormatSupported(gbmFormat)) {
|
||||
continue;
|
||||
}
|
||||
// prefer XRGB8888 as it's most likely to be supported by secondary GPUs as well
|
||||
if (gbmFormat == GBM_BO_FORMAT_XRGB8888) {
|
||||
m_gbmFormat = gbmFormat;
|
||||
|
|
Loading…
Reference in a new issue