mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
drm/amd/display: add basic atomic check for cursor plane
commit 626bf90fe03fa080d8df06bb0397c95c53ae8e27 upstream. This patch adds a basic cursor check when an atomic test-only commit is performed. The position and size of the cursor plane is checked. This should fix user-space relying on atomic checks to assign buffers to planes. Signed-off-by: Simon Ser <[email protected]> Reported-by: Roman Gilg <[email protected]> References: https://github.com/emersion/libliftoff/issues/46 Cc: Alex Deucher <[email protected]> Cc: Harry Wentland <[email protected]> Reviewed-by: Nicholas Kazlauskas <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
97e4331476
commit
57aa19acfc
1 changed files with 24 additions and 2 deletions
|
|
@ -6921,6 +6921,7 @@ static int dm_update_plane_state(struct dc *dc,
|
|||
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
|
||||
struct dm_crtc_state *dm_new_crtc_state, *dm_old_crtc_state;
|
||||
struct dm_plane_state *dm_new_plane_state, *dm_old_plane_state;
|
||||
struct amdgpu_crtc *new_acrtc;
|
||||
bool needs_reset;
|
||||
int ret = 0;
|
||||
|
||||
|
|
@ -6930,9 +6931,30 @@ static int dm_update_plane_state(struct dc *dc,
|
|||
dm_new_plane_state = to_dm_plane_state(new_plane_state);
|
||||
dm_old_plane_state = to_dm_plane_state(old_plane_state);
|
||||
|
||||
/*TODO Implement atomic check for cursor plane */
|
||||
if (plane->type == DRM_PLANE_TYPE_CURSOR)
|
||||
/*TODO Implement better atomic check for cursor plane */
|
||||
if (plane->type == DRM_PLANE_TYPE_CURSOR) {
|
||||
if (!enable || !new_plane_crtc ||
|
||||
drm_atomic_plane_disabling(plane->state, new_plane_state))
|
||||
return 0;
|
||||
|
||||
new_acrtc = to_amdgpu_crtc(new_plane_crtc);
|
||||
|
||||
if ((new_plane_state->crtc_w > new_acrtc->max_cursor_width) ||
|
||||
(new_plane_state->crtc_h > new_acrtc->max_cursor_height)) {
|
||||
DRM_DEBUG_ATOMIC("Bad cursor size %d x %d\n",
|
||||
new_plane_state->crtc_w, new_plane_state->crtc_h);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width ||
|
||||
new_plane_state->crtc_y <= -new_acrtc->max_cursor_height) {
|
||||
DRM_DEBUG_ATOMIC("Bad cursor position %d, %d\n",
|
||||
new_plane_state->crtc_x, new_plane_state->crtc_y);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
needs_reset = should_reset_plane(state, plane, old_plane_state,
|
||||
new_plane_state);
|
||||
|
|
|
|||
Loading…
Reference in a new issue