aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.c7
-rw-r--r--backend/drm/backend.c6
-rw-r--r--backend/drm/drm.c10
-rw-r--r--backend/multi/backend.c15
-rw-r--r--backend/wayland/backend.c13
5 files changed, 11 insertions, 40 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 125ed411..e5b8db14 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -116,13 +116,6 @@ static struct wlr_session *session_create_and_wait(struct wl_display *disp) {
#endif
}
-clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) {
- if (backend->impl->get_presentation_clock) {
- return backend->impl->get_presentation_clock(backend);
- }
- return CLOCK_MONOTONIC;
-}
-
int wlr_backend_get_drm_fd(struct wlr_backend *backend) {
if (!backend->impl->get_drm_fd) {
return -1;
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");
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index fccad5b4..8c36834e 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -63,20 +63,6 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) {
free(backend);
}
-static clockid_t multi_backend_get_presentation_clock(
- struct wlr_backend *backend) {
- struct wlr_multi_backend *multi = multi_backend_from_backend(backend);
-
- struct subbackend_state *sub;
- wl_list_for_each(sub, &multi->backends, link) {
- if (sub->backend->impl->get_presentation_clock) {
- return wlr_backend_get_presentation_clock(sub->backend);
- }
- }
-
- return CLOCK_MONOTONIC;
-}
-
static int multi_backend_get_drm_fd(struct wlr_backend *backend) {
struct wlr_multi_backend *multi = multi_backend_from_backend(backend);
@@ -115,7 +101,6 @@ static uint32_t multi_backend_get_buffer_caps(struct wlr_backend *backend) {
static const struct wlr_backend_impl backend_impl = {
.start = multi_backend_start,
.destroy = multi_backend_destroy,
- .get_presentation_clock = multi_backend_get_presentation_clock,
.get_drm_fd = multi_backend_get_drm_fd,
.get_buffer_caps = multi_backend_get_buffer_caps,
};
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index e8d06eba..9f78b6f1 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -95,7 +95,11 @@ static const struct xdg_wm_base_listener xdg_wm_base_listener = {
static void presentation_handle_clock_id(void *data,
struct wp_presentation *presentation, uint32_t clock) {
struct wlr_wl_backend *wl = data;
- wl->presentation_clock = clock;
+
+ if (clock != CLOCK_MONOTONIC) {
+ wp_presentation_destroy(wl->presentation);
+ wl->presentation = NULL;
+ }
}
static const struct wp_presentation_listener presentation_listener = {
@@ -535,11 +539,6 @@ static void backend_destroy(struct wlr_backend *backend) {
free(wl);
}
-static clockid_t backend_get_presentation_clock(struct wlr_backend *backend) {
- struct wlr_wl_backend *wl = get_wl_backend_from_backend(backend);
- return wl->presentation_clock;
-}
-
static int backend_get_drm_fd(struct wlr_backend *backend) {
struct wlr_wl_backend *wl = get_wl_backend_from_backend(backend);
return wl->drm_fd;
@@ -554,7 +553,6 @@ static uint32_t 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 = get_buffer_caps,
};
@@ -585,7 +583,6 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
wl_list_init(&wl->outputs);
wl_list_init(&wl->seats);
wl_list_init(&wl->buffers);
- wl->presentation_clock = CLOCK_MONOTONIC;
if (remote_display != NULL) {
wl->remote_display = remote_display;