From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933126AbcASKtO (ORCPT ); Tue, 19 Jan 2016 05:49:14 -0500 Received: from [90.155.101.14] ([90.155.101.14]:60997 "EHLO metanate.com" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932677AbcASKsI (ORCPT ); Tue, 19 Jan 2016 05:48:08 -0500 From: John Keeping To: Mark yao Cc: John Keeping , Daniel Vetter , Linux Kernel Mailing List , dri-devel , "open list:ARM/Rockchip SoC..." , "linux-arm-kernel@lists.infradead.org" , Thierry Reding 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: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.7.0.226.gfe986fe