drm/amd/display: Refactor dm_get_plane_scale helper
[ Upstream commit ec4d770bbb155674c2497f255f4199bdc42287a9 ]
Cleanup, no functional change intended.
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Stable-dep-of: bc0b79ce2050 ("drm/amd/display: Bail from dm_check_crtc_cursor if no relevant change")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8960662027
commit
a99afba394
1 changed files with 14 additions and 9 deletions
|
|
@ -9626,6 +9626,17 @@ static void dm_get_oriented_plane_size(struct drm_plane_state *plane_state,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dm_get_plane_scale(struct drm_plane_state *plane_state,
|
||||||
|
int *out_plane_scale_w, int *out_plane_scale_h)
|
||||||
|
{
|
||||||
|
int plane_src_w, plane_src_h;
|
||||||
|
|
||||||
|
dm_get_oriented_plane_size(plane_state, &plane_src_w, &plane_src_h);
|
||||||
|
*out_plane_scale_w = plane_state->crtc_w * 1000 / plane_src_w;
|
||||||
|
*out_plane_scale_h = plane_state->crtc_h * 1000 / plane_src_h;
|
||||||
|
}
|
||||||
|
|
||||||
static int dm_check_crtc_cursor(struct drm_atomic_state *state,
|
static int dm_check_crtc_cursor(struct drm_atomic_state *state,
|
||||||
struct drm_crtc *crtc,
|
struct drm_crtc *crtc,
|
||||||
struct drm_crtc_state *new_crtc_state)
|
struct drm_crtc_state *new_crtc_state)
|
||||||
|
|
@ -9634,8 +9645,6 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
|
||||||
struct drm_plane_state *new_cursor_state, *new_underlying_state;
|
struct drm_plane_state *new_cursor_state, *new_underlying_state;
|
||||||
int i;
|
int i;
|
||||||
int cursor_scale_w, cursor_scale_h, underlying_scale_w, underlying_scale_h;
|
int cursor_scale_w, cursor_scale_h, underlying_scale_w, underlying_scale_h;
|
||||||
int cursor_src_w, cursor_src_h;
|
|
||||||
int underlying_src_w, underlying_src_h;
|
|
||||||
|
|
||||||
/* On DCE and DCN there is no dedicated hardware cursor plane. We get a
|
/* On DCE and DCN there is no dedicated hardware cursor plane. We get a
|
||||||
* cursor per pipe but it's going to inherit the scaling and
|
* cursor per pipe but it's going to inherit the scaling and
|
||||||
|
|
@ -9650,9 +9659,7 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
|
||||||
if (!new_cursor_state->fb)
|
if (!new_cursor_state->fb)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dm_get_oriented_plane_size(new_cursor_state, &cursor_src_w, &cursor_src_h);
|
dm_get_plane_scale(new_cursor_state, &cursor_scale_w, &cursor_scale_h);
|
||||||
cursor_scale_w = new_cursor_state->crtc_w * 1000 / cursor_src_w;
|
|
||||||
cursor_scale_h = new_cursor_state->crtc_h * 1000 / cursor_src_h;
|
|
||||||
|
|
||||||
/* Need to check all enabled planes, even if this commit doesn't change
|
/* Need to check all enabled planes, even if this commit doesn't change
|
||||||
* their state
|
* their state
|
||||||
|
|
@ -9670,10 +9677,8 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
|
||||||
if (!new_underlying_state->fb)
|
if (!new_underlying_state->fb)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dm_get_oriented_plane_size(new_underlying_state,
|
dm_get_plane_scale(new_underlying_state,
|
||||||
&underlying_src_w, &underlying_src_h);
|
&underlying_scale_w, &underlying_scale_h);
|
||||||
underlying_scale_w = new_underlying_state->crtc_w * 1000 / underlying_src_w;
|
|
||||||
underlying_scale_h = new_underlying_state->crtc_h * 1000 / underlying_src_h;
|
|
||||||
|
|
||||||
if (cursor_scale_w != underlying_scale_w ||
|
if (cursor_scale_w != underlying_scale_w ||
|
||||||
cursor_scale_h != underlying_scale_h) {
|
cursor_scale_h != underlying_scale_h) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue