From patchwork Thu Apr 17 06:57:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Shabanov X-Patchwork-Id: 14054998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66D2FC369B2 for ; Thu, 17 Apr 2025 06:58:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B350E10E091; Thu, 17 Apr 2025 06:58:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=etehtsea.me header.i=@etehtsea.me header.b="kRJLB/2r"; dkim-atps=neutral X-Greylist: delayed 9404 seconds by postgrey-1.36 at gabe; Thu, 17 Apr 2025 06:58:26 UTC Received: from outbound.pv.icloud.com (p-west1-cluster2-host5-snip4-9.eps.apple.com [57.103.64.220]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7617B10E091 for ; Thu, 17 Apr 2025 06:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etehtsea.me; s=sig1; bh=2Ww4hpp+z6fgi+nJK6FyaJfCKTs87q137A6aiYcfvEc=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=kRJLB/2rV6qKWhiRvYq1W/QRIhp8ThfVUSEGHb4sbhgLpFogsuV79f38wqoxC3nl+ N1ajnwRaBAa8fh546L8DmgWtTsTGrQvav5+FqGlUnCujhi1jYOgDmun5QphkvnjztC NiIBQ0rdP5Q5l9FRQran2dkkW8Z7YOHPwtWh2j3J2N+WNA712vSB5bfaUwGCBgdG9z OOS8xi97GDWJRP3bfQLWv/GjIb1BIZMwSR1mutQiLaS6B6TRl5dyxjJQUT9wt19qWl Y5O2TLQLMf1dzqaxU8OpY39+3oEiYf15dpplEtI+VOvB5q0/iKCz+Q/YyMjHeDVdam Op7XbW3b9j9aA== Received: from localhost (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id 9762B18001FD; Thu, 17 Apr 2025 06:58:08 +0000 (UTC) From: Konstantin Shabanov To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Konstantin Shabanov , Daniel Stone , Andy Yan , Dan Callaghan , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] drm/rockchip: Disable AFBC for res >2560 on rk3399 Date: Thu, 17 Apr 2025 06:57:58 +0000 Message-ID: <20250417065759.5948-1-mail@etehtsea.me> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250414095332.9674-1-mail@etehtsea.me> References: <20250414095332.9674-1-mail@etehtsea.me> MIME-Version: 1.0 X-Proofpoint-GUID: rwAzO9rQriuU_yzyVXMfa2RlWH8B6Ckm X-Proofpoint-ORIG-GUID: rwAzO9rQriuU_yzyVXMfa2RlWH8B6Ckm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-17_01,2025-04-15_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1030 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2504170053 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As it isn't supported by hardware. At least, RK3399 doesn't support it. From the datasheet[1] ("1.2.10 Video IN/OUT", "Display Interface", p. 17): Support AFBC function co-operation with GPU * support 2560x1600 UI Manually tested on RockPro64 (rk3399): - ARM_AFBC modifier is used for 1920x1080 - DRM_FORMAT_MOD_LINEAR modifier us used for 3840x2160 - No noise on the screen when sway is running in 4k - Dynamic resolution switching works correctly in sway Signed-off-by: Konstantin Shabanov Cc: Daniel Stone Cc: Andy Yan Reported-by: Dan Callaghan Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7968 [1]: https://opensource.rock-chips.com/images/d/d7/Rockchip_RK3399_Datasheet_V2.1-20200323.pdf --- V3 -> V4: Correct redundant header inclusion V2 -> V3: Run check only on rk3399 V1 -> V2: Move the check to the fb_create callback drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) base-commit: 4890d68db651562ea80250f2c93205a5c0327a6a -- 2.48.1 diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index dcc1f07632c3..45e1619b5c97 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -5,6 +5,7 @@ */ #include +#include #include #include @@ -18,6 +19,8 @@ #include "rockchip_drm_fb.h" #include "rockchip_drm_gem.h" +#define RK3399_AFBC_MAX_WIDTH 2560 + static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, @@ -52,6 +55,15 @@ rockchip_fb_create(struct drm_device *dev, struct drm_file *file, } if (drm_is_afbc(mode_cmd->modifier[0])) { + if (of_machine_is_compatible("rockchip,rk3399")) { + if (mode_cmd->width > RK3399_AFBC_MAX_WIDTH) { + DRM_DEBUG_KMS("AFBC is not supported for the width %d (max %d)\n", + mode_cmd->width, + RK3399_AFBC_MAX_WIDTH); + return ERR_PTR(-EINVAL); + }; + } + int ret, i; ret = drm_gem_fb_afbc_init(dev, mode_cmd, afbc_fb);