From patchwork Mon Oct 18 15:58:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1542783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=DtjVr4NF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY1lN1pvKz9sRR for ; Tue, 19 Oct 2021 02:59:12 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mcV2U-0002yi-Ae; Mon, 18 Oct 2021 15:59:02 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mcV2M-0002tS-0E for kernel-team@lists.ubuntu.com; Mon, 18 Oct 2021 15:58:54 +0000 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id C8EB13FFE2 for ; Mon, 18 Oct 2021 15:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1634572733; bh=gOhwVCVSp3B3aqolG4K2Vas5asuWb1s2BMueHNvScDM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DtjVr4NFuTevRppwK5CWz4/NYeZj8LdTyKuzb7wjmz3FqpUHiuQujxGDKvZMbR7SF m+wJr0YrQcfW4r5Ra1MrFoKr8Uq1ZkUQXSgEjSo+KC6MvtF7MXueId2ADRU0qJ/oLt TLP4jsXooisGNO95TvQN4FAreNhJThN6spohh5Cfx9iItEBcJ4E6T6bnHENN80V9dZ ViuGA3Js0SXZxNJivnORh8OTyGKqAAjdy5sRdoMs55hsT8FNVJ97bSkU6xXtkHCPZO ILkkxt4gnRlNjb4r11sfI12uOhi1VwkBOR/hFn2OIVDXSFAEMHteqgCyc6PHYoUOvd bUacw+9IJDeUQ== Received: by mail-ed1-f71.google.com with SMTP id z23-20020aa7cf97000000b003db7be405e1so14851141edx.13 for ; Mon, 18 Oct 2021 08:58:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gOhwVCVSp3B3aqolG4K2Vas5asuWb1s2BMueHNvScDM=; b=GYcxUeXW6JCoLxYdofo4GAJQDF2qB3tARI0f4S90L+UcGOD7RzckUfGN4ZT/VY3QdT D2GZJQRJvoRtj0fIBG3ppgyoRkXIXMbK0ujHQEv7nW3hx3b2bdgTVdFQdNQFdFTzT9RK i1e3HoU/exH8xTUvckuRgw8KlIksXM18KCfGr5fBvwqw5Zw3hp3AapzJcTBIbjREB6FY EcCpLDoQb/iFR7sLdGPmeRoQlsah2f8n8r/X9xk/AHXw5+u40idalXTcxKodQgZ9bkdm Xl+iszqm197GxYaCtpFNNniJGJ/qwzH5VHILyAIacRS4lqWXi1d+K3zwURT1h65txdmW Gu4A== X-Gm-Message-State: AOAM533YcbTWrLm5WmXX8yr28Eb0Egm22tfkKCf6UNn6y3J/g8VNRG5l E3DLO6XZbKkpZeo9C+12LKNnXtyCh9/F9KvIcr2LCxyb8kwR5vfBDEDmjCj4JCejJKC4W5wL2K9 NaP2DIf5R8fHBwZ9x1k6ZQsLtXqHSqH8aZgFalo7BoQ== X-Received: by 2002:a17:906:9399:: with SMTP id l25mr29738008ejx.363.1634572733122; Mon, 18 Oct 2021 08:58:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5Mg3SsbRkcp5Y8fDFT9eweirylu0YboFedRWEfKhchzHenOxBLnhSlRXUOSebgJ+gGNm/kg== X-Received: by 2002:a17:906:9399:: with SMTP id l25mr29737899ejx.363.1634572732177; Mon, 18 Oct 2021 08:58:52 -0700 (PDT) Received: from gollum.fritz.box ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id r22sm9078623ejd.109.2021.10.18.08.58.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 08:58:51 -0700 (PDT) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [SRU][I/raspi][PATCH 04/10] Revert "drm: Introduce a drm_crtc_commit_wait helper" Date: Mon, 18 Oct 2021 17:58:42 +0200 Message-Id: <20211018155848.334053-5-juergh@canonical.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211018155848.334053-1-juergh@canonical.com> References: <20211018155848.334053-1-juergh@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1946368 This reverts commit b99c2c95412c0b85accdafe9e32ba1e84d240f55. Signed-off-by: Juerg Haefliger --- drivers/gpu/drm/drm_atomic.c | 39 ------------------ drivers/gpu/drm/drm_atomic_helper.c | 61 ++++++++++++++++++++++++----- drivers/gpu/drm/vc4/vc4_kms.c | 17 ++++++-- include/drm/drm_atomic.h | 4 -- 4 files changed, 65 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index dd9ed000ad4c..eb7d17332f64 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -52,45 +52,6 @@ void __drm_crtc_commit_free(struct kref *kref) } EXPORT_SYMBOL(__drm_crtc_commit_free); -/** - * drm_crtc_commit_wait - Waits for a commit to complete - * @commit: &drm_crtc_commit to wait for - * - * Waits for a given &drm_crtc_commit to be programmed into the - * hardware and flipped to. - * - * Returns: - * - * 0 on success, a negative error code otherwise. - */ -int drm_crtc_commit_wait(struct drm_crtc_commit *commit) -{ - unsigned long timeout = 10 * HZ; - int ret; - - if (!commit) - return 0; - - ret = wait_for_completion_timeout(&commit->hw_done, timeout); - if (!ret) { - DRM_ERROR("hw_done timed out\n"); - return -ETIMEDOUT; - } - - /* - * Currently no support for overwriting flips, hence - * stall for previous one to execute completely. - */ - ret = wait_for_completion_timeout(&commit->flip_done, timeout); - if (!ret) { - DRM_ERROR("flip_done timed out\n"); - return -ETIMEDOUT; - } - - return 0; -} -EXPORT_SYMBOL(drm_crtc_commit_wait); - /** * drm_atomic_state_default_release - * release memory initialized by drm_atomic_state_init diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index be6ce004277a..c98607ddbde6 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2206,27 +2206,70 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state) struct drm_plane_state *old_plane_state; struct drm_connector *conn; struct drm_connector_state *old_conn_state; + struct drm_crtc_commit *commit; int i; long ret; for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { - ret = drm_crtc_commit_wait(old_crtc_state->commit); - if (ret) - DRM_ERROR("[CRTC:%d:%s] commit wait timed out\n", + commit = old_crtc_state->commit; + + if (!commit) + continue; + + ret = wait_for_completion_timeout(&commit->hw_done, + 10*HZ); + if (ret == 0) + DRM_ERROR("[CRTC:%d:%s] hw_done timed out\n", + crtc->base.id, crtc->name); + + /* Currently no support for overwriting flips, hence + * stall for previous one to execute completely. */ + ret = wait_for_completion_timeout(&commit->flip_done, + 10*HZ); + if (ret == 0) + DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n", crtc->base.id, crtc->name); } for_each_old_connector_in_state(old_state, conn, old_conn_state, i) { - ret = drm_crtc_commit_wait(old_conn_state->commit); - if (ret) - DRM_ERROR("[CONNECTOR:%d:%s] commit wait timed out\n", + commit = old_conn_state->commit; + + if (!commit) + continue; + + ret = wait_for_completion_timeout(&commit->hw_done, + 10*HZ); + if (ret == 0) + DRM_ERROR("[CONNECTOR:%d:%s] hw_done timed out\n", + conn->base.id, conn->name); + + /* Currently no support for overwriting flips, hence + * stall for previous one to execute completely. */ + ret = wait_for_completion_timeout(&commit->flip_done, + 10*HZ); + if (ret == 0) + DRM_ERROR("[CONNECTOR:%d:%s] flip_done timed out\n", conn->base.id, conn->name); } for_each_old_plane_in_state(old_state, plane, old_plane_state, i) { - ret = drm_crtc_commit_wait(old_plane_state->commit); - if (ret) - DRM_ERROR("[PLANE:%d:%s] commit wait timed out\n", + commit = old_plane_state->commit; + + if (!commit) + continue; + + ret = wait_for_completion_timeout(&commit->hw_done, + 10*HZ); + if (ret == 0) + DRM_ERROR("[PLANE:%d:%s] hw_done timed out\n", + plane->base.id, plane->name); + + /* Currently no support for overwriting flips, hence + * stall for previous one to execute completely. */ + ret = wait_for_completion_timeout(&commit->flip_done, + 10*HZ); + if (ret == 0) + DRM_ERROR("[PLANE:%d:%s] flip_done timed out\n", plane->base.id, plane->name); } } diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 919b2c2318b1..a3bdd1c34ef5 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -367,8 +367,9 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { struct vc4_crtc_state *vc4_crtc_state = to_vc4_crtc_state(old_crtc_state); + struct drm_crtc_commit *commit; unsigned int channel = vc4_crtc_state->assigned_channel; - int ret; + unsigned long done; if (channel == VC4_HVS_CHANNEL_DISABLED) continue; @@ -376,9 +377,17 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) if (!old_hvs_state->fifo_state[channel].in_use) continue; - ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[i].pending_commit); - if (ret) - drm_err(dev, "Timed out waiting for commit\n"); + commit = old_hvs_state->fifo_state[i].pending_commit; + if (!commit) + continue; + + done = wait_for_completion_timeout(&commit->hw_done, 10 * HZ); + if (!done) + drm_err(dev, "Timed out waiting for hw_done\n"); + + done = wait_for_completion_timeout(&commit->flip_done, 10 * HZ); + if (!done) + drm_err(dev, "Timed out waiting for flip_done\n"); } drm_atomic_helper_commit_modeset_disables(dev, state); diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index ac5a28eff2c8..ce7023e9115d 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -66,8 +66,6 @@ * * For an implementation of how to use this look at * drm_atomic_helper_setup_commit() from the atomic helper library. - * - * See also drm_crtc_commit_wait(). */ struct drm_crtc_commit { /** @@ -438,8 +436,6 @@ static inline void drm_crtc_commit_put(struct drm_crtc_commit *commit) kref_put(&commit->ref, __drm_crtc_commit_free); } -int drm_crtc_commit_wait(struct drm_crtc_commit *commit); - struct drm_atomic_state * __must_check drm_atomic_state_alloc(struct drm_device *dev); void drm_atomic_state_clear(struct drm_atomic_state *state);