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;
|
return false;
|
||||||
}
|
}
|
||||||
if (KWIN_DRM().isDebugEnabled() && m_gpu->atomicModeSetting()) {
|
if (KWIN_DRM().isDebugEnabled() && m_gpu->atomicModeSetting()) {
|
||||||
for (int i = 0; i < m_propertyDefinitions.count(); i++) {
|
auto debug = QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, KWIN_DRM().categoryName()).debug().nospace();
|
||||||
if (!m_props[i]) {
|
switch(m_objectType) {
|
||||||
qCDebug(KWIN_DRM) << "Could not find property" << m_propertyDefinitions[i].name;
|
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]);
|
m_props[propIndex]->setCurrent(properties->prop_values[drmPropIndex]);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
m_props[propIndex] = new Property(m_gpu, prop.data(), properties->prop_values[drmPropIndex], def.enumNames, blob);
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -165,7 +194,6 @@ DrmObject::Property::Property(DrmGpu *gpu, drmModePropertyRes *prop, uint64_t va
|
||||||
, m_gpu(gpu)
|
, m_gpu(gpu)
|
||||||
{
|
{
|
||||||
if (!enumNames.isEmpty()) {
|
if (!enumNames.isEmpty()) {
|
||||||
qCDebug(KWIN_DRM) << m_propName << " can have enums:" << enumNames;
|
|
||||||
m_enumNames = enumNames;
|
m_enumNames = enumNames;
|
||||||
initEnumMap(prop);
|
initEnumMap(prop);
|
||||||
}
|
}
|
||||||
|
@ -300,9 +328,6 @@ void DrmObject::Property::initEnumMap(drmModePropertyRes *prop)
|
||||||
const int nameCount = m_enumNames.size();
|
const int nameCount = m_enumNames.size();
|
||||||
m_enumMap.resize(nameCount);
|
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++) {
|
for (int i = 0; i < prop->count_enums; i++) {
|
||||||
struct drm_mode_property_enum *en = &prop->enums[i];
|
struct drm_mode_property_enum *en = &prop->enums[i];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -317,24 +342,9 @@ void DrmObject::Property::initEnumMap(drmModePropertyRes *prop)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j < nameCount) {
|
if (j < nameCount) {
|
||||||
qCDebug(KWIN_DRM).nospace() << "Enum '" << en->name
|
|
||||||
<< "': runtime-value = " << en->value;
|
|
||||||
m_enumMap[j] = 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);
|
void initEnumMap(drmModePropertyRes *prop);
|
||||||
|
|
||||||
/**
|
QVector<QByteArray> enumNames() const {
|
||||||
* For properties of enum type the enum map identifies the kernel runtime values,
|
return m_enumNames;
|
||||||
* which must be queried beforehand.
|
}
|
||||||
*
|
QVector<uint64_t> enumMap() const {
|
||||||
* @param n the index to the enum
|
return m_enumMap;
|
||||||
* @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?
|
|
||||||
}
|
}
|
||||||
bool hasEnum(uint64_t value) const {
|
bool hasEnum(uint64_t value) const {
|
||||||
return m_enumMap.contains(value);
|
return m_enumMap.contains(value);
|
||||||
|
|
|
@ -74,7 +74,6 @@ bool DrmConnector::init()
|
||||||
if (!m_conn || !m_conn->count_modes) {
|
if (!m_conn || !m_conn->count_modes) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
qCDebug(KWIN_DRM) << "Creating connector" << id();
|
|
||||||
|
|
||||||
if (!initProps()) {
|
if (!initProps()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -34,7 +34,6 @@ bool DrmCrtc::init()
|
||||||
if (!m_crtc) {
|
if (!m_crtc) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
qCDebug(KWIN_DRM) << "Init for CRTC:" << pipeIndex() << "id:" << id();
|
|
||||||
return initProps();
|
return initProps();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ DrmPlane::DrmPlane(DrmGpu *gpu, uint32_t planeId)
|
||||||
|
|
||||||
bool DrmPlane::init()
|
bool DrmPlane::init()
|
||||||
{
|
{
|
||||||
qCDebug(KWIN_DRM) << "Atomic init for plane:" << id();
|
|
||||||
DrmScopedPointer<drmModePlane> p(drmModeGetPlane(gpu()->fd(), id()));
|
DrmScopedPointer<drmModePlane> p(drmModeGetPlane(gpu()->fd(), id()));
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
|
@ -121,7 +120,7 @@ DrmPlane::TypeIndex DrmPlane::type()
|
||||||
return TypeIndex::Overlay;
|
return TypeIndex::Overlay;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < static_cast<uint32_t>(TypeIndex::Count); i++) {
|
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);
|
return TypeIndex(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,6 +409,10 @@ bool EglGbmBackend::initBufferConfigs()
|
||||||
// Query some configuration parameters, to show in debug log.
|
// Query some configuration parameters, to show in debug log.
|
||||||
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_NATIVE_VISUAL_ID, &gbmFormat);
|
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_NATIVE_VISUAL_ID, &gbmFormat);
|
||||||
|
|
||||||
|
if (!m_gpu->isFormatSupported(gbmFormat)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Query number of bits for color channel
|
// Query number of bits for color channel
|
||||||
EGLint blueSize, redSize, greenSize, alphaSize;
|
EGLint blueSize, redSize, greenSize, alphaSize;
|
||||||
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_RED_SIZE, &redSize);
|
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_BLUE_SIZE, &blueSize);
|
||||||
eglGetConfigAttrib(eglDisplay(), configs[i], EGL_ALPHA_SIZE, &alphaSize);
|
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
|
// prefer XRGB8888 as it's most likely to be supported by secondary GPUs as well
|
||||||
if (gbmFormat == GBM_BO_FORMAT_XRGB8888) {
|
if (gbmFormat == GBM_BO_FORMAT_XRGB8888) {
|
||||||
m_gbmFormat = gbmFormat;
|
m_gbmFormat = gbmFormat;
|
||||||
|
|
Loading…
Reference in a new issue