drm: check for timeline support for explicit sync

This commit is contained in:
Vaxry 2024-07-06 17:45:47 +02:00
parent 330c089cd8
commit d8525fbd63
2 changed files with 6 additions and 3 deletions

View file

@ -44,12 +44,12 @@ namespace Aquamarine {
class CDRMLease { class CDRMLease {
public: public:
static Hyprutils::Memory::CSharedPointer<CDRMLease> create(std::vector<Hyprutils::Memory::CSharedPointer<IOutput>> outputs); static Hyprutils::Memory::CSharedPointer<CDRMLease> create(std::vector<Hyprutils::Memory::CSharedPointer<IOutput>> outputs);
~CDRMLease(); ~CDRMLease();
void terminate(); void terminate();
int leaseFD = -1; int leaseFD = -1;
uint32_t lesseeID = 0; uint32_t lesseeID = 0;
Hyprutils::Memory::CWeakPointer<CDRMBackend> backend; Hyprutils::Memory::CWeakPointer<CDRMBackend> backend;
std::vector<Hyprutils::Memory::CWeakPointer<CDRMOutput>> outputs; std::vector<Hyprutils::Memory::CWeakPointer<CDRMOutput>> outputs;
@ -363,6 +363,7 @@ namespace Aquamarine {
Hyprutils::Math::Vector2D cursorSize; Hyprutils::Math::Vector2D cursorSize;
bool supportsAsyncCommit = false; bool supportsAsyncCommit = false;
bool supportsAddFb2Modifiers = false; bool supportsAddFb2Modifiers = false;
bool supportsTimelines = false;
} drmProps; } drmProps;
struct { struct {

View file

@ -342,6 +342,7 @@ bool Aquamarine::CDRMBackend::checkFeatures() {
drmProps.supportsAsyncCommit = drmGetCap(gpu->fd, DRM_CAP_ASYNC_PAGE_FLIP, &cap) == 0 && cap == 1; 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.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")) { if (envEnabled("AQ_NO_ATOMIC")) {
backend->log(AQ_LOG_WARNING, "drm: AQ_NO_ATOMIC enabled, using the legacy drm iface"); 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.supportsAsyncCommit: {}", drmProps.supportsAsyncCommit));
backend->log(AQ_LOG_DEBUG, std::format("drm: drmProps.supportsAddFb2Modifiers: {}", drmProps.supportsAddFb2Modifiers)); 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? // TODO: allow no-modifiers?
@ -1050,7 +1052,7 @@ void Aquamarine::SDRMConnector::connect(drmModeConnector* connector) {
output->serial = serial; output->serial = serial;
output->description = std::format("{} {} {} ({})", make, model, serial, szName); output->description = std::format("{} {} {} ({})", make, model, serial, szName);
output->needsFrame = true; 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")); backend->backend->log(AQ_LOG_DEBUG, std::format("drm: Explicit sync {}", output->supportsExplicit ? "supported" : "unsupported"));