diff options
| author | Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> | 2019-02-01 09:36:59 -0500 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2019-04-08 11:33:40 -0400 |
| commit | bd13b2b874eceb4677cd26eebdc5f45cc52fa400 (patch) | |
| tree | fbbf38c459ea49895c268bfa0553fef379a8f0b2 /drivers/gpu/drm/amd | |
| parent | c1cefe115d1cdc460014483319d440b2f0d07c68 (diff) | |
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>
Diffstat (limited to 'drivers/gpu/drm/amd')
| -rw-r--r-- | drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c index 683829466a44..0ba68d41b9c3 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | |||
| @@ -1150,28 +1150,9 @@ void hubp1_cursor_set_position( | |||
| 1150 | REG_UPDATE(CURSOR_CONTROL, | 1150 | REG_UPDATE(CURSOR_CONTROL, |
| 1151 | CURSOR_ENABLE, cur_en); | 1151 | CURSOR_ENABLE, cur_en); |
| 1152 | 1152 | ||
| 1153 | //account for cases where we see negative offset relative to overlay plane | 1153 | REG_SET_2(CURSOR_POSITION, 0, |
| 1154 | if (src_x_offset < 0 && src_y_offset < 0) { | ||
| 1155 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1156 | CURSOR_X_POSITION, 0, | ||
| 1157 | CURSOR_Y_POSITION, 0); | ||
| 1158 | x_hotspot -= src_x_offset; | ||
| 1159 | y_hotspot -= src_y_offset; | ||
| 1160 | } else if (src_x_offset < 0) { | ||
| 1161 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1162 | CURSOR_X_POSITION, 0, | ||
| 1163 | CURSOR_Y_POSITION, pos->y); | ||
| 1164 | x_hotspot -= src_x_offset; | ||
| 1165 | } else if (src_y_offset < 0) { | ||
| 1166 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1167 | CURSOR_X_POSITION, pos->x, | 1154 | CURSOR_X_POSITION, pos->x, |
| 1168 | CURSOR_Y_POSITION, 0); | 1155 | CURSOR_Y_POSITION, pos->y); |
| 1169 | y_hotspot -= src_y_offset; | ||
| 1170 | } else { | ||
| 1171 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1172 | CURSOR_X_POSITION, pos->x, | ||
| 1173 | CURSOR_Y_POSITION, pos->y); | ||
| 1174 | } | ||
| 1175 | 1156 | ||
| 1176 | REG_SET_2(CURSOR_HOT_SPOT, 0, | 1157 | REG_SET_2(CURSOR_HOT_SPOT, 0, |
| 1177 | CURSOR_HOT_SPOT_X, x_hotspot, | 1158 | CURSOR_HOT_SPOT_X, x_hotspot, |
