Initialize Wayland output in AbstractOutput
Summary: Wayland output is on protocol level and not dependent on the hardware platform. Next steps are to do the same for output device and then let the virtual output call into these initializing functions as well. Test Plan: Manually and auto test. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: davidedmundson, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16783
This commit is contained in:
parent
c003db22c6
commit
21aee588af
4 changed files with 34 additions and 36 deletions
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "wayland_server.h"
|
||||
|
||||
// KWayland
|
||||
#include <KWayland/Server/display.h>
|
||||
#include <KWayland/Server/output_interface.h>
|
||||
#include <KWayland/Server/outputchangeset.h>
|
||||
#include <KWayland/Server/outputdevice_interface.h>
|
||||
|
@ -109,11 +110,6 @@ void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes)
|
|||
commitChanges();
|
||||
}
|
||||
|
||||
void AbstractOutput::setWaylandOutput(KWayland::Server::OutputInterface *set)
|
||||
{
|
||||
m_waylandOutput = set;
|
||||
}
|
||||
|
||||
void AbstractOutput::createXdgOutput()
|
||||
{
|
||||
if (!m_waylandOutput || m_xdgOutput) {
|
||||
|
@ -127,4 +123,32 @@ void AbstractOutput::setWaylandOutputDevice(KWayland::Server::OutputDeviceInterf
|
|||
m_waylandOutputDevice = set;
|
||||
}
|
||||
|
||||
void AbstractOutput::initWaylandOutput()
|
||||
{
|
||||
Q_ASSERT(m_waylandOutputDevice);
|
||||
|
||||
if (!m_waylandOutput.isNull()) {
|
||||
delete m_waylandOutput.data();
|
||||
m_waylandOutput.clear();
|
||||
}
|
||||
m_waylandOutput = waylandServer()->display()->createOutput();
|
||||
createXdgOutput();
|
||||
|
||||
m_waylandOutput->setManufacturer(m_waylandOutputDevice->manufacturer());
|
||||
m_waylandOutput->setModel(m_waylandOutputDevice->model());
|
||||
m_waylandOutput->setPhysicalSize(rawPhysicalSize());
|
||||
|
||||
for(const auto &mode: m_waylandOutputDevice->modes()) {
|
||||
KWayland::Server::OutputInterface::ModeFlags flags;
|
||||
if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Current) {
|
||||
flags |= KWayland::Server::OutputInterface::ModeFlag::Current;
|
||||
}
|
||||
if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Preferred) {
|
||||
flags |= KWayland::Server::OutputInterface::ModeFlag::Preferred;
|
||||
}
|
||||
m_waylandOutput->addMode(mode.size, flags, mode.refreshRate);
|
||||
}
|
||||
m_waylandOutput->create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,8 +107,6 @@ protected:
|
|||
return m_changeset;
|
||||
}
|
||||
|
||||
void setWaylandOutput(KWayland::Server::OutputInterface *set);
|
||||
|
||||
QPointer<KWayland::Server::XdgOutputInterface> xdgOutput() const {
|
||||
return m_xdgOutput;
|
||||
}
|
||||
|
@ -139,6 +137,7 @@ protected:
|
|||
void setInternal(bool set) {
|
||||
m_internal = set;
|
||||
}
|
||||
void initWaylandOutput();
|
||||
|
||||
private:
|
||||
QPointer<KWayland::Server::OutputChangeSet> m_changeset;
|
||||
|
|
|
@ -193,7 +193,8 @@ void DrmOutput::setEnabled(bool enabled)
|
|||
}
|
||||
if (enabled) {
|
||||
setDpms(DpmsMode::On);
|
||||
initOutput();
|
||||
initWaylandOutput();
|
||||
initDrmWaylandOutput();
|
||||
} else {
|
||||
setDpms(DpmsMode::Off);
|
||||
delete waylandOutput().data();
|
||||
|
@ -328,19 +329,9 @@ void DrmOutput::initUuid()
|
|||
m_uuid = hash.result().toHex().left(10);
|
||||
}
|
||||
|
||||
void DrmOutput::initOutput()
|
||||
void DrmOutput::initDrmWaylandOutput()
|
||||
{
|
||||
auto wlOutputDevice = waylandOutputDevice();
|
||||
Q_ASSERT(wlOutputDevice);
|
||||
|
||||
auto wlOutput = waylandOutput();
|
||||
if (!wlOutput.isNull()) {
|
||||
delete wlOutput.data();
|
||||
wlOutput.clear();
|
||||
}
|
||||
wlOutput = waylandServer()->display()->createOutput();
|
||||
setWaylandOutput(wlOutput.data());
|
||||
createXdgOutput();
|
||||
connect(this, &DrmOutput::modeChanged, this,
|
||||
[this] {
|
||||
auto wlOutput = waylandOutput();
|
||||
|
@ -356,9 +347,6 @@ void DrmOutput::initOutput()
|
|||
}
|
||||
}
|
||||
);
|
||||
wlOutput->setManufacturer(wlOutputDevice->manufacturer());
|
||||
wlOutput->setModel(wlOutputDevice->model());
|
||||
wlOutput->setPhysicalSize(rawPhysicalSize());
|
||||
|
||||
// set dpms
|
||||
if (!m_dpms.isNull()) {
|
||||
|
@ -370,19 +358,6 @@ void DrmOutput::initOutput()
|
|||
}, Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
|
||||
for(const auto &mode: wlOutputDevice->modes()) {
|
||||
KWayland::Server::OutputInterface::ModeFlags flags;
|
||||
if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Current) {
|
||||
flags |= KWayland::Server::OutputInterface::ModeFlag::Current;
|
||||
}
|
||||
if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Preferred) {
|
||||
flags |= KWayland::Server::OutputInterface::ModeFlag::Preferred;
|
||||
}
|
||||
wlOutput->addMode(mode.size, flags, mode.refreshRate);
|
||||
}
|
||||
|
||||
wlOutput->create();
|
||||
}
|
||||
|
||||
void DrmOutput::initOutputDevice(drmModeConnector *connector)
|
||||
|
|
|
@ -124,10 +124,10 @@ private:
|
|||
void initEdid(drmModeConnector *connector);
|
||||
void initDpms(drmModeConnector *connector);
|
||||
void initOutputDevice(drmModeConnector *connector);
|
||||
void initDrmWaylandOutput();
|
||||
|
||||
bool isCurrentMode(const drmModeModeInfo *mode) const;
|
||||
void initUuid();
|
||||
void initOutput();
|
||||
bool initPrimaryPlane();
|
||||
bool initCursorPlane();
|
||||
|
||||
|
|
Loading…
Reference in a new issue