platforms/drm: replace dpms property hack with proper check

Instead of marking the dpms property as immutable, read the
DRM_MODE_PROP_ATOMIC flag and only add atomic properties to
atomic requests.
This commit is contained in:
Xaver Hugl 2021-04-12 19:27:20 +02:00
parent 18f857b1f3
commit a461ff918d
3 changed files with 6 additions and 16 deletions

View file

@ -77,7 +77,7 @@ bool DrmObject::atomicPopulate(drmModeAtomicReq *req) const
bool ret = true;
for (const auto &property : qAsConst(m_props)) {
if (property && !property->isImmutable()) {
if (property && !property->isImmutable() && property->isAtomic()) {
ret &= atomicAddProperty(req, property);
}
}
@ -108,6 +108,7 @@ DrmObject::Property::Property(drmModePropertyRes *prop, uint64_t val, const QVec
, m_propName(prop->name)
, m_value(val)
, m_immutable(prop->flags & DRM_MODE_PROP_IMMUTABLE)
, m_atomic(prop->flags & DRM_MODE_PROP_ATOMIC)
, m_blob(blob)
{
if (!enumNames.isEmpty()) {

View file

@ -135,16 +135,12 @@ protected:
const QByteArray &name() const {
return m_propName;
}
/**
* while this is usually automatically set, some properties
* (like DPMS) are not meant to be used in AMS
*/
void setImmutable() {
m_immutable = true;
}
bool isImmutable() const {
return m_immutable;
}
bool isAtomic() const {
return m_atomic;
}
drmModePropertyBlobRes *blob() const {
return m_blob.data();
}
@ -157,6 +153,7 @@ protected:
QVector<uint64_t> m_enumMap;
QVector<QByteArray> m_enumNames;
bool m_immutable = false;
bool m_atomic;
DrmScopedPointer<drmModePropertyBlobRes> m_blob;
};

View file

@ -42,14 +42,6 @@ bool DrmConnector::init()
return false;
}
if (auto dpmsProp = m_props[static_cast<uint32_t>(PropertyIndex::Dpms)]) {
// the dpms property makes atomic commits fail
// for legacy it will be explicitly set
dpmsProp->setImmutable();
} else {
qCDebug(KWIN_DRM) << "Could not find DPMS property!";
}
// parse edid
if (auto edidProp = m_props[static_cast<uint32_t>(PropertyIndex::Edid)]) {
m_edid = Edid(edidProp->blob()->data, edidProp->blob()->length);