From patchwork Wed Mar 30 13:48:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 8696431 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 5906C9F39A for ; Wed, 30 Mar 2016 13:51:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85CDF2037F for ; Wed, 30 Mar 2016 13:51:11 +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 9709E2037E for ; Wed, 30 Mar 2016 13:51:10 +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 1alGUu-0008F3-NZ; Wed, 30 Mar 2016 13:49:24 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1alGUq-0008BC-0C; Wed, 30 Mar 2016 13:49:21 +0000 Received: by mail-wm0-x243.google.com with SMTP id 139so15127145wmn.2; Wed, 30 Mar 2016 06:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=WbMkxmtjMJvQBubO2pwuE2sGVmUCB431hVsvCRVOLmw=; b=D6jjo+sJRNu9yjNaboSObwuXnUnRO0rM94jP9pGV5RJR9KpR/N6gZJXKwHMo5nkYX0 EkAh4beFZ+pzMSk7PIg+H+H6ZP+feH68ztmlkpgDkw3BWPFuYzrO+j9gSNqK7/Jd1YCr thhahubWnMTJlsFcFSCw9h7BlU1DK/4r4j5QfGXLkX+bnTfKohUJgl5YHdNaUw9zkRyE fa4+mgwe00BSAe6wui3xC/Jyv9yGgDUyLMHMTjzgKLn9QgcLKf6pA9lCKYt92wXDVM8L O4gVAaa2GCsww6iQ8y+Jv69gYbbjOF5DEi5onCGrk/1/zcDF4z3zIYXWQk1ArTyI+LIp Gcvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=WbMkxmtjMJvQBubO2pwuE2sGVmUCB431hVsvCRVOLmw=; b=fsadscy3zwgY5RpLsug3dI3OyIv5/KfBpTEq8hsVWTWHqI+6evN2Cf9/sauXWt37gl 34ti52Tcw2jCRv+alBXL0TTMalZ0vd6C9A10Bvt6KKFjpWXlazKT2BcjMTZFoqzv1Fyn X65jY7Bt41F6Ggkb9rmN2Cq5jkL+sFC1pOFdsXdC+Sst2t1A0xIdDTsiUKDClxGFWVWT cuMTUa/ccd7zASidqaqGjwEd8QOoksEt64zCPkLmwSAQDSu8bvUkVCZinDxVdqaGcr0A LTPP9l9XyhM4sQCZVDXzrVIVjlWBOlq6frWmyG5ioM5rx9UFXdJQi9b1VWcVvTOGpcz/ bH/Q== X-Gm-Message-State: AD7BkJK80Mm3GAoQP/tvJGdizOlWWyAH5t7EBbqC7j0Na9d0BY4kgzM6BQZJFv07t7sZlg== X-Received: by 10.28.65.137 with SMTP id o131mr10746320wma.54.1459345736338; Wed, 30 Mar 2016 06:48:56 -0700 (PDT) Received: from cizrna.lan ([109.72.12.79]) by smtp.gmail.com with ESMTPSA id a1sm4045590wje.43.2016.03.30.06.48.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 06:48:55 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH] drm/rockchip: Return -EBUSY if there's already a pending flip event Date: Wed, 30 Mar 2016 15:48:25 +0200 Message-Id: <1459345705-4473-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160330_064920_201762_CCBFC270 X-CRM114-Status: GOOD ( 11.41 ) X-Spam-Score: -2.4 (--) 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: Heiko Stuebner , Tomeu Vizoso , David Airlie , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Mark Yao 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=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 As per the docs, atomic_commit should return -EBUSY "if an asycnhronous updated is requested and there is an earlier updated pending". Also wait for the pending event to complete when a sync update is requested. Signed-off-by: Tomeu Vizoso --- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 14 +++++++++++++- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index 3529f692edb8..37952eefd33d 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -69,6 +69,7 @@ int rockchip_register_crtc_funcs(struct drm_crtc *crtc, void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc); int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, int out_mode); +bool rockchip_drm_crtc_has_pending_event(struct drm_crtc *crtc); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev, struct device *dev); void rockchip_drm_dma_detach_device(struct drm_device *drm_dev, diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 3b8f652698f8..028fd2f8f47b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -280,7 +280,19 @@ int rockchip_drm_atomic_commit(struct drm_device *dev, { struct rockchip_drm_private *private = dev->dev_private; struct rockchip_atomic_commit *commit = &private->commit; - int ret; + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + int i, ret; + + for_each_crtc_in_state(state, crtc, crtc_state, i) { + if (crtc->state->event || + rockchip_drm_crtc_has_pending_event(crtc)) { + if (async) + return -EBUSY; + else + rockchip_crtc_wait_for_update(crtc); + } + } ret = drm_atomic_helper_prepare_planes(dev, state); if (ret) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index e2118e62345b..5240bc8fe088 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -848,6 +848,12 @@ int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, } EXPORT_SYMBOL_GPL(rockchip_drm_crtc_mode_config); +bool rockchip_drm_crtc_has_pending_event(struct drm_crtc *crtc) +{ + return to_vop(crtc)->event; +} +EXPORT_SYMBOL_GPL(rockchip_drm_crtc_has_pending_event); + static int vop_crtc_enable_vblank(struct drm_crtc *crtc) { struct vop *vop = to_vop(crtc);