From patchwork Mon Aug 27 11:10:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 10576985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BF5C920 for ; Mon, 27 Aug 2018 11:14:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AD0E2972A for ; Mon, 27 Aug 2018 11:14:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DE992983F; Mon, 27 Aug 2018 11:14:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DA9872972A for ; Mon, 27 Aug 2018 11:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XIfCIoZJkwJ8u7mY6ujrgKwC9F9hMgYVccPpe3BRF40=; b=QQLMzzQ98tRF8Y 4DszK/xqG9qy7pO8g01kNT7uspBQpHAWdR2K+rapkoD8GSTViX6ra7qZMgrP4mQ6rnF8S2VSfiYOm Vhy9ii/TO6EshVRaWXMSD/AR1Aw1eX4ulJNFBDYu7NEsx4D10l6HOuqJPOGhx10j32SO/u3nXCif9 xaLzDj7TwRMF8ZJWLDGR8gpUbLGN78p5q2ie5UusXaRYv8x/UhCeaWP0WWBOpj8J9gtohVMCRPSCw PCGRogeioAX2zcpG3nTRsuzXDo2XkIdrQYRoCa+LF27Em0X41Q6OS2lGRWXGgwkQQj/wjL0m5RAzQ uoqEgSVe2shE5gUggm7Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuFTd-0000VU-6h; Mon, 27 Aug 2018 11:14:33 +0000 Received: from mail-he1eur01on0088.outbound.protection.outlook.com ([104.47.0.88] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fuFQf-0007gC-Oq for linux-arm-kernel@lists.infradead.org; Mon, 27 Aug 2018 11:11:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6OuoQ6ME5x9zl8DUCFOnuDh9S4MBGNhyUDs21Ggg0Og=; b=TB2+AJMAxN9/8MQ8PYLTIBkBCCtXz3nK0+W9U6C3C5Npq7Kz2MMtIjro+7qNHXpvAqrYYWGtKq6fBQmTTUX4TeAI+FIlL86gSa+hcE+uzj0rssUOxgmpiNJZ0rW4y45dFiivHS2GIm0QbyqJ0xQ7Xq1XiyNZgCxhxHvCRXQAqDY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leonard.crestez@nxp.com; Received: from localhost.localdomain (95.76.156.53) by DB7PR04MB4297.eurprd04.prod.outlook.com (2603:10a6:5:28::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Mon, 27 Aug 2018 11:11:14 +0000 From: Leonard Crestez To: Marek Vasut , Philipp Zabel Subject: [RESEND 5/5] drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm Date: Mon, 27 Aug 2018 14:10:41 +0300 Message-Id: <1dcf9e3b25ddff3906491a2ce43ac5c1a3f2167a.1535367027.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [95.76.156.53] X-ClientProxiedBy: HE1PR0802CA0012.eurprd08.prod.outlook.com (2603:10a6:3:bd::22) To DB7PR04MB4297.eurprd04.prod.outlook.com (2603:10a6:5:28::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a6baa19-2c1c-43f5-be9f-08d60c0dce90 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR04MB4297; X-Microsoft-Exchange-Diagnostics: 1; DB7PR04MB4297; 3:ot013vanC5Jj+5//rSBJcK1HJPZF92NeiL5viWN0KXmMgn7aErblao+tE/IDydzI0iZqoIKaMI8jMwkxIhjEWgljkePCYhocE/9+7lEeyInRnb1X7axExNC5jDJGnpIZMHEEsqxW2DmUzxRv4Lgi91ocChXLeHgNThTbjKz9gL0YAbZ8j1QrWSLv46sHDIF5IT+aHQe0mlz7rFSmy9BgNJflOPr6gRR+9QCLyOxzjOmP4PUVuBBbQivIihfFh1OT; 25:NBurl/sDJOHS+VlUzMWLwteVLASp14ldHbflwLE7pJQUXTdc0IgVF4znpVFvTVS5OunmmzdWo+xtBDatX2Nb4+zonn52nkmqtWSvlmp/c2DCbml+Rx3dODAaNmzeq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U76TpPAyUlmtWdoZWrLFoNoIul2i90U+h+sMo4cJoE9+r9up6k1M/iA4CNLGRHM+6a0tDYuUzosAB2tt/VgLgulpkXKufba1xn97/GftaIVLZQxICE6F03ptjF/REvFg4F+6vc8GQpDxCPeoyi/fhZYRBbkR+YJFW68S2VU1iLK8b836thkzSEwDR1NxwnCudKB8TFUkZ3/gJBzU3/xbYJjGRc3ti8tmrV92ZSHAzFbTqtVMO1866NYc6pSJ+pqYjXcn39WRBWWIXBtvxlkILFD5Ke8MwT5kUwz2jblDu2BO0vRXurKe/7dR8aA1NS0+ui57fC4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016); SRVR:DB7PR04MB4297; BCL:0; PCL:0; RULEID:; SRVR:DB7PR04MB4297; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(376002)(136003)(366004)(346002)(39860400002)(199004)(189003)(4326008)(305945005)(478600001)(6666003)(2906002)(36756003)(446003)(476003)(2616005)(956004)(81166006)(8676002)(81156014)(14444005)(44832011)(7736002)(486006)(11346002)(3846002)(6116002)(47776003)(6486002)(66066001)(97736004)(86362001)(54906003)(5660300001)(53936002)(6512007)(16586007)(110136005)(316002)(50466002)(48376002)(50226002)(118296001)(105586002)(8936002)(106356001)(51416003)(186003)(26005)(52116002)(16526019)(6506007)(386003)(68736007)(25786009)(76176011)(69590400005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR04MB4297; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR04MB4297; 23:9lIlWoL8LLQibNHBvSGMwegJ2a23ddL1tlgyaOVeE?= +V1GxR6cRkLZ3nkVW7dxgcnyMbomwuxp9r9bggsMirEyEi20jeC0GmBXe37ty0Eg8l6FDVkfdHW+Rt8kpXWPzQQ5HS++/z01cppgM9dEQu1HtyVgqOshFCI18xlUcaWzrt3nsL9yiBuMhNW46k4es1hyT1nvNi1MXq8Ues3OV+iRLKZpKNnG759a0FrLQE/RSLWpRTrMs+eyVq7SFot/xwPa2eDUeNDardoAiwE3Xg7INWcyzVxmzU5ZuRZfQgk2s3D+M8mf1yz/+lSoJTo9JLq3RVpQ0VnQJto9CGhP7CYDixBs7DDtHU9Zh9A6mCLmPVGFZ2lsYhkwQxWozfazsnD0YGyMUJVy3C86b52PMuXG7CZUkQe91/81gqRsWHuCNrmckZi7yRMVJX0v3CN5ix8DyvJn910mB55Q89tGvda4OC3o78QpdferhOBL6tREmsKY3MjCgJSFiL213x/q3yJi9YIq1Nky/XIv0nZZDCfC2clhhkKK2ijZ6Lg4q4uB9r+stvhSeZgjCHivFaQmb9k4GKA3e2mIWjQp60B7mkg3YdN6EphP7rv53lWcnJoHdBK9DkEX2mlX+/XXuiJ9kmTIzeLPExl8jZRAT8aBl7bNCeGMPoCST2a7B2VQ7OnOagmsuLww4ft55nqToMjyz8EK2LfDamfziDO+QUBqaZvxQSos9IQUBdY9y6tDpbeWelulEqgPDbEibMoLeZ2DA9occL4zCaKfXSueFGvjFYvO3KG/O24Y4MEvdUuUs5me6clFI1wQN9ckwoFsunfHPgJOiZxErwMvR6EJBWIinwIhDgkVaPXEvaAWcLqo955d+NNZH0iIYZrWCt5Z46FQbVTPXM5oQEMtItGSfTNhDmFymti8CE3+kQyiacQFsziUY/BpfsuXCSV0DYpLFNUFuH4LlMgb9D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ltdExF4fykNbvNrexuqxpc6W7T9aoHlBcWu3q8m7TWgErofqBdI0raieikEAmNjyzLoNi9Rw0Ae33nogRFM1oF8uTVtAATQxEjn9Jio/brKB9L8vif9+LJLnM3Jdq9g9Lc8CmJpdJ8Ntj0VD3bdo579JrTfzLH/zicu1Fm+SRpKVR7XBPQ==; 5:pPFHGJy5qMqX/egf1yoVGsQRSt6L8BaxPFM8IGE/JpgToTkWBvxnteNEjpv7kAgIsDMbaRC89+9CS/lxizT/Z0maqE+0nQ8IByqJV0/3QQn07YoU3mszX75VZKNBXEKDCBvxtdpfufxyifJTGusmEpDRZYX4QZPcw4ys2vGO1Qs=; 7:WCG6Lq5VfxgXhTYIuWf2V1sSDZzOMcBDOh5kGUCtlHjjwhico1Yy1/VtXdeHqrnw2F1r1G+KBjE3wEKCHAPMnqrvlniTmhh0RfLbXNy/avvMlZgKW8ICrJkb6MGR130f5FiUMqTn/Yil54EW0CbeErZObJPy8mL35+cn/JtF6ojOOAY4y3cj8XhtXNOypuCBKpPitGgZob6BzfL581OpAywizD1yY9wh5fue5s5K76RE/k1E8L1NBvrt42P2I7uK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 11:11:14.1241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a6baa19-2c1c-43f5-be9f-08d60c0dce90 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180827_041129_852910_25824514 X-CRM114-Status: GOOD ( 13.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dong Aisheng , David Airlie , linux-kernel@vger.kernel.org, Stefan Agner , Robert Chiras , dri-devel@lists.freedesktop.org, kernel@pengutronix.de, Fabio Estevam , Marco Franchi , Shawn Guo , linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The lcdif block is only powered on when display is active so plane updates when not enabled are not valid. Writing to an unpowered IP block is mostly ignored but can trigger bus errors on some chips. Prevent this situation by switching to drm_atomic_helper_commit_tail_rpm and having the drm core ensure atomic_plane_update is only called while the crtc is active. This avoids having to keep track of "enabled" bits inside the mxsfb driver. This also requires handling the vblank event for disable from mxsfb_pipe_disable. Signed-off-by: Leonard Crestez Suggested-by: Stefan Agner Reviewed-by: Stefan Agner --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index d797dfd40d98..5777e730085b 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -96,10 +96,14 @@ static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = { .fb_create = drm_gem_fb_create, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; +static const struct drm_mode_config_helper_funcs mxsfb_mode_config_helpers = { + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, +}; + static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, struct drm_crtc_state *crtc_state, struct drm_plane_state *plane_state) { struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe); @@ -113,15 +117,25 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, static void mxsfb_pipe_disable(struct drm_simple_display_pipe *pipe) { struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe); struct drm_device *drm = pipe->plane.dev; + struct drm_crtc *crtc = &pipe->crtc; + struct drm_pending_vblank_event *event; drm_panel_disable(mxsfb->panel); mxsfb_crtc_disable(mxsfb); drm_panel_unprepare(mxsfb->panel); pm_runtime_put_sync(drm->dev); + + spin_lock_irq(&drm->event_lock); + event = crtc->state->event; + if (event) { + crtc->state->event = NULL; + drm_crtc_send_vblank_event(crtc, event); + } + spin_unlock_irq(&drm->event_lock); } static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *plane_state) { @@ -232,10 +246,11 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags) drm->mode_config.min_width = MXSFB_MIN_XRES; drm->mode_config.min_height = MXSFB_MIN_YRES; drm->mode_config.max_width = MXSFB_MAX_XRES; drm->mode_config.max_height = MXSFB_MAX_YRES; drm->mode_config.funcs = &mxsfb_mode_config_funcs; + drm->mode_config.helper_private = &mxsfb_mode_config_helpers; drm_mode_config_reset(drm); pm_runtime_get_sync(drm->dev); ret = drm_irq_install(drm, platform_get_irq(pdev, 0));