diff options
author | Simon Ser <contact@emersion.fr> | 2023-10-30 18:37:13 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-10-30 18:39:39 +0100 |
commit | 1c24b1182ba39cb8c508580713336dcf79e6a295 (patch) | |
tree | 5c2554accf8a5aabd2413648397836da050a1dde /backend/drm | |
parent | 5fac9b1beb2281fb13d3e5de7fdd10ff7ba0f30b (diff) |
backend: drop wlr_backend_get_presentation_clock()
We can just assume CLOCK_MONOTONIC everywhere.
Simplifies the backend API, and fixes clock mismatches when multiple
backends are used together with different clocks.
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/backend.c | 6 | ||||
-rw-r--r-- | backend/drm/drm.c | 10 |
2 files changed, 6 insertions, 10 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index df02c6b3..4ee79773 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -64,11 +64,6 @@ static void backend_destroy(struct wlr_backend *backend) { free(drm); } -static clockid_t backend_get_presentation_clock(struct wlr_backend *backend) { - struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend); - return drm->clock; -} - static int backend_get_drm_fd(struct wlr_backend *backend) { struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend); @@ -86,7 +81,6 @@ static uint32_t drm_backend_get_buffer_caps(struct wlr_backend *backend) { static const struct wlr_backend_impl backend_impl = { .start = backend_start, .destroy = backend_destroy, - .get_presentation_clock = backend_get_presentation_clock, .get_drm_fd = backend_get_drm_fd, .get_buffer_caps = drm_backend_get_buffer_caps, }; diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 3db27749..f7c33690 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -80,6 +80,11 @@ bool check_drm_features(struct wlr_drm_backend *drm) { return false; } + if (drmGetCap(drm->fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap) || !cap) { + wlr_log(WLR_ERROR, "DRM_CAP_TIMESTAMP_MONOTONIC unsupported"); + return false; + } + if (env_parse_bool("WLR_DRM_FORCE_LIBLIFTOFF")) { #if HAVE_LIBLIFTOFF wlr_log(WLR_INFO, @@ -110,13 +115,10 @@ bool check_drm_features(struct wlr_drm_backend *drm) { drm->supports_tearing_page_flips = drmGetCap(drm->fd, DRM_CAP_ASYNC_PAGE_FLIP, &cap) == 0 && cap == 1; } - int ret = drmGetCap(drm->fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap); - drm->clock = (ret == 0 && cap == 1) ? CLOCK_MONOTONIC : CLOCK_REALTIME; - if (env_parse_bool("WLR_DRM_NO_MODIFIERS")) { wlr_log(WLR_DEBUG, "WLR_DRM_NO_MODIFIERS set, disabling modifiers"); } else { - ret = drmGetCap(drm->fd, DRM_CAP_ADDFB2_MODIFIERS, &cap); + int ret = drmGetCap(drm->fd, DRM_CAP_ADDFB2_MODIFIERS, &cap); drm->addfb2_modifiers = ret == 0 && cap == 1; wlr_log(WLR_DEBUG, "ADDFB2 modifiers %s", drm->addfb2_modifiers ? "supported" : "unsupported"); |