From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796209878; b=ytcrI9AdN8GJgbrUok5xVxk6Q1ozO6wEPYhEgU3BTmit9/Pe5R3cFIwbWyN2tC1d4PzS pCgWl5p+xd8XPjC8t6GXVRrfLqmNkdTYDTG5C2aOxUkGYqO6I/DXLOq2sKe9yrJWVVTTy OXlL3h7mpNrbcDh1LJa1hbWTmJb2bmW1Y2RLMx2HM7no5QrD5TwYO0Byf77zWtTNfYiDt WG1hi+jtxb/guUgD9Kyf6BTwkvwsBxP4jVi8xrLSz5pIFSOPs5QSA9/ad97EfskaRh8K2 yWri1iM9FWIOb05u/JmbevyD8+WPt/St2QojOaF2fqLwmXl1IC49CRFaK3ywdqhhsBA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796209878; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=WeYiPJMXcrmRyUGACsrP0jmEvnXZXaRg4G3CpNxgvWU=; b=FIztjkFU2WVJSvZB0NZA+Ihqj+hrB18kzfeSEZir0Z64C5eBCYOjubWDj6maikpuVp5r OjolOW4CxM/qREAC/zuChQtyD4H4aBsqCjn+ruAg/uwuuJF7HK93N+eSlngCvJi1C6OkG 56sNXGCqyTLNOdgre0BcMC6HF7OnSyIgQjHyTNzxp8jUXph+m6Oao4COJSv2TDnM4LOD5 gja7AnZ8ydamMkfkhios35H9+H8MrEpMZfgwh+PrOzZlP2OTFn0rtRQTr/jtAYkhxuH4u fe+yQuaqRjf0OWOaxv4f5hXVx55Iybaci6RHYl0sldSTqIqO21KMcgIF71hfTBDE44w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=khAykiWG; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26200606A31A for ; Wed, 2 Dec 2026 11:11:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=khAykiWG Received: by smtp.kernel.org (Postfix) with ESMTPSA id 281571F000C1; Wed, 2 Dec 2026 11:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796209877; bh=WeYiPJMXcrmRyUGACsrP0jmEvnXZXaRg4G3CpNxgvWU=; h=Subject:To:Cc:From:Date; b=khAykiWGjz3p02fvCZpfEJt0TgiBbm6yn4k0fxcTz4hjkig3iHCWVJ9MU0PYls1m9 bvTvN7K1JYohAtcWSqMzAH2SQY/aofAqm62WdfHN/4VdctA4EbfKHfU0w9+f64NMVF z4vfF2UVNvR6GIheaga+xbflHLe/LCNB5/hU0oSk= Subject: FAILED: patch "[PATCH] drm/amd/display: Keep FreeSync flip timing across plane" failed to apply to 6.12-stable tree To: davidralphhughes@gmail.com,Wayne.Lin@amd.com,alexander.deucher@amd.com,harry.wentland@amd.com Cc: From: Date: Wed, 02 Dec 2026 12:11:13 +0100 Message-ID: <2026120213-opal-dreamboat-48aa@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x fff46a322847a54cf11d5af3d7fc7fa07bc71b29 # git commit -s git send-email --to '' --in-reply-to '2026120213-opal-dreamboat-48aa@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From fff46a322847a54cf11d5af3d7fc7fa07bc71b29 Mon Sep 17 00:00:00 2001 From: Davey Hughes Date: Wed, 28 Oct 2026 15:54:12 -0700 Subject: [PATCH] drm/amd/display: Keep FreeSync flip timing across plane resets dm_update_plane_state() replaces the DC plane with a newly allocated one whenever the plane is reset. The new plane's flip timing is zero, and mod_freesync_handle_preflip() runs before DC stores the new plane's first flip timestamp, so FreeSync takes the 32-bit microsecond timestamp itself as the last render time: the monotonic clock modulo about 71.6 minutes. On a panel with below-the-range compensation (BTR), that engages BTR and pins the frame time at the BTR mid-point (13.447 ms on a 48-165 Hz panel). A panel without BTR (max refresh below twice the min) goes through the fixed refresh path instead and locks to its max refresh after six frames. It takes a reset on every flip to keep the panel there, and color management changes reset the plane. DRM sets color_mgmt_changed whenever a color property is given a different blob, even one with the same contents, and KWin 6.8.1 with HDR enabled and its color accuracy setting at "Prefer efficiency" sets a new GAMMA_LUT blob on every commit (current KWin master no longer does). Plane resets for CRTC color changes, added by commit 7316c4ad2996 ("drm/amd/display: Reset planes for color management changes"), and later for plane color properties and colorops, made this reachable on every flip. Copy the flip timing from the old DC plane into the new one when the plane stays on the same CRTC. Do it in amdgpu_dm_commit_planes() before the preflip, after drm_atomic_helper_wait_for_dependencies() has waited for the previous commit, so the copy holds that commit's flip and does not race with DC writing it. This covers both the BTR and the fixed refresh path. A plane that is newly enabled or moved to another CRTC still starts without history. Fixes: 180db303ff46 ("drm/amd/display: Add below the range support for FreeSync") Reviewed-by: Harry Wentland Signed-off-by: Davey Hughes Signed-off-by: Wayne Lin Signed-off-by: Alex Deucher (cherry picked from commit 4acf82d2a2dcca2d7df8649ecafb3da6c1245003) Cc: stable@vger.kernel.org diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 1b9f830b1c75..5d1b010bec9b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3858,6 +3858,25 @@ STATIC_IFN_KUNIT void dm_arm_vblank_event_pre_programming(struct amdgpu_crtc *ac } EXPORT_IF_KUNIT(dm_arm_vblank_event_pre_programming); +/* + * FreeSync times each frame from the plane's previous flip, and a plane + * reset gives the new DC plane zeroed flip timing, so copy it over. Do + * this at commit time, not in atomic check: by then the previous commit + * has finished writing it. + */ +static void +dm_plane_inherit_flip_time(struct dc_plane_state *dc_plane_state, + struct drm_plane_state *old_plane_state, + struct drm_plane_state *new_plane_state) +{ + struct dc_plane_state *old_dc_plane_state = + to_dm_plane_state(old_plane_state)->dc_state; + + if (old_dc_plane_state && old_dc_plane_state != dc_plane_state && + old_plane_state->crtc == new_plane_state->crtc) + dc_plane_state->time = old_dc_plane_state->time; +} + static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, struct drm_device *dev, struct amdgpu_display_manager *dm, @@ -3962,6 +3981,9 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, if (!dc_plane) continue; + dm_plane_inherit_flip_time(dc_plane, old_plane_state, + new_plane_state); + bundle->surface_updates[planes_count].surface = dc_plane; if (new_pcrtc_state->color_mgmt_changed || new_plane_state->color_mgmt_changed) { bundle->surface_updates[planes_count].gamma = &dc_plane->gamma_correction;