backends/drm: query min and max values for properties
This commit is contained in:
parent
4f2c3a00c4
commit
cfeeb817bf
2 changed files with 21 additions and 0 deletions
|
@ -30,6 +30,11 @@ DrmProperty::DrmProperty(DrmObject *obj, drmModePropertyRes *prop, uint64_t val,
|
|||
m_enumNames = enumNames;
|
||||
initEnumMap(prop);
|
||||
}
|
||||
if (prop->flags & DRM_MODE_PROP_RANGE) {
|
||||
Q_ASSERT(prop->count_values > 1);
|
||||
m_minValue = prop->values[0];
|
||||
m_maxValue = prop->values[1];
|
||||
}
|
||||
}
|
||||
|
||||
DrmProperty::~DrmProperty() = default;
|
||||
|
@ -146,4 +151,14 @@ void DrmProperty::setLegacy()
|
|||
m_legacy = true;
|
||||
}
|
||||
|
||||
uint64_t DrmProperty::minValue() const
|
||||
{
|
||||
return m_minValue;
|
||||
}
|
||||
|
||||
uint64_t DrmProperty::maxValue() const
|
||||
{
|
||||
return m_maxValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,9 @@ public:
|
|||
void setCurrent(uint64_t value);
|
||||
uint64_t current() const;
|
||||
|
||||
uint64_t minValue() const;
|
||||
uint64_t maxValue() const;
|
||||
|
||||
void commit();
|
||||
void commitPending();
|
||||
void rollbackPending();
|
||||
|
@ -87,6 +90,9 @@ private:
|
|||
// the value currently set for or by the kernel
|
||||
uint64_t m_current = 0;
|
||||
|
||||
uint64_t m_minValue = -1;
|
||||
uint64_t m_maxValue = -1;
|
||||
|
||||
QMap<uint32_t, uint64_t> m_enumMap;
|
||||
QVector<QByteArray> m_enumNames;
|
||||
const bool m_immutable;
|
||||
|
|
Loading…
Reference in a new issue