summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/dc
diff options
context:
space:
mode:
authorPiotr Maziarz <piotr.maziarz@amd.com>2026-08-17 14:25:34 +0200
committerAlex Deucher <alexander.deucher@amd.com>2026-09-23 14:18:00 -0400
commit184a71e58b2e98b6b273ac277687bbf186226971 (patch)
treea5e8c61faeec2a00f93d3a2665731ffe06def7b9 /drivers/gpu/drm/amd/display/dc
parent08a07e8c254c40f6c23089d259b26a3e51bfbb4f (diff)
downloadlinux-next-184a71e58b2e98b6b273ac277687bbf186226971.tar.gz
linux-next-184a71e58b2e98b6b273ac277687bbf186226971.zip
drm/amd/display: clamp cursor hotspot at the register write
[Why] dcn401_build_cursor_position() clamped x_hotspot to 0xFF before publishing *pos_out, but that field is also stored into hubp->curs_pos and forwarded to dpp1_set_cursor_position(), which derives src_x_offset from it. The ODM/MPC slice adjustments earlier in the same function deliberately grow x_hotspot past 255 to keep the cursor visible across a slice boundary, so the clamp corrupted DPP source addressing in exactly the case it was meant to handle. [How] Clamp in hubp401_cursor_set_position() instead, where the 8-bit CURSOR_HOT_SPOT_X field lives. A local is used for the register write only; pos->x_hotspot passes through unmodified. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Piotr Maziarz <piotr.maziarz@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc')
-rw-r--r--drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c4
-rw-r--r--drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c4
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c b/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c
index a985c3e00dca..91e87fb51fe4 100644
--- a/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c
+++ b/drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c
@@ -818,6 +818,8 @@ void hubp401_cursor_set_position(
struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
int dst_x_offset = param->dst_x_offset;
uint32_t cur_en = pos->enable ? 1 : 0;
+ /* CURSOR_HOT_SPOT_X is 8 bits wide; clamp only the register write */
+ uint32_t x_hotspot_clamped = pos->x_hotspot > 0xFF ? 0xFF : pos->x_hotspot;
hubp->curs_pos = *pos;
/*
@@ -842,7 +844,7 @@ void hubp401_cursor_set_position(
CURSOR_Y_POSITION, pos->y);
REG_SET_2(CURSOR_HOT_SPOT, 0,
- CURSOR_HOT_SPOT_X, pos->x_hotspot,
+ CURSOR_HOT_SPOT_X, x_hotspot_clamped,
CURSOR_HOT_SPOT_Y, pos->y_hotspot);
REG_SET(CURSOR_DST_OFFSET, 0,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
index 37b699c69144..98398dac9861 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
@@ -1264,10 +1264,6 @@ void dcn401_build_cursor_position(struct pipe_ctx *pipe_ctx,
param.cur_rect_x = rec_x_offset + param.recout.x;
param.cur_rect_y = rec_y_offset + param.recout.y;
- /* Clamp hotspot to the CURSOR_HOT_SPOT_X register field width */
- if (pos_cpy.x_hotspot > 0xFF)
- pos_cpy.x_hotspot = 0xFF;
-
*pos_out = pos_cpy;
*param_out = param;
}