debug console: use FileDescriptor class
This commit is contained in:
parent
1b1e0ab95f
commit
9c4f3d447f
3 changed files with 7 additions and 8 deletions
|
@ -581,13 +581,13 @@ WaylandBackend::WaylandBackend(QObject *parent)
|
|||
|
||||
#if HAVE_WAYLAND_EGL
|
||||
char const *drm_render_node = "/dev/dri/renderD128";
|
||||
m_drmFileDescriptor = open(drm_render_node, O_RDWR);
|
||||
if (m_drmFileDescriptor < 0) {
|
||||
m_drmFileDescriptor = FileDescriptor(open(drm_render_node, O_RDWR));
|
||||
if (!m_drmFileDescriptor.isValid()) {
|
||||
qCWarning(KWIN_WAYLAND_BACKEND) << "Failed to open drm render node" << drm_render_node;
|
||||
m_gbmDevice = nullptr;
|
||||
return;
|
||||
}
|
||||
m_gbmDevice = gbm_create_device(m_drmFileDescriptor);
|
||||
m_gbmDevice = gbm_create_device(m_drmFileDescriptor.get());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -622,7 +622,6 @@ WaylandBackend::~WaylandBackend()
|
|||
m_connectionThreadObject->deleteLater();
|
||||
#if HAVE_WAYLAND_EGL
|
||||
gbm_device_destroy(m_gbmDevice);
|
||||
close(m_drmFileDescriptor);
|
||||
#endif
|
||||
qCDebug(KWIN_WAYLAND_BACKEND) << "Destroyed Wayland display";
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "inputbackend.h"
|
||||
#include "inputdevice.h"
|
||||
#include "platform.h"
|
||||
#include "utils/filedescriptor.h"
|
||||
#include <kwinglobals.h>
|
||||
// Qt
|
||||
#include <QHash>
|
||||
|
@ -356,7 +357,7 @@ private:
|
|||
KWayland::Client::ServerSideDecorationManager *ssdManager();
|
||||
int m_nextId = 0;
|
||||
#if HAVE_WAYLAND_EGL
|
||||
int m_drmFileDescriptor = 0;
|
||||
FileDescriptor m_drmFileDescriptor;
|
||||
gbm_device *m_gbmDevice;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "main.h"
|
||||
#include "scene.h"
|
||||
#include "unmanaged.h"
|
||||
#include "utils/filedescriptor.h"
|
||||
#include "utils/subsurfacemonitor.h"
|
||||
#include "wayland/abstract_data_source.h"
|
||||
#include "wayland/clientconnection.h"
|
||||
|
@ -1642,9 +1643,7 @@ static QByteArray readData(int fd)
|
|||
pollfd pfd;
|
||||
pfd.fd = fd;
|
||||
pfd.events = POLLIN;
|
||||
auto closeFd = qScopeGuard([fd] {
|
||||
close(fd);
|
||||
});
|
||||
FileDescriptor closeFd{fd};
|
||||
QByteArray data;
|
||||
while (true) {
|
||||
const int ready = poll(&pfd, 1, 1000);
|
||||
|
|
Loading…
Reference in a new issue