RK3588 (and likely other Rockchip hardware) requires a full modeset when VRR is enabled in order for it to function properly.
Set mode_changed during the atomic check phase to do this. Signed-off-by: Nicolas Frattaroli <[email protected]> --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 45588b79b3d4..e3aad75b88b4 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -13,6 +13,7 @@ #include <drm/drm_framebuffer.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_probe_helper.h> +#include <drm/drm_print.h> #include "rockchip_drm_drv.h" #include "rockchip_drm_fb.h" @@ -59,9 +60,26 @@ rockchip_fb_create(struct drm_device *dev, struct drm_file *file, return &afbc_fb->base; } +static int rockchip_drm_atomic_check(struct drm_device *dev, struct drm_atomic_commit *state) +{ + struct drm_crtc_state *old_crtc_state, *new_crtc_state; + struct drm_crtc *crtc; + int i; + + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { + if (old_crtc_state->vrr_enabled != new_crtc_state->vrr_enabled) { + new_crtc_state->mode_changed = true; + drm_dbg_driver(dev, "[CRTC:%d:%s] VRR changed\n", + crtc->base.id, crtc->name); + } + } + + return drm_atomic_helper_check(dev, state); +} + static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = { .fb_create = rockchip_fb_create, - .atomic_check = drm_atomic_helper_check, + .atomic_check = rockchip_drm_atomic_check, .atomic_commit = drm_atomic_helper_commit, }; -- 2.56.0
