Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/fbdev/fb_backend.cpp
Show All 18 Lines | |||||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "fb_backend.h" | 20 | #include "fb_backend.h" | ||
21 | #include "composite.h" | 21 | #include "composite.h" | ||
22 | #include "logging.h" | 22 | #include "logging.h" | ||
23 | #include "logind.h" | 23 | #include "logind.h" | ||
24 | #include "scene_qpainter_fb_backend.h" | 24 | #include "scene_qpainter_fb_backend.h" | ||
25 | #include "screens.h" | 25 | #include "screens.h" | ||
26 | #include "virtual_terminal.h" | 26 | #include "virtual_terminal.h" | ||
27 | #include "udev.h" | ||||
27 | // system | 28 | // system | ||
28 | #include <fcntl.h> | 29 | #include <fcntl.h> | ||
29 | #include <unistd.h> | 30 | #include <unistd.h> | ||
30 | #include <sys/ioctl.h> | 31 | #include <sys/ioctl.h> | ||
31 | #include <sys/mman.h> | 32 | #include <sys/mman.h> | ||
32 | // Linux | 33 | // Linux | ||
33 | #include <linux/fb.h> | 34 | #include <linux/fb.h> | ||
34 | 35 | | |||
35 | namespace KWin | 36 | namespace KWin | ||
36 | { | 37 | { | ||
37 | 38 | | |||
38 | FramebufferBackend::FramebufferBackend(QObject *parent) | 39 | FramebufferBackend::FramebufferBackend(QObject *parent) | ||
39 | : Platform(parent) | 40 | : Platform(parent) | ||
41 | , m_udev(new Udev) | ||||
40 | { | 42 | { | ||
41 | } | 43 | } | ||
42 | 44 | | |||
43 | FramebufferBackend::~FramebufferBackend() | 45 | FramebufferBackend::~FramebufferBackend() | ||
44 | { | 46 | { | ||
45 | unmap(); | 47 | unmap(); | ||
46 | if (m_fd >= 0) { | 48 | if (m_fd >= 0) { | ||
47 | close(m_fd); | 49 | close(m_fd); | ||
Show All 27 Lines | 64 | { | |||
75 | } else { | 77 | } else { | ||
76 | connect(logind, &LogindIntegration::connectedChanged, this, takeControl); | 78 | connect(logind, &LogindIntegration::connectedChanged, this, takeControl); | ||
77 | } | 79 | } | ||
78 | VirtualTerminal::create(this); | 80 | VirtualTerminal::create(this); | ||
79 | } | 81 | } | ||
80 | 82 | | |||
81 | void FramebufferBackend::openFrameBuffer() | 83 | void FramebufferBackend::openFrameBuffer() | ||
82 | { | 84 | { | ||
85 | if (strcmp(LogindIntegration::self()->seat(), "seat0") == 0) | ||||
86 | { | ||||
83 | VirtualTerminal::self()->init(); | 87 | VirtualTerminal::self()->init(); | ||
84 | int fd = LogindIntegration::self()->takeDevice(deviceIdentifier().constData()); | 88 | } | ||
89 | char *framebufferDevice = strdup(deviceIdentifier().constData()); | ||||
90 | UdevDevice::Ptr device = m_udev->primaryFramebuffer(); | ||||
91 | if (strcmp(framebufferDevice,"\0") == 0) | ||||
92 | framebufferDevice = strdup(device->devNode()); | ||||
93 | int fd = LogindIntegration::self()->takeDevice(framebufferDevice); | ||||
94 | qCDebug(KWIN_FB) << "Using frame buffer device:" << framebufferDevice; | ||||
85 | if (fd < 0) { | 95 | if (fd < 0) { | ||
86 | qCWarning(KWIN_FB) << "Failed to open frame buffer device through logind, trying without"; | 96 | qCWarning(KWIN_FB) << "Failed to open frame buffer device through logind, trying without"; | ||
87 | } | 97 | } | ||
88 | fd = open(deviceIdentifier().constData(), O_RDWR | O_CLOEXEC); | 98 | fd = open(framebufferDevice, O_RDWR | O_CLOEXEC); | ||
89 | if (fd < 0) { | 99 | if (fd < 0) { | ||
90 | qCWarning(KWIN_FB) << "failed to open frame buffer device"; | 100 | qCWarning(KWIN_FB) << "failed to open frame buffer device"; | ||
91 | emit initFailed(); | 101 | emit initFailed(); | ||
92 | return; | 102 | return; | ||
93 | } | 103 | } | ||
94 | m_fd = fd; | 104 | m_fd = fd; | ||
95 | if (!queryScreenInfo()) { | 105 | if (!queryScreenInfo()) { | ||
96 | qCWarning(KWIN_FB) << "failed to query framebuffer information"; | 106 | qCWarning(KWIN_FB) << "failed to query framebuffer information"; | ||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |