drm-backend: require DRM_CAP_TIMESTAMP_MONOTONIC

Weston internals and Wayland clients assume that output presentation
clock cannot go backwards. Therefore require unconditionally that KMS
uses the monotonic clock.

The kernel unconditionally supports DRM_CAP_TIMESTAMP_MONOTONIC. See:

commit 25e1a79874eb3821d93310c908cc0a81b47af060
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Oct 11 17:20:13 2017 +0200

    drm: vblank: remove drm_timestamp_monotonic parameter

That one removed the final possibility of DRM_CAP_TIMESTAMP_MONOTONIC
being false, by removing the module option. But even before that, all
drivers have been supporting monotonic, since

commit c61eef726a78ae77b6ce223d01ea2130f465fe5c
Author: Imre Deak <imre.deak@intel.com>
Date:   Tue Oct 23 18:53:26 2012 +0000

    drm: add support for monotonic vblank timestamps

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago committed by Pekka Paalanen
parent 1ae3a25642
commit f48277b577
  1. 14
      libweston/backend-drm/kms.c

@ -1421,19 +1421,17 @@ init_kms_caps(struct drm_backend *b)
{ {
uint64_t cap; uint64_t cap;
int ret; int ret;
clockid_t clk_id;
weston_log("using %s\n", b->drm.filename); weston_log("using %s\n", b->drm.filename);
ret = drmGetCap(b->drm.fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap); ret = drmGetCap(b->drm.fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap);
if (ret == 0 && cap == 1) if (ret != 0 || cap != 1) {
clk_id = CLOCK_MONOTONIC; weston_log("Error: kernel DRM KMS does not support DRM_CAP_TIMESTAMP_MONOTONIC.\n");
else return -1;
clk_id = CLOCK_REALTIME; }
if (weston_compositor_set_presentation_clock(b->compositor, clk_id) < 0) { if (weston_compositor_set_presentation_clock(b->compositor, CLOCK_MONOTONIC) < 0) {
weston_log("Error: failed to set presentation clock %d.\n", weston_log("Error: failed to set presentation clock to CLOCK_MONOTONIC.\n");
clk_id);
return -1; return -1;
} }

Loading…
Cancel
Save