From patchwork Tue Jan 19 10:47:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 8060441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D46349F818 for ; Tue, 19 Jan 2016 10:50:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68D8E202E6 for ; Tue, 19 Jan 2016 10:50:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75DA8200F2 for ; Tue, 19 Jan 2016 10:50:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aLTqA-0000EN-KT; Tue, 19 Jan 2016 10:48:46 +0000 Received: from dougal.metanate.com ([90.155.101.14] helo=metanate.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aLTpa-0008Ry-Ii; Tue, 19 Jan 2016 10:48:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=metanate.com; s=stronger; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=Kl8ntMUJVDtGhWBt+TlgqRsPnb6Jc3pe6elPaDypsgg=; b=uI40DzSwjwoGECXup3IxWYMGJASOckYViNrw7aC8/3EwU7ig2RJ8gmQk8hf90Sibov0h19AJun3VHx0Cos0iuWCq8Z3mzCi/m+ieuobvElph9Idn2H/D9flw3sj/99dwlMSE1G1etM28lfGZU4dMUFjmGRPyi+rBWH37vuSZFbDOjECiZIcvUXcUlISR4iaZB9i0Vu0MQbzQgJU6qRIpHo3En4P5d3VYVunh5tz5ybGzmSYFpaReS4LVsy0ZVR1zAjW/CdRkSm1TJZkegVOt0idnrfr2xhe6v3vx3MWwaLywUVwZWItf93kr632PYc2xS9VSsY5tUXwbdFdGy5xTsw==; Received: from brian ([192.168.88.1] helo=leela.metanate.com) by shrek.metanate.com with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.83_RC2) (envelope-from ) id 1aLToj-0006Qz-Ip; Tue, 19 Jan 2016 10:47:17 +0000 From: John Keeping To: Mark yao Subject: [PATCH v2 3/3] drm/rockchip: explain why we can't wait_for_vblanks Date: Tue, 19 Jan 2016 10:47:00 +0000 Message-Id: <921a9f91937bebfeef7d7f563339fe6e4bf63f67.1453200263.git.john@metanate.com> X-Mailer: git-send-email 2.7.0.226.gfe986fe In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160119_024811_054436_BF43241A X-CRM114-Status: UNSURE ( 9.29 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux Kernel Mailing List , dri-devel , "open list:ARM/Rockchip SoC..." , Thierry Reding , John Keeping , Daniel Vetter , "linux-arm-kernel@lists.infradead.org" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: John Keeping --- v2: - Add more detail of the particular race that could happen if we used drm_atomic_helper_wait_for_vblanks(). drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 679d23a..cf0b7bd 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -177,6 +177,21 @@ static void rockchip_crtc_wait_for_update(struct drm_crtc *crtc) crtc_funcs->wait_for_update(crtc); } +/* + * We can't use drm_atomic_helper_wait_for_vblanks() because rk3288 and rk3066 + * have hardware counters for neither vblanks nor scanlines, which results in + * a race where: + * | <-- HW vsync irq and reg take effect + * plane_commit --> | + * get_vblank and wait --> | + * | <-- handle_vblank, vblank->count + 1 + * cleanup_fb --> | + * iommu crash --> | + * | <-- HW vsync irq and reg take effect + * + * This function is equivalent but uses rockchip_crtc_wait_for_update() instead + * of waiting for vblank_count to change. + */ static void rockchip_atomic_wait_for_complete(struct drm_device *dev, struct drm_atomic_state *old_state) {