Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2108440rwr; Fri, 21 Apr 2023 04:36:38 -0700 (PDT) X-Google-Smtp-Source: AKy350YMcpkKBRTRz+Z338jgTAdzh/iP5bsxU4bLDPjeAiissBlgNqBjbWE+iW6GEHdhtYewKEIR X-Received: by 2002:a17:902:e544:b0:1a6:cf4b:4d7d with SMTP id n4-20020a170902e54400b001a6cf4b4d7dmr5752673plf.2.1682076997860; Fri, 21 Apr 2023 04:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682076997; cv=none; d=google.com; s=arc-20160816; b=KqzjQWX+RC9rmsWMtHupHjIiGztop8l7xDVSMxoU9P+Igwih6mw8hedppSUq/kjlha P9eaQyp/k/PsPBZG9j6W5noTQz0a4ac57VckIdJ6sfLs7+U5RlxNbr5xl9dqkcp4HVWQ GWQFYORKNPYmGg/HgSx1/4rTGDlr/IvQitJMhyURKmCPahb03XIBqx29l2sPy1LJ8MxX BECdjZAm42HcYKN49hVCfQAY8WyAcKChmUgWQfbUKvT9LiDFScCEz+FB23/p0mjFnBI9 XxaWQil4TsoH78bGKPqxrGg/R3D9Eo2YLiLv3Z6y3X8bjAVKYcRbAgJfCngj6pCCFl8r RIbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :in-reply-to:from:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature:dkim-filter; bh=dGU/WK8Le8mmtFesutmQKIo9RcAx4ZOdI9l12AmUGN8=; b=fdaA4f6yB2uLSTri8WNIlgL8N4rHkqLJsN2LqeKQcn4mZnwjhjtZNe9C71Ve9/qC0h hbYJNOkXQhwZ7WdD1JqKs9kfrAg6pvqiKL9lfX4rkxSIFEQZgA18iLnxQpfRFnDJ9OpG is3XFtaOB7dkFyi03tpQ0cLpLnlalM6dMDAyLFZ6kLIhAoBTZhXo+fPB8RPI5HgO1Mpl kXCkgPL8NlvZp/pdOVJ4+6lQPPEtlBlSE2qZLlyEBjwoRU0+Lk6qc/Zn6AAf5NDcXIan vF1WFXyUHz7MOTmfdhmKqZThadL8MpGW+7iFj/Hl6MfcdV3O+4wtaEniRH7XLHep6kck R7vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bneS3JfY; 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=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f13-20020a170902ce8d00b001a923bd4e0csi4549977plg.552.2023.04.21.04.36.03; Fri, 21 Apr 2023 04:36:37 -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=@samsung.com header.s=mail20170921 header.b=bneS3JfY; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbjDUL2r (ORCPT + 99 others); Fri, 21 Apr 2023 07:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbjDUL2q (ORCPT ); Fri, 21 Apr 2023 07:28:46 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFF5DA5DD for ; Fri, 21 Apr 2023 04:28:43 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230421112842euoutp015b67a724e25beffe503d630703aafb72~X7690xApI2549825498euoutp01Z for ; Fri, 21 Apr 2023 11:28:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230421112842euoutp015b67a724e25beffe503d630703aafb72~X7690xApI2549825498euoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1682076522; bh=dGU/WK8Le8mmtFesutmQKIo9RcAx4ZOdI9l12AmUGN8=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=bneS3JfYGzuZJV4c1uInsmN7lofnBuN0d7D59uxZFvsO0rYtwT/VP40FCwyJaRewi JC1QZNjq8PfzB6R126NjNdAnOPxVI2QK4K5q/ZzefLTjfUOBNt5hdiV1tq+7limI2u G4oDPZoZwzfwg0RlOTWeCxbbm3aWSvqv8AbUbAQQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230421112841eucas1p2bdc8808aa6cbc85b9d9bc3d53862181f~X769Ik_rQ0627706277eucas1p2D; Fri, 21 Apr 2023 11:28:41 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 91.58.09966.96372446; Fri, 21 Apr 2023 12:28:41 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230421112841eucas1p2ac3d94beca24f038b983681afd6275c2~X768eJ_fb0842208422eucas1p2A; Fri, 21 Apr 2023 11:28:41 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230421112841eusmtrp15a113d10394ed3160f66eac93b3dd266~X768dORF03228632286eusmtrp1J; Fri, 21 Apr 2023 11:28:41 +0000 (GMT) X-AuditID: cbfec7f4-d4fff700000026ee-01-644273697627 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id E6.7F.22108.96372446; Fri, 21 Apr 2023 12:28:41 +0100 (BST) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230421112839eusmtip29b702227ba348551cba4027b22e731df~X767QwsZM2676726767eusmtip2J; Fri, 21 Apr 2023 11:28:39 +0000 (GMT) Message-ID: <8cdb2f0d-f6a2-a04c-2cf4-c0762a47c050@samsung.com> Date: Fri, 21 Apr 2023 13:28:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 1/6] drm: bridge: samsung-dsim: Support multi-lane calculations Content-Language: en-US To: Lucas Stach , Adam Ford Cc: dri-devel@lists.freedesktop.org, Krzysztof Kozlowski , aford@beaconembedded.com, Laurent Pinchart , Andrzej Hajda , Fabio Estevam , marex@denx.de, Robert Foss , David Airlie , Jernej Skrabec , Jagan Teki , NXP Linux Team , devicetree@vger.kernel.org, Daniel Vetter , Jonas Karlman , Sascha Hauer , Inki Dae , Rob Herring , linux-arm-kernel@lists.infradead.org, Neil Armstrong , linux-kernel@vger.kernel.org, Pengutronix Kernel Team , Shawn Guo From: Marek Szyprowski In-Reply-To: <56a805b4a74f620f7948f57d416b135effb6e52d.camel@pengutronix.de> Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Sf1CTdRzu+77v3r1bjl7nOr4QR7EEm1w4zOxrkYrXj7fDOz27uEvvxAVv SPGrDVTSs1XO2MQ5KC4YP0s8cKLGxvg5OJnYRgQRAcLCG5x4/HBECzJFwRivFv893+fzPPc8 n899KVxsIgOppNQMVpmqSJaSQqLux3u/vJik2pEgX7j7Ehr+vRNHzf2n+Mh5/XsMuc/OEuhh XS6Oytq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r8g73+ep/H+01SW899sik4pLUpnOiWr8Cmbv3zBeOvzrS0gP q5dywbS/vydkz798XWvdpQUqf2Y6R9x6u3VK19sk2RCGZetuWdsvD3Rw6f/2XzBszdOqj112 v/jfplq/ylALCpgsWjAvt3/3dj+xw++Op7FxWxnKp4RnL+ktu1Dt4iF0ImbznHZdj54PfMfS xZ6mBiuxFGckGmoxFxUnAgDoPnh9zwMAAA== X-CMS-MailID: 20230421112841eucas1p2ac3d94beca24f038b983681afd6275c2 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20230421084034eucas1p14b1bcf83a86f7a2a828eac2d42eb1449 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230421084034eucas1p14b1bcf83a86f7a2a828eac2d42eb1449 References: <20230415104104.5537-1-aford173@gmail.com> <3e47f0d1017fe4c9f71a5de65f32c6ba1662efe2.camel@pengutronix.de> <19d2c40180d0b9176e17aa6e91c1e7f36f77f626.camel@pengutronix.de> <56a805b4a74f620f7948f57d416b135effb6e52d.camel@pengutronix.de> X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 21.04.2023 10:40, Lucas Stach wrote: > Am Donnerstag, dem 20.04.2023 um 16:51 -0500 schrieb Adam Ford: >> On Thu, Apr 20, 2023 at 8:43 AM Lucas Stach wrote: >>> Am Donnerstag, dem 20.04.2023 um 08:24 -0500 schrieb Adam Ford: >>>> On Thu, Apr 20, 2023 at 8:06 AM Lucas Stach wrote: >>>>> Hi Adam, >>>>> >>>>> Am Mittwoch, dem 19.04.2023 um 05:47 -0500 schrieb Adam Ford: >>>>>> On Mon, Apr 17, 2023 at 6:55 AM Adam Ford wrote: >>>>>>> On Mon, Apr 17, 2023 at 3:43 AM Lucas Stach wrote: >>>>>>>> Hi Adam, >>>>>>>> >>>>>>>> Am Samstag, dem 15.04.2023 um 05:40 -0500 schrieb Adam Ford: >>>>>>>>> If there is more than one lane, the HFP, HBP, and HSA is calculated in >>>>>>>>> bytes/pixel, then they are divided amongst the different lanes with some >>>>>>>>> additional overhead. This is necessary to achieve higher resolutions while >>>>>>>>> keeping the pixel clocks lower as the number of lanes increase. >>>>>>>>> >>>>>>>> In the testing I did to come up with my patch "drm: bridge: samsung- >>>>>>>> dsim: fix blanking packet size calculation" the number of lanes didn't >>>>>>>> make any difference. My testing might be flawed, as I could only >>>>>>>> measure the blanking after translation from MIPI DSI to DPI, so I'm >>>>>>>> interested to know what others did here. How did you validate the >>>>>>>> blanking with your patch? Would you have a chance to test my patch and >>>>>>>> see if it works or breaks in your setup? >>>>>> Lucas, >>>>>> >>>>>> I tried your patch instead of mine. Yours is dependent on the >>>>>> hs_clock being always set to the burst clock which is configured by >>>>>> the device tree. I unrolled a bit of my stuff and replaced it with >>>>>> yours. It worked at 1080p, but when I tried a few other resolutions, >>>>>> they did not work. I assume it's because the DSI clock is fixed and >>>>>> not changing based on the pixel clock. In the version I did, I only >>>>>> did that math when the lanes were > 1. In your patch, you divide by 8, >>>>>> and in mine, I fetch the bits-per-pixel (which is 8) and I divide by >>>>>> that just in case the bpp ever changes from 8. Overall, I think our >>>>>> patches basically do the same thing. >>>>> The calculations in your and my patch are quite different. I'm not >>>>> taking into account the number of lanes or the MIPI format. I'm basing >> I was taking the number of lanes into account in order to calculate >> the clock rate, since 4-lanes can run slower. >> > Ah that makes sense if you aren't running at full clock burst clock > rate. > >>>> I was looking more at the division by 8 and the overhead correction of 6. >>>> This number 6 also appears in the NXP downstream kernel [1]. I know >>>> Marek V had some concerns about that. >>>> >>> Yea, I don't fully remember the details about the overhead. Need to >>> page that back in. The division by 8 in my patch is just to get from >>> the bit to a byte clock, nothing to do with the MIPI format bits per >>> channel or something like that. >>> >>>>> the blanking size purely on the ratio between MIPI DSI byte clock and >>>>> the DPI interface clock. It's quite counter-intuitive that the host >>>>> would scale the blanking to the number of lanes automatically, but >>>>> still require the MIPI packet offset removed, but that's what my >>>>> measurements showed to produce the correct blanking after translation >>>>> to DPI by the TC358767 bridge chip. >>>> How many lanes is your DSI interface using? >>>> >>> When I did the measurements to come up with the patch, I varied the >>> number of lanes between 1 and 4. Different number of lanes didn't make >>> a difference. In fact trying to compensate for the number of lanes when >>> calculating the blanking size to program into the controller lead to >>> wildly wrong blanking on the DPI side of the external bridge. >>> >>>>> If you dynamically scale the HS clock, then you would need to input the >>>>> real used HS clock to the calculation in my patch, instead of the fixed >>>>> burst mode rate. >>>> I think what you're saying makes sense. >>>> >>>> The code I originally modeled this from was from the NXP downstream >>>> kernel where they define the calculation as being in words [2]. I am >>>> not saying the NXP code is perfect, but the NXP code works. With this >>>> series, my monitors are able to sync a bunch of different resolutions >>>> from 1080p down to 640x480 and a bunch in between with various refresh >>>> rates too. That was the goal of this series. >>>> >>>> Instead of just using your patch as-is, I will adapt yours to use the >>>> scaled clock to see how it behaves and get back to you. >>>> >>> Thanks, that would be very much appreciated. >> Lucas, >> >> I took your patch and added a dsi state variable named "hs_clock" to >> keep track of the output of samsung_dsim_set_pll which should be the >> active high-speed clock. >> >> I then replaced one line in your code to reference the hs_clock >> instead of the burst clock: >> >> @@ -960,7 +962,7 @@ static void samsung_dsim_set_display_mode(struct >> samsung_dsim *dsi) >> u32 reg; >> >> if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { >> - int byte_clk_khz = dsi->burst_clk_rate / 1000 / 8; >> + int byte_clk_khz = dsi->hs_clock / 1000 / 8; >> int hfp = (m->hsync_start - m->hdisplay) * >> byte_clk_khz / m->clock; >> >> With that change, your patch works with the rest of my code, and I >> think it's easier to read, and it doesn't involve recalculating the >> clock speed each time since it's cached. If you're OK with that, I'll >> incorporate your code into V2 of my series, and I'll apply my changes >> as a subsequent patch. I hope to be able to send out V2 this weekend. >> > That's good to hear! Seems we are converging here. Feel free to pick up > the patch, that's also easier for me as I don't have to resend with CC > fixed. > >> I would be curious to know frm Marek Szyprowski what the impact is on >> the Samsung devices, if any. >> > Since I messed up the list CC you also couldn't see his reply to my > patch: > > | Tested-by: Marek Szyprowski > | > | Works fine on the Exynos based boards I have in my test farm. I didn't follow this discussion, I'm a bit busy with other stuff. I've just tested this series and patch #3 break Exynos based board. If you want me to test anything else (might be a work-in-progress code), just let me know by the separate mail. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland