[PATCH v2,5/5] amd/display: re-introduce cursor plane rotation prop

Michel Dänzer michel at daenzer.net
Thu Aug 17 09:24:22 UTC 2023


Why is this patch marked as rejected in patchwork? Something like this seems required for a Wayland compositor to use the HW cursor with rotated primary/overlay planes.


On 3/10/21 15:50, Simon Ser wrote:
> The commit 1347385fe187 ("drm/amd/display: don't expose rotation
> prop for cursor plane") removed the rotation property for the
> cursor plane, assuming the cursor would always be displayed without
> any rotation. However the rotation is inherited from the underlying
> plane.
> 
> As a result, if the primary plane is rotated, then the cursor plane
> will incorrectly be rotated as well even though it doesn't have a
> rotation property.
> 
> To fix this, re-introduce the cursor rotation property, and check
> that its value matches the underlying plane's.
> 
> Signed-off-by: Simon Ser <contact at emersion.fr>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Harry Wentland <hwentlan at amd.com>
> Cc: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index b4f6e2985b8a..36ee52104007 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -6897,8 +6897,7 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  		DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
>  		DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
>  
> -	if (dm->adev->asic_type >= CHIP_BONAIRE &&
> -	    plane->type != DRM_PLANE_TYPE_CURSOR)
> +	if (dm->adev->asic_type >= CHIP_BONAIRE)
>  		drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0,
>  						   supported_rotations);
>  
> @@ -9494,6 +9493,11 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
>  		return -EINVAL;
>  	}
>  
> +	if (new_underlying_state->rotation != new_cursor_state->rotation) {
> +		drm_dbg_atomic(crtc->dev, "Cursor plane rotation doesn't match underlying plane\n");
> +		return -EINVAL;
> +	}
> +
>  	/* In theory we could probably support YUV cursors when the underlying
>  	 * plane uses a YUV format, but there's no use-case for it yet. */
>  	if (new_underlying_state->fb->format->is_yuv) {


-- 
Earthling Michel Dänzer            |                  https://redhat.com
Libre software enthusiast          |         Mesa and Xwayland developer



More information about the amd-gfx mailing list