backends/drm: reduce the timeout for waiting for pageflips

30s makes the user suspect the whole PC is completely frozen, even though this can happen
in some cases when unplugging an external GPU for example. The kernel should never take more
than one frame to deliver the pageflip event, one second is plenty to be safe.
wilder/Plasma/6.3
Xaver Hugl 1 year ago
parent 49f8663cfe
commit df4adb8811
  1. 7
      src/backends/drm/drm_commit_thread.cpp
  2. 2
      src/backends/drm/drm_gpu.cpp
  3. 6
      src/backends/drm/drm_gpu.h

@ -19,11 +19,6 @@ using namespace std::chrono_literals;
namespace KWin
{
/**
* This should always be longer than any real pageflip can take, even with PSR and modesets
*/
static constexpr auto s_pageflipTimeout = 5s;
DrmCommitThread::DrmCommitThread(DrmGpu *gpu, const QString &name)
{
if (!gpu->atomicModeSetting()) {
@ -40,7 +35,7 @@ DrmCommitThread::DrmCommitThread(DrmGpu *gpu, const QString &name)
std::unique_lock lock(m_mutex);
bool timeout = false;
if (m_committed) {
timeout = m_commitPending.wait_for(lock, s_pageflipTimeout) == std::cv_status::timeout;
timeout = m_commitPending.wait_for(lock, DrmGpu::s_pageflipTimeout) == std::cv_status::timeout;
} else if (m_commits.empty()) {
m_commitPending.wait(lock);
}

@ -522,7 +522,7 @@ void DrmGpu::waitIdle()
pfds[0].fd = m_fd;
pfds[0].events = POLLIN;
const int ready = poll(pfds, 1, 30000);
const int ready = poll(pfds, 1, s_pageflipTimeout.count());
if (ready < 0) {
if (errno != EINTR) {
qCWarning(KWIN_DRM) << Q_FUNC_INFO << "poll() failed:" << strerror(errno);

@ -18,6 +18,7 @@
#include <QSocketNotifier>
#include <qobject.h>
#include <chrono>
#include <epoxy/egl.h>
#include <sys/types.h>
@ -62,6 +63,11 @@ class DrmGpu : public QObject
{
Q_OBJECT
public:
/**
* This should always be longer than any real pageflip can take, even with PSR and modesets
*/
static constexpr std::chrono::milliseconds s_pageflipTimeout = std::chrono::seconds(1);
DrmGpu(DrmBackend *backend, int fd, std::unique_ptr<DrmDevice> &&device);
~DrmGpu();

Loading…
Cancel
Save