]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amd/display: Fix negative cursor pos programming (v2)
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Fri, 1 Feb 2019 14:36:59 +0000 (09:36 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 8 Apr 2019 15:33:40 +0000 (10:33 -0500)
commitbd13b2b874eceb4677cd26eebdc5f45cc52fa400
treefbbf38c459ea49895c268bfa0553fef379a8f0b2
parentc1cefe115d1cdc460014483319d440b2f0d07c68
drm/amd/display: Fix negative cursor pos programming (v2)

[Why]
If the cursor pos passed from DM is less than the plane_state->dst_rect
top left corner then the unsigned cursor pos wraps around to a large
positive number since cursor pos is a u32.

There was an attempt to guard against this in hubp1_cursor_set_position
by checking the src_x_offset and src_y_offset and offseting the
cursor hotspot within hubp1_cursor_set_position.

However, the cursor position itself is still being programmed
incorrectly as a large value.

This manifests itself visually as the cursor disappearing or containing
strange artifacts near the middle of the screen on raven.

[How]
Don't subtract the destination rect top left corner from the pos but
add it to the hotspot instead. This happens before the pos gets
passed into hubp1_cursor_set_position.

This achieves the same result but avoids the subtraction wrap around.
With this fix the original cursor programming logic can be used again.

v2: add hunk that got dropped accidently when this patch was originally
committed. (Alex)
Fixes: 0921c41e1902831 ("drm/amd/display: Fix negative cursor pos programming")
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Acked-by: Murton Liu <Murton.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c