From patchwork Fri Dec 4 15:11:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 338493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6637AC433FE for ; Fri, 4 Dec 2020 15:13:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F8D222B49 for ; Fri, 4 Dec 2020 15:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730364AbgLDPNg (ORCPT ); Fri, 4 Dec 2020 10:13:36 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:47303 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730276AbgLDPNg (ORCPT ); Fri, 4 Dec 2020 10:13:36 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id E8D3558016D; Fri, 4 Dec 2020 10:11:49 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 04 Dec 2020 10:11:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=PX7X2Z6taOpqK t6iQGcnzgqz2zwAc/S2uGxRr/4zIcM=; b=qYt31ghTHx33E6P/uA8mUw5WmmuQO a9sLZCZGCnFbYk0JHeukUdw6uSxGOc+7NMrmX9YaccM5uX23vJVHYw9DhGfei1bq 8LraUUpq9UJAQR50h3/vOJB6ZkrRx/oVugDQUUhe/u3OwQHTYsvyd9o+JIXti/rq RJG2dB7sFnte4yJzP8PXzathj93+Md7UPWXMb2XSWiN4m6Xamkot+w/6Ta4GBcRx Y6KFhYtUpaw8ZQ004xsCoODTJc0tyXwLtZEKC+/aqUxjprZBk0EotFaYZd1jnG0c zmcRILsUF1rbWhT95UVm93S2XlINfNGwUXMiEpaAJRUhhNwnUEd/OKaKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=PX7X2Z6taOpqKt6iQGcnzgqz2zwAc/S2uGxRr/4zIcM=; b=RHrtIz5c KuUfPdOzPQxx5GBg4WPByg6o9X9d/IcZN/Kn2MYl5pRkYn0g8DTx0xsUF1VWfzPJ 48hCrAC/Sr/X2+peAW3VqcJTFQWMs6JIva8U/Kx/2t7bMWyF6fk3vpwi3GJqFXzG 0VWX1t+r9zUbnvcJVb29QvkMV0j+q5D/M7PxjNysv9aiPoey0tNMugIbeiWEoH/O PzI7GS2qDySevNUmuoOATdZWsI4r8MXsmQtKq921oUXcea3z03iCeJeK0N0Fo6FS Pl/USbDgDbNUGl6ZWZl5C0GOsH5MlzlrFEaoywCObT5Y4+UOjLub66lbSDAZLEBm 3XSHmTDMtlErEw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeikedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepvdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 9197E24005A; Fri, 4 Dec 2020 10:11:49 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Mark Rutland , Rob Herring , Frank Rowand , Eric Anholt Cc: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Tim Gover , Dave Stevenson , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Phil Elwell Subject: [PATCH v2 6/7] drm/vc4: kms: Remove async modeset semaphore Date: Fri, 4 Dec 2020 16:11:37 +0100 Message-Id: <20201204151138.1739736-7-maxime@cerno.tech> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204151138.1739736-1-maxime@cerno.tech> References: <20201204151138.1739736-1-maxime@cerno.tech> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Now that we have proper ordering guaranteed by the previous patch, the semaphore is redundant and can be removed. Acked-by: Thomas Zimmermann Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_crtc.c | 13 ------------- drivers/gpu/drm/vc4/vc4_drv.h | 2 -- drivers/gpu/drm/vc4/vc4_kms.c | 24 ++---------------------- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 482219fb4db2..c469594a2d3a 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -690,7 +690,6 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) container_of(cb, struct vc4_async_flip_state, cb); struct drm_crtc *crtc = flip_state->crtc; struct drm_device *dev = crtc->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); struct drm_plane *plane = crtc->primary; vc4_plane_async_set_fb(plane, flip_state->fb); @@ -722,8 +721,6 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) } kfree(flip_state); - - up(&vc4->async_modeset); } /* Implements async (non-vblank-synced) page flips. @@ -738,7 +735,6 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, uint32_t flags) { struct drm_device *dev = crtc->dev; - struct vc4_dev *vc4 = to_vc4_dev(dev); struct drm_plane *plane = crtc->primary; int ret = 0; struct vc4_async_flip_state *flip_state; @@ -767,15 +763,6 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, flip_state->crtc = crtc; flip_state->event = event; - /* Make sure all other async modesetes have landed. */ - ret = down_interruptible(&vc4->async_modeset); - if (ret) { - drm_framebuffer_put(fb); - vc4_bo_dec_usecnt(bo); - kfree(flip_state); - return ret; - } - /* Save the current FB before it's replaced by the new one in * drm_atomic_set_fb_for_plane(). We'll need the old FB in * vc4_async_page_flip_complete() to decrement the BO usecnt and keep diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index c5f2944d5bc6..4dcef3140dff 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -215,8 +215,6 @@ struct vc4_dev { struct work_struct reset_work; } hangcheck; - struct semaphore async_modeset; - struct drm_modeset_lock ctm_state_lock; struct drm_private_obj ctm_manager; struct drm_private_obj hvs_channels; diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index fa40c44eb770..ffbfdde55fff 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -418,8 +418,6 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state) clk_set_min_rate(hvs->core_clk, 0); drm_atomic_state_put(state); - - up(&vc4->async_modeset); } static void commit_work(struct work_struct *work) @@ -477,26 +475,17 @@ static int vc4_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, bool nonblock) { - struct vc4_dev *vc4 = to_vc4_dev(dev); int ret; if (state->async_update) { - ret = down_interruptible(&vc4->async_modeset); - if (ret) - return ret; - ret = drm_atomic_helper_prepare_planes(dev, state); - if (ret) { - up(&vc4->async_modeset); + if (ret) return ret; - } drm_atomic_helper_async_commit(dev, state); drm_atomic_helper_cleanup_planes(dev, state); - up(&vc4->async_modeset); - return 0; } @@ -512,21 +501,14 @@ static int vc4_atomic_commit(struct drm_device *dev, INIT_WORK(&state->commit_work, commit_work); - ret = down_interruptible(&vc4->async_modeset); - if (ret) - return ret; - ret = drm_atomic_helper_prepare_planes(dev, state); - if (ret) { - up(&vc4->async_modeset); + if (ret) return ret; - } if (!nonblock) { ret = drm_atomic_helper_wait_for_fences(dev, state, true); if (ret) { drm_atomic_helper_cleanup_planes(dev, state); - up(&vc4->async_modeset); return ret; } } @@ -1008,8 +990,6 @@ int vc4_kms_load(struct drm_device *dev) vc4->load_tracker_enabled = true; } - sema_init(&vc4->async_modeset, 1); - /* Set support for vblank irq fast disable, before drm_vblank_init() */ dev->vblank_disable_immediate = true;