summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2019-02-12 17:57:17 +0100
committerMichel Dänzer <michel@daenzer.net>2019-02-22 17:45:04 +0100
commitbd090f389f19f1f4a3f662ffdd891345a3899539 (patch)
tree5945a61a0cc497c353a67d22afdaed1144395c76
parentd9be5d712d469595e1e610f7294bc670ca3b1985 (diff)
Call amdgpu_present_set_screen_vrr from amdgpu_vrr_property_update
If the window is currently flipping. This might make a difference when the property gets disabled: Variable refresh will now be disabled immediately in that case, instead of only when the window can no longer use page flipping at all. Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
-rw-r--r--src/amdgpu_drv.h1
-rw-r--r--src/amdgpu_kms.c7
-rw-r--r--src/amdgpu_present.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 7b3bace..0ae171f 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -361,6 +361,7 @@ void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
);
/* amdgpu_present.c */
+void amdgpu_present_set_screen_vrr(ScrnInfoPtr scrn, Bool vrr_enabled);
Bool amdgpu_present_screen_init(ScreenPtr screen);
/* amdgpu_sync.c */
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index e50c6d1..458d2d0 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -102,7 +102,14 @@ static inline struct amdgpu_window_priv *get_window_priv(WindowPtr win) {
static void
amdgpu_vrr_property_update(WindowPtr window, Bool variable_refresh)
{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(window->drawable.pScreen);
+ AMDGPUInfoPtr info = AMDGPUPTR(scrn);
+
get_window_priv(window)->variable_refresh = variable_refresh;
+
+ if (info->flip_window == window &&
+ info->drmmode.present_flipping)
+ amdgpu_present_set_screen_vrr(scrn, variable_refresh);
}
/* Wrapper for xserver/dix/property.c:ProcChangeProperty */
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 5a4b9c0..2fbcd25 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -90,7 +90,7 @@ amdgpu_present_get_ust_msc(RRCrtcPtr crtc, CARD64 *ust, CARD64 *msc)
/*
* Changes the variable refresh state for every CRTC on the screen.
*/
-static void
+void
amdgpu_present_set_screen_vrr(ScrnInfoPtr scrn, Bool vrr_enabled)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);