Also initialize properties when not using AMS

BUG: 431981
This commit is contained in:
Xaver Hugl 2021-01-26 21:23:44 +01:00
parent 7a997bc4ec
commit 9f4a1433e4
9 changed files with 20 additions and 22 deletions

View file

@ -18,7 +18,7 @@ public:
{
}
~MockDrmObject() override {}
bool atomicInit() override;
bool init() override;
bool initProps() override;
void setProperties(uint32_t count, uint32_t *props, uint64_t *values) {
@ -49,7 +49,7 @@ private:
uint64_t *m_values = nullptr;
};
bool MockDrmObject::atomicInit()
bool MockDrmObject::init()
{
return initProps();
}
@ -186,7 +186,7 @@ void ObjectTest::testInitProperties()
}
});
object.atomicInit();
object.init();
// verify the names
QCOMPARE(object.name(0), QByteArrayLiteral("foo"));

View file

@ -101,7 +101,7 @@ void DrmGpu::tryAMS()
for (unsigned int i = 0; i < planeResources->count_planes; ++i) {
DrmScopedPointer<drmModePlane> kplane(drmModeGetPlane(m_fd, planeResources->planes[i]));
DrmPlane *p = new DrmPlane(kplane->plane_id, m_fd);
if (p->atomicInit()) {
if (p->init()) {
planes << p;
if (p->type() == DrmPlane::TypeIndex::Overlay) {
overlayPlanes << p;
@ -146,15 +146,13 @@ bool DrmGpu::updateOutputs()
auto it = std::find_if(m_connectors.constBegin(), m_connectors.constEnd(), [currentConnector] (DrmConnector *c) { return c->id() == currentConnector; });
if (it == m_connectors.constEnd()) {
auto c = new DrmConnector(currentConnector, m_fd);
if (m_atomicModeSetting) {
if (!c->atomicInit()) {
delete c;
continue;
}
if (c->isNonDesktop()) {
delete c;
continue;
}
if (!c->init()) {
delete c;
continue;
}
if (c->isNonDesktop()) {
delete c;
continue;
}
m_connectors << c;
} else {
@ -167,7 +165,7 @@ bool DrmGpu::updateOutputs()
auto it = std::find_if(m_crtcs.constBegin(), m_crtcs.constEnd(), [currentCrtc] (DrmCrtc *c) { return c->id() == currentCrtc; });
if (it == m_crtcs.constEnd()) {
auto c = new DrmCrtc(currentCrtc, m_backend, this, i);
if (m_atomicModeSetting && !c->atomicInit()) {
if (!c->init()) {
delete c;
continue;
}

View file

@ -36,7 +36,7 @@ public:
* Must be called to query necessary data directly after creation.
* @return true when initializing was successful
*/
virtual bool atomicInit() = 0;
virtual bool init() = 0;
uint32_t id() const {
return m_id;

View file

@ -27,7 +27,7 @@ DrmConnector::DrmConnector(uint32_t connector_id, int fd)
DrmConnector::~DrmConnector() = default;
bool DrmConnector::atomicInit()
bool DrmConnector::init()
{
qCDebug(KWIN_DRM) << "Creating connector" << m_id;

View file

@ -21,7 +21,7 @@ public:
~DrmConnector() override;
bool atomicInit() override;
bool init() override;
enum class PropertyIndex {
CrtcId = 0,

View file

@ -33,9 +33,9 @@ DrmCrtc::~DrmCrtc()
{
}
bool DrmCrtc::atomicInit()
bool DrmCrtc::init()
{
qCDebug(KWIN_DRM) << "Atomic init for CRTC:" << resIndex() << "id:" << m_id;
qCDebug(KWIN_DRM) << "Init for CRTC:" << resIndex() << "id:" << m_id;
if (!initProps()) {
return false;

View file

@ -27,7 +27,7 @@ public:
~DrmCrtc() override;
bool atomicInit() override;
bool init() override;
enum class PropertyIndex {
ModeId = 0,

View file

@ -25,7 +25,7 @@ DrmPlane::~DrmPlane()
delete m_next;
}
bool DrmPlane::atomicInit()
bool DrmPlane::init()
{
qCDebug(KWIN_DRM) << "Atomic init for plane:" << m_id;
DrmScopedPointer<drmModePlane> p(drmModeGetPlane(fd(), m_id));

View file

@ -62,7 +62,7 @@ public:
Q_ENUM(Transformation)
Q_DECLARE_FLAGS(Transformations, Transformation);
bool atomicInit() override;
bool init() override;
bool initProps() override;
TypeIndex type();