Introduce the legacy flag for drm properties

There are properties like for example rotation
that don't have the atomic flag, yet work and
are needed in atomic mode setting.
This commit is contained in:
Xaver Hugl 2021-04-20 00:42:37 +02:00
parent 5839e59e24
commit 7a9676dc0a
3 changed files with 17 additions and 6 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() && property->isAtomic()) {
if (property && !property->isImmutable() && !property->isLegacy()) {
ret &= atomicAddProperty(req, property);
}
}
@ -108,7 +108,6 @@ 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

@ -138,12 +138,18 @@ protected:
bool isImmutable() const {
return m_immutable;
}
bool isAtomic() const {
return m_atomic;
}
drmModePropertyBlobRes *blob() const {
return m_blob.data();
}
bool isLegacy() const {
return m_legacy;
}
/**
* Makes this property be ignored by DrmObject::atomicPopulate
*/
void setLegacy() {
m_legacy = true;
}
private:
uint32_t m_propId = 0;
@ -153,7 +159,7 @@ protected:
QVector<uint64_t> m_enumMap;
QVector<QByteArray> m_enumNames;
const bool m_immutable;
const bool m_atomic;
bool m_legacy = false;
DrmScopedPointer<drmModePropertyBlobRes> m_blob;
};

View file

@ -67,6 +67,12 @@ bool DrmConnector::init()
return false;
}
if (auto dpmsProp = m_props[static_cast<uint32_t>(PropertyIndex::Dpms)]) {
dpmsProp->setLegacy();
} 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);