From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964815AbcECRs1 (ORCPT ); Tue, 3 May 2016 13:48:27 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34217 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933401AbcECRs1 (ORCPT ); Tue, 3 May 2016 13:48:27 -0400 From: robert.foss@collabora.com To: daniel.vetter@ffwll.ch, airlied@linux.ie, eric@anholt.net, aniel.vetter@ffwll.ch, fengguang.wu@intel.com, maarten.lankhorst@linux.intel.com, julia.lawall@lip6.fr, alexander.deucher@amd.com, daniels@collabora.com, derekf@osg.samsung.com, varadgautam@gmail.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Robert Foss Subject: [PATCH v2] drm/vc4: Return -EBUSY if there's already a pending flip event. Date: Tue, 3 May 2016 13:48:20 -0400 Message-Id: <1462297700-17491-1-git-send-email-robert.foss@collabora.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Foss As per the documentation in drm_crtc.h, atomic_commit should return -EBUSY if an asycnhronous update is requested and there is an earlier update pending. Note: docs cited here are drm_crtc.h, and the whole quote is: * - -EBUSY, if an asynchronous updated is requested and there is * an earlier updated pending. Drivers are allowed to support a queue * of outstanding updates, but currently no driver supports that. * Note that drivers must wait for preceding updates to complete if a * synchronous update is requested, they are not allowed to fail the * commit in that case. Signed-off-by: Robert Foss --- Changes since v1: - Corrected and simplified patch to piggyback on a previously existing check. drivers/gpu/drm/vc4/vc4_kms.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 4718ae5..7c7188d 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -117,10 +117,18 @@ static int vc4_atomic_commit(struct drm_device *dev, return -ENOMEM; /* Make sure that any outstanding modesets have finished. */ - ret = down_interruptible(&vc4->async_modeset); - if (ret) { - kfree(c); - return ret; + if (async) { + ret = down_trylock(&vc4->async_modeset); + if (ret) { + kfree(c); + return -EBUSY; + } + } else { + ret = down_interruptible(&vc4->async_modeset); + if (ret) { + kfree(c); + return ret; + } } ret = drm_atomic_helper_prepare_planes(dev, state); -- 2.5.0