Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp909657iog; Fri, 24 Jun 2022 17:50:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uatAL3YBgihmR/pvnFRsNkXTVFzD1/zlCj40fVB+VFJKh1wrTw+1dlofEcS/Os7bKFcdCw X-Received: by 2002:a17:902:d485:b0:16a:4eff:1ca0 with SMTP id c5-20020a170902d48500b0016a4eff1ca0mr1805107plg.155.1656118234329; Fri, 24 Jun 2022 17:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656118234; cv=none; d=google.com; s=arc-20160816; b=XAz9duOJRigYkOpe/du+OvTkQTcSizmZdNQUMad7AAsm2u24FeekwL6Wl9zNDbMSyh gZO9/uiwKLUbCIVKaotSoFZYPfhdSJNex4yhd19u8GAfac55rErPQYHnzPeWdB3pHKxz rdS+vClCnEYH9/KkXycSMhxxKCqRDmjdw6mNEJwgDlNk/iHIIZc1RHdhznc4VUOoxBWZ CwEJAJOQw9G4iDzXRs00LfMLpY5eViUl/d7/c+z97OkUF9Em4oP6UOv5ico5qcF8Ek2F 8IdJIxC+6MhxmpkvITplr4GfBmcfEzhO1EEIZmWhzO+j9cBxwqulDF31E3n2NNjUrgyG 1xHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qWabTs9Z/AycxhgD+YVKBCtce/+Yy52lmzeo+JIfI4w=; b=Xw3K33BZltnamWjY0HcyVULLRvAhkfn0KKUT+qOBnFlpGq8UNUiujQ7hX+yZ9lyEBt 6poi08jUFd4tzhDonkrcvLgarrTlPEGvfvA2+lPi2iS235xOvSFLZJiQ4e2AYZcAA2Wr Q2soj0oFIqBtGG08iDrpefqCIyuly8WpZeGrrNEkkOCXci01GiT8v+23btiJzdKqb9QH 6IKgcGr//glLC38NPdTakGnP13rSduVGGX+unNvkVSDc9K3LDmtcqGbGpAXFtmL3VD6C GD6ppvta8n7Nkw4XUXt/qYnu/IWyZ7puV0gZ7vXHs+RWZWohjNYukQZw2jPPhuzh3xzl XD2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rDlRVKT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 9-20020a17090a018900b001ec9f94d9d7si8356174pjc.84.2022.06.24.17.50.22; Fri, 24 Jun 2022 17:50:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rDlRVKT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231587AbiFYALk (ORCPT + 99 others); Fri, 24 Jun 2022 20:11:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230421AbiFYALi (ORCPT ); Fri, 24 Jun 2022 20:11:38 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964EE10FFA for ; Fri, 24 Jun 2022 17:11:37 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id y14so6841638qvs.10 for ; Fri, 24 Jun 2022 17:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qWabTs9Z/AycxhgD+YVKBCtce/+Yy52lmzeo+JIfI4w=; b=rDlRVKT+s9NZX7C9hE0LYy4h/AEztwQLYUshpUlBNNvEaJzK5xwoVl8/DpZyl4FpDI GI/8TM+6WHixBQzmeap+eFhDC00E9pxSvk96zCSfIjN9+ddHZ7s7AS35UsJeHBST7KGi 1O9w+A/p9vKWpbz67eodAcmJRwEo/Fz7m2A6dzdq9nF23wwWWWUFFMRwzeluloIJae9H EqBk4Wss7HYhuqjG5qq8rzxZkr2QEEuUP6AP/D9eIzldGdBx7lr7FofyXMYgaoBBr1q3 ENg0h8yjUPVJMKT1nemwGQ2kZg3a0yQU5UTWXjO1iNYHukMEhqEzv+cAaDHdG2jCVnfq uLgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qWabTs9Z/AycxhgD+YVKBCtce/+Yy52lmzeo+JIfI4w=; b=vKcMCKKvi2HqEC7iyqB2C5/72OK8Soq7nKGvNGDV/jv5JOlMW7DFYYFSL9i7NErwea D/b9UYK8bOO25On8xeL9twMwf2/BMtZCcRi35I0g414GXlAxpADmC7U2n7wdGFXKx8cm GEdtTJFwAls1Pb+UVwtO3XjAKbRpY3TsD009nTlZdyutUGtGp/RpX2TUWVW9LEpr10cI +OlhfnAGJWm0NYaFzrOOIGhSBn/wun95zhfhcaABCcOu3TI67yfWB8mvezP5qbHyK0ly ME5SsnB0qEwSQWWk7aSonx+ond1JczO78XIvm+fwgEIxpO6R/Ev7dLBxYrZ4d7KsNXqR Y3cw== X-Gm-Message-State: AJIora9E0koLyGnMOtn+dg9Hn/C1MDdDzE2+D0hG3NAMAzti25qXdjqg VNOhB2BsdyS56thg1KP3H5o0zz7Fqp8RHOF+mZEOwQ== X-Received: by 2002:a05:622a:34a:b0:304:f25a:ecf0 with SMTP id r10-20020a05622a034a00b00304f25aecf0mr1501371qtw.62.1656115896703; Fri, 24 Jun 2022 17:11:36 -0700 (PDT) MIME-Version: 1.0 References: <1656090912-18074-1-git-send-email-quic_khsieh@quicinc.com> <1656090912-18074-3-git-send-email-quic_khsieh@quicinc.com> <007ea4c9-9701-f4ab-3278-5d36bf2018c4@quicinc.com> <326912ff-9771-0711-366d-79acd436908b@quicinc.com> <0ff3d6a3-dc5c-7c77-f8a1-6c4f6c1a3215@quicinc.com> <66ff4642-f268-f5b0-7e28-b196368c508a@quicinc.com> <5cf094cf-343a-82d7-91c4-1284683f9748@quicinc.com> In-Reply-To: <5cf094cf-343a-82d7-91c4-1284683f9748@quicinc.com> From: Dmitry Baryshkov Date: Sat, 25 Jun 2022 03:11:25 +0300 Message-ID: Subject: Re: [PATCH v1 2/3] drm/msm/dp: decoupling dp->id out of dp controller_id at scxxxx_dp_cfg table To: Abhinav Kumar Cc: Kuogee Hsieh , Stephen Boyd , agross@kernel.org, airlied@linux.ie, bjorn.andersson@linaro.org, daniel@ffwll.ch, dianders@chromium.org, dri-devel@lists.freedesktop.org, robdclark@gmail.com, sean@poorly.run, vkoul@kernel.org, quic_aravindh@quicinc.com, quic_sbillaka@quicinc.com, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 25 Jun 2022 at 03:03, Abhinav Kumar wrote: > > Hi Stephen / Dmitry > > Let me try to explain the issue kuogee is trying to fix below: > > On 6/24/2022 4:56 PM, Kuogee Hsieh wrote: > > > > On 6/24/2022 4:45 PM, Stephen Boyd wrote: > >> Quoting Kuogee Hsieh (2022-06-24 16:30:59) > >>> On 6/24/2022 4:12 PM, Stephen Boyd wrote: > >>>> Quoting Kuogee Hsieh (2022-06-24 15:53:45) > >>>>> MSM_DP_CONTROLLER_1 need to match to the index = 1 of > >>>>> sc7280_dp_cfg[] <== This is correct > >>>>> > >>>>> The problem is sc7280_dp_cfg[] have two entries since eDP place at > >>>>> index > >>>>> of MSM_DP_CONTROLLER_1. > >>>>> > >>>>> but .num_desc = 1 <== this said only have one entry at > >>>>> sc7280_dp_cfg[] > >>>>> table. Therefore eDP will never be found at for loop at > >>>>> _dpu_kms_initialize_displayport(). > >>>>> > >>>> Yes, but what else does the MSM_DP_CONTROLLER_1 need to match? Because > >>>> the intention of the previous commit was to make it so the order of > >>>> sc7280_dp_cfg couldn't be messed up and not match the > >>>> MSM_DP_CONTROLLER_1 value that lives in sc7280_intf[]. > >>> > >>> at _dpu_kms_initialize_displayport() > >>> > >>>> - info.h_tile_instance[0] = i; <== assign i to become dp > >>>> controller id, "i" is index of scxxxx_dp_cfg[] > >>> This what I mean MSM_DP_CONTROLLER_1 need to match to index = 1 of > >>> scxxxx_dp_cfg[]. > >>> > >>> it it is not match, then MSM_DP_CONTROLLER_1 with match to different > >>> INTF. > >> I thought we matched the INTF instance by searching through > >> sc7280_intf[] for a matching MSM_DP_CONTROLLER_1 and then returning that > >> INTF number. See dpu_encoder_get_intf() and the caller. > > > > yes, but the controller_id had been over written by dp->id. > > > > u32 controller_id = disp_info->h_tile_instance[i]; > > > > > > See below code. > > > > > >> for (i = 0; i < disp_info->num_of_h_tiles && !ret; i++) { > >> /* > >> * Left-most tile is at index 0, content is > >> controller id > >> * h_tile_instance_ids[2] = {0, 1}; DSI0 = left, DSI1 > >> = right > >> * h_tile_instance_ids[2] = {1, 0}; DSI1 = left, DSI0 > >> = right > >> */ > >> u32 controller_id = disp_info->h_tile_instance[i]; > >> <== kuogee assign dp->id to controller_id > >> > >> if (disp_info->num_of_h_tiles > 1) { > >> if (i == 0) > >> phys_params.split_role = > >> ENC_ROLE_MASTER; > >> else > >> phys_params.split_role = ENC_ROLE_SLAVE; > >> } else { > >> phys_params.split_role = ENC_ROLE_SOLO; > >> } > >> > >> DPU_DEBUG("h_tile_instance %d = %d, split_role %d\n", > >> i, controller_id, > >> phys_params.split_role); > >> > >> phys_params.intf_idx = > >> dpu_encoder_get_intf(dpu_kms->catalog, > >> > >> intf_type, > >> > >> controller_id); > > > So let me try to explain this as this is what i understood from the > patch and how kuogee explained me. > > The ordering of the array still matters here and thats what he is trying > to address with the second change. > > So as per him, he tried to swap the order of entries like below and that > did not work and that is incorrect behavior because he still retained > the MSM_DP_CONTROLLER_x field for the table like below: I'd like to understand why did he try to change the order in the first place. > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c > b/drivers/gpu/drm/msm/dp/dp_display.c > index dcd80c8a794c..7816e82452ca 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -140,8 +140,8 @@ static const struct msm_dp_config sc7180_dp_cfg = { > > static const struct msm_dp_config sc7280_dp_cfg = { > .descs = (const struct msm_dp_desc[]) { > - [MSM_DP_CONTROLLER_0] = { .io_start = 0x0ae90000, > .connector_type = DRM_MODE_CONNECTOR_DisplayPort, .wide_bus_en = true }, > [MSM_DP_CONTROLLER_1] = { .io_start = 0x0aea0000, > .connector_type = DRM_MODE_CONNECTOR_eDP, .wide_bus_en = true }, > + [MSM_DP_CONTROLLER_0] = { .io_start = 0x0ae90000, > .connector_type = DRM_MODE_CONNECTOR_DisplayPort, .wide_bus_en = true }, > }, > .num_descs = 2, > }; > > > The reason order is important is because in this function below, even > though it matches the address to find which one to use it loops through > the array and so the value of *id will change depending on which one is > located where. > > static const struct msm_dp_desc *dp_display_get_desc(struct > platform_device *pdev, > unsigned int *id) > { > const struct msm_dp_config *cfg = of_device_get_match_data(&pdev->dev); > struct resource *res; > int i; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (!res) > return NULL; > > for (i = 0; i < cfg->num_descs; i++) { > if (cfg->descs[i].io_start == res->start) { > *id = i; The id is set to the index of the corresponding DP instance in the descs array, which is MSM_DP_CONTROLLER_n. Correct up to now. > return &cfg->descs[i]; > } > } > > In dp_display_bind(), dp->id is used as the index of assigning the > dp_display, > > priv->dp[dp->id] = &dp->dp_display; dp->id earlier is set to the id returned by dp_display_get_desc. So the priv->dp is now indexed by MSM_DP_CONTROLLER_n. Again, correct. > > And now in _dpu_kms_initialize_displayport(), in the array this will > decide the value of info.h_tile_instance[0] which will be assigned to > just the index i. i is iterated over priv->dp indices (MSM_DP_CONTROLLER_n, see above), which means that that h_tile_instance[0] is now set to the MSM_DP_CONTROLLER_n. Still correct. > info.h_tile_instance[0] is then used as the controller id to find from > the catalog table. This sounds good. > So if this order is not retained it does not work. > > Thats the issue he is trying to address to make the order of entries > irrelevant in the table in dp_display.c -- With best wishes Dmitry