mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-23 06:59:44 -05:00
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.
This commit is contained in:
parent
5fac9b1beb
commit
1c24b1182b
12 changed files with 13 additions and 56 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue