Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3117805rdb; Thu, 16 Nov 2023 00:01:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuOQSR2feidGxgophiexOZoJStdkKR2uXhb64lF7TtjMDVkRMzDiTsYyAldsZfTv5lvW5w X-Received: by 2002:a05:6808:199:b0:3af:795d:b74b with SMTP id w25-20020a056808019900b003af795db74bmr13637101oic.50.1700121711863; Thu, 16 Nov 2023 00:01:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700121711; cv=none; d=google.com; s=arc-20160816; b=t+MWePqq6jR7URh3rDgcy7qg4LK3XwTKLTuC1KRjQl8Zr+2mW6wyJjzZYeuYIUoPNZ x7hNh72Veuwjpuq0UnGNHUX4hWaZmpAo7olTBd7dCwLZBg0DzhX5KI6OuMtwGr/dqDPi ly+LOFQ6zxNd73+jAyOCQ9PDFcu/I18GyYAnnRBvC/3YRusBdYhWd2zEL2i5Ss217PvO 1I3QZC65CEeCWC1MInWhOf1DLjWoypbpBJct/OpJds13RuLzOi7UF7tRFJ0dLA3PXFa5 GT26cUNc5T40QYyqKBREpUJKd/q3NJce2KA9f/iqIrw2PWp6n+sEGKpX3ztmLbEKG91A LTuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=tb1X4KpeIfR7YuU+9FGfgBz5jQqP4HMT01BOCR63WJc=; fh=OIGwdmvqc16swakll8QclR/tIMfddQXy4C6CPb3sT38=; b=Zb3kl7tr+IWk05NdwJ2m5I2H9bLS0/6WbGmHTj0C8kx3op3hmRPNDAccg1qqlHm1x8 FatOAhPeWzTB5hStxNZmo7K58wVQVVdr4lVh2asugA9bOmBWAKndBOrsHgh+xh1cGMxz //6v6JErfkYZFDs1TdHOZMiJn9rB03WVuT9CuBiTmJmLM6lg4CxRH2gFpZNtqET6nsA9 F10JvzgMT9FkWo7ptNNrx5aYS2yrOPSc3ckLj24w2rFD/imXNh90SdUa+TCzF3dCuE83 D4bZQa9Mm2iHsUHc/lU280VAXUa+ts7kEMkuPs9h+Cu4uqzPpkNo52jbniqxjjRQimqw 737A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rock-chips.com header.s=default header.b=KWqvvflA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e7-20020a656887000000b00588fdd9504bsi11305185pgt.858.2023.11.16.00.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:01:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@rock-chips.com header.s=default header.b=KWqvvflA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C45108080EF8; Thu, 16 Nov 2023 00:01:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbjKPIBK (ORCPT + 99 others); Thu, 16 Nov 2023 03:01:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbjKPIBJ (ORCPT ); Thu, 16 Nov 2023 03:01:09 -0500 X-Greylist: delayed 2093 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 16 Nov 2023 00:01:04 PST Received: from mail-m118112.qiye.163.com (mail-m118112.qiye.163.com [115.236.118.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4814319D; Thu, 16 Nov 2023 00:01:04 -0800 (PST) DKIM-Signature: a=rsa-sha256; b=KWqvvflA9+/axwizsRSRSGyg5fk6IiUM3lVg4IWeuLgSTHP3EQwrAHevkwLc9fj1YaVp0MhVr5sxIW+M6U3bH5A8RWx1FFuNaXhOfQX4jKKO0eplRABeNejJiZklHazkzs1VNUFwz0Ei+cMawQgO4+qE4HMijB789pKyiY4iVWo=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=tb1X4KpeIfR7YuU+9FGfgBz5jQqP4HMT01BOCR63WJc=; h=date:mime-version:subject:message-id:from; Received: from [172.16.12.141] (unknown [58.22.7.114]) by mail-m12779.qiye.163.com (Hmail) with ESMTPA id A79AA7801AF; Thu, 16 Nov 2023 16:00:06 +0800 (CST) Message-ID: Date: Thu, 16 Nov 2023 16:00:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 09/11] drm/rockchip: vop2: Add support for rk3588 Content-Language: en-US To: Sascha Hauer Cc: Andy Yan , heiko@sntech.de, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, devicetree@vger.kernel.org, sebastian.reichel@collabora.com, kever.yang@rock-chips.com, chris.obbard@collabora.com References: <20231114112534.1770731-1-andyshrk@163.com> <20231114112855.1771372-1-andyshrk@163.com> <20231115090823.GY3359458@pengutronix.de> <229557d7-beec-44e0-9ee6-4a962b33ec79@rock-chips.com> <20231116075015.GG3359458@pengutronix.de> From: Andy Yan In-Reply-To: <20231116075015.GG3359458@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZQxkZGVZKH0weGEofGR9NQ0pVEwETFh oSFyQUDg9ZV1kYEgtZQVlOQ1VJSVVMVUpKT1lXWRYaDxIVHRRZQVlPS0hVSk5MSUpJVUpLS1VKQl kG X-HM-Tid: 0a8bd724fb70b24fkuuua79aa7801af X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NU06Pzo6Pzw8KUIOMiocFBA0 SyNPCxRVSlVKTEtLSklKTUtMT0NCVTMWGhIXVRoVHwJVAhoVOwkUGBBWGBMSCwhVGBQWRVlXWRIL WUFZTkNVSUlVTFVKSk9ZV1kIAVlBT05NTjcG X-Spam-Status: No, score=0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 00:01:20 -0800 (PST) Hi Sascha: On 11/16/23 15:50, Sascha Hauer wrote: > On Thu, Nov 16, 2023 at 03:24:54PM +0800, Andy Yan wrote: >>> case ROCKCHIP_VOP2_EP_HDMI0: >>> case ROCKCHIP_VOP2_EP_HDMI1: >>> ... >>> } >>> >>> would look a bit better overall. >>> >>>> + /* >>>> + * K = 2: dclk_core = if_pixclk_rate > if_dclk_rate >>>> + * K = 1: dclk_core = hdmie_edp_dclk > if_pixclk_rate >>>> + */ >>>> + if (output_mode == ROCKCHIP_OUT_MODE_YUV420) { >>>> + dclk_rate = dclk_rate >> 1; >>>> + K = 2; >>>> + } >>>> + >>>> + if_pixclk_rate = (dclk_core_rate << 1) / K; >>>> + if_dclk_rate = dclk_core_rate / K; >>>> + >>>> + *if_pixclk_div = dclk_rate / if_pixclk_rate; >>>> + *if_dclk_div = dclk_rate / if_dclk_rate; >>> Not sure if this will change with future extensions, but currently >>> *if_pixclk_div will always be 2 and *if_dclk_div will alway be 4, >>> so maybe better write it like this >> >> Yes, the calculation of *if_pixclk_div is always 2 and *if_dclk_div is always 4, >> >> I think calculation formula can give us a clear explanation why is 2 or 4. >> >> considering the great power of rk3588, i think it can calculate it very easy. > Sure it can. My concern is not the CPU time it takes to do that > equation, but more the readability of the code. For me as a reader it > might be more easily acceptable that both dividers have fixed values > than it is to understand the equation. > > Your mileage may vary, I won't insist on this. Or I make it as fixed values, and leave the calculation formula as comments ? > >>> >>>> + *dclk_core_div = dclk_rate / dclk_core_rate; >>> *dclk_core_div is calculated the same way for all cases. You could pull >>> this out of the if/else. >> Okay, will do. >>>> + } else if (vop2_output_if_is_edp(id)) { >>>> + /* edp_pixclk = edp_dclk > dclk_core */ >>>> + if_pixclk_rate = v_pixclk / K; >>>> + if_dclk_rate = v_pixclk / K; >>> if_dclk_rate is unused here. >> >> It will be removed in next version. >> >>>> + dclk_rate = if_pixclk_rate * K; >>>> + *dclk_core_div = dclk_rate / dclk_core_rate; >>>> + *if_pixclk_div = dclk_rate / if_pixclk_rate; >>>> + *if_dclk_div = *if_pixclk_div; >>> Both *if_pixclk_div and *if_dclk_div will always be 1. >> Actually,  they will be the value of K here,  if it work at split mode(two >> >> edp connect to one VP, one show the image for left half, one for right half, >> >> a function like a dual channel mipi dsi). >> >> I know it split mode is not supported by the current mainline, but i think keep > Ok. > > Sascha > >