提交 08ed681c 编写于 作者: D Dmytro Laktyushkin 提交者: Alex Deucher

drm/amd/display: add dcn cursor hotsport rotation and mirror support

Signed-off-by: NDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: NTony Cheng <Tony.Cheng@amd.com>
Acked-by: NHarry Wentland <harry.wentland@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 613cb725
...@@ -408,6 +408,7 @@ struct dc_cursor_mi_param { ...@@ -408,6 +408,7 @@ struct dc_cursor_mi_param {
struct fixed31_32 h_scale_ratio; struct fixed31_32 h_scale_ratio;
struct fixed31_32 v_scale_ratio; struct fixed31_32 v_scale_ratio;
enum dc_rotation_angle rotation; enum dc_rotation_angle rotation;
bool mirror;
}; };
/* IPP related types */ /* IPP related types */
......
...@@ -2807,7 +2807,8 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx) ...@@ -2807,7 +2807,8 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)
.viewport = pipe_ctx->plane_res.scl_data.viewport, .viewport = pipe_ctx->plane_res.scl_data.viewport,
.h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz, .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,
.v_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.vert, .v_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.vert,
.rotation = pipe_ctx->plane_state->rotation .rotation = pipe_ctx->plane_state->rotation,
.mirror = pipe_ctx->plane_state->horizontal_mirror
}; };
if (pipe_ctx->plane_state->address.type if (pipe_ctx->plane_state->address.type
......
...@@ -1084,8 +1084,10 @@ void hubp1_cursor_set_position( ...@@ -1084,8 +1084,10 @@ void hubp1_cursor_set_position(
{ {
struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp); struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp);
int src_x_offset = pos->x - pos->x_hotspot - param->viewport.x; int src_x_offset = pos->x - pos->x_hotspot - param->viewport.x;
int x_hotspot = pos->x_hotspot;
int y_hotspot = pos->y_hotspot;
uint32_t dst_x_offset;
uint32_t cur_en = pos->enable ? 1 : 0; uint32_t cur_en = pos->enable ? 1 : 0;
uint32_t dst_x_offset = (src_x_offset >= 0) ? src_x_offset : 0;
/* /*
* Guard aganst cursor_set_position() from being called with invalid * Guard aganst cursor_set_position() from being called with invalid
...@@ -1097,6 +1099,18 @@ void hubp1_cursor_set_position( ...@@ -1097,6 +1099,18 @@ void hubp1_cursor_set_position(
if (hubp->curs_attr.address.quad_part == 0) if (hubp->curs_attr.address.quad_part == 0)
return; return;
if (param->rotation == ROTATION_ANGLE_90 || param->rotation == ROTATION_ANGLE_270) {
src_x_offset = pos->y - pos->y_hotspot - param->viewport.x;
y_hotspot = pos->x_hotspot;
x_hotspot = pos->y_hotspot;
}
if (param->mirror) {
x_hotspot = param->viewport.width - x_hotspot;
src_x_offset = param->viewport.x + param->viewport.width - src_x_offset;
}
dst_x_offset = (src_x_offset >= 0) ? src_x_offset : 0;
dst_x_offset *= param->ref_clk_khz; dst_x_offset *= param->ref_clk_khz;
dst_x_offset /= param->pixel_clk_khz; dst_x_offset /= param->pixel_clk_khz;
...@@ -1124,8 +1138,8 @@ void hubp1_cursor_set_position( ...@@ -1124,8 +1138,8 @@ void hubp1_cursor_set_position(
CURSOR_Y_POSITION, pos->y); CURSOR_Y_POSITION, pos->y);
REG_SET_2(CURSOR_HOT_SPOT, 0, REG_SET_2(CURSOR_HOT_SPOT, 0,
CURSOR_HOT_SPOT_X, pos->x_hotspot, CURSOR_HOT_SPOT_X, x_hotspot,
CURSOR_HOT_SPOT_Y, pos->y_hotspot); CURSOR_HOT_SPOT_Y, y_hotspot);
REG_SET(CURSOR_DST_OFFSET, 0, REG_SET(CURSOR_DST_OFFSET, 0,
CURSOR_DST_X_OFFSET, dst_x_offset); CURSOR_DST_X_OFFSET, dst_x_offset);
......
...@@ -2523,7 +2523,8 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx) ...@@ -2523,7 +2523,8 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
.viewport = pipe_ctx->plane_res.scl_data.viewport, .viewport = pipe_ctx->plane_res.scl_data.viewport,
.h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz, .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,
.v_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.vert, .v_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.vert,
.rotation = pipe_ctx->plane_state->rotation .rotation = pipe_ctx->plane_state->rotation,
.mirror = pipe_ctx->plane_state->horizontal_mirror
}; };
if (pipe_ctx->plane_state->address.type if (pipe_ctx->plane_state->address.type
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册