Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4789636rwd; Sun, 11 Jun 2023 15:31:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QBAcph8iwnwXKXZ0Tjken3R4ka/MP2wFpvjKXpV9z+ddWj2BTHeTi+V99Ft4rvUpBNGFD X-Received: by 2002:a17:906:ef07:b0:96a:1c2a:5a38 with SMTP id f7-20020a170906ef0700b0096a1c2a5a38mr6825691ejs.11.1686522673946; Sun, 11 Jun 2023 15:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686522673; cv=none; d=google.com; s=arc-20160816; b=BZLHI5pwNb883DxUjtK7Mi9qrwv5RcmhCYxswx+nyavTbLNiD1Nz0z2yyQbXB6ms/v DsQ3mQola6o94dkisNh87wysL9KrP0ocx+//eXIhspY/4x3OCi+x7JLw8DdOcFDWyIe2 KK0SGq1qG46VgMb5sjw0HINRcwW5bKBIXSjtVsUhpiywrmdd4Nbz1QVvRpDnsdREsvMp rskW+Gay/xFWHQjldSzGtpaCcKzFAZVVf9juhWqL35RdOQ5yfZYMKyHNN7FvXivw9YLs J99m5Yo48KOoSHI/R8gr/cJubKdaiwEIj1hz4z4Q2scQO9x6McbQk1ybwyCvh4S3XmG7 2h1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Xbc9PtzDlQKXNLKeaTnfsAHAFIiJAnvvylVj+QFaxaY=; b=YK3nC4KH4aRxqBhq5wteJ5xhUKvl1/h+TkGvqO7Rcy4TldjdsvTIgk6TpgPCtuH0gc ERZQW8a2X3DwVoQ8mbqD0GMXjFZD8nVq1odNVZz65edh0VG7XRmHpW5nhFfEG/yQkC3c FvM06XL3+5OaHOmu3M/rOHWAlxwQF+cuF/bhUJlSu5k00WTANuBvU21zbXMOuzYXO06N +SA9Krgnvn6znqKCJUl2dJ43qnPXU8nauSHOHbr0THx/xtAUYy9HHndSqclikkMrvvyS XvDqJ84DQlhbdxKvszbE0QUbWpZQIQ9GR30zC3iYsTseOVneNINsFy0FAOgBn3+ON3fu tJdg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b19-20020a170906661300b0094f1de9030dsi3012951ejp.897.2023.06.11.15.30.49; Sun, 11 Jun 2023 15:31:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229725AbjFKV7U (ORCPT + 99 others); Sun, 11 Jun 2023 17:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbjFKV7T (ORCPT ); Sun, 11 Jun 2023 17:59:19 -0400 Received: from relay01.th.seeweb.it (relay01.th.seeweb.it [IPv6:2001:4b7a:2000:18::162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D8D5E48; Sun, 11 Jun 2023 14:59:18 -0700 (PDT) Received: from SoMainline.org (94-211-6-86.cable.dynamic.v4.ziggo.nl [94.211.6.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r1.th.seeweb.it (Postfix) with ESMTPSA id 08BCE1F5D4; Sun, 11 Jun 2023 23:59:16 +0200 (CEST) Date: Sun, 11 Jun 2023 23:59:14 +0200 From: Marijn Suijten To: Jessica Zhang Cc: freedreno@lists.freedesktop.org, Sean Paul , Abhinav Kumar , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Rob Clark , Daniel Vetter , linux-arm-msm@vger.kernel.org, Dmitry Baryshkov , David Airlie Subject: Re: [Freedreno] [PATCH v5 2/5] drm/msm/dsi: Adjust pclk rate for compression Message-ID: References: <20230405-add-dsc-support-v5-0-028c10850491@quicinc.com> <20230405-add-dsc-support-v5-2-028c10850491@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 2023-06-08 17:56:47, Jessica Zhang wrote: > > As discussed before we realized that this change is more-or-less a hack, > > since downstream calculates pclk quite differently - at least for > > command-mode panels. Do you still intend to land this patch this way, > > or go the proper route by introducing the right math from the get-go? > > Or is the math at least correct for video-mode panels? > > Sorry but can you please clarify what exactly is incorrect or different > about this math when compared to downstream? And, if you think that this > math is incorrect, what exactly has to be changed to make it the "right > math"? > > We've already shown step-by-step [1] not only how the resulting pclk > from the downstream code matches out upstream calculations, but also how > the inclusion of porches in the upstream math would make up for the fact > that upstream has no concept of transfer time [2]. But it doesn't match, unless one hardcodes the desired clock (and/or tranfer_time calculations) in a panel driver and uses that to come up with artificial porches in the DRM mode. > If the lack of transfer time in the upstream math is the issue, I > believe that that's not within the scope of this series, as transfer > time is not something specific to DSC. Yes, that is the issue, and there is zero documentation in this patch describing that it is currently a workaround to rescale the hdisplay portion. After all, when there are no porches pretending to make up for the lack of transfer time, this code will be obsolete. > Moreover, as stated in an earlier revision [3], there is no way to > validate DSC over DSI for video mode. As far as I know, we do not have a > way to validate video mode datapath for DSI in general. It was just a question wheter a calculation of this form is correct for video mode, where porches are used and not - afaik - tranfer time? > [1] https://gitlab.freedesktop.org/drm/msm/-/issues/24#note_1936144 > [2] https://gitlab.freedesktop.org/drm/msm/-/issues/24#note_1945792 > [3] > https://patchwork.freedesktop.org/patch/535117/?series=117219&rev=1#comment_970492 > > > > > This function requires a documentation comment to explain that all. > > > >> + const struct drm_dsc_config *dsc) > >> +{ > >> + int new_hdisplay = DIV_ROUND_UP(mode->hdisplay * drm_dsc_get_bpp_int(dsc), > > > > This sounds like a prime candidate for msm_dsc_get_bytes_per_line(), if > > bits_per_component==8 is assumed. In fact, it then becomes identical > > to the following line in dsi_host.c which you added previously: > > > > hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), 3); > > > > If not, what is the difference between these two calculations? Maybe > > they both need to be in a properly-named helper. > > While the math technically matches up (assuming, also, that > mode->hdisplay == slice_width * slice_count for all cases), there are > conceptual differences between the pclk and hdisplay calculations. > > Just to reiterate what was already said on IRC: > > In the pclk calculation, we're multiplying pclk by the compression ratio > (which would be target_bpp / src_bpp) -- please note that here, we > calculate src_bpp by doing bpc * 3. > > In the hdisplay calculation, we calculate the bytes per line and divide > by 3 (bytes) to account for the fact that we can only process 3 bytes > per pclk cycle. Your comment in v6 explains that hdisplay is divided by 3 because "DPU sends 3 bytes per pclk cycle to DSI". That inherently describes **a relation between hdisplay and pclk** so why is the math then different? After all, pclk is calculated based on the number of bytes (after DSC compression) that need to be sent from DPU to DSI... and that has nothing to do with the number of source bytes. Note that the original hdisplay neither has any notion of bytes: it is the _number of horizontal pixels_. > So while I understand why you would want to put this behind a shared > helper, I think abstracting the pclk and hdisplay math away would > obfuscate the conceptual difference between the 2 calculations. That difference is still unclear, FWIW. > >> + dsc->bits_per_component * 3); And bits_per_component hasn't been used before yet... It is the number of bits in the original image, so this could just be dsi_get_bpp() as used elsewhere? > > > > As we established in the drm/msm issue [2] there is currently a > > confusion whether this /3 (and the /3 in dsi_timing_setup) come from the > > ratio between dsi_get_bpp() and dsc->bpp or something else. Can you > > clarify that with constants and comments? > > Sure, we are planning to add a patch to the end of this series > documenting the math. Why can't you - at least for the new math introduced right here - document it right from the get-go? Having a separate patch to add it seems extraneous; though extra documentation for existing code is always welcome. - Marijn