From d960be4b3f3987dc55830ad48417cdc20c697554 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Tue, 27 Aug 2019 12:28:19 +0200 Subject: [PATCH] [platforms/fbdev] Create output device Summary: Create output device in framebuffer backend. Test Plan: On VT started `dbus-run-session kwin_wayland --framebuffer --xwayland`. Reviewers: #kwin Subscribers: kwin Tags: #kwin Maniphest Tasks: T11459 Differential Revision: https://phabricator.kde.org/D23478 --- plugins/platforms/fbdev/fb_backend.cpp | 16 +++++++++++++++- plugins/platforms/fbdev/fb_backend.h | 4 +--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/plugins/platforms/fbdev/fb_backend.cpp b/plugins/platforms/fbdev/fb_backend.cpp index 6e374f5f44..2dccb334f7 100644 --- a/plugins/platforms/fbdev/fb_backend.cpp +++ b/plugins/platforms/fbdev/fb_backend.cpp @@ -37,9 +37,22 @@ along with this program. If not, see . namespace KWin { +void FramebufferOutput::init(const QSize &size) +{ + m_pixelSize = size; + KWayland::Server::OutputDeviceInterface::Mode mode; + mode.id = 0; + mode.size = size; + mode.flags = KWayland::Server::OutputDeviceInterface::ModeFlag::Current; + mode.refreshRate = 60000; // TODO: get actual refresh rate of fb device? + AbstractWaylandOutput::initWaylandOutputDevice("model_TODO", "manufacturer_TODO", + "UUID_TODO", { mode }); +} + FramebufferBackend::FramebufferBackend(QObject *parent) : Platform(parent) { + handleOutputs(); } FramebufferBackend::~FramebufferBackend() @@ -137,8 +150,9 @@ bool FramebufferBackend::handleScreenInfo() } auto *output = new FramebufferOutput(this); - output->setPixelSize(QSize(varinfo.xres, varinfo.yres)); + output->init(QSize(varinfo.xres, varinfo.yres)); output->setRawPhysicalSize(QSize(varinfo.width, varinfo.height)); + output->setEnabled(true); m_outputs << output; m_id = QByteArray(fixinfo.id); diff --git a/plugins/platforms/fbdev/fb_backend.h b/plugins/platforms/fbdev/fb_backend.h index 09bf37ff24..c38e29ca0b 100644 --- a/plugins/platforms/fbdev/fb_backend.h +++ b/plugins/platforms/fbdev/fb_backend.h @@ -37,12 +37,10 @@ public: FramebufferOutput(QObject *parent = nullptr) : AbstractWaylandOutput(parent) {} ~FramebufferOutput() override = default; + void init(const QSize &size); QSize pixelSize() const override { return m_pixelSize; } - void setPixelSize(const QSize &set) { - m_pixelSize = set; - } void setRawPhysicalSize(const QSize &set) { AbstractWaylandOutput::setRawPhysicalSize(set);