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) | ||||
41 | { | ||||
42 | m_pixelSize = size; | ||||
43 | KWayland::Server::OutputDeviceInterface::Mode mode; | ||||
44 | mode.id = 0; | ||||
45 | mode.size = size; | ||||
46 | mode.flags = KWayland::Server::OutputDeviceInterface::ModeFlag::Current; | ||||
47 | mode.refreshRate = 60000; // TODO: get actual refresh rate of fb device? | ||||
48 | AbstractWaylandOutput::initWaylandOutputDevice("model_TODO", "manufacturer_TODO", | ||||
49 | "UUID_TODO", { mode }); | ||||
50 | } | ||||
51 | | ||||
40 | FramebufferBackend::FramebufferBackend(QObject *parent) | 52 | FramebufferBackend::FramebufferBackend(QObject *parent) | ||
41 | : Platform(parent) | 53 | : Platform(parent) | ||
42 | { | 54 | { | ||
55 | handleOutputs(); | ||||
43 | } | 56 | } | ||
44 | 57 | | |||
45 | FramebufferBackend::~FramebufferBackend() | 58 | FramebufferBackend::~FramebufferBackend() | ||
46 | { | 59 | { | ||
47 | unmap(); | 60 | unmap(); | ||
48 | if (m_fd >= 0) { | 61 | if (m_fd >= 0) { | ||
49 | close(m_fd); | 62 | close(m_fd); | ||
50 | } | 63 | } | ||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 130 | { | |||
132 | ioctl(m_fd, FBIOPUT_VSCREENINFO, &varinfo); | 145 | ioctl(m_fd, FBIOPUT_VSCREENINFO, &varinfo); | ||
133 | 146 | | |||
134 | // Probe the device for new screen information. | 147 | // Probe the device for new screen information. | ||
135 | if (ioctl(m_fd, FBIOGET_VSCREENINFO, &varinfo) < 0) { | 148 | if (ioctl(m_fd, FBIOGET_VSCREENINFO, &varinfo) < 0) { | ||
136 | return false; | 149 | return false; | ||
137 | } | 150 | } | ||
138 | 151 | | |||
139 | auto *output = new FramebufferOutput(this); | 152 | auto *output = new FramebufferOutput(this); | ||
140 | output->setPixelSize(QSize(varinfo.xres, varinfo.yres)); | 153 | output->init(QSize(varinfo.xres, varinfo.yres)); | ||
141 | output->setRawPhysicalSize(QSize(varinfo.width, varinfo.height)); | 154 | output->setRawPhysicalSize(QSize(varinfo.width, varinfo.height)); | ||
155 | output->setEnabled(true); | ||||
142 | m_outputs << output; | 156 | m_outputs << output; | ||
143 | 157 | | |||
144 | m_id = QByteArray(fixinfo.id); | 158 | m_id = QByteArray(fixinfo.id); | ||
145 | m_red = {varinfo.red.offset, varinfo.red.length}; | 159 | m_red = {varinfo.red.offset, varinfo.red.length}; | ||
146 | m_green = {varinfo.green.offset, varinfo.green.length}; | 160 | m_green = {varinfo.green.offset, varinfo.green.length}; | ||
147 | m_blue = {varinfo.blue.offset, varinfo.blue.length}; | 161 | m_blue = {varinfo.blue.offset, varinfo.blue.length}; | ||
148 | m_alpha = {varinfo.transp.offset, varinfo.transp.length}; | 162 | m_alpha = {varinfo.transp.offset, varinfo.transp.length}; | ||
149 | m_bitsPerPixel = varinfo.bits_per_pixel; | 163 | m_bitsPerPixel = varinfo.bits_per_pixel; | ||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |