summaryrefslogtreecommitdiff
path: root/src/amdgpu_present.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/amdgpu_present.c')
-rw-r--r--src/amdgpu_present.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 85b2e67..f3af045 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -88,6 +88,23 @@ amdgpu_present_get_ust_msc(RRCrtcPtr crtc, CARD64 *ust, CARD64 *msc)
}
/*
+ * Changes the variable refresh state for every CRTC on the screen.
+ */
+static void
+amdgpu_present_set_screen_vrr(ScrnInfoPtr scrn)
+{
+ AMDGPUInfoPtr info = AMDGPUPTR(scrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc;
+ int i;
+
+ for (i = 0; i < config->num_crtc; i++) {
+ crtc = config->crtc[i];
+ drmmode_crtc_set_vrr(crtc, info->drmmode.vrr_flipping);
+ }
+}
+
+/*
* Flush the DRM event queue when full; this
* makes space for new requests
*/
@@ -275,6 +292,16 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
info->flip_window = window;
+ /* A window can only flip if it covers the entire X screen.
+ * Only one window can flip at a time.
+ *
+ * If the window also has the variable refresh property then
+ * variable refresh supported can be enabled on every CRTC.
+ */
+ info->drmmode.vrr_flipping =
+ info->vrr_support &&
+ amdgpu_window_has_variable_refresh(window);
+
return TRUE;
}
@@ -329,6 +356,7 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
event->event_id = event_id;
+ amdgpu_present_set_screen_vrr(scrn);
amdgpu_glamor_flush(scrn);
ret = amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT,
@@ -362,6 +390,8 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
int i;
info->flip_window = NULL;
+ info->drmmode.vrr_flipping = FALSE;
+ amdgpu_present_set_screen_vrr(scrn);
if (!amdgpu_present_check_unflip(scrn))
goto modeset;