From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9312B4B5AE for ; Mon, 12 Aug 2024 14:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723474304; cv=none; b=tOP/qttjtNO+2LQD1zAMsZarr+DMhfXdgAC42lsULl3L4tRkqZCKHvLB93GKvbusRwHoW1ItIU1PhtsZMy09dBjob5deCkx7fW4O/rGKuNMi5s0luOaGr4eLdekyijSEIxHfdlrHUv3JwsBTLgAeDfsl3SVY0v2TTTIkrAUg2t4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723474304; c=relaxed/simple; bh=Y3pYIOUv/p/m3i5QQQpUQAYeYt3ymK30WBwdfLlvDfc=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=TAVKDapD5UCugfwWzoOb6Q69GR5/WH7zzqAl593natOyXLVCSviGl2izWXYyDRAbNAnUwRRn3B2jqWnRD4MByepunLUc6cFrY91mQj9itJPNyWnVbug8wwYpZf3LtZ5UVLEEtBZELvrLeOQHZYJIPvSwM7be5+RahRlHC1yo7BI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=is7wTe0d; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="is7wTe0d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F38C0C32782; Mon, 12 Aug 2024 14:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723474304; bh=Y3pYIOUv/p/m3i5QQQpUQAYeYt3ymK30WBwdfLlvDfc=; h=Subject:To:Cc:From:Date:From; b=is7wTe0dyUn85V6ZEWAc9S34O3JCyg9EzvZGZYHMxdz0+RmQCGcZvgqj3qXmdAt9D h4sqBIkq1NE0cILe2147/tjqV2oDAzlZeQQhz2Tew+1kTG+hr2GQGn7jNeRLxjBJAL 6uS59tDfM+9HB3S1M6PlarP1+OGJBTugW3d2NN/g= Subject: FAILED: patch "[PATCH] drm/amd/display: Use sw cursor for DCN401 with rotation" failed to apply to 5.15-stable tree To: aurabindo.pillai@amd.com,alex.hung@amd.com,alexander.deucher@amd.com,daniel.wheeler@amd.com,mario.limonciello@amd.com,rodrigo.siqueira@amd.com,sunpeng.li@amd.com Cc: From: Date: Mon, 12 Aug 2024 16:49:40 +0200 Message-ID: <2024081239-trident-straining-a689@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 2ffa97c50a8b0598975e47c890032e71958425a0 # git commit -s git send-email --to '' --in-reply-to '2024081239-trident-straining-a689@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: 2ffa97c50a8b ("drm/amd/display: Use sw cursor for DCN401 with rotation") 1b04dcca4fb1 ("drm/amd/display: Introduce overlay cursor mode") 730ac573868b ("drm/amd/display: Convert some legacy DRM debug macros into appropriate categories") e582c097d3d1 ("drm/amd/display: Always use legacy way of setting cursor on DCE") 66eba12a5482 ("drm/amd/display: Do cursor programming with rest of pipe") f63f86b5affc ("drm/amd/display: Separate setting and programming of cursor") 27f03bc680ef ("drm/amd/display: Guard cursor idle reallow by DC debug option") 0701117efd1e ("Revert "drm/amd/display: For FPO and SubVP/DRR configs program vmin/max sel"") 1b5b72b4d67c ("drm/amd/display: Fix MST Null Ptr for RV") a9b1a4f684b3 ("drm/amd/display: Add more checks for exiting idle in DC") dcbf438d4834 ("drm/amd/display: Unify optimize_required flags and VRR adjustments") 8457bddc266c ("drm/amd/display: Revert "Rework DC Z10 restore"") e6f82bd44b40 ("drm/amd/display: Rework DC Z10 restore") a465536ebff8 ("drm/amd/display: revert "Optimize VRR updates to only necessary ones"") 012a04b1d6af ("drm/amd/display: Refactor phantom resource allocation") 09a4ec5da92c ("drm/amd/display: Refactor dc_state interface") 8e57c06bf4b0 ("drm/amd/display: Refactor DMCUB enter/exit idle interface") 6e4337f695c2 ("drm/amd/display: Unify optimize_required flags and VRR adjustments") 0f657938e434 ("drm/amd/display: do not send commands to DMUB if DMUB is inactive from S3") 0f5afa190b89 ("drm/amd/display: add CRTC gamma TF driver-specific property") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2ffa97c50a8b0598975e47c890032e71958425a0 Mon Sep 17 00:00:00 2001 From: Aurabindo Pillai Date: Mon, 10 Jun 2024 18:22:59 +0000 Subject: [PATCH] drm/amd/display: Use sw cursor for DCN401 with rotation [WHAT & HOW] On DCN401, the cursor composition to the plane happens after scaler. So the cursor isn't stretched with the rest of the surface. Temporarily disable hardware cursor in case when hardware rotation is enabled such that userspace falls back to software cursor. Reviewed-by: Sun peng Li Reviewed-by: Rodrigo Siqueira Cc: Mario Limonciello Cc: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Alex Hung Signed-off-by: Aurabindo Pillai Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher 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 cefc2569a50f..6e757ee2d74b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -11093,8 +11093,12 @@ static int dm_crtc_get_cursor_mode(struct amdgpu_device *adev, int cursor_scale_w, cursor_scale_h; int i; - /* Overlay cursor not supported on HW before DCN */ - if (amdgpu_ip_version(adev, DCE_HWIP, 0) == 0) { + /* Overlay cursor not supported on HW before DCN + * DCN401 does not have the cursor-on-scaled-plane or cursor-on-yuv-plane restrictions + * as previous DCN generations, so enable native mode on DCN401 in addition to DCE + */ + if (amdgpu_ip_version(adev, DCE_HWIP, 0) == 0 || + amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 0, 1)) { *cursor_mode = DM_CURSOR_NATIVE_MODE; return 0; } @@ -11237,7 +11241,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state, *new_crtc_state; struct drm_plane *plane; - struct drm_plane_state *old_plane_state, *new_plane_state; + struct drm_plane_state *old_plane_state, *new_plane_state, *new_cursor_state; enum dc_status status; int ret, i; bool lock_and_validation_needed = false; @@ -11465,19 +11469,39 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, drm_dbg_atomic(dev, "MPO enablement requested on crtc:[%p]\n", crtc); } - /* Check cursor planes restrictions */ + /* Check cursor restrictions */ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { enum amdgpu_dm_cursor_mode required_cursor_mode; + int is_rotated, is_scaled; /* Overlay cusor not subject to native cursor restrictions */ dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); if (dm_new_crtc_state->cursor_mode == DM_CURSOR_OVERLAY_MODE) continue; + /* Check if rotation or scaling is enabled on DCN401 */ + if ((drm_plane_mask(crtc->cursor) & new_crtc_state->plane_mask) && + amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 0, 1)) { + new_cursor_state = drm_atomic_get_new_plane_state(state, crtc->cursor); + + is_rotated = new_cursor_state && + ((new_cursor_state->rotation & DRM_MODE_ROTATE_MASK) != DRM_MODE_ROTATE_0); + is_scaled = new_cursor_state && ((new_cursor_state->src_w >> 16 != new_cursor_state->crtc_w) || + (new_cursor_state->src_h >> 16 != new_cursor_state->crtc_h)); + + if (is_rotated || is_scaled) { + drm_dbg_driver( + crtc->dev, + "[CRTC:%d:%s] cannot enable hardware cursor due to rotation/scaling\n", + crtc->base.id, crtc->name); + ret = -EINVAL; + goto fail; + } + } + /* If HW can only do native cursor, check restrictions again */ ret = dm_crtc_get_cursor_mode(adev, state, dm_new_crtc_state, &required_cursor_mode); - if (ret) { drm_dbg_driver(crtc->dev, "[CRTC:%d:%s] Checking cursor mode failed\n",