From ad039cdfd2b473e2e402fa4d67ed3c868957674a Mon Sep 17 00:00:00 2001 From: Naveen Kumar Date: Mon, 15 Apr 2024 10:21:56 +0000 Subject: [PATCH] backend-drm: Enable atomic async flip support Since DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP capability is available in the mainline kernel, now we should enable back tearing support. v2: - Bump kernel version to 6.9 - include the fallback definitions Reviewed-by: Marius Vlad Reviewed-by: Derek Foreman Signed-off-by: Naveen Kumar --- .gitlab-ci/build-deps.sh | 2 +- libweston/backend-drm/kms.c | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci/build-deps.sh b/.gitlab-ci/build-deps.sh index 82a41df2..b4af6fe2 100755 --- a/.gitlab-ci/build-deps.sh +++ b/.gitlab-ci/build-deps.sh @@ -64,7 +64,7 @@ pip3 install $PIP_ARGS sphinx_rtd_theme==1.0.0 # The fork pulls in this support from the original GitHub PR, rebased on top of # a newer upstream version which fixes AArch64 support. if [[ -n "$KERNEL_DEFCONFIG" ]]; then - git clone --depth=1 --branch=v6.3 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux + git clone --depth=1 --branch=v6.9 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux cd linux if [[ "${BUILD_ARCH}" = "x86-64" ]]; then diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c index ccbfd4d9..f0fd6924 100644 --- a/libweston/backend-drm/kms.c +++ b/libweston/backend-drm/kms.c @@ -42,6 +42,10 @@ #include "pixel-formats.h" #include "presentation-time-server-protocol.h" +#ifndef DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP +#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15 +#endif + struct drm_property_enum_info plane_type_enums[] = { [WDRM_PLANE_TYPE_PRIMARY] = { .name = "Primary", @@ -1891,19 +1895,11 @@ init_kms_caps(struct drm_device *device) drmSetClientCap(device->drm.fd, DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1); -#if 0 - /* FIXME: DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP isn't merged into mainline so - * we can't really use it at this point. Until then, make it so we - * don't support it. After it gets merged, we can flip this back such - * that we don't need to revert the entire tearing work, and we can - * still get it all back, when the capability is actually available in - * the kernel. */ ret = drmGetCap(device->drm.fd, DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP, &cap); - if (ret != 0) - cap = 0; -#endif - device->tearing_supported = 0; - weston_log("DRM: does not support async page flipping\n"); + if (ret == 0) + device->tearing_supported = cap; + weston_log("DRM: %s Atomic async page flip\n", + device->tearing_supported ? "supports" : "does not support"); /* * KMS support for hardware planes cannot properly synchronize