From d8525fbd63cbc24749e54a1fc50b18e6108ac2c0 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 6 Jul 2024 17:45:47 +0200 Subject: [PATCH] drm: check for timeline support for explicit sync --- include/aquamarine/backend/DRM.hpp | 5 +++-- src/backend/drm/DRM.cpp | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/aquamarine/backend/DRM.hpp b/include/aquamarine/backend/DRM.hpp index 84c93b3..e4e7b00 100644 --- a/include/aquamarine/backend/DRM.hpp +++ b/include/aquamarine/backend/DRM.hpp @@ -44,12 +44,12 @@ namespace Aquamarine { class CDRMLease { public: - static Hyprutils::Memory::CSharedPointer create(std::vector> outputs); + static Hyprutils::Memory::CSharedPointer create(std::vector> outputs); ~CDRMLease(); void terminate(); - int leaseFD = -1; + int leaseFD = -1; uint32_t lesseeID = 0; Hyprutils::Memory::CWeakPointer backend; std::vector> outputs; @@ -363,6 +363,7 @@ namespace Aquamarine { Hyprutils::Math::Vector2D cursorSize; bool supportsAsyncCommit = false; bool supportsAddFb2Modifiers = false; + bool supportsTimelines = false; } drmProps; struct { diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index 76e0f94..7b5e237 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -342,6 +342,7 @@ bool Aquamarine::CDRMBackend::checkFeatures() { drmProps.supportsAsyncCommit = drmGetCap(gpu->fd, DRM_CAP_ASYNC_PAGE_FLIP, &cap) == 0 && cap == 1; drmProps.supportsAddFb2Modifiers = drmGetCap(gpu->fd, DRM_CAP_ADDFB2_MODIFIERS, &cap) == 0 && cap == 1; + drmProps.supportsTimelines = drmGetCap(gpu->fd, DRM_CAP_SYNCOBJ_TIMELINE, &cap) == 0 && cap == 1; if (envEnabled("AQ_NO_ATOMIC")) { backend->log(AQ_LOG_WARNING, "drm: AQ_NO_ATOMIC enabled, using the legacy drm iface"); @@ -358,6 +359,7 @@ bool Aquamarine::CDRMBackend::checkFeatures() { backend->log(AQ_LOG_DEBUG, std::format("drm: drmProps.supportsAsyncCommit: {}", drmProps.supportsAsyncCommit)); backend->log(AQ_LOG_DEBUG, std::format("drm: drmProps.supportsAddFb2Modifiers: {}", drmProps.supportsAddFb2Modifiers)); + backend->log(AQ_LOG_DEBUG, std::format("drm: drmProps.supportsTimelines: {}", drmProps.supportsTimelines)); // TODO: allow no-modifiers? @@ -1050,7 +1052,7 @@ void Aquamarine::SDRMConnector::connect(drmModeConnector* connector) { output->serial = serial; output->description = std::format("{} {} {} ({})", make, model, serial, szName); output->needsFrame = true; - output->supportsExplicit = crtc->props.out_fence_ptr && crtc->primary->props.in_fence_fd; + output->supportsExplicit = backend->drmProps.supportsTimelines && crtc->props.out_fence_ptr && crtc->primary->props.in_fence_fd; backend->backend->log(AQ_LOG_DEBUG, std::format("drm: Explicit sync {}", output->supportsExplicit ? "supported" : "unsupported"));