Commit ac01f6ad authored by George Shen's avatar George Shen Committed by Alex Deucher

drm/amd/display: Fix divide by zero in CURSOR_DST_X_OFFSET calculation

[Why]
Certain situations cause pipes to have a recout of 0, such as when the
dst_rect lies completely outside of a given ODM slice.

[How]
Skip calculation that transforms cursor coordinates to viewport space.
Reviewed-by: default avatarAlvin Lee <alvin.lee2@amd.com>
Signed-off-by: default avatarJerry Zuo <jerry.zuo@amd.com>
Signed-off-by: default avatarGeorge Shen <george.shen@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent eb6dfbb7
......@@ -677,12 +677,23 @@ void hubp401_cursor_set_position(
int rec_x_offset = x_pos - pos->x_hotspot;
int rec_y_offset = y_pos - pos->y_hotspot;
int dst_x_offset;
int x_pos_viewport = x_pos * param->viewport.width / param->recout.width;
int x_hot_viewport = pos->x_hotspot * param->viewport.width / param->recout.width;
int x_pos_viewport = 0;
int x_hot_viewport = 0;
uint32_t cur_en = pos->enable ? 1 : 0;
hubp->curs_pos = *pos;
/* Recout is zero for pipes if the entire dst_rect is contained
* within preceeding ODM slices.
*/
if (param->recout.width) {
x_pos_viewport = x_pos * param->viewport.width / param->recout.width;
x_hot_viewport = pos->x_hotspot * param->viewport.width / param->recout.width;
} else {
ASSERT(!cur_en || x_pos == 0);
ASSERT(!cur_en || pos->x_hotspot == 0);
}
/*
* Guard aganst cursor_set_position() from being called with invalid
* attributes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment