From patchwork Thu Sep 21 20:03:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13394471 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 25F8BE7D0A2 for ; Thu, 21 Sep 2023 20:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=GNFa3WydcbRVTzTjJJZKEu9pxsf0O3So7ihOxZU+pO8=; b=IpnHbGMavXsI3+ jHR722h6NlL7aDPCXHyBVTIgid7T9gKA0t7ZsIxrbg7gPXrHZ8K9XXsJkzC0+eoWbE++9q05VejMc hWYbPjX0WS/xmKKr8IeIbFCnp3mMkWMuZhL9u6n3iOFHzyv1ozPag5QOn2SB0c9BxCX7Zr5bM+Y0N 9XmnRuOz+IlFFma2vxPxEq9TSWC9m4nO10tW+tbdyjiB9o9WRZRTIPt1RUHgSwF+40tN/XEgKdeD5 eQV4QGWBQwP6rNl8oOKGTXrq9wc6Xxx1mPO9nD+7+cBWN5htY8kGzYkydF2j6OacILZQD9rXXUABK qfQsSN8O6gfd+USHj4Gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtP-0072GL-2K; Thu, 21 Sep 2023 20:03:19 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtM-0072E7-2k for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 20:03:18 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjPtI-0000P1-Pe; Thu, 21 Sep 2023 22:03:12 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qjPtI-00804q-71; Thu, 21 Sep 2023 22:03:12 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v2 1/6] drm: lcdif: improve burst size configuration comment Date: Thu, 21 Sep 2023 22:03:07 +0200 Message-Id: <20230921200312.3989073-1-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_130316_890615_47CD3215 X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The comment regarding AXI bust size configuration is a bit hard to read. Improve the wording somewhat. Signed-off-by: Lucas Stach Reviewed-by: Marco Felsch Reviewed-by: Marek Vasut --- v2: Some more rewording. --- drivers/gpu/drm/mxsfb/lcdif_kms.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index 2541d2de4e45..07e343e01f3e 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -329,12 +329,12 @@ static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags) lcdif->base + LCDC_V8_CTRLDESCL0_1); /* - * Undocumented P_SIZE and T_SIZE register but those written in the - * downstream kernel those registers control the AXI burst size. As of - * now there are two known values: + * The P_SIZE and T_SIZE bitfields are only documented in the + * downstream driver. Those bitfields control the AXI burst size. + * As of now there are two known values: * 1 - 128Byte * 2 - 256Byte - * Downstream set it to 256B burst size to improve the memory + * Downstream sets this to 256B burst size to improve the memory access * efficiency so set it here too. */ ctrl = CTRLDESCL0_3_P_SIZE(2) | CTRLDESCL0_3_T_SIZE(2) | From patchwork Thu Sep 21 20:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13394474 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B0685E7D0A7 for ; Thu, 21 Sep 2023 20:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OD/YjvsN54uTSBL6fSjEesYOljYucI/DNQdHbcjDKOc=; b=Vc7mVPkpRcHL1d iVhQJR2lZfkjRzvRGs0qs3ZlRRh56uDx+UYwYVlGx9RZFAJK5VjaoqfVw7tLvL8s6WBBTBvDWlndo tK3GoaDBB8y/cQc2riA8A27/dsr2RiG8uwlKurluCE+IkuH4L4PpaSZ9L2Jrj5NPm8+csWsETugvj bFRiniIdbbli3MMEQXjr9a3EqxX2nWrhUSVtSbkxQyOa8Kn/cgd0ZuHfF1G4b/a+1V9qQdwMfHPKv eJUoFp012mxcgQt4AHYnXNttsihuQqDyeGYBPXRuqMHE+XhsktXELQ23qYWOefdS+3D8QB/nVXCp4 8ATIfCPIkJ65tuNuL36Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtd-0072Nc-18; Thu, 21 Sep 2023 20:03:33 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtM-0072E8-31 for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 20:03:19 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjPtI-0000P2-Pe; Thu, 21 Sep 2023 22:03:12 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qjPtI-00804q-9s; Thu, 21 Sep 2023 22:03:12 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v2 2/6] drm: lcdif: don't clear unrelated bits in CTRLDESCL0_5 when setting up format Date: Thu, 21 Sep 2023 22:03:08 +0200 Message-Id: <20230921200312.3989073-2-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921200312.3989073-1-l.stach@pengutronix.de> References: <20230921200312.3989073-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_130317_004281_50C1B749 X-CRM114-Status: GOOD ( 12.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The CTRLDESCL0_5 register also holds other bits that are not related to the format, which should not be overwritten when the format is set up. Use a proper RMW access in lcdif_set_formats(). Signed-off-by: Lucas Stach --- v2: new patch --- drivers/gpu/drm/mxsfb/lcdif_kms.c | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index 07e343e01f3e..e277592e5fa5 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -166,6 +166,7 @@ static void lcdif_set_formats(struct lcdif_drm_private *lcdif, const u32 format = plane_state->fb->format->format; bool in_yuv = false; bool out_yuv = false; + u32 ctrl_desc_5; switch (bus_format) { case MEDIA_BUS_FMT_RGB565_1X16: @@ -186,52 +187,49 @@ static void lcdif_set_formats(struct lcdif_drm_private *lcdif, break; } + ctrl_desc_5 = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5) & + ~(CTRLDESCL0_5_BPP_MASK | CTRLDESCL0_5_YUV_FORMAT_MASK); + switch (format) { /* RGB Formats */ case DRM_FORMAT_RGB565: - writel(CTRLDESCL0_5_BPP_16_RGB565, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_16_RGB565; break; case DRM_FORMAT_RGB888: - writel(CTRLDESCL0_5_BPP_24_RGB888, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_24_RGB888; break; case DRM_FORMAT_XRGB1555: - writel(CTRLDESCL0_5_BPP_16_ARGB1555, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_16_ARGB1555; break; case DRM_FORMAT_XRGB4444: - writel(CTRLDESCL0_5_BPP_16_ARGB4444, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_16_ARGB4444; break; case DRM_FORMAT_XBGR8888: - writel(CTRLDESCL0_5_BPP_32_ABGR8888, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_32_ABGR8888; break; case DRM_FORMAT_XRGB8888: - writel(CTRLDESCL0_5_BPP_32_ARGB8888, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_32_ARGB8888; break; /* YUV Formats */ case DRM_FORMAT_YUYV: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_VY2UY1, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_VY2UY1; in_yuv = true; break; case DRM_FORMAT_YVYU: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_UY2VY1, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_UY2VY1; in_yuv = true; break; case DRM_FORMAT_UYVY: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_Y2VY1U, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_Y2VY1U; in_yuv = true; break; case DRM_FORMAT_VYUY: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_Y2UY1V, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_Y2UY1V; in_yuv = true; break; @@ -240,6 +238,8 @@ static void lcdif_set_formats(struct lcdif_drm_private *lcdif, break; } + writel(ctrl_desc_5, lcdif->base + LCDC_V8_CTRLDESCL0_5); + /* * The CSC differentiates between "YCbCr" and "YUV", but the reference * manual doesn't detail how they differ. Experiments showed that the From patchwork Thu Sep 21 20:03:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13394472 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 31A6EE7D0A6 for ; Thu, 21 Sep 2023 20:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zZ6E1lggQ4UGzz1lQVBvyL9PmknLeTLzsTlT77Ha2KI=; b=lcCTEpX7sQJ3IB ouR2AGSyrpni7As2FLMdIInq/bDJPSVL1PVNZJlaQsLjHZLm9G7zH2UGWqPg8ia6zJmqndmO0tPua A+WPlfhDT70di6Nd1ZL0eNeqhl4h5yp/Ct7dwOA/SOJrVbuwzoz37T8hkSs9MNVggOLeLEddeldcU 3hpxm0FBOfMcuBwxBGOHeZNPsN1VOy3WPZEW4vF+IYz0jfjK2TIGNR6+fFKYfpiqNUm40iZTTVUYs 2URHY9ekvFXvqk9DC33wRJeWzRJkVI1VtxXbxoJnvDncHRmrSKMry0feaZCBlY2P7Ud3CsCJiicJj wVEogd0yY45Uy/4nQgVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtQ-0072H2-1j; Thu, 21 Sep 2023 20:03:20 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtM-0072ED-2k for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 20:03:18 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjPtI-0000PB-Ps; Thu, 21 Sep 2023 22:03:12 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qjPtI-00804q-Cn; Thu, 21 Sep 2023 22:03:12 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v2 3/6] drm: lcdif: rework runtime PM handling in the atomic commit Date: Thu, 21 Sep 2023 22:03:09 +0200 Message-Id: <20230921200312.3989073-3-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921200312.3989073-1-l.stach@pengutronix.de> References: <20230921200312.3989073-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_130316_890911_A3A0E657 X-CRM114-Status: GOOD ( 13.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org drm_atomic_helper_commit_tail_rpm makes it hard for drivers to follow the documented encoder/bridge enable flow, as it commits all CRTC enables before the planes are fully set up, so drivers that can't enable the display link without valid plane setup either need to do the plane setup in the CRTC enable or violate the flow by enabling the display link after the planes have been set up. Neither of those options seem like a good idea. For devices that only do coarse-grained runtime PM for the whole display controller and not per CRTC, like the i.MX LCDIF, we can handle hardware wakeup and suspend in the atomic_commit_tail. Add a commit tail which follows the more conventional atomic commit flow of first diabling any unused CRTCs, setting up all the active plane state, then enable all active display pipes and also handles the device runtime PM at the appropriate times. Signed-off-by: Lucas Stach --- v2: new patch --- drivers/gpu/drm/mxsfb/lcdif_drv.c | 22 +++++++++++++++++++++- drivers/gpu/drm/mxsfb/lcdif_kms.c | 12 ++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index 18de2f17e249..205f6855fb1b 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -36,8 +36,28 @@ static const struct drm_mode_config_funcs lcdif_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; +void lcdif_commit_tail(struct drm_atomic_state *old_state) +{ + struct drm_device *drm = old_state->dev; + + pm_runtime_get_sync(drm->dev); + + drm_atomic_helper_commit_modeset_disables(drm, old_state); + drm_atomic_helper_commit_planes(drm, old_state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); + drm_atomic_helper_commit_modeset_enables(drm, old_state); + + drm_atomic_helper_fake_vblank(old_state); + drm_atomic_helper_commit_hw_done(old_state); + drm_atomic_helper_wait_for_vblanks(drm, old_state); + + pm_runtime_put(drm->dev); + + drm_atomic_helper_cleanup_planes(drm, old_state); +} + static const struct drm_mode_config_helper_funcs lcdif_mode_config_helpers = { - .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, + .atomic_commit_tail = lcdif_commit_tail, }; static const struct drm_encoder_funcs lcdif_encoder_funcs = { diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index e277592e5fa5..ccee5e28f236 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -540,7 +540,11 @@ static void lcdif_crtc_atomic_enable(struct drm_crtc *crtc, clk_set_rate(lcdif->clk, m->crtc_clock * 1000); - pm_runtime_get_sync(drm->dev); + /* + * Update the RPM usage count, actual resume already happened in + * lcdif_commit_tail wrapping all the atomic update. + */ + pm_runtime_get_noresume(drm->dev); lcdif_crtc_mode_set_nofb(new_cstate, new_pstate); @@ -576,7 +580,11 @@ static void lcdif_crtc_atomic_disable(struct drm_crtc *crtc, } spin_unlock_irq(&drm->event_lock); - pm_runtime_put_sync(drm->dev); + /* + * Update the RPM usage count, actual suspend happens in + * lcdif_commit_tail wrapping all the atomic update. + */ + pm_runtime_put(drm->dev); } static void lcdif_crtc_atomic_destroy_state(struct drm_crtc *crtc, From patchwork Thu Sep 21 20:03:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13394473 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 129A9E7D0A2 for ; Thu, 21 Sep 2023 20:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BBePVGC3gPIuOr1PNIsVNkwffrZwaeB2uolc3+rEU/Q=; b=ZCZDwGAxw0rlF2 ZZDXu9R6R8moTg9TrqeXgi7Z+n7HpNi4Fbk9adEPwyCZQ3cJKoDZavEWJ/LAXPD87ClcNH2ksGeEL wJl03HTk3GSP4ENr/yWAJYDHua8R6NsUafe3Twrsx0OjJAzuL7J2haAiUnJh+tuDJ6PyTYtz10Yjm J4rYGSIJwHsFPK8gKqvf0FqB0t7u+fGWOuysUrI5wiR5fMioUzWbQebhJHhMB10gXsw5bs3WAWt/O 0rjPwGE6qw2aEvCTQNzT05T5X26AE6SD9JgZWGhSwodZ/77PHwti+mFxWG+p65ekxm0ccZcbxAajM 8eWtSES9V9x0VHBcqrgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtc-0072MG-0C; Thu, 21 Sep 2023 20:03:32 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtM-0072E6-2s for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 20:03:19 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjPtI-0000PH-R6; Thu, 21 Sep 2023 22:03:12 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qjPtI-00804q-EE; Thu, 21 Sep 2023 22:03:12 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v2 4/6] drm: lcdif: remove superfluous setup of framebuffer DMA address Date: Thu, 21 Sep 2023 22:03:10 +0200 Message-Id: <20230921200312.3989073-4-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921200312.3989073-1-l.stach@pengutronix.de> References: <20230921200312.3989073-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_130316_938165_89341E79 X-CRM114-Status: GOOD ( 10.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that the plane state is fully programmed into the hardware before the scanout is started there is no need to program the plane framebuffer DMA address from the CRTC atomic_enable anymore. Signed-off-by: Lucas Stach Reviewed-by: Marek Vasut --- v2: no changes --- drivers/gpu/drm/mxsfb/lcdif_kms.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index ccee5e28f236..4e9284b0d12e 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -536,7 +536,6 @@ static void lcdif_crtc_atomic_enable(struct drm_crtc *crtc, crtc->primary); struct drm_display_mode *m = &lcdif->crtc.state->adjusted_mode; struct drm_device *drm = lcdif->drm; - dma_addr_t paddr; clk_set_rate(lcdif->clk, m->crtc_clock * 1000); @@ -548,14 +547,6 @@ static void lcdif_crtc_atomic_enable(struct drm_crtc *crtc, lcdif_crtc_mode_set_nofb(new_cstate, new_pstate); - /* Write cur_buf as well to avoid an initial corrupt frame */ - paddr = drm_fb_dma_get_gem_addr(new_pstate->fb, new_pstate, 0); - if (paddr) { - writel(lower_32_bits(paddr), - lcdif->base + LCDC_V8_CTRLDESCL_LOW0_4); - writel(CTRLDESCL_HIGH0_4_ADDR_HIGH(upper_32_bits(paddr)), - lcdif->base + LCDC_V8_CTRLDESCL_HIGH0_4); - } lcdif_enable_controller(lcdif); drm_crtc_vblank_on(crtc); From patchwork Thu Sep 21 20:03:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13394475 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 02129E7D0A8 for ; Thu, 21 Sep 2023 20:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SRhdBhkmz3VS/jlXl3GkSDQRxwB8EiJuLN9XEuU6b8Y=; b=xozeFfLUukPYg1 sEk9Ne1GwSY2nkNpb4ZXJWp6BmfsMsq0kmAr0VDVxjJ3a0oQVi4zEgP68GnocVdopyagcPbyY4/hd Vy6+synmJY85gVZ1Z8Xru71h3td54pO6GeA/vZUFuORX3DRtuyzAgvKhogArfDhTg5rX24BBduuuu 3Fnkhxp/VSvHDQfSgH8BJbbGwrJo10Vt9j+RRxeb3pAszrTLXI8l9qRfLX/mkZFqABGoWbGLGnzPi wsjriMQU8RvelXRarbnV8YHG9t7MUqUL/Jub7IgvqBwMAbqJdfqwzfoKrHFR0YeqlZiHva34bfQcR a15+IRw7DpwGjcP3CCPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtc-0072Mz-2K; Thu, 21 Sep 2023 20:03:32 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtM-0072EE-30 for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 20:03:19 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjPtI-0000PI-U5; Thu, 21 Sep 2023 22:03:12 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qjPtI-00804q-FX; Thu, 21 Sep 2023 22:03:12 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v2 5/6] drm: lcdif: move pitch setup to plane atomic update Date: Thu, 21 Sep 2023 22:03:11 +0200 Message-Id: <20230921200312.3989073-5-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921200312.3989073-1-l.stach@pengutronix.de> References: <20230921200312.3989073-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_130316_991539_6F91831A X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The buffer pitch may change when switching the buffer on a atomic update. As the register is double buffered it can be safely changed while the display is active. Signed-off-by: Lucas Stach Reviewed-by: Marek Vasut --- v2: no changes --- drivers/gpu/drm/mxsfb/lcdif_kms.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index 4e9284b0d12e..daf54ff2b7bd 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -327,19 +327,6 @@ static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags) writel(CTRLDESCL0_1_HEIGHT(m->vdisplay) | CTRLDESCL0_1_WIDTH(m->hdisplay), lcdif->base + LCDC_V8_CTRLDESCL0_1); - - /* - * The P_SIZE and T_SIZE bitfields are only documented in the - * downstream driver. Those bitfields control the AXI burst size. - * As of now there are two known values: - * 1 - 128Byte - * 2 - 256Byte - * Downstream sets this to 256B burst size to improve the memory access - * efficiency so set it here too. - */ - ctrl = CTRLDESCL0_3_P_SIZE(2) | CTRLDESCL0_3_T_SIZE(2) | - CTRLDESCL0_3_PITCH(lcdif->crtc.primary->state->fb->pitches[0]); - writel(ctrl, lcdif->base + LCDC_V8_CTRLDESCL0_3); } static void lcdif_enable_controller(struct lcdif_drm_private *lcdif) @@ -694,6 +681,19 @@ static void lcdif_plane_primary_atomic_update(struct drm_plane *plane, writel(CTRLDESCL_HIGH0_4_ADDR_HIGH(upper_32_bits(paddr)), lcdif->base + LCDC_V8_CTRLDESCL_HIGH0_4); } + + /* + * The P_SIZE and T_SIZE bitfields are only documented in the + * downstream driver. Those bitfields control the AXI burst size. + * As of now there are two known values: + * 1 - 128Byte + * 2 - 256Byte + * Downstream sets this to 256B burst size to improve the memory access + * efficiency so set it here too. + */ + writel(CTRLDESCL0_3_P_SIZE(2) | CTRLDESCL0_3_T_SIZE(2) | + CTRLDESCL0_3_PITCH(new_pstate->fb->pitches[0]), + lcdif->base + LCDC_V8_CTRLDESCL0_3); } static bool lcdif_format_mod_supported(struct drm_plane *plane, From patchwork Thu Sep 21 20:03:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13394476 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C993CE7D0A6 for ; Thu, 21 Sep 2023 20:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J8If4ftvCft2UsH6MFc5mqrR4gMuXJLUrreuzZ7ly+c=; b=T5xvTBfFOp98S8 0D0t5utfkAmtVOqwbf5NFEI74xqIM6015IsLsuJwedA1Dj3ovbJm14+f1c7VEYn0W+stLosrgM5wN FE59agXMorAZyoRJBZvoJUZathiRjH2VVX6nrfYtB2BhZoVCUdK49EavXOOB1YIyZfv1c/mkrvHc6 sK/IkYNxYmA1PSzJYtzsnzueQsWP9KK6gUjg+nbrcFvZW63jc71YGaUUAXRDOPsSew0qKG2SVbc9G c2q0pPUlT+S9MVvOug7Z+Apc/4JL71drCM8UAbUIG+8dSxIrxq5Lv0TOEO8XEFx9BfPcsILNYnIyN 6BfNgsYj+E8jRf6oisbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtb-0072Li-1e; Thu, 21 Sep 2023 20:03:31 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtM-0072EF-2s for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 20:03:19 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjPtJ-0000Pc-1E; Thu, 21 Sep 2023 22:03:13 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qjPtI-00804q-II; Thu, 21 Sep 2023 22:03:12 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v2 6/6] drm: lcdif: force modeset when FB format changes Date: Thu, 21 Sep 2023 22:03:12 +0200 Message-Id: <20230921200312.3989073-6-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921200312.3989073-1-l.stach@pengutronix.de> References: <20230921200312.3989073-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_130316_928784_59A94752 X-CRM114-Status: GOOD ( 17.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Force a modeset if the new FB has a different format than the currently active one. While it might be possible to change between compatible formats without a full modeset as the format control is also supposed to be double buffered, the colorspace conversion is not, so when the CSC changes we need a modeset. For now just always force a modeset when the FB format changes to properly reconfigure all parts of the device for the new format. Signed-off-by: Lucas Stach Reviewed-by: Marek Vasut --- v2: fix indentation --- drivers/gpu/drm/mxsfb/lcdif_drv.c | 18 +++++++++++++++++- drivers/gpu/drm/mxsfb/lcdif_kms.c | 26 ++++++++++++++++++++------ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index 205f6855fb1b..69a2a9323257 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -30,9 +30,25 @@ #include "lcdif_drv.h" #include "lcdif_regs.h" +static int lcdif_atomic_check(struct drm_device *dev, + struct drm_atomic_state *state) +{ + int ret; + + ret = drm_atomic_helper_check(dev, state); + if (ret) + return ret; + + /* + * Check modeset again in case crtc_state->mode_changed is + * updated in plane's ->atomic_check callback. + */ + return drm_atomic_helper_check_modeset(dev, state); +} + static const struct drm_mode_config_funcs lcdif_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .atomic_check = drm_atomic_helper_check, + .atomic_check = lcdif_atomic_check, .atomic_commit = drm_atomic_helper_commit, }; diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index daf54ff2b7bd..34386e4b31c4 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -652,18 +652,32 @@ static const struct drm_crtc_funcs lcdif_crtc_funcs = { static int lcdif_plane_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state) { - struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, - plane); + struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, + plane); + struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state, + plane); struct lcdif_drm_private *lcdif = to_lcdif_drm_private(plane->dev); struct drm_crtc_state *crtc_state; + int ret; + + /* always okay to disable the plane */ + if (!new_state->fb) + return 0; crtc_state = drm_atomic_get_new_crtc_state(state, &lcdif->crtc); - return drm_atomic_helper_check_plane_state(plane_state, crtc_state, - DRM_PLANE_NO_SCALING, - DRM_PLANE_NO_SCALING, - false, true); + ret = drm_atomic_helper_check_plane_state(new_state, crtc_state, + DRM_PLANE_NO_SCALING, + DRM_PLANE_NO_SCALING, + false, true); + if (ret) + return ret; + + if (old_state->fb && new_state->fb->format != old_state->fb->format) + crtc_state->mode_changed = true; + + return 0; } static void lcdif_plane_primary_atomic_update(struct drm_plane *plane,