From patchwork Fri Nov 16 18:42:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10686801 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 182231747 for ; Fri, 16 Nov 2018 18:43:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B9A12D804 for ; Fri, 16 Nov 2018 18:43:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 001552D812; Fri, 16 Nov 2018 18:43:09 +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 5BD9D2D815 for ; Fri, 16 Nov 2018 18:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390464AbeKQE4j (ORCPT ); Fri, 16 Nov 2018 23:56:39 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:42925 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728039AbeKQE4h (ORCPT ); Fri, 16 Nov 2018 23:56:37 -0500 Received: by mail-yb1-f194.google.com with SMTP id o204-v6so10130758yba.9 for ; Fri, 16 Nov 2018 10:43:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aeKksG2k8lgyc1lvWfja1nmO5eSFhWOZT/4b+PHX/pE=; b=UQBBbRWz8Cm3q1axgHfqPAad+bZ+8KXEZr/OSF9oa4ZyF/e13H/GFuGKnrmw5gMS/m 2WC5FxPJM8gmq4tUJ4uqBe/jEJxShF50fCMn223DUOBJo6Xwl4ehaya7GCP/UoM/pUhd svhKMFwIpC026dEy3qmT26SGMGHhR2WZbXEE+LGXxS89niDJNj1w5HpDK47qUAQ2thcz DwU1R7J2igw3MJPc/GwFLbS/1b1Mo9h9TZIwNh6LNTjDXmyRStd8LJR3SbTNqeqdP+8s q3Twm4Ch6o750ZBe3i+iJ/VgFVoguHALpqZ46IpYRQIfKscu/Vdcn2yCkSCBRUZ5Os5m 0Zxg== 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=aeKksG2k8lgyc1lvWfja1nmO5eSFhWOZT/4b+PHX/pE=; b=Z2g7oEVodeh4A+pTisUKUoGRSafjLhjg7vU2/WuY8A2pJbo8Lk3Wkf7CZW1SV1KqNF b9H7a7W1CjLlsQz3kfWndGr7gEMis/h3++4srIOccpejquqzrsfjiL83MNHJBN5txPI5 72sy4WzLkvtVH8/UH4BenIDy8TDqwKFWE5TaDmupfeXCeKUIuVlo2Il9n1jl9EN9PAL0 qZph5y7YjQQWv/LAk7nXEwC6f6mwSuhmVxXYlYT9/nf5jd4MfmWvw9FiikzzZm+kBQpg 7CWQAEJZE88ovtjBsif5Rrq+ggCYs9n5XLtuuGXkGTgHwxfkaf4f2KNaTzD+MCNv3qn5 muKQ== X-Gm-Message-State: AGRZ1gJAi7THceCBeXgLPbu2entiorJ83XVjJP590jBTYTvsSzQgOmFC 4qFhdpPgRTSMjdzZPAhG0TZZ3g== X-Google-Smtp-Source: AJdET5cwhPUwe/ezCBT8NGWsnY1m1YwHYMzSYOSgTMAoaq4AeQIq0JiqtVM13WEBqXutphy5G309Dg== X-Received: by 2002:a25:3bd7:: with SMTP id i206-v6mr11222232yba.491.1542393785155; Fri, 16 Nov 2018 10:43:05 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id b144sm5359134ywa.33.2018.11.16.10.43.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 10:43:04 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul Subject: [PATCH v2 05/24] drm/msm: dpu: Handle crtc pm_runtime_resume() directly Date: Fri, 16 Nov 2018 13:42:15 -0500 Message-Id: <20181116184238.170034-6-sean@poorly.run> X-Mailer: git-send-email 2.19.1.1215.g8438c0b245-goog In-Reply-To: <20181116184238.170034-1-sean@poorly.run> References: <20181116184238.170034-1-sean@poorly.run> 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 From: Sean Paul Instead of registering through dpu_power_handle just to get a call on runtime_resume, call the crtc function directly. Changes in v2: - None Signed-off-by: Sean Paul Reviewed-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 23 ++++++----------------- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 10 ++++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++ drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 8 ++++---- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index e09209d6c469..c55cb751e2b4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -33,7 +33,6 @@ #include "dpu_plane.h" #include "dpu_encoder.h" #include "dpu_vbif.h" -#include "dpu_power_handle.h" #include "dpu_core_perf.h" #include "dpu_trace.h" @@ -69,8 +68,6 @@ static void dpu_crtc_destroy(struct drm_crtc *crtc) if (!crtc) return; - dpu_crtc->phandle = NULL; - drm_crtc_cleanup(crtc); mutex_destroy(&dpu_crtc->crtc_lock); kfree(dpu_crtc); @@ -844,15 +841,17 @@ static struct drm_crtc_state *dpu_crtc_duplicate_state(struct drm_crtc *crtc) return &cstate->base; } -static void dpu_crtc_handle_power_event(u32 event_type, void *arg) +void dpu_crtc_runtime_resume(struct drm_crtc *crtc) { - struct drm_crtc *crtc = arg; struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); struct drm_encoder *encoder; mutex_lock(&dpu_crtc->crtc_lock); - trace_dpu_crtc_handle_power_event(DRMID(crtc), event_type); + if (!dpu_crtc->enabled) + goto end; + + trace_dpu_crtc_runtime_resume(DRMID(crtc)); /* restore encoder; crtc will be programmed during commit */ drm_for_each_encoder(encoder, crtc->dev) { @@ -862,6 +861,7 @@ static void dpu_crtc_handle_power_event(u32 event_type, void *arg) dpu_encoder_virt_restore(encoder); } +end: mutex_unlock(&dpu_crtc->crtc_lock); } @@ -917,10 +917,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) dpu_encoder_register_frame_event_callback(encoder, NULL, NULL); } - if (dpu_crtc->power_event) - dpu_power_handle_unregister_event(dpu_crtc->phandle, - dpu_crtc->power_event); - memset(cstate->mixers, 0, sizeof(cstate->mixers)); cstate->num_mixers = 0; @@ -972,11 +968,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, /* Enable/restore vblank irq handling */ drm_crtc_vblank_on(crtc); - - dpu_crtc->power_event = dpu_power_handle_register_event( - dpu_crtc->phandle, DPU_POWER_EVENT_ENABLE, - dpu_crtc_handle_power_event, crtc, dpu_crtc->name); - } struct plane_state { @@ -1522,8 +1513,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane, /* initialize event handling */ spin_lock_init(&dpu_crtc->event_lock); - dpu_crtc->phandle = &kms->phandle; - DPU_DEBUG("%s: successfully initialized crtc\n", dpu_crtc->name); return crtc; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h index 4822602402f9..1dca91d1210f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h @@ -151,7 +151,6 @@ struct dpu_crtc_frame_event { * @event_worker : Event worker queue * @event_lock : Spinlock around event handling code * @phandle: Pointer to power handler - * @power_event : registered power event handle * @cur_perf : current performance committed to clock/bandwidth driver */ struct dpu_crtc { @@ -187,9 +186,6 @@ struct dpu_crtc { /* for handling internal event thread */ spinlock_t event_lock; - struct dpu_power_handle *phandle; - struct dpu_power_event *power_event; - struct dpu_core_perf_params cur_perf; struct dpu_crtc_smmu_state_data smmu_state; @@ -333,4 +329,10 @@ static inline bool dpu_crtc_is_enabled(struct drm_crtc *crtc) return crtc ? crtc->enabled : false; } +/** + * dpu_crtc_runtime_resume - called by the top-level on pm_runtime_resume + * @crtc: CRTC to resume + */ +void dpu_crtc_runtime_resume(struct drm_crtc *crtc); + #endif /* _DPU_CRTC_H_ */ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index ab8574ab8327..654ea5060e02 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1137,6 +1137,7 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) int rc = -1; struct platform_device *pdev = to_platform_device(dev); struct dpu_kms *dpu_kms = platform_get_drvdata(pdev); + struct drm_crtc *crtc; struct drm_device *ddev; struct dss_module_power *mp = &dpu_kms->mp; @@ -1154,6 +1155,9 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) dpu_vbif_init_memtypes(dpu_kms); + drm_for_each_crtc(crtc, ddev) + dpu_crtc_runtime_resume(crtc); + rc = dpu_power_resource_enable(&dpu_kms->phandle, true); if (rc) DPU_ERROR("resource enable failed: %d\n", rc); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h index 7ab0ba8224f6..328df37d7580 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h @@ -298,6 +298,10 @@ DEFINE_EVENT(dpu_drm_obj_template, dpu_kms_wait_for_commit_done, TP_PROTO(uint32_t drm_id), TP_ARGS(drm_id) ); +DEFINE_EVENT(dpu_drm_obj_template, dpu_crtc_runtime_resume, + TP_PROTO(uint32_t drm_id), + TP_ARGS(drm_id) +); TRACE_EVENT(dpu_enc_enable, TP_PROTO(uint32_t drm_id, int hdisplay, int vdisplay), @@ -518,10 +522,6 @@ DEFINE_EVENT(dpu_id_event_template, dpu_crtc_frame_event_cb, TP_PROTO(uint32_t drm_id, u32 event), TP_ARGS(drm_id, event) ); -DEFINE_EVENT(dpu_id_event_template, dpu_crtc_handle_power_event, - TP_PROTO(uint32_t drm_id, u32 event), - TP_ARGS(drm_id, event) -); DEFINE_EVENT(dpu_id_event_template, dpu_crtc_frame_event_done, TP_PROTO(uint32_t drm_id, u32 event), TP_ARGS(drm_id, event)