From a8eb8ae0148e049b1c3b8646ea560769fb81b04d Mon Sep 17 00:00:00 2001 From: Ikalco <73481042+ikalco@users.noreply.github.com> Date: Thu, 5 Sep 2024 19:00:39 -0500 Subject: [PATCH] drm: add AQ_NO_MODIFIERS to try to mitigate hardware limitations (#77) --- docs/env.md | 1 + src/backend/drm/DRM.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/env.md b/docs/env.md index 1a3e2b2..55aeea2 100644 --- a/docs/env.md +++ b/docs/env.md @@ -7,6 +7,7 @@ Unless specified otherwise, a variable is enabled if and only if it's set to `1` `AQ_DRM_DEVICES` -> Set an explicit list of DRM devices (GPUs) to use. It's a colon-separated list of paths, with the first being the primary. E.g. `/dev/dri/card1:/dev/dri/card0` `AQ_NO_ATOMIC` -> Disables drm atomic modesetting `AQ_MGPU_NO_EXPLICIT` -> Disables explicit syncing on mgpu buffers +`AQ_NO_MODIFIERS` -> Disables modifiers for DRM buffers ### Debugging diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index 7e4616b..26d5c4b 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -381,9 +381,14 @@ bool Aquamarine::CDRMBackend::checkFeatures() { return false; } - 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; + drmProps.supportsAsyncCommit = drmGetCap(gpu->fd, DRM_CAP_ASYNC_PAGE_FLIP, &cap) == 0 && cap == 1; + drmProps.supportsTimelines = drmGetCap(gpu->fd, DRM_CAP_SYNCOBJ_TIMELINE, &cap) == 0 && cap == 1; + + if (envEnabled("AQ_NO_MODIFIERS")) { + backend->log(AQ_LOG_WARNING, "drm: AQ_NO_MODIFIERS enabled, disabling modifiers for DRM buffers."); + drmProps.supportsAddFb2Modifiers = false; + } else + drmProps.supportsAddFb2Modifiers = drmGetCap(gpu->fd, DRM_CAP_ADDFB2_MODIFIERS, &cap) == 0 && cap == 1; if (envEnabled("AQ_NO_ATOMIC")) { backend->log(AQ_LOG_WARNING, "drm: AQ_NO_ATOMIC enabled, using the legacy drm iface");