From patchwork Fri Oct 5 15:48:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Wang X-Patchwork-Id: 10628345 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 680B6933 for ; Fri, 5 Oct 2018 15:48:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D53229853 for ; Fri, 5 Oct 2018 15:48:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5119E29855; Fri, 5 Oct 2018 15:48:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54C229853 for ; Fri, 5 Oct 2018 15:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727878AbeJEWsF (ORCPT ); Fri, 5 Oct 2018 18:48:05 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:38530 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbeJEWsF (ORCPT ); Fri, 5 Oct 2018 18:48:05 -0400 Received: by mail-yb1-f193.google.com with SMTP id e190-v6so5600705ybb.5 for ; Fri, 05 Oct 2018 08:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=brJxpEDFXXwT7xCHHz8Jdc+TOjUuTeYWymeJChmfG7o=; b=j/VLf7H66pEJBT/Jvku4CEobltQYU4WRcbsTzd60D8GYzuQkagzzRcY5PyzD49tpP2 5uXvmw83+o4ZMLDK9v/8lkD2cczUGhQixe7rN8lAxXJ66awdyncv1g+akpl2piPQ06zR kdFikXxIYcO06tPZUlzObPtXvV/+4AqHCklqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=brJxpEDFXXwT7xCHHz8Jdc+TOjUuTeYWymeJChmfG7o=; b=POfzxTxa1/Q4cQSqbV+W0GCflMP8HOFEI8aPbgg7WsCIeljMOZb7X315H7wDxXaf8I HmdN9MF4z/r7soxUbq7Q+ZWgO0gcv/5Ny4zJTjsGOlZQ2XXeTTeDrbCe4Pmr+nxR6qrV XuDdGwWzFoij21+f+1jEonNc0YX7p9ysamrqQ1SeXsQ+0LuNQ+4sG+nRz0urwjYVFBLv zm8CK/Bt+8fiesZD123rW0GMJy++7YW9WGNtHMhbBJ4sOWTSF4buvg6+3y1JEnqD+pe+ vK5nuWJrD5YpvQ5nWiM3xxPx+BaMRgo3NkJI8GlZZveRRAsA3Ke+9cm/mKGPE3Fvt10j +pBw== X-Gm-Message-State: ABuFfojTDInxa6BvMU0HNPQZHiXMEL38LzRTMgCqeRPOa/G9mMA/snZl 4CS9zmVa0ej76UN5EowmomRGrA== X-Google-Smtp-Source: ACcGV60JDVMOYJRRuKSkgrnHqOb6hT6Uc49OE7VhjBKi46FDaMHq/pK7wdZbl44pAVDKVtDHmfkXcg== X-Received: by 2002:a25:c04a:: with SMTP id c71-v6mr6736130ybf.336.1538754528013; Fri, 05 Oct 2018 08:48:48 -0700 (PDT) Received: from bzwang.cnc.corp.google.com ([2620:0:1013:11:6f9e:dcbe:41ef:a61]) by smtp.gmail.com with ESMTPSA id x64-v6sm7592281ywx.103.2018.10.05.08.48.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 08:48:46 -0700 (PDT) From: Bruce Wang To: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: seanpaul@chromium.org, jsanka@codeaurora.org, robdclark@gmail.com, abhinavk@codeaurora.org, jcrouse@codeaurora.org Subject: [PATCH 1/4] drm/msm/dpu: Remove dpu_kms_pm_suspend/resume Date: Fri, 5 Oct 2018 11:48:40 -0400 Message-Id: <20181005154843.172326-2-bzwang@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181005154843.172326-1-bzwang@chromium.org> References: <20181005154843.172326-1-bzwang@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PM resume was crashing during dpu_kms_pm_resume. This patch removes dpu_kms_pm_suspend/resume so that msm_pm_suspend/resume uses the atomic helpers instead (see next patch). This patch also removes dpu_kms_is_suspend_blocked since it is never called. Signed-off-by: Bruce Wang Reviewed-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 123 ------------------------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 15 --- 2 files changed, 138 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 0a683e65a9f3..ff06b50dfc87 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -709,127 +709,6 @@ static void dpu_kms_destroy(struct msm_kms *kms) _dpu_kms_hw_destroy(dpu_kms); } -static int dpu_kms_pm_suspend(struct device *dev) -{ - struct drm_device *ddev; - struct drm_modeset_acquire_ctx ctx; - struct drm_atomic_state *state; - struct dpu_kms *dpu_kms; - int ret = 0, num_crtcs = 0; - - if (!dev) - return -EINVAL; - - ddev = dev_get_drvdata(dev); - if (!ddev || !ddev_to_msm_kms(ddev)) - return -EINVAL; - - dpu_kms = to_dpu_kms(ddev_to_msm_kms(ddev)); - - /* disable hot-plug polling */ - drm_kms_helper_poll_disable(ddev); - - /* acquire modeset lock(s) */ - drm_modeset_acquire_init(&ctx, 0); - -retry: - DPU_ATRACE_BEGIN("kms_pm_suspend"); - - ret = drm_modeset_lock_all_ctx(ddev, &ctx); - if (ret) - goto unlock; - - /* save current state for resume */ - if (dpu_kms->suspend_state) - drm_atomic_state_put(dpu_kms->suspend_state); - dpu_kms->suspend_state = drm_atomic_helper_duplicate_state(ddev, &ctx); - if (IS_ERR_OR_NULL(dpu_kms->suspend_state)) { - DRM_ERROR("failed to back up suspend state\n"); - dpu_kms->suspend_state = NULL; - goto unlock; - } - - /* create atomic state to disable all CRTCs */ - state = drm_atomic_state_alloc(ddev); - if (IS_ERR_OR_NULL(state)) { - DRM_ERROR("failed to allocate crtc disable state\n"); - goto unlock; - } - - state->acquire_ctx = &ctx; - - /* check for nothing to do */ - if (num_crtcs == 0) { - DRM_DEBUG("all crtcs are already in the off state\n"); - drm_atomic_state_put(state); - goto suspended; - } - - /* commit the "disable all" state */ - ret = drm_atomic_commit(state); - if (ret < 0) { - DRM_ERROR("failed to disable crtcs, %d\n", ret); - drm_atomic_state_put(state); - goto unlock; - } - -suspended: - dpu_kms->suspend_block = true; - -unlock: - if (ret == -EDEADLK) { - drm_modeset_backoff(&ctx); - goto retry; - } - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); - - DPU_ATRACE_END("kms_pm_suspend"); - return 0; -} - -static int dpu_kms_pm_resume(struct device *dev) -{ - struct drm_device *ddev; - struct dpu_kms *dpu_kms; - int ret; - - if (!dev) - return -EINVAL; - - ddev = dev_get_drvdata(dev); - if (!ddev || !ddev_to_msm_kms(ddev)) - return -EINVAL; - - dpu_kms = to_dpu_kms(ddev_to_msm_kms(ddev)); - - DPU_ATRACE_BEGIN("kms_pm_resume"); - - drm_mode_config_reset(ddev); - - drm_modeset_lock_all(ddev); - - dpu_kms->suspend_block = false; - - if (dpu_kms->suspend_state) { - dpu_kms->suspend_state->acquire_ctx = - ddev->mode_config.acquire_ctx; - ret = drm_atomic_commit(dpu_kms->suspend_state); - if (ret < 0) { - DRM_ERROR("failed to restore state, %d\n", ret); - drm_atomic_state_put(dpu_kms->suspend_state); - } - dpu_kms->suspend_state = NULL; - } - drm_modeset_unlock_all(ddev); - - /* enable hot-plug polling */ - drm_kms_helper_poll_enable(ddev); - - DPU_ATRACE_END("kms_pm_resume"); - return 0; -} - static void _dpu_kms_set_encoder_mode(struct msm_kms *kms, struct drm_encoder *encoder, bool cmd_mode) @@ -873,8 +752,6 @@ static const struct msm_kms_funcs kms_funcs = { .check_modified_format = dpu_format_check_modified_format, .get_format = dpu_get_msm_format, .round_pixclk = dpu_kms_round_pixclk, - .pm_suspend = dpu_kms_pm_suspend, - .pm_resume = dpu_kms_pm_resume, .destroy = dpu_kms_destroy, .set_encoder_mode = _dpu_kms_set_encoder_mode, #ifdef CONFIG_DEBUG_FS diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 66d466628e2b..1991cbe424a3 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -137,7 +137,6 @@ struct dpu_kms { /* saved atomic state during system suspend */ struct drm_atomic_state *suspend_state; - bool suspend_block; struct dpu_rm rm; bool rm_init; @@ -176,20 +175,6 @@ static inline bool dpu_kms_is_suspend_state(struct drm_device *dev) return to_dpu_kms(ddev_to_msm_kms(dev))->suspend_state != NULL; } -/** - * dpu_kms_is_suspend_blocked - whether or not commits are blocked due to pm - * suspend status - * @dev: Pointer to drm device - * Return: True if commits should be rejected due to pm suspend - */ -static inline bool dpu_kms_is_suspend_blocked(struct drm_device *dev) -{ - if (!dpu_kms_is_suspend_state(dev)) - return false; - - return to_dpu_kms(ddev_to_msm_kms(dev))->suspend_block; -} - /** * Debugfs functions - extra helper functions for debugfs support * From patchwork Fri Oct 5 15:48:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Wang X-Patchwork-Id: 10628347 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7DE815E2 for ; Fri, 5 Oct 2018 15:48:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CFB329854 for ; Fri, 5 Oct 2018 15:48:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90E8C29859; Fri, 5 Oct 2018 15:48:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 333A029854 for ; Fri, 5 Oct 2018 15:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727958AbeJEWsG (ORCPT ); Fri, 5 Oct 2018 18:48:06 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:36665 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbeJEWsG (ORCPT ); Fri, 5 Oct 2018 18:48:06 -0400 Received: by mail-yw1-f67.google.com with SMTP id e201-v6so5426762ywa.3 for ; Fri, 05 Oct 2018 08:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UskCe1qUSQB8EunJ/KkV7we0yFmkRvYoIjzrrAGJqNY=; b=bjK1mEPMny1B79G24gpj46Xd2u+S0gYUaBFGKlYMGMCIuu1xnTV87gpzeweC+mrEFb usDltWAVExl1qplm1xt+E3xgAIoWfiQo8+YiQjlaooAYw2VtRe3ib8XCUDIIAK3f94fd 3/Z920+lTsf975Dez78QqozeriF1XtLl0L31g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UskCe1qUSQB8EunJ/KkV7we0yFmkRvYoIjzrrAGJqNY=; b=LHfniWWs6r5RLhzffL1/A8jMlV3JPTmkU1zxwMF/Bj6qFcITOkd+wL8iu78j/INcJy pqE1SFfxZfqpwR7VV+hUHqEC9SVJQFfjkcsymbBkGBfTJLYoAT/eqTNh8E6MI4tvqIuS rQselT4HHZLrZ6A+wiPyCPfJfC7EPJaEXM3aPJOs6vPCC0tEboZuKZuM1pcjnBUdRtuo pMUW14ki984Ss1WHNSylkUUEMTVrc+yqZnzwgnHH2xF0tBOgoPXIhSQlGBOP19Iwl6pD /TW/ImoBrBxT+u3602l5mb2KWKwu1HdkVUn/zcmPcZ4N3oA/cyEHTQwqzhuFD/Bi49Z1 /JyQ== X-Gm-Message-State: ABuFfojcvL/Z91US+EOyVa0V03jS/+LlobMEvH0ah6rrpe1YmYIfgQm6 ae6C8vfIMbe6D2SzVZXmBWsxvA== X-Google-Smtp-Source: ACcGV616Ni23vG7cv5gZMtBT532p0ATcugvZXDYiA8vCS57ovluCEHG206NtpC2pn3JwjAxyFrdPVA== X-Received: by 2002:a0d:f9c1:: with SMTP id j184-v6mr6683667ywf.286.1538754529535; Fri, 05 Oct 2018 08:48:49 -0700 (PDT) Received: from bzwang.cnc.corp.google.com ([2620:0:1013:11:6f9e:dcbe:41ef:a61]) by smtp.gmail.com with ESMTPSA id x64-v6sm7592281ywx.103.2018.10.05.08.48.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 08:48:48 -0700 (PDT) From: Bruce Wang To: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: seanpaul@chromium.org, jsanka@codeaurora.org, robdclark@gmail.com, abhinavk@codeaurora.org, jcrouse@codeaurora.org Subject: [PATCH 2/4] drm/msm: Cut dpu_kms hooks from msm_pm_suspend/resume Date: Fri, 5 Oct 2018 11:48:41 -0400 Message-Id: <20181005154843.172326-3-bzwang@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181005154843.172326-1-bzwang@chromium.org> References: <20181005154843.172326-1-bzwang@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Removes the traces of the non-atomic helper calls in msm_pm_suspend/resume since we just deleted those functions (see patch 1). Also removes the drm_kms_helper_poll_disable/enable calls, since the DRM_CONNECTOR_POLL_CONNECT flag is never set so periodic polling doesn't happen anyways. Signed-off-by: Bruce Wang --- drivers/gpu/drm/msm/msm_drv.c | 28 ++++++++++------------------ drivers/gpu/drm/msm/msm_kms.h | 3 --- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 4904d0d41409..f987df7f10df 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1069,37 +1069,29 @@ static int msm_pm_suspend(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); struct msm_drm_private *priv = ddev->dev_private; - struct msm_kms *kms = priv->kms; - - /* TODO: Use atomic helper suspend/resume */ - if (kms && kms->funcs && kms->funcs->pm_suspend) - return kms->funcs->pm_suspend(dev); - drm_kms_helper_poll_disable(ddev); + if (!IS_ERR_OR_NULL(priv->pm_state)) + return 0; priv->pm_state = drm_atomic_helper_suspend(ddev); - if (IS_ERR(priv->pm_state)) { - drm_kms_helper_poll_enable(ddev); - return PTR_ERR(priv->pm_state); - } - return 0; + return PTR_ERR_OR_ZERO(priv->pm_state); } static int msm_pm_resume(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); struct msm_drm_private *priv = ddev->dev_private; - struct msm_kms *kms = priv->kms; + int ret; - /* TODO: Use atomic helper suspend/resume */ - if (kms && kms->funcs && kms->funcs->pm_resume) - return kms->funcs->pm_resume(dev); + if (IS_ERR_OR_NULL(priv->pm_state)) + return 0; - drm_atomic_helper_resume(ddev, priv->pm_state); - drm_kms_helper_poll_enable(ddev); + ret = drm_atomic_helper_resume(ddev, priv->pm_state); + if (ret == 0) + priv->pm_state = NULL; - return 0; + return ret; } #endif diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index fd88cebb6adb..2b81b43a4bab 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -67,9 +67,6 @@ struct msm_kms_funcs { void (*set_encoder_mode)(struct msm_kms *kms, struct drm_encoder *encoder, bool cmd_mode); - /* pm suspend/resume hooks */ - int (*pm_suspend)(struct device *dev); - int (*pm_resume)(struct device *dev); /* cleanup: */ void (*destroy)(struct msm_kms *kms); #ifdef CONFIG_DEBUG_FS From patchwork Fri Oct 5 15:48:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Wang X-Patchwork-Id: 10628349 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8915515E2 for ; Fri, 5 Oct 2018 15:48:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E98E29854 for ; Fri, 5 Oct 2018 15:48:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72C132985E; Fri, 5 Oct 2018 15:48:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB72B29854 for ; Fri, 5 Oct 2018 15:48:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727725AbeJEWsI (ORCPT ); Fri, 5 Oct 2018 18:48:08 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:42021 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbeJEWsI (ORCPT ); Fri, 5 Oct 2018 18:48:08 -0400 Received: by mail-yw1-f68.google.com with SMTP id a197-v6so5410389ywh.9 for ; Fri, 05 Oct 2018 08:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U/Le0MCIJ+eFFtkupF8VmgX6LVjaF/syDwkinchT8h4=; b=bmLa4vEoeVVv0oUtjo+PVJm8cdCXahhhXqX97xtIO8JyOnxRO2LAC0eKk6EqOTX3ER byGNyEN8Mxd1qcstEUAiTO8uaQB0xF0lajTqQkKeugjnTuFs76ESwvr2tWFZj/jGXmV2 Oz5lusSfgOK+2QeJtJIeBPRLpoN3TZxUxTqTk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U/Le0MCIJ+eFFtkupF8VmgX6LVjaF/syDwkinchT8h4=; b=Pbrab5mpMJNAwbCNinzGMXzV5Of5MeuOjV0CJWcvLUR9KXp2EokVULuIOtPEbfmD41 flP2uhKt9cd1tayEXNE6pLKgGxJZ2NTTsX+3XPI7BJvVQqn0cAuvKYwvEpcDPLIkngPz YrzVDDcBsldcidBrT2TGeNVr5AQxYFeGR3HFyqprFk+032+h2MMbU1npmD2is4UkcbGT XxW/zS5YOWj+SJLbeZtVlevc3ckuiLV4C3dWUaTNhIHJMzfCdFObyIXj/4pudZkzuT0b i6kahXGqLoZXkfuWenj76cXn81mzHnDBPMIR2ruMWc7basNXqJhKj8UPNN4sYwhyJBZO LlQA== X-Gm-Message-State: ABuFfoiCZ5LgmueRu2AmjU2Bix1kBsWYc/CTjdVSKmSXB1gJRUXCXVFA QPFtwvo3WQD3HRM7ZZPNxUz8aQ== X-Google-Smtp-Source: ACcGV62+IWwvuvEb9jjyL11U/Cp4e+vdZCtupxdwpkxIi3yGC+HD99Y5J1XR+EJDoo27vWB7YtRToQ== X-Received: by 2002:a81:8044:: with SMTP id q65-v6mr6654824ywf.196.1538754530903; Fri, 05 Oct 2018 08:48:50 -0700 (PDT) Received: from bzwang.cnc.corp.google.com ([2620:0:1013:11:6f9e:dcbe:41ef:a61]) by smtp.gmail.com with ESMTPSA id x64-v6sm7592281ywx.103.2018.10.05.08.48.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 08:48:49 -0700 (PDT) From: Bruce Wang To: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: seanpaul@chromium.org, jsanka@codeaurora.org, robdclark@gmail.com, abhinavk@codeaurora.org, jcrouse@codeaurora.org Subject: [PATCH 3/4] drm/msm/dpu: Remove suspend state tracking from crtc Date: Fri, 5 Oct 2018 11:48:42 -0400 Message-Id: <20181005154843.172326-4-bzwang@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181005154843.172326-1-bzwang@chromium.org> References: <20181005154843.172326-1-bzwang@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dpu_crtc_enable/disable/reset are only being called upon initialization/destruction of the device and as part of the PM suspend/resume handling. Since core suspend and resume calls are guarenteed to not overlap with one another we don't need to track whether or not we're in a suspended state from inside the crtc. This patch removes the suspend logic from the crtc, and removes the relevant tracing from dpu_trace. Signed-off-by: Bruce Wang --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 61 ++--------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 2 - drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 15 +----- 3 files changed, 7 insertions(+), 71 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index d4530d60767b..31e372554e0c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -815,35 +815,6 @@ static void _dpu_crtc_vblank_enable_no_lock( } } -/** - * _dpu_crtc_set_suspend - notify crtc of suspend enable/disable - * @crtc: Pointer to drm crtc object - * @enable: true to enable suspend, false to indicate resume - */ -static void _dpu_crtc_set_suspend(struct drm_crtc *crtc, bool enable) -{ - struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); - - DRM_DEBUG_KMS("crtc%d suspend = %d\n", crtc->base.id, enable); - - mutex_lock(&dpu_crtc->crtc_lock); - - /* - * If the vblank is enabled, release a power reference on suspend - * and take it back during resume (if it is still enabled). - */ - trace_dpu_crtc_set_suspend(DRMID(&dpu_crtc->base), enable, dpu_crtc); - if (dpu_crtc->suspend == enable) - DPU_DEBUG("crtc%d suspend already set to %d, ignoring update\n", - crtc->base.id, enable); - else if (dpu_crtc->enabled && dpu_crtc->vblank_requested) { - _dpu_crtc_vblank_enable_no_lock(dpu_crtc, !enable); - } - - dpu_crtc->suspend = enable; - mutex_unlock(&dpu_crtc->crtc_lock); -} - /** * dpu_crtc_duplicate_state - state duplicate hook * @crtc: Pointer to drm crtc structure @@ -881,25 +852,14 @@ static struct drm_crtc_state *dpu_crtc_duplicate_state(struct drm_crtc *crtc) */ static void dpu_crtc_reset(struct drm_crtc *crtc) { - struct dpu_crtc *dpu_crtc; struct dpu_crtc_state *cstate; - if (!crtc) { - DPU_ERROR("invalid crtc\n"); - return; - } - - /* revert suspend actions, if necessary */ - if (dpu_kms_is_suspend_state(crtc->dev)) - _dpu_crtc_set_suspend(crtc, false); - /* remove previous state, if present */ if (crtc->state) { dpu_crtc_destroy_state(crtc, crtc->state); - crtc->state = 0; + crtc->state = NULL; } - dpu_crtc = to_dpu_crtc(crtc); cstate = kzalloc(sizeof(*cstate), GFP_KERNEL); if (!cstate) { DPU_ERROR("failed to allocate state\n"); @@ -951,9 +911,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) DRM_DEBUG_KMS("crtc%d\n", crtc->base.id); - if (dpu_kms_is_suspend_state(crtc->dev)) - _dpu_crtc_set_suspend(crtc, true); - /* Disable/save vblank irq handling */ drm_crtc_vblank_off(crtc); @@ -966,8 +923,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) atomic_read(&dpu_crtc->frame_pending)); trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc); - if (dpu_crtc->enabled && !dpu_crtc->suspend && - dpu_crtc->vblank_requested) { + if (dpu_crtc->enabled && dpu_crtc->vblank_requested) { _dpu_crtc_vblank_enable_no_lock(dpu_crtc, false); } dpu_crtc->enabled = false; @@ -1033,8 +989,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, mutex_lock(&dpu_crtc->crtc_lock); trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc); - if (!dpu_crtc->enabled && !dpu_crtc->suspend && - dpu_crtc->vblank_requested) { + if (!dpu_crtc->enabled && dpu_crtc->vblank_requested) { _dpu_crtc_vblank_enable_no_lock(dpu_crtc, true); } dpu_crtc->enabled = true; @@ -1289,17 +1244,11 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) { - struct dpu_crtc *dpu_crtc; - - if (!crtc) { - DPU_ERROR("invalid crtc\n"); - return -EINVAL; - } - dpu_crtc = to_dpu_crtc(crtc); + struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); mutex_lock(&dpu_crtc->crtc_lock); trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc); - if (dpu_crtc->enabled && !dpu_crtc->suspend) { + if (dpu_crtc->enabled) { _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en); } dpu_crtc->vblank_requested = en; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h index 3723b4830335..7dc181aabb4d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h @@ -133,7 +133,6 @@ struct dpu_crtc_frame_event { * @play_count : frame count between crtc enable and disable * @vblank_cb_time : ktime at vblank count reset * @vblank_requested : whether the user has requested vblank events - * @suspend : whether or not a suspend operation is in progress * @enabled : whether the DPU CRTC is currently enabled. updated in the * commit-thread, not state-swap time which is earlier, so * safe to make decisions on during VBLANK on/off work @@ -169,7 +168,6 @@ struct dpu_crtc { u64 play_count; ktime_t vblank_cb_time; bool vblank_requested; - bool suspend; bool enabled; struct list_head feature_list; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h index 636b31b0d311..0c122e173892 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h @@ -749,7 +749,6 @@ TRACE_EVENT(dpu_crtc_vblank_enable, __field( uint32_t, enc_id ) __field( bool, enable ) __field( bool, enabled ) - __field( bool, suspend ) __field( bool, vblank_requested ) ), TP_fast_assign( @@ -757,15 +756,12 @@ TRACE_EVENT(dpu_crtc_vblank_enable, __entry->enc_id = enc_id; __entry->enable = enable; __entry->enabled = crtc->enabled; - __entry->suspend = crtc->suspend; __entry->vblank_requested = crtc->vblank_requested; ), - TP_printk("id:%u encoder:%u enable:%s state{enabled:%s suspend:%s " - "vblank_req:%s}", + TP_printk("id:%u encoder:%u enable:%s state{enabled:%s vblank_req:%s}", __entry->drm_id, __entry->enc_id, __entry->enable ? "true" : "false", __entry->enabled ? "true" : "false", - __entry->suspend ? "true" : "false", __entry->vblank_requested ? "true" : "false") ); @@ -776,26 +772,19 @@ DECLARE_EVENT_CLASS(dpu_crtc_enable_template, __field( uint32_t, drm_id ) __field( bool, enable ) __field( bool, enabled ) - __field( bool, suspend ) __field( bool, vblank_requested ) ), TP_fast_assign( __entry->drm_id = drm_id; __entry->enable = enable; __entry->enabled = crtc->enabled; - __entry->suspend = crtc->suspend; __entry->vblank_requested = crtc->vblank_requested; ), - TP_printk("id:%u enable:%s state{enabled:%s suspend:%s vblank_req:%s}", + TP_printk("id:%u enable:%s state{enabled:%s vblank_req:%s}", __entry->drm_id, __entry->enable ? "true" : "false", __entry->enabled ? "true" : "false", - __entry->suspend ? "true" : "false", __entry->vblank_requested ? "true" : "false") ); -DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_set_suspend, - TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc), - TP_ARGS(drm_id, enable, crtc) -); DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_enable, TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc), TP_ARGS(drm_id, enable, crtc) From patchwork Fri Oct 5 15:48:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Wang X-Patchwork-Id: 10628351 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77CB3933 for ; Fri, 5 Oct 2018 15:48:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B33E29854 for ; Fri, 5 Oct 2018 15:48:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FD172985E; Fri, 5 Oct 2018 15:48:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E317B29854 for ; Fri, 5 Oct 2018 15:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbeJEWsJ (ORCPT ); Fri, 5 Oct 2018 18:48:09 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:37812 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbeJEWsJ (ORCPT ); Fri, 5 Oct 2018 18:48:09 -0400 Received: by mail-yw1-f65.google.com with SMTP id y14-v6so5417135ywa.4 for ; Fri, 05 Oct 2018 08:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xElFqik/i1Nuy+Ef7zT5YU9DWq4DbN6e9fzJNlOuDC4=; b=k/fQT8NS01zGirzdhnHrD+vlUEWDaqffMX10KrrBRSY6KNiHvMW27NaAImgbHPaNkJ PxD2POGX+LV8jpqKC5nfWH+/Aw1NlHGAz3YQ/7UA04/QmSJ7hYFCCLQna0gkwc1w/e/x lNErEQvZ10AZOEbbX7mPqc1gUVDQg1s/G9uLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xElFqik/i1Nuy+Ef7zT5YU9DWq4DbN6e9fzJNlOuDC4=; b=hU6aWuP8Vqwh3WdVQURIKXSrv9JylBCexOClMPAVFey/QBYA/Wn0Dbhr2K8LUTwXqO Vlu4OxuvHscbgeYHREKuHxIw5gYxid6RK7aQKFXw13E0JRLGavyNDQPXzxblU3bbYD3n kt7q2li3T5wlkdaapT5tYAVPJqLhc05RfHQx0mSDjHvshSVaeHTRftokOWx4Kb4n5Dum 7g6RPqXcD4515Hr9FhGU/NxvfkyDpY3H0qADj9QcbSrFAY+oxMp1aaIGn1quC/9R7R+V m5FhQbEKDSfgG23b0jCJagqy57FyqsBhAFdqegpmWbT0Hcu/SL8kDFY0K7M87otQ6O3i qdOQ== X-Gm-Message-State: ABuFfohKznnkBAMLIUvdjI51vDmJ7tHgRhrIt5A8DE8jJtMUTQFDErUW 8a2TqNbIhT+7GqRTIV4k2xZyrQ== X-Google-Smtp-Source: ACcGV62EiQErWzvshL9VRbZ2cyDZ1KFdckWfWSIDD+fHg8U2KsBx8UkL6xAAAVEDP2kU0q8exm6m6A== X-Received: by 2002:a0d:eb4c:: with SMTP id u73-v6mr6518698ywe.125.1538754532414; Fri, 05 Oct 2018 08:48:52 -0700 (PDT) Received: from bzwang.cnc.corp.google.com ([2620:0:1013:11:6f9e:dcbe:41ef:a61]) by smtp.gmail.com with ESMTPSA id x64-v6sm7592281ywx.103.2018.10.05.08.48.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 08:48:51 -0700 (PDT) From: Bruce Wang To: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: seanpaul@chromium.org, jsanka@codeaurora.org, robdclark@gmail.com, abhinavk@codeaurora.org, jcrouse@codeaurora.org Subject: [PATCH 4/4] drm/msm/dpu: Remove suspend_state from dpu_kms Date: Fri, 5 Oct 2018 11:48:43 -0400 Message-Id: <20181005154843.172326-5-bzwang@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181005154843.172326-1-bzwang@chromium.org> References: <20181005154843.172326-1-bzwang@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The suspend_state field is no longer used and can be removed along with dpu_kms_is_suspend_state. Signed-off-by: Bruce Wang --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 1991cbe424a3..2a3625eef6d3 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -135,9 +135,6 @@ struct dpu_kms { struct dpu_core_perf perf; - /* saved atomic state during system suspend */ - struct drm_atomic_state *suspend_state; - struct dpu_rm rm; bool rm_init; @@ -162,19 +159,6 @@ struct vsync_info { #define ddev_to_msm_kms(D) ((D) && (D)->dev_private ? \ ((struct msm_drm_private *)((D)->dev_private))->kms : NULL) -/** - * dpu_kms_is_suspend_state - whether or not the system is pm suspended - * @dev: Pointer to drm device - * Return: Suspend status - */ -static inline bool dpu_kms_is_suspend_state(struct drm_device *dev) -{ - if (!ddev_to_msm_kms(dev)) - return false; - - return to_dpu_kms(ddev_to_msm_kms(dev))->suspend_state != NULL; -} - /** * Debugfs functions - extra helper functions for debugfs support *