Commit 9f4a1433 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

Also initialize properties when not using AMS

BUG: 431981
parent 7a997bc4
......@@ -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"));
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -21,7 +21,7 @@ public:
~DrmConnector() override;
bool atomicInit() override;
bool init() override;
enum class PropertyIndex {
CrtcId = 0,
......
......@@ -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;
......
......@@ -27,7 +27,7 @@ public:
~DrmCrtc() override;
bool atomicInit() override;
bool init() override;
enum class PropertyIndex {
ModeId = 0,
......
......@@ -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));
......
......@@ -62,7 +62,7 @@ public:
Q_ENUM(Transformation)
Q_DECLARE_FLAGS(Transformations, Transformation);
bool atomicInit() override;
bool init() override;
bool initProps() override;
TypeIndex type();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment