Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/virtual/egl_gbm_backend.cpp
Show All 17 Lines | |||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "egl_gbm_backend.h" | 20 | #include "egl_gbm_backend.h" | ||
21 | // kwin | 21 | // kwin | ||
22 | #include "composite.h" | 22 | #include "composite.h" | ||
23 | #include "virtual_backend.h" | 23 | #include "virtual_backend.h" | ||
24 | #include "options.h" | 24 | #include "options.h" | ||
25 | #include "screens.h" | 25 | #include "screens.h" | ||
26 | #if HAVE_UDEV | | |||
27 | #include "udev.h" | 26 | #include "udev.h" | ||
28 | #endif | | |||
29 | #include <logging.h> | 27 | #include <logging.h> | ||
30 | // kwin libs | 28 | // kwin libs | ||
31 | #include <kwinglplatform.h> | 29 | #include <kwinglplatform.h> | ||
32 | #include <kwinglutils.h> | 30 | #include <kwinglutils.h> | ||
33 | // Qt | 31 | // Qt | ||
34 | #include <QOpenGLContext> | 32 | #include <QOpenGLContext> | ||
35 | // system | 33 | // system | ||
36 | #include <fcntl.h> | 34 | #include <fcntl.h> | ||
Show All 20 Lines | 52 | { | |||
57 | } | 55 | } | ||
58 | delete m_fbo; | 56 | delete m_fbo; | ||
59 | delete m_backBuffer; | 57 | delete m_backBuffer; | ||
60 | cleanup(); | 58 | cleanup(); | ||
61 | } | 59 | } | ||
62 | 60 | | |||
63 | void EglGbmBackend::initGbmDevice() | 61 | void EglGbmBackend::initGbmDevice() | ||
64 | { | 62 | { | ||
65 | #if HAVE_UDEV | | |||
66 | if (m_backend->drmFd() != -1) { | 63 | if (m_backend->drmFd() != -1) { | ||
67 | // already initialized | 64 | // already initialized | ||
68 | return; | 65 | return; | ||
69 | } | 66 | } | ||
70 | QScopedPointer<Udev> udev(new Udev); | 67 | QScopedPointer<Udev> udev(new Udev); | ||
71 | UdevDevice::Ptr device = udev->virtualGpu(); | 68 | UdevDevice::Ptr device = udev->virtualGpu(); | ||
72 | if (!device) { | 69 | if (!device) { | ||
73 | // if we don't have a virtual (vgem) device, try to find a render node | 70 | // if we don't have a virtual (vgem) device, try to find a render node | ||
Show All 13 Lines | |||||
87 | m_backend->setDrmFd(fd); | 84 | m_backend->setDrmFd(fd); | ||
88 | #if HAVE_GBM | 85 | #if HAVE_GBM | ||
89 | auto gbmDevice = gbm_create_device(fd); | 86 | auto gbmDevice = gbm_create_device(fd); | ||
90 | if (!gbmDevice) { | 87 | if (!gbmDevice) { | ||
91 | qCWarning(KWIN_VIRTUAL) << "Failed to open gbm device"; | 88 | qCWarning(KWIN_VIRTUAL) << "Failed to open gbm device"; | ||
92 | } | 89 | } | ||
93 | m_backend->setGbmDevice(gbmDevice); | 90 | m_backend->setGbmDevice(gbmDevice); | ||
94 | #endif | 91 | #endif | ||
95 | #endif | | |||
96 | } | 92 | } | ||
97 | 93 | | |||
98 | bool EglGbmBackend::initializeEgl() | 94 | bool EglGbmBackend::initializeEgl() | ||
99 | { | 95 | { | ||
100 | initClientExtensions(); | 96 | initClientExtensions(); | ||
101 | EGLDisplay display = m_backend->sceneEglDisplay(); | 97 | EGLDisplay display = m_backend->sceneEglDisplay(); | ||
102 | 98 | | |||
103 | // Use eglGetPlatformDisplayEXT() to get the display pointer | 99 | // Use eglGetPlatformDisplayEXT() to get the display pointer | ||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |