backends/drm: Fix 100% cpu usage after tty switch

The drm fd can get stuck in readable state, in which case the
QSocketNotifier will fire the activated signal as often as it can
leading to high cpu usage.

We need to read() the drm fd in order to make the socket notifier stop
firing QSocketNotifier::activated.

This change removes the m_platform->isActive() check to ensure that
drmHandleEvent() gets called, in general, it should be safe as we only
notify the outputs about completed pageflips.

BUG: 452726
This commit is contained in:
Vlad Zahorodnii 2022-09-26 22:10:56 +03:00
parent 2c874fc3e0
commit 1d8c9c62cf

View file

@ -562,9 +562,6 @@ void DrmGpu::pageFlipHandler(int fd, unsigned int sequence, unsigned int sec, un
void DrmGpu::dispatchEvents() void DrmGpu::dispatchEvents()
{ {
if (!m_platform->isActive()) {
return;
}
drmEventContext context = {}; drmEventContext context = {};
context.version = 3; context.version = 3;
context.page_flip_handler2 = pageFlipHandler; context.page_flip_handler2 = pageFlipHandler;