All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] drm/amd/display: Copy probed modes for atomic_check
@ 2026-11-14 23:09 ` Hugo Sales
  0 siblings, 0 replies; 19+ messages in thread
From: Hugo Sales via B4 Relay @ 2026-11-14 23:09 UTC (permalink / raw)
  To: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Ray Wu,
	Fangzhi Zuo, Roman Li, Alex Hung
  Cc: amd-gfx, dri-devel, linux-kernel, Ville Syrjälä,
	Aurabindo Pillai, Hugo Sales

mode_config.mutex protects connector->modes, but amdgpu_dm walks it from
atomic_check, in create_stream_for_sink() and
amdgpu_dm_get_highest_refresh_rate_mode(), without that mutex.
atomic_check can't take the mutex because of lock ordering. An earlier
patch I submitted moved the probe helper's sort under the modeset locks
so this walk couldn't race it, and Ville pointed out that the bug is in
the reader:
https://lore.kernel.org/r/auh8pUx_kXUYSdZ8@intel.com

atomic_check only needs the preferred mode and the highest refresh rate
mode. This series copies both at the end of each probe, under
mode_config.mutex and connection_mutex, and atomic_check reads the
copies under connection_mutex. The highest refresh rate copy is the mode
add_fs_modes() built the FreeSync video modes from, as upstream's cached
freesync_vid_base is. It's done this way because a search of
connector->modes at the end of the probe could pick a command line mode
with a higher refresh rate, and amdgpu_dm_is_freesync_video_mode() would
then reject the video modes

The copies also need work to stay current after a monitor swap. Until
the next probe they still describe the previous monitor, as
connector->modes could, and two paths read them before that probe.
mode_valid runs before the probe refreshes them, and after a swap the
HPD handlers commit before the next probe. Patch 3 has mode_valid
validate each mode with its own timing, so it no longer needs the
preferred mode. Patch 4 records the EDID of the sink the copies came
from, and patch 7 uses them only for a sink with that EDID. atomic_check
checks them against the sink of the stream it builds, since a hotplug
can swap dc_sink under it. With another sink, atomic_check uses the
requested mode's own timing until the next probe, as before the first
probe

Patch 1 drops a debug check that walked probed_modes and
connector->modes from atomic_check, and asks its author below the cut
whether to keep it behind mutex_trylock() instead. Patch 2 stops
add_fs_modes() matching against connector->modes, which dropped the
FreeSync video modes on every second probe. Patch 4 adds the copies,
patches 5 and 6 pass the sink of the stream being built to the code that
checks them, patch 7 switches the readers to them, and patch 8 adds
tests for the copies

Patch 6 also changes one behaviour, only with amdgpu.freesync_video=1,
which is off by default. A CRTC turned on straight into a FreeSync video
mode now gets its fixed refresh config, which it never got before

---
Hugo Sales (8):
      drm/amd/display: Drop the unadvertised mode check
      drm/amd/display: Don't match FreeSync video modes against the last probe
      drm/amd/display: Validate modes with their own timing
      drm/amd/display: Copy the preferred and highest refresh modes after probe
      drm/amd/display: Pass the sink to the FreeSync and stream timing helpers
      drm/amd/display: Pick the FreeSync video config for the new stream's sink
      drm/amd/display: Stop reading connector->modes from atomic_check
      drm/amd/display: Add KUnit tests for the mode copies

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |   38 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |   23 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.c    |  499 +++++---
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.h    |   13 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |    2 +-
 .../amdgpu_dm/tests/amdgpu_dm_connector_test.c     | 1209 +++++++++++++++++---
 .../amd/display/amdgpu_dm/tests/amdgpu_dm_test.c   |  153 +++
 7 files changed, 1644 insertions(+), 293 deletions(-)
---
base-commit: 47df73aa49d1988c8f684b7caf8be6570e966844
change-id: 20261104-amdgpu-modes-four-57aaed43ab18

Best regards,
--  
Hugo Sales <hugo@hsal.es>



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-11-14 23:41 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 23:09 [PATCH 0/8] drm/amd/display: Copy probed modes for atomic_check Hugo Sales via B4 Relay
2026-11-14 23:09 ` Hugo Sales
2026-11-14 23:09 ` [PATCH 1/8] drm/amd/display: Drop the unadvertised mode check Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales
2026-11-14 23:09 ` [PATCH 2/8] drm/amd/display: Don't match FreeSync video modes against the last probe Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales
2026-11-14 23:09 ` [PATCH 3/8] drm/amd/display: Validate modes with their own timing Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales
2026-11-14 23:09 ` [PATCH 4/8] drm/amd/display: Copy the preferred and highest refresh modes after probe Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales
2026-11-14 23:40   ` sashiko-bot
2026-11-14 23:09 ` [PATCH 5/8] drm/amd/display: Pass the sink to the FreeSync and stream timing helpers Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales
2026-11-14 23:09 ` [PATCH 6/8] drm/amd/display: Pick the FreeSync video config for the new stream's sink Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales
2026-11-14 23:09 ` [PATCH 7/8] drm/amd/display: Stop reading connector->modes from atomic_check Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales
2026-11-14 23:09 ` [PATCH 8/8] drm/amd/display: Add KUnit tests for the mode copies Hugo Sales via B4 Relay
2026-11-14 23:09   ` Hugo Sales

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.