From ced38b1b0f46f9fbdf9d37644d27bdbd2a29af1d Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Sun, 24 Aug 2025 09:57:37 +0200 Subject: disable buffer readability checks on intel (#11515) * dmabuf: disable buffer read check on intel readability checks directly on buffer fds on some intel laptops is broken, see https://gitlab.freedesktop.org/drm/intel/-/issues/9415 * sync: use rvalue ref in addwaiter doonreadable use rvalue reference in addwaiter and doonreadable, because we store the function in the SReadableWaiter a lot of the time, move it into place there when that happends or let it go out of scope after function call. --- src/protocols/DRMSyncobj.cpp | 4 ++-- src/protocols/DRMSyncobj.hpp | 2 +- src/protocols/core/Compositor.cpp | 4 ++-- src/protocols/types/DMABuffer.cpp | 8 ++++++-- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/protocols') diff --git a/src/protocols/DRMSyncobj.cpp b/src/protocols/DRMSyncobj.cpp index 2d232e28..bedec422 100644 --- a/src/protocols/DRMSyncobj.cpp +++ b/src/protocols/DRMSyncobj.cpp @@ -27,9 +27,9 @@ UP CDRMSyncPointState::createSyncRelease() { return makeUnique(m_timeline, m_point); } -bool CDRMSyncPointState::addWaiter(const std::function& waiter) { +bool CDRMSyncPointState::addWaiter(std::function&& waiter) { m_acquireCommitted = true; - return m_timeline->addWaiter(waiter, m_point, 0u); + return m_timeline->addWaiter(std::move(waiter), m_point, 0u); } bool CDRMSyncPointState::committed() { diff --git a/src/protocols/DRMSyncobj.hpp b/src/protocols/DRMSyncobj.hpp index b330818d..4fcbaf09 100644 --- a/src/protocols/DRMSyncobj.hpp +++ b/src/protocols/DRMSyncobj.hpp @@ -20,7 +20,7 @@ class CDRMSyncPointState { const uint64_t& point(); WP timeline(); Hyprutils::Memory::CUniquePointer createSyncRelease(); - bool addWaiter(const std::function& waiter); + bool addWaiter(std::function&& waiter); bool committed(); Hyprutils::OS::CFileDescriptor exportAsFD(); void signal(); diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index 73326990..a859148f 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -161,7 +161,7 @@ CWLSurfaceResource::CWLSurfaceResource(SP resource_) : m_resource(re if (state->updated.bits.acquire) { // wait on acquire point for this surface, from explicit sync protocol - state->acquire.addWaiter(whenReadable); + state->acquire.addWaiter(std::move(whenReadable)); } else if (state->buffer->isSynchronous()) { // synchronous (shm) buffers can be read immediately whenReadable(); @@ -170,7 +170,7 @@ CWLSurfaceResource::CWLSurfaceResource(SP resource_) : m_resource(re auto syncFd = dc(state->buffer.m_buffer.get())->exportSyncFile(); if (syncFd.isValid()) - g_pEventLoopManager->doOnReadable(std::move(syncFd), whenReadable); + g_pEventLoopManager->doOnReadable(std::move(syncFd), std::move(whenReadable)); else whenReadable(); } else { diff --git a/src/protocols/types/DMABuffer.cpp b/src/protocols/types/DMABuffer.cpp index 1f6a1a6b..464008f4 100644 --- a/src/protocols/types/DMABuffer.cpp +++ b/src/protocols/types/DMABuffer.cpp @@ -118,8 +118,12 @@ CFileDescriptor CDMABuffer::exportSyncFile() { if (fd == -1) continue; - if (CFileDescriptor::isReadable(fd)) - continue; + // buffer readability checks are rather slow on some Intel laptops + // see https://gitlab.freedesktop.org/drm/intel/-/issues/9415 + if (g_pHyprRenderer && !g_pHyprRenderer->isIntel()) { + if (CFileDescriptor::isReadable(fd)) + continue; + } dma_buf_export_sync_file request{ .flags = DMA_BUF_SYNC_READ, -- cgit v1.2.3