Commit f9becf80 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez

wayland: Make sure EDID are being fed to wayland outputs

At the moment, despite the protocol supporting it, we were not feeding
the EDIDs. KScreen was falling back to the output name so it didn't fail
horribly but it's still a good idea to provide all the data.
parent 4150c1f0
......@@ -242,7 +242,8 @@ void AbstractWaylandOutput::setWaylandMode(const QSize &size, int refreshRate)
void AbstractWaylandOutput::initInterfaces(const QString &model, const QString &manufacturer,
const QByteArray &uuid, const QSize &physicalSize,
const QVector<DeviceInterface::Mode> &modes)
const QVector<DeviceInterface::Mode> &modes,
const QByteArray &edid)
{
m_waylandOutputDevice->setUuid(uuid);
......@@ -251,6 +252,7 @@ void AbstractWaylandOutput::initInterfaces(const QString &model, const QString &
} else {
m_waylandOutputDevice->setManufacturer(i18n("unknown"));
}
m_waylandOutputDevice->setEdid(edid);
m_waylandOutputDevice->setModel(model);
m_waylandOutputDevice->setPhysicalSize(physicalSize);
......
......@@ -124,7 +124,8 @@ Q_SIGNALS:
protected:
void initInterfaces(const QString &model, const QString &manufacturer,
const QByteArray &uuid, const QSize &physicalSize,
const QVector<KWaylandServer::OutputDeviceInterface::Mode> &modes);
const QVector<KWaylandServer::OutputDeviceInterface::Mode> &modes,
const QByteArray &edid);
QPoint globalPos() const;
......
......@@ -318,7 +318,7 @@ void DrmOutput::initOutputDevice(drmModeConnector *connector)
physicalSize = overwriteSize;
}
setName(connectorName);
initInterfaces(model, manufacturer, m_uuid, physicalSize, modes);
initInterfaces(model, manufacturer, m_uuid, physicalSize, modes, m_edid.raw());
}
bool DrmOutput::isCurrentMode(const drmModeModeInfo *mode) const
......@@ -352,6 +352,7 @@ void DrmOutput::initEdid(drmModeConnector *connector)
}
}
if (!edid) {
qDebug() << "could not find edid for connector" << connector << connector->connector_id;
return;
}
......
......@@ -154,6 +154,9 @@ Edid::Edid()
Edid::Edid(const void *data, uint32_t size)
{
m_raw.resize(size);
memcpy(m_raw.data(), data, size);
const uint8_t *bytes = static_cast<const uint8_t *>(data);
if (size < 128) {
......@@ -203,4 +206,9 @@ QByteArray Edid::vendor() const
return m_vendor;
}
QByteArray Edid::raw() const
{
return m_raw;
}
} // namespace KWin
......@@ -56,12 +56,19 @@ public:
*/
QByteArray vendor() const;
/**
* Returns the raw edid
*/
QByteArray raw() const;
private:
QSize m_physicalSize;
QByteArray m_vendor;
QByteArray m_eisaId;
QByteArray m_monitorName;
QByteArray m_serialNumber;
QByteArray m_raw;
bool m_isValid = false;
};
......
......@@ -39,7 +39,7 @@ void FramebufferOutput::init(const QSize &pixelSize, const QSize &physicalSize)
mode.size = pixelSize;
mode.flags = KWaylandServer::OutputDeviceInterface::ModeFlag::Current;
mode.refreshRate = 60000; // TODO: get actual refresh rate of fb device?
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", physicalSize, { mode });
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", physicalSize, { mode }, {});
}
FramebufferBackend::FramebufferBackend(QObject *parent)
......
......@@ -31,7 +31,7 @@ void VirtualOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
mode.size = pixelSize;
mode.flags = KWaylandServer::OutputDeviceInterface::ModeFlag::Current;
mode.refreshRate = 60000; // TODO
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", pixelSize, { mode });
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", pixelSize, { mode }, {});
setGeometry(QRect(logicalPosition, pixelSize));
}
......
......@@ -53,7 +53,7 @@ void WaylandOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
mode.size = pixelSize;
mode.flags = KWaylandServer::OutputDeviceInterface::ModeFlag::Current;
mode.refreshRate = 60000; // TODO: can we get refresh rate data from Wayland host?
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", pixelSize, { mode });
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", pixelSize, { mode }, {});
setGeometry(logicalPosition, pixelSize);
setScale(backend()->initialOutputScale());
}
......
......@@ -51,7 +51,7 @@ void X11WindowedOutput::init(const QPoint &logicalPosition, const QSize &pixelSi
// Physicial size must be adjusted, such that QPA calculates correct sizes of
// internal elements.
const QSize physicalSize = pixelSize / 96.0 * 25.4 / m_backend->initialOutputScale();
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", physicalSize, { mode });
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", physicalSize, { mode }, {});
setGeometry(logicalPosition, pixelSize);
setScale(m_backend->initialOutputScale());
......
Markdown is supported
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