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: 8696401 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 852F1C0553 for ; Wed, 30 Mar 2016 13:49:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE0DC20382 for ; Wed, 30 Mar 2016 13:49:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CA6ED2037F for ; Wed, 30 Mar 2016 13:49:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E486589AB3; Wed, 30 Mar 2016 13:49:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4F92689AB3 for ; Wed, 30 Mar 2016 13:48:58 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id i204so13361108wmd.0 for ; Wed, 30 Mar 2016 06:48:58 -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=eeU/taiLFlHPbwAXxp86fiC6mSw/uWuRzpM4oV1vFABJZB8yQs3GParC9qbgk1C4HY b30auLqUy+EInIJB9RErC0pLfKy3nz6WmYj4xkkOVgV573cLQv+rqYrrbTm790Fyxw1H RQnVDi/1UwA2VCczpXVWHsCeNLyFxH4RSZ4p39dOkSsJsIr8esxptUkKyotQ/2UYbILq WK88XkVAiba26nPpnfeMz/aYRyz9RKA31MHEf+nBzdkRzWCwF7wrw1a1CuZE5g4Na/g4 bcsm+vIlNyZKq+3EBII4SYhIcloG5t3/JTtSmE64/FL8/VwcVHAXlhEvdqvYbLtLmhcf q67Q== X-Gm-Message-State: AD7BkJLb6SqrZ/rKKVT/GYw81DlppzikYYfeFRz3nH94H071FQU9NlfT1ZhT9Ugir/DbIQ== 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 Cc: Tomeu Vizoso , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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);