From 9203d98f8b1de91c4f7cb4ef1954d95075bd0b48 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 24 Nov 2022 14:11:01 -0600 Subject: [PATCH] backend-drm: Check for the atomic tearing capability Check if our drm device supports atomic async page flips. Signed-off-by: Derek Foreman --- libweston/backend-drm/drm-internal.h | 2 ++ libweston/backend-drm/kms.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index b146d019..fcfba2ee 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -298,6 +298,8 @@ struct drm_device { bool atomic_modeset; + bool tearing_supported; + bool aspect_ratio_supported; int32_t cursor_width; diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c index ec7d440b..9955cd90 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", @@ -1639,6 +1643,11 @@ init_kms_caps(struct drm_device *device) drmSetClientCap(device->drm.fd, DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1); + ret = drmGetCap(device->drm.fd, DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP, &cap); + if (ret != 0) + cap = 0; + device->tearing_supported = cap; + /* * KMS support for hardware planes cannot properly synchronize * without nuclear page flip. Without nuclear/atomic, hw plane