diff options
author | Philip Langdale <philipl@overt.org> | 2022-04-03 20:08:33 -0700 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2022-04-05 20:56:36 -0700 |
commit | 73a06ffae663e9fb78c5dff4b6bd01a637296a69 (patch) | |
tree | 22672b7d07e0ed0c53ea4817015481143f0b6d6d /video/out/drm_atomic.c | |
parent | f61eda0f5e9f8085003c4c31111db525a438cbc1 (diff) | |
download | mpv-73a06ffae663e9fb78c5dff4b6bd01a637296a69.tar.bz2 mpv-73a06ffae663e9fb78c5dff4b6bd01a637296a69.tar.xz |
drm: context_drm_egl: add support for enabling VRR
Variable Refresh Rate (VRR), aka Freesync or Adaptive Sync can be used
with DRM by setting the VRR_ENABLED property on a crtc if the
connector reports that it is VRR_CAPABLE. This is a useful feature
for us as it is common to play 24/25/50 fps content on displays that
are nominally locked to 60Hz. VRR can allow this content to play at
native framerates.
This is a simple change as we just need to check the capability
and set the enabled property if requested by the user. I've defaulted
it to disabled for now, but it might make sense to default to auto
in the long term.
Diffstat (limited to 'video/out/drm_atomic.c')
-rw-r--r-- | video/out/drm_atomic.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/video/out/drm_atomic.c b/video/out/drm_atomic.c index bf7012c155..e615d2f9c7 100644 --- a/video/out/drm_atomic.c +++ b/video/out/drm_atomic.c @@ -389,6 +389,9 @@ bool drm_atomic_save_old_state(struct drm_atomic_context *ctx) if (0 > drm_object_get_property(ctx->crtc, "ACTIVE", &ctx->old_state.crtc.active)) ret = false; + // This property was added in kernel 5.0. We will just ignore any errors. + drm_object_get_property(ctx->crtc, "VRR_ENABLED", &ctx->old_state.crtc.vrr_enabled); + if (0 > drm_object_get_property(ctx->connector, "CRTC_ID", &ctx->old_state.connector.crtc_id)) ret = false; @@ -412,6 +415,9 @@ bool drm_atomic_restore_old_state(drmModeAtomicReqPtr request, struct drm_atomic if (0 > drm_object_set_property(request, ctx->connector, "CRTC_ID", ctx->old_state.connector.crtc_id)) ret = false; + // This property was added in kernel 5.0. We will just ignore any errors. + drm_object_set_property(request, ctx->crtc, "VRR_ENABLED", ctx->old_state.crtc.vrr_enabled); + if (!drm_mode_ensure_blob(ctx->fd, &ctx->old_state.crtc.mode)) ret = false; if (0 > drm_object_set_property(request, ctx->crtc, "MODE_ID", ctx->old_state.crtc.mode.blob_id)) |