From patchwork Sun Jul 25 04:24:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 485655 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2705257jao; Sat, 24 Jul 2021 21:26:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZmKgOF73bHgjUiPKz3LngCz3rFpKDGo5hJ+345ALOWcjWpeZOgmgNvgNf/rSweDryjpX1 X-Received: by 2002:a17:90a:17a1:: with SMTP id q30mr11224899pja.190.1627187193332; Sat, 24 Jul 2021 21:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627187193; cv=none; d=google.com; s=arc-20160816; b=PjxApqy2sP60LHmGMbYeckd+xC2VazEivDJTQe/ok/Y7uOOuZ0DCnEX+MH3k9NbxAS 4TIyi56Su+i89n12mBrnjwK1YktkgrBasxPtZmS6vT0OxhhItS3cLkNNb6oIkJno5si8 GYegQ9Y4bqBqeY9kDnUTF2xSYOow3NRWFenpwX00WuVSg5//sgJbO9moqmjJ0N3hp5n+ j3u8QXsWWvwMGBYqUnP0aJKMzj93tBJr/tdYXmXUpX7IdpTCm8Aa9XU0NJrkVLq2YVwv F1H2Y6SdYXmTxgMJnP4XTbXhpqqMSSJrQZMO7Ds/xczuV61rHNyoCR34Z/fYHYJ7sz72 OSNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=kLIpHKwFlMuHXbvXnn7lcDZQY67Dtyth80Io278/rNM=; b=rTl3CvBvtqD8evCso6aQ0qkoAhqMOzrfNb6HliItSrsMdw0izfH0UXaOtVi9Nrf/Y4 MtjNi6L2eu1pyOngfcbAU5jOvl/r10kQHREY9VRe+nZIAIK0cflCsJ6L+nlcTqnYRIUx 9Jxn31vznT9GqVTg4+gxCM0pFLFAe+695RTe9nhuIj6ybAcpP4O4xXiEaCCeQoDb0qJF HjhJrIG6TMMGWwm2u7zghLQV1mBqVX6b3RR72XEMSyQ+6HQYr+FfBw/0X7ONb2YSetyH cgOvxmAf0awS3x4bpjmp0VMEjT0BwFrODwTDXaFo5JKQRK0CmLUd/Xpgi7BVpIwJpUM/ +2zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Y5Ai3brq; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id t19si16085833ply.14.2021.07.24.21.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 21:26:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Y5Ai3brq; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2269F737FB; Sun, 25 Jul 2021 04:26:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5204273049 for ; Sun, 25 Jul 2021 04:26:26 +0000 (UTC) Received: by mail-ot1-x32d.google.com with SMTP id c2-20020a0568303482b029048bcf4c6bd9so5076272otu.8 for ; Sat, 24 Jul 2021 21:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kLIpHKwFlMuHXbvXnn7lcDZQY67Dtyth80Io278/rNM=; b=Y5Ai3brq2K5DR9ucCChonXVGTYduqDK3BdwGhM+jz9Ia7mWW/pfsXoLJlGBGub9YMj 597wrEKirFSD62Uilrms59MVw4H1IEdmgSKKDlBEsnQy9tQssrIZ/E06F550Co+vWe43 80trfKhcDXDxpZgCUfS2fJaIVmfDTrZafaByjJ5siMB2vTXDpehT77Pi6sKqeQuyBYZ3 poLBWGeYRrHvYSp5qnGIaHDqLUUbjS/TRukyigXGtnaQo4VJ3Okp2Fxqja1y/KZptR+S Xtn2wPZI4D1aqfjk+7Gbpd4LdEw8j8eN/Calx78ZIw3U6yC7HwfviI/nHqC/pPTSifj4 fhZw== 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=kLIpHKwFlMuHXbvXnn7lcDZQY67Dtyth80Io278/rNM=; b=eGZkw133VlDMj14TxQUo/ua1GRiI+IN0b1+WELm4ahbphWjh6osftOtZmJrZUub3S+ HfoYYF+x6q6TS3RW33Uy1oVGTlv4SQRRtyI1foPZ7AsfDSr7x1S5IhP8DU8OzhSJ5M5X +agxy+dAAqvZv9gEwLk9j1WDNbk9+yBg1UZS+1gF3jBQgmUTfjqWJDJpmPBVhBYXUSYs bssag5Vo9kgWcmiJGjtPod1DliNzWsh2NZDdaOLr/6qY3cn3C6ERfaro/6ilNcvUEYcX EZx8/b2tN3UkIbZ41YDi4DJZNqj1CiyWBDh//CoXQIhC1iKmI6TUVSBsiHBtXnCiOucX ll4A== X-Gm-Message-State: AOAM5311U1I6jy63vKctU2Xlwc3NYFDUBtUtWjbOl2wuCM9P4P6VPVy0 FTAtePqBiuYe65osR4h5h80dow== X-Received: by 2002:a9d:39e3:: with SMTP id y90mr8228160otb.257.1627187185599; Sat, 24 Jul 2021 21:26:25 -0700 (PDT) Received: from localhost.localdomain (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id t144sm6986200oih.57.2021.07.24.21.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 21:26:25 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Subject: [PATCH 2/5] drm/msm/dp: Modify prototype of encoder based API Date: Sat, 24 Jul 2021 21:24:32 -0700 Message-Id: <20210725042436.3967173-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210725042436.3967173-1-bjorn.andersson@linaro.org> References: <20210725042436.3967173-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , Rob Herring , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Functions in the DisplayPort code that relates to individual instances (encoders) are passed both the struct msm_dp and the struct drm_encoder. But in a situation where multiple DP instances would exist this means that the caller need to resolve which struct msm_dp relates to the struct drm_encoder at hand. The information for doing this lookup is available inside the DP driver, so update the API to take the struct msm_drm_private and the struct drm_encoder and have the DP code figure out which struct msm_dp the operation relates to. Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 17 +++++---- drivers/gpu/drm/msm/dp/dp_display.c | 38 +++++++++++++++++---- drivers/gpu/drm/msm/msm_drv.h | 31 +++++++++-------- 3 files changed, 56 insertions(+), 30 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 1c04b7cce43e..0d64ef0819af 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1002,8 +1002,8 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, trace_dpu_enc_mode_set(DRMID(drm_enc)); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) - msm_dp_display_mode_set(priv->dp, drm_enc, mode, adj_mode); + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) + msm_dp_display_mode_set(priv, drm_enc, mode, adj_mode); list_for_each_entry(conn_iter, connector_list, head) if (conn_iter->encoder == drm_enc) @@ -1184,9 +1184,8 @@ static void dpu_encoder_virt_enable(struct drm_encoder *drm_enc) _dpu_encoder_virt_enable_helper(drm_enc); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) { - ret = msm_dp_display_enable(priv->dp, - drm_enc); + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) { + ret = msm_dp_display_enable(priv, drm_enc); if (ret) { DPU_ERROR_ENC(dpu_enc, "dp display enable failed: %d\n", ret); @@ -1226,8 +1225,8 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) /* wait for idle */ dpu_encoder_wait_for_event(drm_enc, MSM_ENC_TX_COMPLETE); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) { - if (msm_dp_display_pre_disable(priv->dp, drm_enc)) + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) { + if (msm_dp_display_pre_disable(priv, drm_enc)) DPU_ERROR_ENC(dpu_enc, "dp display push idle failed\n"); } @@ -1255,8 +1254,8 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n"); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) { - if (msm_dp_display_disable(priv->dp, drm_enc)) + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) { + if (msm_dp_display_disable(priv, drm_enc)) DPU_ERROR_ENC(dpu_enc, "dp display disable failed\n"); } diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 8696b36d30e4..59ffd6c8f41f 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1432,12 +1432,25 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, return 0; } -int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) +static struct msm_dp *msm_dp_from_drm_encoder(struct msm_drm_private *priv, + struct drm_encoder *encoder) +{ + if (priv->dp && priv->dp->encoder == encoder) + return priv->dp; + + return NULL; +} + +int msm_dp_display_enable(struct msm_drm_private *priv, struct drm_encoder *encoder) { int rc = 0; struct dp_display_private *dp_display; + struct msm_dp *dp = msm_dp_from_drm_encoder(priv, encoder); u32 state; + if (!dp) + return -EINVAL; + dp_display = container_of(dp, struct dp_display_private, dp_display); if (!dp_display->dp_mode.drm_mode.clock) { DRM_ERROR("invalid params\n"); @@ -1489,9 +1502,13 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) return rc; } -int msm_dp_display_pre_disable(struct msm_dp *dp, struct drm_encoder *encoder) +int msm_dp_display_pre_disable(struct msm_drm_private *priv, struct drm_encoder *encoder) { struct dp_display_private *dp_display; + struct msm_dp *dp = msm_dp_from_drm_encoder(priv, encoder); + + if (!dp) + return 0; dp_display = container_of(dp, struct dp_display_private, dp_display); @@ -1500,11 +1517,15 @@ int msm_dp_display_pre_disable(struct msm_dp *dp, struct drm_encoder *encoder) return 0; } -int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder) +int msm_dp_display_disable(struct msm_drm_private *priv, struct drm_encoder *encoder) { int rc = 0; u32 state; struct dp_display_private *dp_display; + struct msm_dp *dp = msm_dp_from_drm_encoder(priv, encoder); + + if (!dp) + return 0; dp_display = container_of(dp, struct dp_display_private, dp_display); @@ -1531,11 +1552,16 @@ int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder) return rc; } -void msm_dp_display_mode_set(struct msm_dp *dp, struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +void msm_dp_display_mode_set(struct msm_drm_private *priv, + struct drm_encoder *encoder, + struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) { struct dp_display_private *dp_display; + struct msm_dp *dp = msm_dp_from_drm_encoder(priv, encoder); + + if (!dp) + return; dp_display = container_of(dp, struct dp_display_private, dp_display); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9bfd37855969..e9232032b266 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -388,12 +388,13 @@ int __init msm_dp_register(void); void __exit msm_dp_unregister(void); int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder); -int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder); -int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder); -int msm_dp_display_pre_disable(struct msm_dp *dp, struct drm_encoder *encoder); -void msm_dp_display_mode_set(struct msm_dp *dp, struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); +int msm_dp_display_enable(struct msm_drm_private *priv, struct drm_encoder *encoder); +int msm_dp_display_disable(struct msm_drm_private *priv, struct drm_encoder *encoder); +int msm_dp_display_pre_disable(struct msm_drm_private *priv, struct drm_encoder *encoder); +void msm_dp_display_mode_set(struct msm_drm_private *priv, + struct drm_encoder *encoder, + struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); void msm_dp_irq_postinstall(struct msm_dp *dp_display); void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm_dp *dp_display); @@ -413,25 +414,25 @@ static inline int msm_dp_modeset_init(struct msm_dp *dp_display, { return -EINVAL; } -static inline int msm_dp_display_enable(struct msm_dp *dp, +static inline int msm_dp_display_enable(struct msm_drm_private *priv, struct drm_encoder *encoder) { return -EINVAL; } -static inline int msm_dp_display_disable(struct msm_dp *dp, - struct drm_encoder *encoder) +static inline int msm_dp_display_disable(struct msm_drm_private *priv, + struct drm_encoder *encoder) { return -EINVAL; } -static inline int msm_dp_display_pre_disable(struct msm_dp *dp, - struct drm_encoder *encoder) +static inline int msm_dp_display_pre_disable(struct msm_drm_private *priv, + struct drm_encoder *encoder) { return -EINVAL; } -static inline void msm_dp_display_mode_set(struct msm_dp *dp, - struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static inline void msm_dp_display_mode_set(struct msm_drm_private *priv, + struct drm_encoder *encoder, + struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) { }