Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/fbdev/fb_backend.cpp
Show All 31 Lines | |||||
32 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> | ||
33 | #include <sys/mman.h> | 33 | #include <sys/mman.h> | ||
34 | // Linux | 34 | // Linux | ||
35 | #include <linux/fb.h> | 35 | #include <linux/fb.h> | ||
36 | 36 | | |||
37 | namespace KWin | 37 | namespace KWin | ||
38 | { | 38 | { | ||
39 | 39 | | |||
40 | void FramebufferOutput::init(const QSize &size) | 40 | void FramebufferOutput::init(const QSize &pixelSize, const QSize &physicalSize) | ||
41 | { | 41 | { | ||
42 | KWayland::Server::OutputDeviceInterface::Mode mode; | 42 | KWayland::Server::OutputDeviceInterface::Mode mode; | ||
43 | mode.id = 0; | 43 | mode.id = 0; | ||
44 | mode.size = size; | 44 | mode.size = pixelSize; | ||
45 | mode.flags = KWayland::Server::OutputDeviceInterface::ModeFlag::Current; | 45 | mode.flags = KWayland::Server::OutputDeviceInterface::ModeFlag::Current; | ||
46 | mode.refreshRate = 60000; // TODO: get actual refresh rate of fb device? | 46 | mode.refreshRate = 60000; // TODO: get actual refresh rate of fb device? | ||
47 | AbstractWaylandOutput::initWaylandOutputDevice("model_TODO", "manufacturer_TODO", | 47 | AbstractWaylandOutput::initWaylandOutputDevice("model_TODO", "manufacturer_TODO", | ||
48 | "UUID_TODO", { mode }); | 48 | "UUID_TODO", physicalSize, { mode }); | ||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | FramebufferBackend::FramebufferBackend(QObject *parent) | 51 | FramebufferBackend::FramebufferBackend(QObject *parent) | ||
52 | : Platform(parent) | 52 | : Platform(parent) | ||
53 | { | 53 | { | ||
54 | handleOutputs(); | 54 | handleOutputs(); | ||
55 | } | 55 | } | ||
56 | 56 | | |||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 129 | { | |||
144 | ioctl(m_fd, FBIOPUT_VSCREENINFO, &varinfo); | 144 | ioctl(m_fd, FBIOPUT_VSCREENINFO, &varinfo); | ||
145 | 145 | | |||
146 | // Probe the device for new screen information. | 146 | // Probe the device for new screen information. | ||
147 | if (ioctl(m_fd, FBIOGET_VSCREENINFO, &varinfo) < 0) { | 147 | if (ioctl(m_fd, FBIOGET_VSCREENINFO, &varinfo) < 0) { | ||
148 | return false; | 148 | return false; | ||
149 | } | 149 | } | ||
150 | 150 | | |||
151 | auto *output = new FramebufferOutput(this); | 151 | auto *output = new FramebufferOutput(this); | ||
152 | output->init(QSize(varinfo.xres, varinfo.yres)); | 152 | output->init(QSize(varinfo.xres, varinfo.yres), QSize(varinfo.width, varinfo.height)); | ||
153 | output->setRawPhysicalSize(QSize(varinfo.width, varinfo.height)); | | |||
154 | output->setEnabled(true); | 153 | output->setEnabled(true); | ||
155 | m_outputs << output; | 154 | m_outputs << output; | ||
156 | 155 | | |||
157 | m_id = QByteArray(fixinfo.id); | 156 | m_id = QByteArray(fixinfo.id); | ||
158 | m_red = {varinfo.red.offset, varinfo.red.length}; | 157 | m_red = {varinfo.red.offset, varinfo.red.length}; | ||
159 | m_green = {varinfo.green.offset, varinfo.green.length}; | 158 | m_green = {varinfo.green.offset, varinfo.green.length}; | ||
160 | m_blue = {varinfo.blue.offset, varinfo.blue.length}; | 159 | m_blue = {varinfo.blue.offset, varinfo.blue.length}; | ||
161 | m_alpha = {varinfo.transp.offset, varinfo.transp.length}; | 160 | m_alpha = {varinfo.transp.offset, varinfo.transp.length}; | ||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |