summaryrefslogtreecommitdiff
path: root/drivers/gpu
AgeCommit message (Collapse)Author
8 daysdrm/amd/display: Fix HF-VSDB DSC bpc detection to be cumulativeFangzhi Zuo
[Why & How] The HDMI Forum VSDB reports the maximum DSC color depth a sink supports. This maximum is cumulative: a sink that reports 12 bpc also supports 10 and 8 bpc. The previous code used exact "== 10" and "== 12" comparisons chained with else-if, so a 12 bpc sink only set frl_dsc_12bpc and never set frl_dsc_10bpc, incorrectly narrowing the DSC bpc range usable with that sink. Use ">= 10" and a separate ">= 12" check so a sink advertising a higher maximum also enables the lower DSC bit depths it supports. Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 4523adbf4dca157aea96a6f28b4e7b7ebd4d5eda)
8 daysdrm/amd/display: Exit IPS before connector detection on resumeFangzhi Zuo
[Why & How] On resume, dm_resume() walks the connector list and, for each connector, calls dc_link_detect_connection_type() at the top of the loop iteration before the per-connector dc_exit_ips_for_hw_access() that sits in the detection branch. There is no dc_exit_ips_for_hw_access() before the loop, so the very first HW access relies on an earlier connector having already taken the display out of IPS. Commit d1d51519bc3b ("drm/amd/display: Skip eDP detection when no sink") skips the eDP connector when no panel is present. On a DCN3.5 APU whose eDP link has no sink, the eDP iteration - which used to bring the HW out of IPS first - is now skipped, so a downstream DP connector becomes the first one processed. Its initial DDC/AUX access then runs while the HW is still idle, the AUX transfers time out (-ETIMEDOUT), and the EDID read fails: [drm:dm_helpers_read_local_edid [amdgpu]] *ERROR* EDID err: 2, on connector: DP-1 amdgpu: [drm] *ERROR* No EDID read. Take the display out of IPS once before the detection loop so the first connector processed no longer touches the AUX/DDC engine while the HW is still in idle power state. This keeps the eDP-skip boot/resume optimization while fixing the DP EDID read failure. Fixes: d1d51519bc3b ("drm/amd/display: Skip eDP detection when no sink") Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 86420fe3093161971b4064e05be11ffff1df76aa) Cc: stable@vger.kernel.org
8 daysdrm/amd/display: Shorten hdmi_frl_status_polling_workqueueNathan Chancellor
There is a warning when creating the hdmi_frl_status_polling_wq workqueue because "hdmi_frl_status_polling_workqueue" excceds WQ_NAME_LEN: workqueue: name exceeds WQ_NAME_LEN. Truncating to: hdmi_frl_status_polling_workque Shorten the workqueue name to "hdmi_frl_status_polling_wq" like the structure member to avoid the warning. Fixes: 5c9b8b27a883 ("drm/amd/display: Tie FRL support into amdgpu_dm") Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260618-amdgpu-fix-wq_name_len-warning-v2-1-ef0e2e6f5be7@kernel.org Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 767ae341b68193fda5fdbc510b2d77e3e8938039)
8 daysdm/amdgpu: fix malformed link_settings debugfs outputHarry Wentland
[Why] dp_link_settings_read() passed strlen() of each format string as the size argument to snprintf() and then advanced rd_buf_ptr by that same fixed amount. The format-string length has no relation to the formatted output length, so snprintf() truncated each field at a NUL it wrote inside the buffer while the pointer was advanced past it. The result is a buffer peppered with embedded NUL bytes and fields that are silently cut short, so the data read back from the debugfs node does not reflect the actual link settings. [How] Use scnprintf() with the real remaining buffer size (rd_buf_size - (rd_buf_ptr - rd_buf)) and advance rd_buf_ptr by its return value, which is the number of characters actually written. This both bounds each write to the space left in rd_buf and keeps the output a single, properly terminated string. The now-unused str_len local is removed. Fixes: 41db5f1931ec ("drm/amd/display: set-read link rate and lane count through debugfs") Assisted-by: Copilot:claude-opus-4.8 Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 43b9f0f18693c7f7b75613f3aeae25fa2b4e2f76) Cc: stable@vger.kernel.org
8 daysdrm/amdgpu: skip the VMID 0 flush for VRAMArunpravin Paneer Selvam
Clear-on-release only runs on VRAM, which amdgpu_ttm_map_buffer() reaches via its direct MC address without programming a GART window, yet the wipe still forces a VMID 0 flush. On GFX11 (e.g. Navi33) that spurious SDMA flush can wedge the engine; only flush when a GART window is actually used. v2: Let amdgpu_ttm_map_buffer() return whether the VMID 0 flush is needed, and drive the clear and copy paths from that. (Christian) v3: Make the vm_needs_flush output parameter mandatory instead of allowing NULL. (Christian) Fixes: a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality") Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5413 Cc: Christian König <christian.koenig@amd.com> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit a306e406e570b74318ff7d80e5b07b540ca1d3a9) Cc: stable@vger.kernel.org
8 daysdrm/amd/display: Consult MCCS FreeSync cap only if requested & supportedMichel Dänzer
When the do_mccs parameter is false, we don't call dm_helpers_read_mccs_caps, so sink->mccs_caps.freesync_supported is unlikely to be true. Fixes: 6f71d5dd3206 ("drm/amd/display: Read sink freesync support via mccs") Bug: https://gitlab.freedesktop.org/drm/amd/-/work_items/5286 Signed-off-by: Michel Dänzer <mdaenzer@redhat.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit ac3aea794fb4156467b4b3b92c3155d95bf435c9) Cc: stable@vger.kernel.org
8 daysdrm/amd/pm: report energy accumulator for smu 13.0.0Kevin Wang
add energy accumulator on pmfw 0x004e8600 and above version. Signed-off-by: Kevin Wang <kevin.wang@amd.com> Reviewed-by: Kenneth Feng <kenneth.feng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/pm: fix gpu metrics energy accumulator for smu 13.0.0/13.0.7Kevin Wang
GPU metrics v1.3 defines energy_accumulator as a 64‑bit field. The unsupported‑firmware code path assigns UINT_MAX, which is neither the full‑width invalid value for this field nor its default value. Fixes: 8de9edb35976 ("drm/amd/pm: remove invalid gpu_metrics.energy_accumulator on smu v13.0.x") Signed-off-by: Kevin Wang <kevin.wang@amd.com> Reviewed-by: Kenneth Feng <kenneth.feng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu: remove redundant NULL check in amdgpu_cs_vm_handlingJiangshan Yi
bo_va is assigned from fpriv->csa_va, which is already verified to be non-NULL by the surrounding if statement. The inner NULL check can therefore never trigger and is dead code, so remove it. Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/ras: Adjust second parameter of mp1_v13_0_eeprom_send_msg()Nathan Chancellor
When building with -Wincompatible-function-pointer-types-strict, a warning designed to catch kernel control flow integrity (kCFI) issues at build time, there is an instance around mp1_v13_0_eeprom_send_msg(): drivers/gpu/drm/amd/amdgpu/../ras/ras_mgr/amdgpu_ras_mp1_v13_0.c:157:25: error: incompatible function pointer types initializing 'int (*)(struct ras_core_context *, u32, uint32_t, uint32_t *)' (aka 'int (*)(struct ras_core_context *, unsigned int, unsigned int, unsigned int *)') with an expression of type 'int (struct ras_core_context *, enum ras_fw_eeprom_cmd, uint32_t, uint32_t *)' (aka 'int (struct ras_core_context *, enum ras_fw_eeprom_cmd, unsigned int, unsigned int *)') [-Werror,-Wincompatible-function-pointer-types-strict] 157 | .mp1_send_eeprom_msg = mp1_v13_0_eeprom_send_msg, | ^~~~~~~~~~~~~~~~~~~~~~~~~ While 'u32' and 'enum ras_fw_eeprom_cmd' are ABI compatible, hence no regular warning from -Wincompatible-function-pointer-types, the mismatch will trigger a kCFI violation when mp1_v13_0_eeprom_send_msg() is called indirectly. Update the second parameter of mp1_v13_0_eeprom_send_msg()' to be 'u32 msg_id' to match the prototype in 'struct ras_mp1_sys_func' (which was recently changed to support mp1_v15_0), clearing up the warning and kCFI violation. Fixes: 11a948c7817b ("drm/amd/ras: Support retrieving bad page info from mp1_v15_0") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Rebuild InfoFrames on output color space changesSatyajit Roy
resource_build_info_frame() derives colorimetry and RGB quantization from stream->output_color_space. A Broadcast RGB-only atomic commit updates that field and reprograms the output CSC, but none of the InfoFrame update predicates include output_color_space. The sink can therefore retain the previous AVI InfoFrame range while the source starts transmitting a different pixel range. Treat an output color space change as an InfoFrame change in update classification and in both stream programming paths. Hardware testing on an HDMI 2.1 television confirmed that its automatic black-level selection follows Full to Limited and Limited to Full transitions in SDR, HDR, and HDR with VRR active, without a modeset or visible link blank. Fixes: 6eb4c13a3845 ("drm/amd/display: Support "Broadcast RGB" drm property") Signed-off-by: Satyajit Roy <sroy14@alum.utk.edu> Reviewed-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Honor Broadcast RGB for BT.2020 RGB outputSatyajit Roy
amdgpu_dm_get_output_color_space() applies the Broadcast RGB connector property to default RGB output, but always selects full-range output for BT.2020 RGB. Consequently, explicitly selecting Limited has no effect on the output CSC or AVI InfoFrame when HDR uses BT.2020 RGB. Select COLOR_SPACE_2020_RGB_LIMITEDRANGE when the output encoding is RGB and Broadcast RGB is Limited. Keep Automatic and Full at full range, and leave YCbCr output unchanged. Add KUnit coverage for limited-range RGB output through both BT.2020 connector colorspace values. Fixes: 6eb4c13a3845 ("drm/amd/display: Support "Broadcast RGB" drm property") Signed-off-by: Satyajit Roy <sroy14@alum.utk.edu> Reviewed-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Propagate HDMI RGB quantization selectabilitySatyajit Roy
DC uses dc_edid_caps.qs_bit when constructing the HDMI AVI InfoFrame quantization-range field. Although DRM parses the sink capability into drm_display_info, DM never copies it into the DC EDID capabilities. The field therefore remains zero and the AVI quantization range stays at its default value. Copy rgb_quant_range_selectable for HDMI sinks and extend the existing EDID-capability KUnit test to cover it. Fixes: 6eb4c13a3845 ("drm/amd/display: Support "Broadcast RGB" drm property") Signed-off-by: Satyajit Roy <sroy14@alum.utk.edu> Reviewed-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysRevert "drm/amdgpu: debugfs: avoid extra EOLs in amdgpu_gem_info"Thadeu Lima de Souza Cascardo
This reverts commit c119d05a36a884482decc67e55944648f8cba97e. It removes the newline even when there are no fences attached to a struct dma_resv, leading to multiple BOs being output on the same line, making the debug file less readable, not more as the commit intended. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu/gfx8: fix register_list_format leak in gfx_v8_0_init_microcodeWillian Oliveira
gfx_v8_0_init_microcode() allocates rlc.register_list_format before loading the MEC firmware. If loading one of the subsequent firmware files fails, the function returns through the error path without freeing register_list_format. Use gfx_v8_0_free_microcode() in the error path so all previously allocated firmware resources, including register_list_format, are released. Signed-off-by: Willian Oliveira <williandossantosdeoliveira287@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu/gmc12: drop duplicate gmc.init_pte_flagsAlex Deucher
This is now set for all GMC 12.x variants in early_init() so drop the duplicate setting. Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Prike Liang <Prike.Liang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu: Reset UALink connection on failed TLB-shootdown sendMukul Joshi
If sending TLB shootdown to a remote GPU fails, reset the connection and mark the connection as NOT_READY. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu: Don't ignore LSDMA copy errors during remote interrupt sendMukul Joshi
On the LSDMA path amdgpu_ualink_send_command() ignored the return of amdgpu_lsdma_copy_mem() and polled the remote completion for the full timeout even when the copy failed. With a peer down, every NPA-REVOKE send in amdgpu_ualink_exp_cleanup_worker() wasted ~2s, and the peer stayed ESTABLISHED so each subsequent handle cleanup timed out again, piling up past the 120s hung-task threshold. Return immediately when an LSDMA copy fails, and mark the connection NOT_READY on a failed revoke send so other cleanups skip the unreachable peer via amdgpu_ualink_check_conn_ready(). Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu: skip gfx switch_power_profile during GPU resetPrike Liang
During resume from GPU reset, the gfx idle work may invoke switch_power_profile before the reset completes. This causes the following assert error because the register access occurs without first releasing the GPU reset semaphore: [ 1576.768935] CR2: 0000559ea133ead0 CR3: 00000002e6c42000 CR4: 0000000000350ef0 [ 1576.768940] Call Trace: [ 1576.768944] <TASK> [ 1576.768953] amdgpu_device_rreg+0x21/0x50 [amdgpu] [ 1576.769158] smu_msg_v1_send_msg+0x1a4/0x6e0 [amdgpu] [ 1576.769437] smu_cmn_send_smc_msg_with_params_ext+0xba/0x120 [amdgpu] [ 1576.769721] smu_cmn_send_smc_msg_with_param+0x33/0x40 [amdgpu] [ 1576.769993] smu_v13_0_0_set_power_profile_mode+0x192/0x2b0 [amdgpu] [ 1576.770267] smu_bump_power_profile_mode+0x5d/0x80 [amdgpu] [ 1576.770538] smu_switch_power_profile+0xa4/0xf0 [amdgpu] [ 1576.770839] amdgpu_dpm_switch_power_profile+0x6f/0x90 [amdgpu] [ 1576.771210] amdgpu_gfx_profile_idle_work_handler+0xe9/0x130 [amdgpu] [ 1576.771460] process_one_work+0x23e/0x6f0 [ 1576.771491] worker_thread+0x1c4/0x380 [ 1576.771506] kthread+0x10c/0x150 [ 1576.771512] ? __pfx_worker_thread+0x10/0x10 [ 1576.771518] ? __pfx_kthread+0x10/0x10 [ 1576.771530] ret_from_fork+0x314/0x390 [ 1576.771537] ? __pfx_kthread+0x10/0x10 [ 1576.771546] ret_from_fork_asm+0x1a/0x30 Signed-off-by: Prike Liang <Prike.Liang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu: clean up the userq support redundant checkPrike Liang
If the userq doesn't support in a system. then there's no valid userq_doorbell_xa entry to walk over and then has a no-op. Signed-off-by: Prike Liang <Prike.Liang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu/userq: reset a hung SDMA user queue over MMIOJesse Zhang
A hung SDMA user queue wedges MES, so the MES packet reset times out and falls back to a full MODE1 reset - once per in-flight job, a reset storm. The queue is still on its HW slot at the first hang-detect, so use detect_hung_queue to recover its slot from the doorbell and reset it over MMIO, which does not need MES. Mark it HUNG (not UNMAPPED) so the restore worker does not re-map and re-run the guilty job, and short-circuit the per-fence hang-detect re-entry once the queue is already reset. Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu/sdma7: implement detect_hung_queueJesse Zhang
Match each SDMA queue's DOORBELL_OFFSET register against the given doorbell to recover its (instance, queue_id) HW slot. The per-queue register stride is derived from the named QUEUE0/QUEUE1 registers. Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu/sdma6: implement detect_hung_queueJesse Zhang
Match each SDMA queue's DOORBELL_OFFSET register against the given doorbell to recover its (instance, queue_id) HW slot. The per-queue register stride is derived from the named QUEUE0/QUEUE1 registers. Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdkfd: allow 255 queues per process on GFX 12.1.0Horatio Zhang
GFX 12.1.0 queues are managed by MES, not by the HWS runlist, so the 127 queue limit does not apply. The topology advertises 32 CP queues plus 16 SDMA engines with 6 queues each, so creating every queue needs 128 and the last one fails with -ENOSPC. Signed-off-by: Horatio Zhang <hongkun.zhang@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu/sdma: add detect_hung_queue callbackJesse Zhang
Add an optional per-IP callback that maps a user queue's doorbell index to its HW slot (instance, queue_id). It is needed to reset a hung SDMA user queue over MMIO, since struct amdgpu_usermode_queue does not store its HW slot. Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Promote DC to 3.2.397Taimur Hassan
This version brings along the following updates: - Ensure requested LSDMA bandwidth stays within the SOP bound. - Refactor DC_SEND_CURSOR_INFO_TO_DMU to drop the pipe_ctx param. - Add an override for LSDMA bandwidth in the QoS table. - Expand amdgpu_dm KUnit coverage across vblank IRQ, self-refresh, GPU reset, plane update, MST resume, cached suspend state, writeback transitions, atomic validation, connector-state restore, EDID CEA parsing and DM IRQ source handling. - Keep streamclk gating off when enabling streamclk. - Remove unnecessary includes. - Set mpc_tree_params->opp_id during OPP resource construct. - Add override capability for UTM table params. - Add immediate restore to FAMS2 for DRR. - Fix missing APG registers for DCN60 HDMI. - Exit IPS before connector detection on resume. - Fix HF-VSDB DSC bpc detection to be cumulative. - Fix unused params in flip schedule. - Enable the FW locality check in DCN6. - Fix DC Hub reference frequency assert range. - Dump clock registers in HW init instead of SW init. - Validate the IRQ source in the DM IRQ handler. - Revert "Fix CalculateFlipSchedule Calculation". - Assorted DML updates. - Update urgent burst calculation to account for unbounded requests. - Add a stressed peak-bandwidth probe with DMA contention. - Revert "Unify CalculateFlipSchedule Logic". Acked-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: [FW Promotion] Release 0.1.74.0Taimur Hassan
[Why & How] Update DMUB related command structure. Acked-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix signedness mismatches in cm3Alex Hung
[Why] In cm3_helper_translate_curve_to_degamma_hw_format(), seg_distr[] and the loop counter k are uint32_t, while -1, region_start/region_end and i are signed. Comparing them relies on implicit integer conversions, which some compilers diagnose and which obscures the intent of the comparisons. [How] Add explicit casts so the signedness of each comparison is stated in the code. No functional change. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix NULL deref of new_stream->sink in VTEM guardFangzhi Zuo
[Why & How] amdgpu_dm_update_freesync_state_on_stream() keyed the VTEM guard off new_stream->sink->sink_signal, but new_stream->sink can be NULL, leading to a NULL pointer dereference. Use new_stream->signal instead, which is a direct field of the already validated new_stream and carries the same HDMI signal type. This matches the ALLM block in the same function, which already uses new_stream->signal. Fixes: 640fd039dc8b ("drm/amd/display: Emit VTEM for HF-VSDB VRR on TMDS links") Reviewed-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Update DML fields used for mode supportAustin Zheng
[Why & How] Update fields used for mode support. Also expose some functions so they can be re-used for future products Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Route DCN6 mode programming calcs through function pointer ↵Wenjing Liu
table [Why] dml2_core_dcn6_funcs_mode_programming.c called DCN5 and DCN6 calcs functions directly by name, coupling the mode programming flow to specific generations. Routing through the calcs table lets a future core generation reuse this flow without editing it. [How] Add a static get_calcs(ctx) helper returning ctx->calcs->dcn6. Replace every direct dcn5_*/dcn6_* calcs call with get_calcs(ctx)->slot(...). dcn6_populate_mode_programming() did not previously receive the mp context, so thread calc_mp_ctx through it to reach get_calcs() for its three calcs calls. Assign ctx->calcs from core->calcs in dcn6_mp_build_calculate_mp_context(). Drop the now-unused dml2_core_dcn5_calcs_dchub.h, dml2_core_dcn5_calcs_display_pipe.h, and dml2_core_dcn6_calcs_dchub.h includes in favor of dml2_core_dcn6_calcs.h. Reviewed-by: Austin Zheng <austin.zheng@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Route DCN6 mode support calcs through function pointer tableWenjing Liu
[Why] dml2_core_dcn6_funcs_mode_support.c called DCN5 and DCN6 calcs functions directly by name, coupling the mode support flow to specific generations. Routing through the calcs table lets a future core generation reuse this flow without editing it. [How] Add a static get_calcs(ctx) helper returning ctx->calcs->dcn6. Replace every direct dcn5_*/dcn6_* calcs call with get_calcs(ctx)->slot(...). Assign calc_ms_ctx->calcs from core->calcs when the context is built. Drop the now-unused dml2_core_dcn5_calcs_dchub.h, dml2_core_dcn5_calcs_display_pipe.h, and dml2_core_dcn6_calcs_dchub.h includes in favor of dml2_core_dcn6_calcs.h. Reviewed-by: Austin Zheng <austin.zheng@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Add dml2_core_dcn6_calcs function pointer tableWenjing Liu
[Why] DCN6 core mode support/programming call DCN5 and DCN6 calcs functions directly by name. The calcs layer needs one seam the funcs layer can go through instead of hardcoding a generation. [How] Add union dml2_core_calcs holding one function pointer table per generation, plus a calcs field on dml2_core_instance and on the mode support/programming contexts. Add dml2_core_dcn6_calcs.c/.h defining struct dml2_core_dcn6_calcs, a flat table covering every DCN6 calcs function and every DCN5 calcs function DCN6 reuses, and dml2_core_dcn6_calcs_init() to populate it. Call dml2_core_dcn6_calcs_init() from dml2_core_dcn6_funcs_initialize(). Reviewed-by: Austin Zheng <austin.zheng@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysRevert "drm/amd/display: Unify CalculateFlipSchedule Logic"Austin Zheng
Revert commit 1e719006b623 ("drm/amd/display: Unify CalculateFlipSchedule Logic") Because it causes some regression Reviewed-by: Joshua Aberback <joshua.aberback@amd.com> Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Update Urgent Burst Calculation To Account For Unbounded ↵Austin Zheng
Requests [Why & How] dcn5_calculate_urgent_burst_factor function is aware of unbounded request mode making the buffer larger Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Set DISPCLK per surface in DMLAustin Zheng
[Why & How] Always set DISPCLK per surface. Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysRevert "drm/amd/display: Fix CalculateFlipSchedule Calculation"Samson Tam
Revert commit 7bee76300211 ("drm/amd/display: Fix CalculateFlipSchedule Calculation") Because it causes some regression Reviewed-by: Austin Zheng <austin.zheng@amd.com> Signed-off-by: Samson Tam <samson.tam@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test DM IRQ handler source guardAlex Hung
[Why & How] Add dm_test_irq_handler_invalid_source to cover the early return in amdgpu_dm_irq_handler() when dc_interrupt_to_irq_source() cannot map the hardware entry. Reuse the existing unmapped irq_service stub and assert that neither the high- nor the low-context handler is dispatched. Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Validate irq source in DM IRQ handlerAlex Hung
[Why] dc_interrupt_to_irq_source() can return DC_IRQ_SOURCE_INVALID for an unmapped src_id/src_data pair. The value was passed straight to dc_interrupt_ack() and used to index the DM high/low handler tables. [How] Reject sources outside the valid range before using them. Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Dump clock registers in HW init instead of SW initAlvin Lee
[Why & How] - Dumping clock registers in SW init can get incorrect clock readback due to other init code (e.g., in DMU) potentially not executed yet - Move clk_ip register access into HW init to ensure the clock read back gets the correct values Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix DC Hub reference frequency assert rangeNevenko Stupar
[Why & How] The DC Hub reference frequency valid range was asserted incorrectly. Correct the range to 20 to 50 MHz and update the comment accordingly. Reviewed-by: Sridevi Arvindekar <sridevi.arvindekar@amd.com> Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Nevenko Stupar <Nevenko.Stupar@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Enable FW locality check in DCN6Alvin Lee
[Why & How] Enable FW locality check in DCN6 Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix unused params in flip schedAlex Hung
[Why & How] dcn6_calculate_flip_schedule() no longer uses meta_row_height and meta_row_height_chroma in any of its calculations, so both parameters are flagged as unreferenced by compilers with stricter warning levels. Cast both to void to document that they are intentionally unused. The parameters are kept because the signature is fixed by the shared function pointer. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Austin Zheng <austin.zheng@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix HF-VSDB DSC bpc detection to be cumulativeFangzhi Zuo
[Why & How] The HDMI Forum VSDB reports the maximum DSC color depth a sink supports. This maximum is cumulative: a sink that reports 12 bpc also supports 10 and 8 bpc. The previous code used exact "== 10" and "== 12" comparisons chained with else-if, so a 12 bpc sink only set frl_dsc_12bpc and never set frl_dsc_10bpc, incorrectly narrowing the DSC bpc range usable with that sink. Use ">= 10" and a separate ">= 12" check so a sink advertising a higher maximum also enables the lower DSC bit depths it supports. Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Exit IPS before connector detection on resumeFangzhi Zuo
[Why & How] On resume, dm_resume() walks the connector list and, for each connector, calls dc_link_detect_connection_type() at the top of the loop iteration before the per-connector dc_exit_ips_for_hw_access() that sits in the detection branch. There is no dc_exit_ips_for_hw_access() before the loop, so the very first HW access relies on an earlier connector having already taken the display out of IPS. Commit d1d51519bc3b ("drm/amd/display: Skip eDP detection when no sink") skips the eDP connector when no panel is present. On a DCN3.5 APU whose eDP link has no sink, the eDP iteration - which used to bring the HW out of IPS first - is now skipped, so a downstream DP connector becomes the first one processed. Its initial DDC/AUX access then runs while the HW is still idle, the AUX transfers time out (-ETIMEDOUT), and the EDID read fails: [drm:dm_helpers_read_local_edid [amdgpu]] *ERROR* EDID err: 2, on connector: DP-1 amdgpu: [drm] *ERROR* No EDID read. Take the display out of IPS once before the detection loop so the first connector processed no longer touches the AUX/DDC engine while the HW is still in idle power state. This keeps the eDP-skip boot/resume optimization while fixing the DP EDID read failure. Fixes: d1d51519bc3b ("drm/amd/display: Skip eDP detection when no sink") Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix missing APG regs for DCN60 HDMIIlya Bakoulin
[Why & How] Add missing APG instance for HDMI stream encoder. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Add immediate restore to FAMS2 for DRRDillon Varone
[Why & How] Adds toggle to immediately restore FAMS2 streams instead of waiting for DRR VTotal changes to latch Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Dillon Varone <Dillon.Varone@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Add override capability for UTM table paramsAlvin Lee
[Why & How] Add calls for overriding UTM table params from PMFW. This is for debug and test purposes only when PMFW has not yet populated the table values correctly. Reviewed-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Set mpc_tree_params->opp_id during OPP resource constructOvidiu Bunea
[Why & How] Currently, init_pipes() is the only interface responsible for initializing the OPP->MPCC resource for all pipes. However, during seamless boot transitions, init_pipes() is skipped and we transition directly to an ODM2:1 config where we end up programming the default SW struct state of mpc_tree_params, which is 0. This results in a config where both HUBP0 & HUBP1 are being fed into the same OPP inst, 0 in this case. This is purely a case of programming incorrect SW state initialization values into HW, so fix this by initializing mpc_tree_params with the correct instances during resource construct. Reviewed-by: Michael Strauss <michael.strauss@amd.com> Signed-off-by: Ovidiu Bunea <ovidiu.bunea@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Remove unnecessary includesJoshua Aberback
[Why & How] These direct inclusions are unnecessary as the relevant headers are taken care of by the broader inclusions in these files. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Joshua Aberback <joshua.aberback@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>