From patchwork Fri May 21 12:49:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444670 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp946523jac; Fri, 21 May 2021 05:50:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQWRjrCbAuXzIGJVNiT+JqJ4a30KDzvzMst/J5lqV31/1tYPcDtW+7sR3YKQ7fjlulVu7K X-Received: by 2002:a17:90a:4545:: with SMTP id r5mr11019425pjm.51.1621601407939; Fri, 21 May 2021 05:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601407; cv=none; d=google.com; s=arc-20160816; b=X25b+19Bim38Jir6c6WFQaq2Tg+gCtfrBRlnr8l++whyreZS2oDJSzXzmujvYUuH0E Coqhj1BkduGUPidQfWCDP6u1qrQo2s5YWq+SJ6c9inSl5zRtA8KBC1NcDIkNFyKebeLe yQLU/Vuyaldz9Iqhw0+l4DPVZsEjjkKlKYAm4A7TET/WhlVkMAj5QsqhDvP6J1rq0/oL MT80M+HC5VDb9MIHrA97wOXaZbZ+mnxsj/IkzuUTYWVhnFpcLlFS6FoOejtA+nDZGVYl t7x4VGQdZo7kRGgGb7cTJlO0nQgkgZ5E88SzCUjDdUNvKrfJ8FctlwWdANXF+jlr4GS7 fElQ== 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=yI+oQr1s/sKiPNY0eQBU/prVaCIigfQn+NctM3E+dvE=; b=ocSMFY8Ua6TMTdokiQVeK7jGlxbK3bEsHfqd23nlnWSf9A/RHjw3cRAJYjEcqLjqRw qQLjp4fa9Gk2VXfiGKVWYyf5X4pdVeDgajfYXfWKhIpjYnDgGg6Qt6hxMYJgo+ygM5va gmWK3wNRWm7HXkRely7j874JCu3DVI216EB0Q2lrRTL15CRo6TokaXNVoXB5aqhN1A7Q hs6sccsNlM54owebq2gWRlslsPq75XMfl5dlwd5S77c6tk3HPhFBsHvtKHrQ98hTMSRf plp0sgeZgNjWuqFFe2AEyAAI9vgihFpxvGLJGta8phpi/Gxi+fUrywph/0WlimuxocJI F1pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=S7mAlvha; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id p20si6925311plq.437.2021.05.21.05.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=S7mAlvha; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEEC36E4F9; Fri, 21 May 2021 12:50:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 92E9D6E4F8; Fri, 21 May 2021 12:50:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A5BEC613DD; Fri, 21 May 2021 12:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601403; bh=Eo+Q/n/ObHKYPA8KdmfJSeka049NRwoo0j4Nc78qMAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S7mAlvhails2QDce0UEUE5pSdbFrXQgTe0wQ0BT0JeYpvxalnkvc8GPXDKOsaeT+c 0LVAWUShmJWd7gu9H8fu/MFT3MQZEy8ko9/7KJ6CvS++2KJjvTfUydORnDBvc66Jak x+MaNuFzcT9p8NEp43E8t/Kdm1/l1cf134Knd64YT9ObRwZYSVfYi0LPuYY04qqrip qUsu9UpI21WpbglGBbYtldFWOGxOz1cskzFaQRJQLBMeuBl9voyIIB/rg4cFt+xzLE kmLgonDfx5cuWuC6xFxoF1B/rx7FzctL99/jwHCKxiukKicTFD30XtDJwoz1cIRokt XkqCKqEj+W+mQ== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 01/13] drm/dsc: Add dsc pps header init function Date: Fri, 21 May 2021 18:19:30 +0530 Message-Id: <20210521124946.3617862-2-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We required a helper to create and set the dsc_dce_header, so add the dsc_dce_header and API drm_dsc_dsi_pps_header_init Signed-off-by: Vinod Koul --- drivers/gpu/drm/drm_dsc.c | 11 +++++++++++ include/drm/drm_dsc.h | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) -- 2.26.3 diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c index ff602f7ec65b..0c1b745090e2 100644 --- a/drivers/gpu/drm/drm_dsc.c +++ b/drivers/gpu/drm/drm_dsc.c @@ -49,6 +49,17 @@ void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header) } EXPORT_SYMBOL(drm_dsc_dp_pps_header_init); +void drm_dsc_dsi_pps_header_init(struct dsc_dce_header *dsc_header) +{ + memset(dsc_header, 0, sizeof(*dsc_header)); + + dsc_header->bp0 = 0x0A; + dsc_header->bp1 = 1; + dsc_header->bp4 = 10; + dsc_header->bp6 = 128; +} +EXPORT_SYMBOL(drm_dsc_dsi_pps_header_init); + /** * drm_dsc_dp_rc_buffer_size - get rc buffer size in bytes * @rc_buffer_block_size: block size code, according to DPCD offset 62h diff --git a/include/drm/drm_dsc.h b/include/drm/drm_dsc.h index bbe120f461e5..5a3bbeb3e12f 100644 --- a/include/drm/drm_dsc.h +++ b/include/drm/drm_dsc.h @@ -602,8 +602,24 @@ struct drm_dsc_pps_infoframe { struct drm_dsc_picture_parameter_set pps_payload; } __packed; +struct dsc_dce_header { + u8 bp0; + u8 bp1; + u8 bp2; + u8 bp3; + u8 bp4; + u8 bp5; + u8 bp6; +} __packed; + +struct drm_dsi_dsc_infoframe { + struct dsc_dce_header dsc_header; + struct drm_dsc_picture_parameter_set pps_payload; +} __packed; + void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header); int drm_dsc_dp_rc_buffer_size(u8 rc_buffer_block_size, u8 rc_buffer_size); +void drm_dsc_dsi_pps_header_init(struct dsc_dce_header *dsc_header); void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_sdp, const struct drm_dsc_config *dsc_cfg); int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); From patchwork Fri May 21 12:49:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444671 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp946703jac; Fri, 21 May 2021 05:50:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQpcdfpqoq8kuwlzAmAh4iBFLfT4nN+msDGELaX+p5eP1sMj6Mw/u25Gezni47kcTmpW5r X-Received: by 2002:a17:902:854a:b029:ef:3f99:91a7 with SMTP id d10-20020a170902854ab02900ef3f9991a7mr12157636plo.74.1621601416244; Fri, 21 May 2021 05:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601416; cv=none; d=google.com; s=arc-20160816; b=TUDyq9r606ff457JlQfinyeQZkvxE07Oe60ae1PpRdLbqvA8z5gT8SCRYoDs4fso98 BqnO+WlkRhF1simzEi7Y0PAqBae+JxY7Ownl5qt2a9CkUfLWOSZv4T/LtX5iA6L53F5Y O2yeuFwt7OKL671I2BuXapyY6NM27qhEQgHWW91GLV8q4VHO/UQGy6/jYpl/CMsZBRwQ lO/zhM7wDU7JS/WIgnxtdwd7FBVfPgge94SRv4mYqTptIWNqZuJFiTycKavLpLjo5yM0 3kovlodPw93j4i0GmSQFZDOJXrwDf5+UJQXgdHfecRYCRSUi1AGuL/e3oNjAfSU0kQqS hH9w== 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=nLLjlQfsKKMIbomL4SW9oje9MYEEm8y8jzYvNLs0QDE=; b=qQTIXOz/muISu3ujFpVYQOmjOt7UUZmxvZicozXX2g/mYmhVSGtD+uB+EGZ7hVXm2f DfMj19OJFfoZnUe36qeQY7K3Bxd9WdJGLXNLbC68G9kccwhpZ3IR/tWC4na6abdznZaQ ACbHoEwkL7Ra6R2Wk9twF/AQtWCWDmjL6F4A/DK4tx0d3Q4mv/5myPlvgZQjooPvW2xV K4wI4kNgCXE3g3XKPQupSt/dPPy3kgDe8Pc963Y2d/HxEYySLOeDa8QMURf2Lwj8VKDh D5QwQ8BXfAuj+rjBeGLsKGJF/14jLsQvxfcGmOdYmwaBEEa31jyIFPvgxx/eIbb+YvJP KMow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=swpkH1Ol; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id r34si6654475pgb.320.2021.05.21.05.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=swpkH1Ol; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A35F6E50D; Fri, 21 May 2021 12:50:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CA756E500; Fri, 21 May 2021 12:50:08 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 14B946128A; Fri, 21 May 2021 12:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601408; bh=evW5pHUN/T4rGcgEYxzNl0VVIeE5qNWtjDjSxJvpPkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=swpkH1OlMp8m3dC3Op2knzSP+7dNpwV+GLpnTqKTP6Rv9cOr4ZuDrQg1RerHShygz GWLDF2inM+t6mnDbG2UCW7r6z/TwN1q7YgMWTOaDoVRGulMbiBXG8zG4/5b91XLUTP rDwf1hQ18aLr1h+gRkhRnfQT8Lqeyrv1Hyxyq9Mt1y1Imwn3MLM8ZTGY/hqHpwX4uB TeSq+8VtHdoDVNt4FL7T80PylE2tHdIJvqLYj8bApZz92UPSMmy3eukhXnaatygXaK Jd9UQgB4pJ7MrivQRrAButxeohwGiHLp1cdP/JL73buJlKi0PQaKtPGYBKrDtL3LMS uVKjiCutUDDQg== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 02/13] dt-bindings: msm/dsi: Document Display Stream Compression (DSC) parameters Date: Fri, 21 May 2021 18:19:31 +0530 Message-Id: <20210521124946.3617862-3-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: devicetree@vger.kernel.org, Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , Rob Herring , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DSC enables streams to be compressed before we send to panel. This requires DSC enabled encoder and a panel to be present. So we add this information in board DTS and find if DSC can be enabled and the parameters required to configure DSC are added to binding document along with example Signed-off-by: Vinod Koul --- .../devicetree/bindings/display/msm/dsi.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.26.3 diff --git a/Documentation/devicetree/bindings/display/msm/dsi.txt b/Documentation/devicetree/bindings/display/msm/dsi.txt index b9a64d3ff184..83d2fb92267e 100644 --- a/Documentation/devicetree/bindings/display/msm/dsi.txt +++ b/Documentation/devicetree/bindings/display/msm/dsi.txt @@ -48,6 +48,13 @@ Optional properties: - pinctrl-n: the "sleep" pinctrl state - ports: contains DSI controller input and output ports as children, each containing one endpoint subnode. +- qcom,mdss-dsc-enabled: Display Stream Compression (DSC) is enabled +- qcom,mdss-slice-height: DSC slice height in pixels +- qcom,mdss-slice-width: DSC slice width in pixels +- qcom,mdss-slice-per-pkt: DSC slices per packet +- qcom,mdss-bit-per-component: DSC bits per component +- qcom,mdss-bit-per-pixel: DSC bits per pixel +- qcom,mdss-block-prediction-enable: Block prediction mode of DSC enabled DSI Endpoint properties: - remote-endpoint: For port@0, set to phandle of the connected panel/bridge's @@ -188,6 +195,14 @@ Example: qcom,master-dsi; qcom,sync-dual-dsi; + qcom,mdss-dsc-enabled; + qcom,mdss-slice-height = <16>; + qcom,mdss-slice-width = <540>; + qcom,mdss-slice-per-pkt = <1>; + qcom,mdss-bit-per-component = <8>; + qcom,mdss-bit-per-pixel = <8>; + qcom,mdss-block-prediction-enable; + qcom,mdss-mdp-transfer-time-us = <12000>; pinctrl-names = "default", "sleep"; From patchwork Fri May 21 12:49:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444672 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp946750jac; Fri, 21 May 2021 05:50:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze2GzUj6Yq/K9i/T2BicG2h7M/nF1URDrmMQ3BPg2wLAvqXev1i3VvIhghyWOV9GxO9aXI X-Received: by 2002:a17:90a:6446:: with SMTP id y6mr11075939pjm.17.1621601419098; Fri, 21 May 2021 05:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601419; cv=none; d=google.com; s=arc-20160816; b=pQG8ltN8DVC7IEAVERpGgDvbH97eKUHhaXZxwQZsFnGvZWctmGJViNkROmYfZhK5Un VEgOoSJj4magHPZ/qDtIFR0jnUWNCvIY94BZVJH1PcU4Xvg8UbsISqk7D7ZdUu5ecp4r CRaLJOaiNYPP4wK/ZghloDcA9xkzrB4FbxWKD5oNCdHxKELdhYxtLevRdRqxYQLeeIP3 M73onBkRzqUJRHneK/DmTQ85tuLDRJz9Srd/waG/7lFg5YpuRATZvy6y8pKl/XmQ+lM9 53b0pWTmfxnojG14gAaTKVeQUf5XwPOKlSqRI4hJU45Dw/mPMgIKcVff5Uv998PA0EOZ LzEA== 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=lac2A2nq45E97sBxWQTiV82LZZVgynBApDopQqC7CTY=; b=taXZkz3jtxlh3YH+7AB1RXG/26Ty2FU8rW/+YL+0G+umdq0hwti95Y73nzY+71WFCF +yOoI2f+EB/jmgoEs0ld2GgIxt1tG2u1W4mRYRdxQILe964clEpeHi9Oy2XNCD0tsNg0 MVH7LFU6csGJaiUS9+4RN6MZMoQ4IIKACldfFbSxL8tyaiBx/yH4RenM94Ip2kslIz++ hHUthHIl48odHoC+mFLj95XeY5vEdkttoUVa/kTvyYPIM/2/Jnk68rrTUc3RLluOtcaJ TDkf/DPs1xRYnJk4dZx9yvhz0WSVXBNYPVO7lfZFWHAmHWD/hj1vvBgGUSdMFq6M8GAb nFHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=jm3ngW48; 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=kernel.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 jz15si6409266pjb.145.2021.05.21.05.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:19 -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=@kernel.org header.s=k20201202 header.b=jm3ngW48; 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=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 032016F62A; Fri, 21 May 2021 12:50:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id EDBFB6F626; Fri, 21 May 2021 12:50:12 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 099C3613D9; Fri, 21 May 2021 12:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601412; bh=joPOVMfFdkTNvDjuDBiSMEoUkBTumlx+hNVB8mSmK6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jm3ngW48VGdn+DvF6z2CTLDFmce5IoHySb9lGmb+4yySmLQELwgYsTemllcWCG9HR CYXGiqrSUW3n/dRq4K4r4WlZxwpuVj3oQqSWNP3XlxwMYwU7aJsv4zh4OmoIwdFKMS fZ8QTyckfnaDUvUBhaaSCZtvFkJnECCXgfu7YYjEfZgLuV17z8zY+M7LSKTcyoECIf zy2Fhn0dEp0kqlqDnAvMEMBltciqrcT+BOWdq2mym5w8Gc0UfUs3EAN0oRJJ/iUH9n KChZ5d171GOYs0QbfDtNvwjzlHqL9nqZcsbBLnt5RT9yR9Iu+vZvncZSsONBlYKAaa U9MOyjJvyC9wA== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 03/13] drm/msm/disp/dpu1: Add support for DSC Date: Fri, 21 May 2021 18:19:32 +0530 Message-Id: <20210521124946.3617862-4-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Display Stream Compression (DSC) is one of the hw blocks in dpu, so add support by adding hw blocks for DSC Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/Makefile | 1 + .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 26 +++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 221 ++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h | 79 +++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 13 ++ 5 files changed, 340 insertions(+) create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h -- 2.26.3 diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index 610d630326bb..fd8fc57f1f58 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -61,6 +61,7 @@ msm-y := \ disp/dpu1/dpu_hw_blk.o \ disp/dpu1/dpu_hw_catalog.o \ disp/dpu1/dpu_hw_ctl.o \ + disp/dpu1/dpu_hw_dsc.o \ disp/dpu1/dpu_hw_interrupts.o \ disp/dpu1/dpu_hw_intf.o \ disp/dpu1/dpu_hw_lm.o \ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h index 4dfd8a20ad5c..a699633f7013 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -165,6 +165,7 @@ enum { * @DPU_PINGPONG_TE2 Additional tear check block for split pipes * @DPU_PINGPONG_SPLIT PP block supports split fifo * @DPU_PINGPONG_SLAVE PP block is a suitable slave for split fifo + * @DPU_PINGPONG_DSC Display stream compression blocks * @DPU_PINGPONG_DITHER, Dither blocks * @DPU_PINGPONG_MAX */ @@ -173,10 +174,21 @@ enum { DPU_PINGPONG_TE2, DPU_PINGPONG_SPLIT, DPU_PINGPONG_SLAVE, + DPU_PINGPONG_DSC, DPU_PINGPONG_DITHER, DPU_PINGPONG_MAX }; +/** + * DSC sub-blocks + * @DPU_DSC DSC sub block + * @DPU_DSC_MAX + */ +enum { + DPU_DSC = 0x1, + DPU_DSC_MAX +}; + /** * CTL sub-blocks * @DPU_CTL_SPLIT_DISPLAY CTL supports video mode split display @@ -413,6 +425,7 @@ struct dpu_dspp_sub_blks { struct dpu_pingpong_sub_blks { struct dpu_pp_blk te; struct dpu_pp_blk te2; + struct dpu_pp_blk dsc; struct dpu_pp_blk dither; }; @@ -547,6 +560,16 @@ struct dpu_merge_3d_cfg { const struct dpu_merge_3d_sub_blks *sblk; }; +/** + * struct dpu_dsc_cfg - information of DSC blocks + * @id enum identifying this block + * @base register offset of this block + * @features bit mask identifying sub-blocks/features + */ +struct dpu_dsc_cfg { + DPU_HW_BLK_INFO; +}; + /** * struct dpu_intf_cfg - information of timing engine blocks * @id enum identifying this block @@ -748,6 +771,9 @@ struct dpu_mdss_cfg { u32 merge_3d_count; const struct dpu_merge_3d_cfg *merge_3d; + u32 dsc_count; + struct dpu_dsc_cfg *dsc; + u32 intf_count; const struct dpu_intf_cfg *intf; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c new file mode 100644 index 000000000000..8b8d0553709d --- /dev/null +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c @@ -0,0 +1,221 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2020, Linaro Limited + */ + +#include "dpu_kms.h" +#include "dpu_hw_catalog.h" +#include "dpu_hwio.h" +#include "dpu_hw_mdss.h" +#include "dpu_hw_dsc.h" + +#define DSC_COMMON_MODE 0x000 +#define DSC_ENC 0X004 +#define DSC_PICTURE 0x008 +#define DSC_SLICE 0x00C +#define DSC_CHUNK_SIZE 0x010 +#define DSC_DELAY 0x014 +#define DSC_SCALE_INITIAL 0x018 +#define DSC_SCALE_DEC_INTERVAL 0x01C +#define DSC_SCALE_INC_INTERVAL 0x020 +#define DSC_FIRST_LINE_BPG_OFFSET 0x024 +#define DSC_BPG_OFFSET 0x028 +#define DSC_DSC_OFFSET 0x02C +#define DSC_FLATNESS 0x030 +#define DSC_RC_MODEL_SIZE 0x034 +#define DSC_RC 0x038 +#define DSC_RC_BUF_THRESH 0x03C +#define DSC_RANGE_MIN_QP 0x074 +#define DSC_RANGE_MAX_QP 0x0B0 +#define DSC_RANGE_BPG_OFFSET 0x0EC + +static void dpu_hw_dsc_disable(struct dpu_hw_dsc *dsc) +{ + struct dpu_hw_blk_reg_map *c = &dsc->hw; + + DPU_REG_WRITE(c, DSC_COMMON_MODE, 0); +} + +static void dpu_hw_dsc_config(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc, + u32 mode, bool ich_reset_override) +{ + struct dpu_hw_blk_reg_map *c = &hw_dsc->hw; + u32 data; + u32 initial_lines = dsc->initial_lines; + bool is_cmd_mode = !(mode & BIT(2)); + + DPU_REG_WRITE(c, DSC_COMMON_MODE, mode); + + data = 0; + if (ich_reset_override) + data = 3 << 28; + + if (is_cmd_mode) + initial_lines += 1; + + data |= (initial_lines << 20); + data |= ((dsc->slice_last_group_size) << 18); + /* bpp is 6.4 format, 4 LSBs bits are for fractional part */ + data |= dsc->drm.bits_per_pixel << 12; + data |= (dsc->drm.block_pred_enable << 7); + data |= (dsc->drm.line_buf_depth << 3); + data |= (dsc->drm.simple_422 << 2); + data |= (dsc->drm.convert_rgb << 1); + if (dsc->drm.bits_per_component == 10) + data |= BIT(0); + + DPU_REG_WRITE(c, DSC_ENC, data); + + data = dsc->drm.pic_width << 16; + data |= dsc->drm.pic_height; + DPU_REG_WRITE(c, DSC_PICTURE, data); + + data = dsc->drm.slice_width << 16; + data |= dsc->drm.slice_height; + DPU_REG_WRITE(c, DSC_SLICE, data); + + data = DIV_ROUND_UP(dsc->drm.slice_width * dsc->drm.bits_per_pixel, 8) << 16; + + DPU_REG_WRITE(c, DSC_CHUNK_SIZE, data); + + data = dsc->drm.initial_dec_delay << 16; + data |= dsc->drm.initial_xmit_delay; + DPU_REG_WRITE(c, DSC_DELAY, data); + + data = dsc->drm.initial_scale_value; + DPU_REG_WRITE(c, DSC_SCALE_INITIAL, data); + + data = dsc->drm.scale_decrement_interval; + DPU_REG_WRITE(c, DSC_SCALE_DEC_INTERVAL, data); + + data = 0x00000184; /* only this value works */ + DPU_REG_WRITE(c, DSC_SCALE_INC_INTERVAL, data); + + data = dsc->drm.first_line_bpg_offset; + DPU_REG_WRITE(c, DSC_FIRST_LINE_BPG_OFFSET, data); + + data = dsc->drm.nfl_bpg_offset << 16; + data |= dsc->drm.slice_bpg_offset; + DPU_REG_WRITE(c, DSC_BPG_OFFSET, data); + + data = dsc->drm.initial_offset << 16; + data |= dsc->drm.final_offset; + DPU_REG_WRITE(c, DSC_DSC_OFFSET, data); + + data = dsc->det_thresh_flatness << 10; + data |= dsc->drm.flatness_max_qp << 5; + data |= dsc->drm.flatness_min_qp; + DPU_REG_WRITE(c, DSC_FLATNESS, data); + + data = dsc->drm.rc_model_size; + DPU_REG_WRITE(c, DSC_RC_MODEL_SIZE, data); + + data = dsc->drm.rc_tgt_offset_low << 18; + data |= dsc->drm.rc_tgt_offset_high << 14; + data |= dsc->drm.rc_quant_incr_limit1 << 9; + data |= dsc->drm.rc_quant_incr_limit0 << 4; + data |= dsc->drm.rc_edge_factor; + DPU_REG_WRITE(c, DSC_RC, data); +} + +static void dpu_hw_dsc_config_thresh(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc) +{ + struct drm_dsc_rc_range_parameters *rc = dsc->drm.rc_range_params; + struct dpu_hw_blk_reg_map *c = &hw_dsc->hw; + u32 off = 0x0; + u16 *lp; + int i; + + lp = dsc->drm.rc_buf_thresh; + off = DSC_RC_BUF_THRESH; + for (i = 0; i < DSC_NUM_BUF_RANGES - 1 ; i++) { + DPU_REG_WRITE(c, off, *lp++); + off += 4; + } + + off = DSC_RANGE_MIN_QP; + for (i = 0; i < DSC_NUM_BUF_RANGES; i++) { + DPU_REG_WRITE(c, off, rc[i].range_min_qp); + off += 4; + } + + off = DSC_RANGE_MAX_QP; + for (i = 0; i < 15; i++) { + DPU_REG_WRITE(c, off, rc[i].range_max_qp); + off += 4; + } + + off = DSC_RANGE_BPG_OFFSET; + for (i = 0; i < 15; i++) { + DPU_REG_WRITE(c, off, rc[i].range_bpg_offset); + off += 4; + } +} + +static struct dpu_dsc_cfg *_dsc_offset(enum dpu_dsc dsc, + struct dpu_mdss_cfg *m, + void __iomem *addr, + struct dpu_hw_blk_reg_map *b) +{ + int i; + + for (i = 0; i < m->dsc_count; i++) { + if (dsc == m->dsc[i].id) { + b->base_off = addr; + b->blk_off = m->dsc[i].base; + b->length = m->dsc[i].len; + b->hwversion = m->hwversion; + b->log_mask = DPU_DBG_MASK_DSC; + return &m->dsc[i]; + } + } + + return NULL; +} + +static void _setup_dsc_ops(struct dpu_hw_dsc_ops *ops, + unsigned long cap) +{ + ops->dsc_disable = dpu_hw_dsc_disable; + ops->dsc_config = dpu_hw_dsc_config; + ops->dsc_config_thresh = dpu_hw_dsc_config_thresh; +}; + +static struct dpu_hw_blk_ops dpu_hw_ops = { + .start = NULL, + .stop = NULL, +}; + +struct dpu_hw_dsc *dpu_hw_dsc_init(enum dpu_dsc idx, void __iomem *addr, + struct dpu_mdss_cfg *m) +{ + struct dpu_hw_dsc *c; + struct dpu_dsc_cfg *cfg; + + c = kzalloc(sizeof(*c), GFP_KERNEL); + if (!c) + return ERR_PTR(-ENOMEM); + + cfg = _dsc_offset(idx, m, addr, &c->hw); + if (IS_ERR_OR_NULL(cfg)) { + kfree(c); + return ERR_PTR(-EINVAL); + } + + c->idx = idx; + c->caps = cfg; + _setup_dsc_ops(&c->ops, c->caps->features); + + dpu_hw_blk_init(&c->base, DPU_HW_BLK_DSC, idx, &dpu_hw_ops); + + return c; +} + +void dpu_hw_dsc_destroy(struct dpu_hw_dsc *dsc) +{ + if (dsc) + dpu_hw_blk_destroy(&dsc->base); + kfree(dsc); +} diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h new file mode 100644 index 000000000000..c680fd948865 --- /dev/null +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (c) 2020, Linaro Limited */ + +#ifndef _DPU_HW_DSC_H +#define _DPU_HW_DSC_H + +#include + +#define DSC_MODE_SPLIT_PANEL BIT(0) +#define DSC_MODE_MULTIPLEX BIT(1) +#define DSC_MODE_VIDEO BIT(2) + +struct dpu_hw_dsc; + +/** + * struct dpu_hw_dsc_ops - interface to the dsc hardware driver functions + * Assumption is these functions will be called after clocks are enabled + */ +struct dpu_hw_dsc_ops { + /** + * dsc_disable - disable dsc + * @hw_dsc: Pointer to dsc context + */ + void (*dsc_disable)(struct dpu_hw_dsc *hw_dsc); + + /** + * dsc_config - configures dsc encoder + * @hw_dsc: Pointer to dsc context + * @dsc: panel dsc parameters + * @mode: dsc topology mode to be set + * @ich_reset_override: option to reset ich + */ + void (*dsc_config)(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc, + u32 mode, bool ich_reset_override); + + /** + * dsc_config_thresh - programs panel thresholds + * @hw_dsc: Pointer to dsc context + * @dsc: panel dsc parameters + */ + void (*dsc_config_thresh)(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc); +}; + +struct dpu_hw_dsc { + struct dpu_hw_blk base; + struct dpu_hw_blk_reg_map hw; + + /* dsc */ + enum dpu_dsc idx; + const struct dpu_dsc_cfg *caps; + + /* ops */ + struct dpu_hw_dsc_ops ops; +}; + +/** + * dpu_hw_dsc_init - initializes the dsc block for the passed dsc idx. + * @idx: DSC index for which driver object is required + * @addr: Mapped register io address of MDP + * @m: Pointer to mdss catalog data + * Returns: Error code or allocated dpu_hw_dsc context + */ +struct dpu_hw_dsc *dpu_hw_dsc_init(enum dpu_dsc idx, void __iomem *addr, + struct dpu_mdss_cfg *m); + +/** + * dpu_hw_dsc_destroy - destroys dsc driver context + * @dsc: Pointer to dsc driver context returned by dpu_hw_dsc_init + */ +void dpu_hw_dsc_destroy(struct dpu_hw_dsc *dsc); + +static inline struct dpu_hw_dsc *to_dpu_hw_dsc(struct dpu_hw_blk *hw) +{ + return container_of(hw, struct dpu_hw_dsc, base); +} + +#endif /* _DPU_HW_DSC_H */ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h index 09a3fb3e89f5..1b72c11090ee 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h @@ -97,6 +97,7 @@ enum dpu_hw_blk_type { DPU_HW_BLK_WB, DPU_HW_BLK_DSPP, DPU_HW_BLK_MERGE_3D, + DPU_HW_BLK_DSC, DPU_HW_BLK_MAX, }; @@ -176,6 +177,17 @@ enum dpu_ctl { CTL_MAX }; +enum dpu_dsc { + DSC_NONE = 0, + DSC_0, + DSC_1, + DSC_2, + DSC_3, + DSC_4, + DSC_5, + DSC_MAX +}; + enum dpu_pingpong { PINGPONG_0 = 1, PINGPONG_1, @@ -437,5 +449,6 @@ struct dpu_mdss_color { #define DPU_DBG_MASK_VBIF (1 << 8) #define DPU_DBG_MASK_ROT (1 << 9) #define DPU_DBG_MASK_DSPP (1 << 10) +#define DPU_DBG_MASK_DSC (1 << 11) #endif /* _DPU_HW_MDSS_H */ From patchwork Fri May 21 12:49:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444674 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp946932jac; Fri, 21 May 2021 05:50:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+AwJ4rfObznUALKAaQ3UATd+/19M8yNsv3qdHUiCmElu7KsrqUh63VURNcNxfWwE9Puxy X-Received: by 2002:aa7:8194:0:b029:2aa:db3a:4c1d with SMTP id g20-20020aa781940000b02902aadb3a4c1dmr9880845pfi.58.1621601431954; Fri, 21 May 2021 05:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601431; cv=none; d=google.com; s=arc-20160816; b=qEwivLCu+5x9frtDZaM4OMIBUS9ngBPVqy0yhDQfqTZwGNOVKupFTapLe/6hH5l6if ZcTAaw36r2LDcBS2toNGkIG8ogZLvbJS1Xy7FP4D+1pzCbLaj6SDzd0Ymh/f+kI/hO4t R6aWzNbGRL6VupOHnZB7FXf23MzuWehk/wd6r65OW3/hSIgsmVFLTHyAjuDgnLRMuQmF zIu0c3rgqpUyha7xWFThKrZggZPG+ENtKM6J5M9jYw4ly09q1BANj2D/zt9JjRubPHef 6kEVkZSkCqRkenVIC51h7sMpIiqSLIkJwcDRYdKFwYQemgao8asdWNKuGL56GtDiCPSy HsPQ== 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=lac2A2nq45E97sBxWQTiV82LZZVgynBApDopQqC7CTY=; b=yGAq20An9paAi5mCduV3+gq/26LmdclTXQ0cn6tvPZIB0tA2CKEcVKKCJpl7FhpisV Au/w3X3dbvvSaPI1ersdvRHw+kRWwlf7DaBT7tjvcI8UsdoZt7gCJNGPbdne5Y6vyCs1 bcmSmpGudQJFrMcAm2u9ZovyXlYMbCpc57l0D+N4DjBnYqknxtanGhVUW7EnnsLBHrBw L1G5a+kp3VSZzGhe2zsjglBD2fyt+gjkZb5L5ZDM1qEKuABQ2HQ9h96ngZwe4OWt3Kkv 7SvYnS9VgRbopk7btg04CdSqqyGhBeKOu+oXn1LJKrWAid+rgGrapRv65CS/4Q42QA4q ZXKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=VpLjqC0z; 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=kernel.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 h30si6671405pgb.405.2021.05.21.05.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:31 -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=@kernel.org header.s=k20201202 header.b=VpLjqC0z; 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=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D6C96F63B; Fri, 21 May 2021 12:50:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 324D66E4F8; Fri, 21 May 2021 12:50:26 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 411B6613D8; Fri, 21 May 2021 12:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601426; bh=joPOVMfFdkTNvDjuDBiSMEoUkBTumlx+hNVB8mSmK6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VpLjqC0zGS/r8EjU0xdz4P1V18OwOU/vPVgHFG2OOAq8O42ZPX+25IyjJdxte/2Ik FPaAzUpxxJbSvhEmEBR4E97Jxc6KAoGT5tNP7byUh/bD25JAvN/O2MZ2XnaqSIJtAT EcdAvKEMgI64m05SAn0ClfJbAZERGKJcreWUCqctPpWjKKhRsmCyQnZfyAX3X5PHF+ uamN6PvdLgkjJtllXmK627TBYEvTtBqwH7UGb3E8m96nvhyiPq4lF0d2/EVYDdVCiu rQheTHqY1/TNtKNXhQ0MzEKKCOWBPBb0SWtUsntABt8ykK1j6EueTK9lKz7ZXKU6I1 rQ8iXgSwmf4KA== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 04/13] drm/msm/disp/dpu1: Add support for DSC Date: Fri, 21 May 2021 18:19:35 +0530 Message-Id: <20210521124946.3617862-7-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Display Stream Compression (DSC) is one of the hw blocks in dpu, so add support by adding hw blocks for DSC Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/Makefile | 1 + .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 26 +++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 221 ++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h | 79 +++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 13 ++ 5 files changed, 340 insertions(+) create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c create mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h -- 2.26.3 diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index 610d630326bb..fd8fc57f1f58 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -61,6 +61,7 @@ msm-y := \ disp/dpu1/dpu_hw_blk.o \ disp/dpu1/dpu_hw_catalog.o \ disp/dpu1/dpu_hw_ctl.o \ + disp/dpu1/dpu_hw_dsc.o \ disp/dpu1/dpu_hw_interrupts.o \ disp/dpu1/dpu_hw_intf.o \ disp/dpu1/dpu_hw_lm.o \ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h index 4dfd8a20ad5c..a699633f7013 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -165,6 +165,7 @@ enum { * @DPU_PINGPONG_TE2 Additional tear check block for split pipes * @DPU_PINGPONG_SPLIT PP block supports split fifo * @DPU_PINGPONG_SLAVE PP block is a suitable slave for split fifo + * @DPU_PINGPONG_DSC Display stream compression blocks * @DPU_PINGPONG_DITHER, Dither blocks * @DPU_PINGPONG_MAX */ @@ -173,10 +174,21 @@ enum { DPU_PINGPONG_TE2, DPU_PINGPONG_SPLIT, DPU_PINGPONG_SLAVE, + DPU_PINGPONG_DSC, DPU_PINGPONG_DITHER, DPU_PINGPONG_MAX }; +/** + * DSC sub-blocks + * @DPU_DSC DSC sub block + * @DPU_DSC_MAX + */ +enum { + DPU_DSC = 0x1, + DPU_DSC_MAX +}; + /** * CTL sub-blocks * @DPU_CTL_SPLIT_DISPLAY CTL supports video mode split display @@ -413,6 +425,7 @@ struct dpu_dspp_sub_blks { struct dpu_pingpong_sub_blks { struct dpu_pp_blk te; struct dpu_pp_blk te2; + struct dpu_pp_blk dsc; struct dpu_pp_blk dither; }; @@ -547,6 +560,16 @@ struct dpu_merge_3d_cfg { const struct dpu_merge_3d_sub_blks *sblk; }; +/** + * struct dpu_dsc_cfg - information of DSC blocks + * @id enum identifying this block + * @base register offset of this block + * @features bit mask identifying sub-blocks/features + */ +struct dpu_dsc_cfg { + DPU_HW_BLK_INFO; +}; + /** * struct dpu_intf_cfg - information of timing engine blocks * @id enum identifying this block @@ -748,6 +771,9 @@ struct dpu_mdss_cfg { u32 merge_3d_count; const struct dpu_merge_3d_cfg *merge_3d; + u32 dsc_count; + struct dpu_dsc_cfg *dsc; + u32 intf_count; const struct dpu_intf_cfg *intf; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c new file mode 100644 index 000000000000..8b8d0553709d --- /dev/null +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c @@ -0,0 +1,221 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2020, Linaro Limited + */ + +#include "dpu_kms.h" +#include "dpu_hw_catalog.h" +#include "dpu_hwio.h" +#include "dpu_hw_mdss.h" +#include "dpu_hw_dsc.h" + +#define DSC_COMMON_MODE 0x000 +#define DSC_ENC 0X004 +#define DSC_PICTURE 0x008 +#define DSC_SLICE 0x00C +#define DSC_CHUNK_SIZE 0x010 +#define DSC_DELAY 0x014 +#define DSC_SCALE_INITIAL 0x018 +#define DSC_SCALE_DEC_INTERVAL 0x01C +#define DSC_SCALE_INC_INTERVAL 0x020 +#define DSC_FIRST_LINE_BPG_OFFSET 0x024 +#define DSC_BPG_OFFSET 0x028 +#define DSC_DSC_OFFSET 0x02C +#define DSC_FLATNESS 0x030 +#define DSC_RC_MODEL_SIZE 0x034 +#define DSC_RC 0x038 +#define DSC_RC_BUF_THRESH 0x03C +#define DSC_RANGE_MIN_QP 0x074 +#define DSC_RANGE_MAX_QP 0x0B0 +#define DSC_RANGE_BPG_OFFSET 0x0EC + +static void dpu_hw_dsc_disable(struct dpu_hw_dsc *dsc) +{ + struct dpu_hw_blk_reg_map *c = &dsc->hw; + + DPU_REG_WRITE(c, DSC_COMMON_MODE, 0); +} + +static void dpu_hw_dsc_config(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc, + u32 mode, bool ich_reset_override) +{ + struct dpu_hw_blk_reg_map *c = &hw_dsc->hw; + u32 data; + u32 initial_lines = dsc->initial_lines; + bool is_cmd_mode = !(mode & BIT(2)); + + DPU_REG_WRITE(c, DSC_COMMON_MODE, mode); + + data = 0; + if (ich_reset_override) + data = 3 << 28; + + if (is_cmd_mode) + initial_lines += 1; + + data |= (initial_lines << 20); + data |= ((dsc->slice_last_group_size) << 18); + /* bpp is 6.4 format, 4 LSBs bits are for fractional part */ + data |= dsc->drm.bits_per_pixel << 12; + data |= (dsc->drm.block_pred_enable << 7); + data |= (dsc->drm.line_buf_depth << 3); + data |= (dsc->drm.simple_422 << 2); + data |= (dsc->drm.convert_rgb << 1); + if (dsc->drm.bits_per_component == 10) + data |= BIT(0); + + DPU_REG_WRITE(c, DSC_ENC, data); + + data = dsc->drm.pic_width << 16; + data |= dsc->drm.pic_height; + DPU_REG_WRITE(c, DSC_PICTURE, data); + + data = dsc->drm.slice_width << 16; + data |= dsc->drm.slice_height; + DPU_REG_WRITE(c, DSC_SLICE, data); + + data = DIV_ROUND_UP(dsc->drm.slice_width * dsc->drm.bits_per_pixel, 8) << 16; + + DPU_REG_WRITE(c, DSC_CHUNK_SIZE, data); + + data = dsc->drm.initial_dec_delay << 16; + data |= dsc->drm.initial_xmit_delay; + DPU_REG_WRITE(c, DSC_DELAY, data); + + data = dsc->drm.initial_scale_value; + DPU_REG_WRITE(c, DSC_SCALE_INITIAL, data); + + data = dsc->drm.scale_decrement_interval; + DPU_REG_WRITE(c, DSC_SCALE_DEC_INTERVAL, data); + + data = 0x00000184; /* only this value works */ + DPU_REG_WRITE(c, DSC_SCALE_INC_INTERVAL, data); + + data = dsc->drm.first_line_bpg_offset; + DPU_REG_WRITE(c, DSC_FIRST_LINE_BPG_OFFSET, data); + + data = dsc->drm.nfl_bpg_offset << 16; + data |= dsc->drm.slice_bpg_offset; + DPU_REG_WRITE(c, DSC_BPG_OFFSET, data); + + data = dsc->drm.initial_offset << 16; + data |= dsc->drm.final_offset; + DPU_REG_WRITE(c, DSC_DSC_OFFSET, data); + + data = dsc->det_thresh_flatness << 10; + data |= dsc->drm.flatness_max_qp << 5; + data |= dsc->drm.flatness_min_qp; + DPU_REG_WRITE(c, DSC_FLATNESS, data); + + data = dsc->drm.rc_model_size; + DPU_REG_WRITE(c, DSC_RC_MODEL_SIZE, data); + + data = dsc->drm.rc_tgt_offset_low << 18; + data |= dsc->drm.rc_tgt_offset_high << 14; + data |= dsc->drm.rc_quant_incr_limit1 << 9; + data |= dsc->drm.rc_quant_incr_limit0 << 4; + data |= dsc->drm.rc_edge_factor; + DPU_REG_WRITE(c, DSC_RC, data); +} + +static void dpu_hw_dsc_config_thresh(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc) +{ + struct drm_dsc_rc_range_parameters *rc = dsc->drm.rc_range_params; + struct dpu_hw_blk_reg_map *c = &hw_dsc->hw; + u32 off = 0x0; + u16 *lp; + int i; + + lp = dsc->drm.rc_buf_thresh; + off = DSC_RC_BUF_THRESH; + for (i = 0; i < DSC_NUM_BUF_RANGES - 1 ; i++) { + DPU_REG_WRITE(c, off, *lp++); + off += 4; + } + + off = DSC_RANGE_MIN_QP; + for (i = 0; i < DSC_NUM_BUF_RANGES; i++) { + DPU_REG_WRITE(c, off, rc[i].range_min_qp); + off += 4; + } + + off = DSC_RANGE_MAX_QP; + for (i = 0; i < 15; i++) { + DPU_REG_WRITE(c, off, rc[i].range_max_qp); + off += 4; + } + + off = DSC_RANGE_BPG_OFFSET; + for (i = 0; i < 15; i++) { + DPU_REG_WRITE(c, off, rc[i].range_bpg_offset); + off += 4; + } +} + +static struct dpu_dsc_cfg *_dsc_offset(enum dpu_dsc dsc, + struct dpu_mdss_cfg *m, + void __iomem *addr, + struct dpu_hw_blk_reg_map *b) +{ + int i; + + for (i = 0; i < m->dsc_count; i++) { + if (dsc == m->dsc[i].id) { + b->base_off = addr; + b->blk_off = m->dsc[i].base; + b->length = m->dsc[i].len; + b->hwversion = m->hwversion; + b->log_mask = DPU_DBG_MASK_DSC; + return &m->dsc[i]; + } + } + + return NULL; +} + +static void _setup_dsc_ops(struct dpu_hw_dsc_ops *ops, + unsigned long cap) +{ + ops->dsc_disable = dpu_hw_dsc_disable; + ops->dsc_config = dpu_hw_dsc_config; + ops->dsc_config_thresh = dpu_hw_dsc_config_thresh; +}; + +static struct dpu_hw_blk_ops dpu_hw_ops = { + .start = NULL, + .stop = NULL, +}; + +struct dpu_hw_dsc *dpu_hw_dsc_init(enum dpu_dsc idx, void __iomem *addr, + struct dpu_mdss_cfg *m) +{ + struct dpu_hw_dsc *c; + struct dpu_dsc_cfg *cfg; + + c = kzalloc(sizeof(*c), GFP_KERNEL); + if (!c) + return ERR_PTR(-ENOMEM); + + cfg = _dsc_offset(idx, m, addr, &c->hw); + if (IS_ERR_OR_NULL(cfg)) { + kfree(c); + return ERR_PTR(-EINVAL); + } + + c->idx = idx; + c->caps = cfg; + _setup_dsc_ops(&c->ops, c->caps->features); + + dpu_hw_blk_init(&c->base, DPU_HW_BLK_DSC, idx, &dpu_hw_ops); + + return c; +} + +void dpu_hw_dsc_destroy(struct dpu_hw_dsc *dsc) +{ + if (dsc) + dpu_hw_blk_destroy(&dsc->base); + kfree(dsc); +} diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h new file mode 100644 index 000000000000..c680fd948865 --- /dev/null +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (c) 2020, Linaro Limited */ + +#ifndef _DPU_HW_DSC_H +#define _DPU_HW_DSC_H + +#include + +#define DSC_MODE_SPLIT_PANEL BIT(0) +#define DSC_MODE_MULTIPLEX BIT(1) +#define DSC_MODE_VIDEO BIT(2) + +struct dpu_hw_dsc; + +/** + * struct dpu_hw_dsc_ops - interface to the dsc hardware driver functions + * Assumption is these functions will be called after clocks are enabled + */ +struct dpu_hw_dsc_ops { + /** + * dsc_disable - disable dsc + * @hw_dsc: Pointer to dsc context + */ + void (*dsc_disable)(struct dpu_hw_dsc *hw_dsc); + + /** + * dsc_config - configures dsc encoder + * @hw_dsc: Pointer to dsc context + * @dsc: panel dsc parameters + * @mode: dsc topology mode to be set + * @ich_reset_override: option to reset ich + */ + void (*dsc_config)(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc, + u32 mode, bool ich_reset_override); + + /** + * dsc_config_thresh - programs panel thresholds + * @hw_dsc: Pointer to dsc context + * @dsc: panel dsc parameters + */ + void (*dsc_config_thresh)(struct dpu_hw_dsc *hw_dsc, + struct msm_display_dsc_config *dsc); +}; + +struct dpu_hw_dsc { + struct dpu_hw_blk base; + struct dpu_hw_blk_reg_map hw; + + /* dsc */ + enum dpu_dsc idx; + const struct dpu_dsc_cfg *caps; + + /* ops */ + struct dpu_hw_dsc_ops ops; +}; + +/** + * dpu_hw_dsc_init - initializes the dsc block for the passed dsc idx. + * @idx: DSC index for which driver object is required + * @addr: Mapped register io address of MDP + * @m: Pointer to mdss catalog data + * Returns: Error code or allocated dpu_hw_dsc context + */ +struct dpu_hw_dsc *dpu_hw_dsc_init(enum dpu_dsc idx, void __iomem *addr, + struct dpu_mdss_cfg *m); + +/** + * dpu_hw_dsc_destroy - destroys dsc driver context + * @dsc: Pointer to dsc driver context returned by dpu_hw_dsc_init + */ +void dpu_hw_dsc_destroy(struct dpu_hw_dsc *dsc); + +static inline struct dpu_hw_dsc *to_dpu_hw_dsc(struct dpu_hw_blk *hw) +{ + return container_of(hw, struct dpu_hw_dsc, base); +} + +#endif /* _DPU_HW_DSC_H */ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h index 09a3fb3e89f5..1b72c11090ee 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h @@ -97,6 +97,7 @@ enum dpu_hw_blk_type { DPU_HW_BLK_WB, DPU_HW_BLK_DSPP, DPU_HW_BLK_MERGE_3D, + DPU_HW_BLK_DSC, DPU_HW_BLK_MAX, }; @@ -176,6 +177,17 @@ enum dpu_ctl { CTL_MAX }; +enum dpu_dsc { + DSC_NONE = 0, + DSC_0, + DSC_1, + DSC_2, + DSC_3, + DSC_4, + DSC_5, + DSC_MAX +}; + enum dpu_pingpong { PINGPONG_0 = 1, PINGPONG_1, @@ -437,5 +449,6 @@ struct dpu_mdss_color { #define DPU_DBG_MASK_VBIF (1 << 8) #define DPU_DBG_MASK_ROT (1 << 9) #define DPU_DBG_MASK_DSPP (1 << 10) +#define DPU_DBG_MASK_DSC (1 << 11) #endif /* _DPU_HW_MDSS_H */ From patchwork Fri May 21 12:49:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444675 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp946964jac; Fri, 21 May 2021 05:50:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6mJDGajLJ6rnV50uN1/Qv/HOOIXz68vYsERFWTh6bDdlDWRWl1yNKVeQ21gzRwz1/tdkr X-Received: by 2002:a63:9d43:: with SMTP id i64mr9603521pgd.205.1621601434867; Fri, 21 May 2021 05:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601434; cv=none; d=google.com; s=arc-20160816; b=MYGBnKpE7FSMc/SleoaIo0YM3LrAmBu82bCLwkhp9Yo2+364hOo5FyUQ237zUAtLRI RLRVauYssujxhjUrzLx9GXaQrdoOFnYqIQuMZksB28e5QSYWFPdvGEDBlBWUW3dzUc6V axkYPoQiW9nD+6c9pd/g4+Ipfyfafc9TlhG8LyY4BklYOrjN70/sAlDzIQ9Kqdw4CDwi KbT/oDI7Gu6fGVavdUf7lJXFSt46fDrQNqQanfU+ADEJQm1sTr9CcjF9bcqhB0yBBGmW he2rD6TMSQVT/aMRCDc8KVIke6FaCWYxN9p8lZxfwxI+j2LcTlcCOd14TriL8LAs8tQX WuCA== 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=sKLBX4jBLVQvnyMr1Ww7CASagKoijpefcDJjIzYZaM4=; b=j42ZMu0jB/eenzC+KZmao+XPi/gUNC++dFWanXkQE3ybmlil9K9yseG7D7npvZLNFD GTU/IqK8Q2SKnmsGXI/WWFx09qAIQ5lJAYfdmrlcwvmUkUCwZKWi7MA5CbFd/1RbmJko sguBojGhyotXAiy3SqhzrU8kU9Wiwi2vxmjJQchxFC2K/A27CG3oJXmGJIFvlfvI6FnB yU73vqHYNS/VhYZ8oMGXm8EnHZpGqkXQ+p5Iu+2UhWlD1StLpXMYTwMZ9d9f6vKMvwR4 zkzaclvrJhh5Ze6UIeoS16mto4DEyVauwK0G7tCgWLD2grthpCPH1lFGt7lFM5GDU9/h Bf+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=luYjJoBF; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a18si6708186pfv.201.2021.05.21.05.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=luYjJoBF; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7B476F63A; Fri, 21 May 2021 12:50:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id A75886F642; Fri, 21 May 2021 12:50:30 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A3785613DD; Fri, 21 May 2021 12:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601430; bh=9SoiHu6HAdAusAoi4raCnnFpxv209nzRo5hMIPpogYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=luYjJoBFcbJhXdTdXk91nmy8D+bkW55GlJ1Fapbom7SmYDPDaG4LnSHTEgjinWE2E u8z017tCiorCmZIdrezco+ICasdezJLrbGg6cKL7Y5rJgjTZvuBcHnCqDpTq/3Fim4 qUkYq2kybXkw++PLjWwRoLg3RHWA73Q0Sf+BIb6x4ht0SvQZEiZNpLPTB/TgpBGWIh gZee1kTcFUOWIzZZtxr4ddwEJJbNnrNGadGy0ZUH3eR9WJ+5CO7y2+z2mgEeEgSf3V gA2HD/L/PGtwcv7Nr8OUkPNv+9fR3SMHe9sofWtlOEpXGdu0EFGJVkA6KIVW4kPJTj Cs9Un/+Qo82hQ== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 05/13] drm/msm/disp/dpu1: Add support for DSC in pingpong block Date: Fri, 21 May 2021 18:19:36 +0530 Message-Id: <20210521124946.3617862-8-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In SDM845, DSC can be enabled by writing to pingpong block registers, so add support for DSC in hw_pp Signed-off-by: Vinod Koul --- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 32 +++++++++++++++++++ .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 14 ++++++++ 2 files changed, 46 insertions(+) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c index 245a7a62b5c6..07fc131ca9aa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c @@ -28,6 +28,9 @@ #define PP_FBC_MODE 0x034 #define PP_FBC_BUDGET_CTL 0x038 #define PP_FBC_LOSSY_MODE 0x03C +#define PP_DSC_MODE 0x0a0 +#define PP_DCE_DATA_IN_SWAP 0x0ac +#define PP_DCE_DATA_OUT_SWAP 0x0c8 #define PP_DITHER_EN 0x000 #define PP_DITHER_BITDEPTH 0x004 @@ -245,6 +248,32 @@ static u32 dpu_hw_pp_get_line_count(struct dpu_hw_pingpong *pp) return line; } +static int dpu_hw_pp_dsc_enable(struct dpu_hw_pingpong *pp) +{ + struct dpu_hw_blk_reg_map *c = &pp->hw; + + DPU_REG_WRITE(c, PP_DSC_MODE, 1); + return 0; +} + +static void dpu_hw_pp_dsc_disable(struct dpu_hw_pingpong *pp) +{ + struct dpu_hw_blk_reg_map *c = &pp->hw; + + DPU_REG_WRITE(c, PP_DSC_MODE, 0); +} + +static int dpu_hw_pp_setup_dsc(struct dpu_hw_pingpong *pp) +{ + struct dpu_hw_blk_reg_map *pp_c = &pp->hw; + int data; + + data = DPU_REG_READ(pp_c, PP_DCE_DATA_OUT_SWAP); + data |= BIT(18); /* endian flip */ + DPU_REG_WRITE(pp_c, PP_DCE_DATA_OUT_SWAP, data); + return 0; +} + static void _setup_pingpong_ops(struct dpu_hw_pingpong *c, unsigned long features) { @@ -256,6 +285,9 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c, c->ops.get_autorefresh = dpu_hw_pp_get_autorefresh_config; c->ops.poll_timeout_wr_ptr = dpu_hw_pp_poll_timeout_wr_ptr; c->ops.get_line_count = dpu_hw_pp_get_line_count; + c->ops.setup_dsc = dpu_hw_pp_setup_dsc; + c->ops.enable_dsc = dpu_hw_pp_dsc_enable; + c->ops.disable_dsc = dpu_hw_pp_dsc_disable; if (test_bit(DPU_PINGPONG_DITHER, &features)) c->ops.setup_dither = dpu_hw_pp_setup_dither; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h index 845b9ce80e31..5058e41ffbc0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h @@ -124,6 +124,20 @@ struct dpu_hw_pingpong_ops { */ void (*setup_dither)(struct dpu_hw_pingpong *pp, struct dpu_hw_dither_cfg *cfg); + /** + * Enable DSC + */ + int (*enable_dsc)(struct dpu_hw_pingpong *pp); + + /** + * Disable DSC + */ + void (*disable_dsc)(struct dpu_hw_pingpong *pp); + + /** + * Setup DSC + */ + int (*setup_dsc)(struct dpu_hw_pingpong *pp); }; struct dpu_hw_pingpong { From patchwork Fri May 21 12:49:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444678 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947078jac; Fri, 21 May 2021 05:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylvCmfWbgz63YSdQLO9Pw0cGJimprt9rAUcEM980vCh8pEV/N4oeO2+rxN/8ciUzZbfwR7 X-Received: by 2002:a17:903:20cc:b029:f0:cc11:51c2 with SMTP id i12-20020a17090320ccb02900f0cc1151c2mr11993300plb.32.1621601444073; Fri, 21 May 2021 05:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601444; cv=none; d=google.com; s=arc-20160816; b=aKzeKQpGtl3n15xtbtwogy8Eih1aSl5QZgeTUU0t4gkUTf4bXHcn/rpOKasGy0BLtM 2COg0TQpd9+/1f1rWe7cnpRQjz0a4Xxn5FwihEm1kKGWTxaA/wUGbRv5e8FMOgHaVIjF /1aMD4PtDf5QOMWI2ria0/Yhjo0xTlC8dYrXCHxxO3qL872kYeJtQwdzzq4dXkhEv2mv +03aK4msZesO71nj154i7oNhG9vjAYU+DmDvYAJLHnVsIOahRRAnczJdPAvNJjyajFrB 4gzh2Wn6KoS1aGRM7TQ6Pz21vLwY5EWAYp4SrhtCa8MjR3OXdZMU/XgR8vMEGa05dmMj tO6w== 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=32O59HgWLIq2eCYIg53a+xXJ+DR9iyCDxgrS0yqlILI=; b=a1GIQwZ906yWDepgh3PL4YPO7YAkqPtkwpmW5yr2a5y+/H34aS1erfEqYaKJUeuD2R 7MIs7xZoIEP2YBpbvJIstvi6F7GXgDrp6F1yOxHnrpAhza4vtBZPlhJJNDZxxbH7yOO0 ALt2wrH481wr7oOHqp7kuoeEutHdNcErPVNpadf4sTlRtoAzqv7MUnVxIVdHMs65gOga Hm2zOPo0ViwQyglpKEM+mwrzC+1iI7XRSGGxc3W8V01G52P+p10Qe8udrgLa2HwQsBRR QkovhKzUi/pCRlR2joPN8IO6GlHqX45naeBNW6DdR7spGsCiqS7+M0KtRZupbFZG5Vmz 7E+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=I3LsPb4r; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id c7si6694140pls.401.2021.05.21.05.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=I3LsPb4r; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC2406E506; Fri, 21 May 2021 12:50:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 188096F635; Fri, 21 May 2021 12:50:39 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 750C8613D9; Fri, 21 May 2021 12:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601439; bh=Gb5d67i9Q4U15xb2aE7Imj0HQ2P/vErp6AIgUyNfqvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3LsPb4rQpeFHtPNwU8iI/BmV9ZRJNNwyEIakasGihBN8gev7lksE929hszuv3Bro kVeBnMBqjTzLgpZuuYJP7v1R313RDqd7+0aMclaJVsmPhn8Mq1J72rtQsnl12zK8Tu WZ01DkU6C5y0GbmrUbPsVJKoLcTzYFo5Ktmh5bMSAe9E68VFrwkIRyGRyi4eVt4djw WlWAJFaaKIEfPhe5GNHfF454i62OfzAE4PuW8ucha0Tm2iJ6HDf/GhDCWP+ux7vNwb WMScJXW07GnGg2n4E8H9IQWX08TJBI04r6CLPURJsCWHIaB644ziMw5ksnfC8qcD4z D9isIvcGV1IeQ== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 06/13] drm/msm/disp/dpu1: Add DSC support in RM Date: Fri, 21 May 2021 18:19:38 +0530 Message-Id: <20210521124946.3617862-10-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This add the bits in RM to enable the DSC blocks Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 32 +++++++++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 1 + 3 files changed, 34 insertions(+) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index d6717d6672f7..d56c05146dfe 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -165,6 +165,7 @@ struct dpu_global_state { uint32_t ctl_to_enc_id[CTL_MAX - CTL_0]; uint32_t intf_to_enc_id[INTF_MAX - INTF_0]; uint32_t dspp_to_enc_id[DSPP_MAX - DSPP_0]; + uint32_t dsc_to_enc_id[DSC_MAX - DSC_0]; }; struct dpu_global_state diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index fd2d104f0a91..4da6d72b7996 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -11,6 +11,7 @@ #include "dpu_hw_intf.h" #include "dpu_hw_dspp.h" #include "dpu_hw_merge3d.h" +#include "dpu_hw_dsc.h" #include "dpu_encoder.h" #include "dpu_trace.h" @@ -75,6 +76,14 @@ int dpu_rm_destroy(struct dpu_rm *rm) dpu_hw_intf_destroy(hw); } } + for (i = 0; i < ARRAY_SIZE(rm->dsc_blks); i++) { + struct dpu_hw_dsc *hw; + + if (rm->intf_blks[i]) { + hw = to_dpu_hw_dsc(rm->dsc_blks[i]); + dpu_hw_dsc_destroy(hw); + } + } return 0; } @@ -221,6 +230,19 @@ int dpu_rm_init(struct dpu_rm *rm, rm->dspp_blks[dspp->id - DSPP_0] = &hw->base; } + for (i = 0; i < cat->dsc_count; i++) { + struct dpu_hw_dsc *hw; + const struct dpu_dsc_cfg *dsc = &cat->dsc[i]; + + hw = dpu_hw_dsc_init(dsc->id, mmio, cat); + if (IS_ERR_OR_NULL(hw)) { + rc = PTR_ERR(hw); + DPU_ERROR("failed dsc object creation: err %d\n", rc); + goto fail; + } + rm->dsc_blks[dsc->id - DSC_0] = &hw->base; + } + return 0; fail: @@ -476,6 +498,9 @@ static int _dpu_rm_reserve_intf( } global_state->intf_to_enc_id[idx] = enc_id; + + global_state->dsc_to_enc_id[0] = enc_id; + global_state->dsc_to_enc_id[1] = enc_id; return 0; } @@ -567,6 +592,8 @@ void dpu_rm_release(struct dpu_global_state *global_state, ARRAY_SIZE(global_state->ctl_to_enc_id), enc->base.id); _dpu_rm_clear_mapping(global_state->intf_to_enc_id, ARRAY_SIZE(global_state->intf_to_enc_id), enc->base.id); + _dpu_rm_clear_mapping(global_state->dsc_to_enc_id, + ARRAY_SIZE(global_state->dsc_to_enc_id), enc->base.id); } int dpu_rm_reserve( @@ -640,6 +667,11 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, hw_to_enc_id = global_state->dspp_to_enc_id; max_blks = ARRAY_SIZE(rm->dspp_blks); break; + case DPU_HW_BLK_DSC: + hw_blks = rm->dsc_blks; + hw_to_enc_id = global_state->dsc_to_enc_id; + max_blks = ARRAY_SIZE(rm->dsc_blks); + break; default: DPU_ERROR("blk type %d not managed by rm\n", type); return 0; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index 1f12c8d5b8aa..278d2a510b80 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -30,6 +30,7 @@ struct dpu_rm { struct dpu_hw_blk *intf_blks[INTF_MAX - INTF_0]; struct dpu_hw_blk *dspp_blks[DSPP_MAX - DSPP_0]; struct dpu_hw_blk *merge_3d_blks[MERGE_3D_MAX - MERGE_3D_0]; + struct dpu_hw_blk *dsc_blks[DSC_MAX - DSC_0]; uint32_t lm_max_width; }; From patchwork Fri May 21 12:49:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444679 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947130jac; Fri, 21 May 2021 05:50:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo/OHuXHGfOjxcHzaES7K2J+SurxJ78Hcg4/G9UriBE51/j4nLK7N251RD/npBafv/H/ps X-Received: by 2002:a17:90a:66c3:: with SMTP id z3mr11381755pjl.196.1621601447811; Fri, 21 May 2021 05:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601447; cv=none; d=google.com; s=arc-20160816; b=vImCqG6BTOCUxnIB93RlfXUeyDBOk3u7jIYq7J+1eLioJdYLd9uAGHFfis/0KoM7AH +9d+n9EjTLar4Vdhg1ah6+uMY9fjY9z4cypf8j5oKfmQtR/7vbfEpNZ1sfqp2micTtPE SqUCwWXSwFibrFF7GCwde2dgDHeVr5TTnWOxPde6WZAPDYo+9oP131VYpo+ONe3zDMXq IcWqf5o34GHOQhGSZap2QyOMDOXL+AQZEZHyermf9hBP4QtayLEqlDY5gMQSD9qheAAN UJNwK/e5lD3//ALrF1A46xQtJaLAB/nAg9hZFMkyrDgf2ts0r57DFcEetMLI+6VAzFa9 YPMg== 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=y6P2ztb27c0rciR8dYLfYpkEipB17w1V0Htd2HZMRBs=; b=N5TCPsiIY2pLprimXNAPioWiAuCYtkN8X8uRRmGnxkxSrQww0sYsnTQbgawmFja4yN FJA/sPITWpZP964ysIyxMMJcFyB5/LW/x3xv/XH28VRZl9CWsFrFNu4qWfIjZyW8ryYl I7b/lPZ93FWBPnPSeAyGvNvUudJEvvr+uq7tDXEQ2OZj+pfB/AtyBucxFwhiYtGHMD5I KjXix49FhLttiOV5LXpOM+Ubyd/DioTQgwOqxaM+vNnMbROPoFX0CIAz6E8iutwNWnet 1BCP3J7ChrMzCKDIOhU8oHgLb5B0yO4DDv8ZkuhSC2Q/UxwMMAMetaiRuPiMuIcAHBTV xBLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b="rgn+1H/1"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id w7si6966443ply.373.2021.05.21.05.50.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b="rgn+1H/1"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 748216F635; Fri, 21 May 2021 12:50:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCED16F641; Fri, 21 May 2021 12:50:43 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D82D96128A; Fri, 21 May 2021 12:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601443; bh=L0xwOq04an7+Pz3OpZctKSdmZivqWGnbevwnOTd9LK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rgn+1H/17yJtWqL3+pUjns/pIN8nRYXCbEAidZfTyTls4BiEtYxRN3zHxlGUIkYvh xUDGUNCTWvpryQUIYt9tcc0h1BmO5sExIQQutoEqejKTp/T7I90ysdzSspoNkpYjFC QhPeQsRhxJid8PrsCghlHc0LWoaVaqk6bYMIyMIHnBAlYC9kypQmjrhXbXYsaSoz2x rbGx1m0p+LWB35bMH7/CBqZxqGVOxb41C5IFnWeO1kVj2SV14yD5VsJw49PNo79u0s 49+tdz6VlWw6iWm9dzdVq+mdAsFX+ReNIM3O2odR2JSQsrne2zh6LJinex1eQqV63p g4XmI13yaZiVg== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 07/13] drm/msm/disp/dpu1: Add DSC for SDM845 to hw_catalog Date: Fri, 21 May 2021 18:19:39 +0530 Message-Id: <20210521124946.3617862-11-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This add SDM845 DSC blocks into hw_catalog Signed-off-by: Vinod Koul --- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index b569030a0847..1bf599e8ffe0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -40,6 +40,8 @@ #define PINGPONG_SDM845_MASK BIT(DPU_PINGPONG_DITHER) +#define DSC_SDM845_MASK BIT(DPU_DSC) + #define PINGPONG_SDM845_SPLIT_MASK \ (PINGPONG_SDM845_MASK | BIT(DPU_PINGPONG_TE2)) @@ -751,6 +753,24 @@ static const struct dpu_pingpong_cfg sc7280_pp[] = { PP_BLK("pingpong_2", PINGPONG_2, 0x6b000, 0, sc7280_pp_sblk), PP_BLK("pingpong_3", PINGPONG_3, 0x6c000, 0, sc7280_pp_sblk), }; + +/************************************************************* + * DSC sub blocks config + *************************************************************/ +#define DSC_BLK(_name, _id, _base) \ + {\ + .name = _name, .id = _id, \ + .base = _base, .len = 0x140, \ + .features = DSC_SDM845_MASK, \ + } + +static struct dpu_dsc_cfg sdm845_dsc[] = { + DSC_BLK("dsc_0", DSC_0, 0x80000), + DSC_BLK("dsc_1", DSC_1, 0x80400), + DSC_BLK("dsc_2", DSC_2, 0x80800), + DSC_BLK("dsc_3", DSC_3, 0x80c00), +}; + /************************************************************* * INTF sub blocks config *************************************************************/ @@ -1053,6 +1073,8 @@ static void sdm845_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .mixer = sdm845_lm, .pingpong_count = ARRAY_SIZE(sdm845_pp), .pingpong = sdm845_pp, + .dsc_count = ARRAY_SIZE(sdm845_dsc), + .dsc = sdm845_dsc, .intf_count = ARRAY_SIZE(sdm845_intf), .intf = sdm845_intf, .vbif_count = ARRAY_SIZE(sdm845_vbif), From patchwork Fri May 21 12:49:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444680 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947186jac; Fri, 21 May 2021 05:50:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSr6oyHv4so24Gepzhf9VF5hAtJ+rewkHZT8iaOTU+Dc6j7L5d/VFpeItRu/YaoO+/zHy2 X-Received: by 2002:a62:5288:0:b029:2e3:fd7d:267a with SMTP id g130-20020a6252880000b02902e3fd7d267amr5895064pfb.21.1621601450983; Fri, 21 May 2021 05:50:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601450; cv=none; d=google.com; s=arc-20160816; b=TZfC6ZlyZC3VXFmaX93ZgYVn7ExXCmU0XeAc6Ku3vGi7XDAn8SPCaS/+10zKh4H9eb NX9F3vjAV5ZZV4yol+y0Uc8UAjmoeuLQY7G8CmyHWLwAKtbX+zJQOhoNyiJ2fAW6WNSX VlnxBrMhAn2/ChpNuW9iWfMCePkZ49tsKF0SbxQph4ndrfKktrB3rRjWQiaPp0NQEyKG eENTx10GedATS91NwVD3eTN4bix9QYpnqPXjM8XM3kT/r1VKMAGuVxgigOQYgmXhCt14 IWV+oR5pAivUpLEOX7tWkuvVviyIy4oY40SP93ARN7LHUVp57JdP0eGLje5h+NCDhTtr 5F2g== 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=O+21yLVLq+5P0fUEnFbXcir78ith8UdQJxVq7yONFUI=; b=DdzEkzWu/UhhDxVXgjuIvrLvtleHJXFlPYnnwYFioYeXU8AzjliME/QwF9o1u3jZDc 1zmSgttraUzUarlg2Th+xjVMQWWO6UKPHyObFyOhhLOf6lVa6UOwJe+iGbU2kY3yMgp2 MbBNbRmB5uM+cVIMiI36oSyB4/sV9uKCdlV3dKB7xsZ1Iem2eCl7YnMJBNugaMaJWW0r 2h10bCVjL/bOGcCVcHMsLyE84YKTNOGskYPfnVtQvS+k1mjSiwzujz7Q4VTohLgi/M3n crykOkcsXIoih1VjraH29ldxtuqztHjBb5Pcy+nAG6BI9L07ZFXt1w60eUWCPnEDlPle RM8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=p+b1dMuL; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id q21si7010987pfu.298.2021.05.21.05.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=p+b1dMuL; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C24686F641; Fri, 21 May 2021 12:50:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3902D6F640; Fri, 21 May 2021 12:50:48 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 4579D613D8; Fri, 21 May 2021 12:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601448; bh=0XahmhIFMEbevuz651JK1SuRalOKFeJShM5ZS9hUNOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+b1dMuLcyV319Bhe3jSEigdayqKsFhF//ypqJCP+tluFH8ZmM8eq2gAlvlHrHLhG DM7rm48oYDW1OO42JBNc98oyZmjUCZwM3wiAVVBGBry1AAAwK7CK9NkoHxqmQGCbel MNp2RrXN7BjXR4PEqdURurAdn5zsJv5d5aUJzfjM/l2gHWboplc1+q3Bjl/4clH1tH 98w47KacMrvjiyAqlv4lewKUCj+5utIiFXscIPz/fBLWV/QsIeLUgEhp1WyMuaG60J L1vzriacLSu4IPLeYspBAA3IrFfoDsNdexO/Gii5yGjsCzMUzCLRjNeg5C/4/uPiQB cV3CdAQkUn3AQ== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 08/13] drm/msm/disp/dpu1: Add DSC support in hw_ctl Date: Fri, 21 May 2021 18:19:40 +0530 Message-Id: <20210521124946.3617862-12-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Later gens of hardware have DSC bits moved to hw_ctl, so configure these bits so that DSC would work there as well Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c index 2d4645e01ebf..aeea6add61ee 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c @@ -25,6 +25,8 @@ #define CTL_MERGE_3D_ACTIVE 0x0E4 #define CTL_INTF_ACTIVE 0x0F4 #define CTL_MERGE_3D_FLUSH 0x100 +#define CTL_DSC_ACTIVE 0x0E8 +#define CTL_DSC_FLUSH 0x104 #define CTL_INTF_FLUSH 0x110 #define CTL_INTF_MASTER 0x134 #define CTL_FETCH_PIPE_ACTIVE 0x0FC @@ -34,6 +36,7 @@ #define DPU_REG_RESET_TIMEOUT_US 2000 #define MERGE_3D_IDX 23 +#define DSC_IDX 22 #define INTF_IDX 31 #define CTL_INVALID_BIT 0xffff @@ -120,6 +123,7 @@ static u32 dpu_hw_ctl_get_pending_flush(struct dpu_hw_ctl *ctx) static inline void dpu_hw_ctl_trigger_flush_v1(struct dpu_hw_ctl *ctx) { + DPU_REG_WRITE(&ctx->hw, CTL_DSC_FLUSH, BIT(0) | BIT(1) | BIT(2) | BIT(3)); if (ctx->pending_flush_mask & BIT(MERGE_3D_IDX)) DPU_REG_WRITE(&ctx->hw, CTL_MERGE_3D_FLUSH, @@ -128,7 +132,7 @@ static inline void dpu_hw_ctl_trigger_flush_v1(struct dpu_hw_ctl *ctx) DPU_REG_WRITE(&ctx->hw, CTL_INTF_FLUSH, ctx->pending_intf_flush_mask); - DPU_REG_WRITE(&ctx->hw, CTL_FLUSH, ctx->pending_flush_mask); + DPU_REG_WRITE(&ctx->hw, CTL_FLUSH, ctx->pending_flush_mask | BIT(DSC_IDX)); } static inline void dpu_hw_ctl_trigger_flush(struct dpu_hw_ctl *ctx) @@ -507,6 +511,7 @@ static void dpu_hw_ctl_intf_cfg_v1(struct dpu_hw_ctl *ctx, if (cfg->merge_3d) DPU_REG_WRITE(c, CTL_MERGE_3D_ACTIVE, BIT(cfg->merge_3d - MERGE_3D_0)); + DPU_REG_WRITE(c, CTL_DSC_ACTIVE, BIT(0) | BIT(1) | BIT(2) | BIT(3)); } static void dpu_hw_ctl_intf_cfg(struct dpu_hw_ctl *ctx, From patchwork Fri May 21 12:49:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444681 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947265jac; Fri, 21 May 2021 05:50:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSDHRt69Ca1IvMhtCu/sYKgSoaazqqbKmNXDKarXl0NTZhWcaL6Rt3TLI8fonAuVXE2YQG X-Received: by 2002:a63:4609:: with SMTP id t9mr9660729pga.13.1621601455773; Fri, 21 May 2021 05:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601455; cv=none; d=google.com; s=arc-20160816; b=Dm0J/gD8zo6NLF0rC0g0tNBa1n+LUz5mgSZ4vYIxStvCmEaJZdLjFYl65s0iS1+s+Q /+HqIolu55D2pKFXLI1JM9enI3FmE1Z05NbgDUiHUfMvmk5Vai+fDgpgycSbIkQgfady wRUAzHd9YPsqRp9W0W78WYrnXdvBf6sd3saqmAo0oWVariDuXhHRMzEwEVOx9zXxd1Lt JJX9CYIp4TTPoC2mQEGEeFH9Rnsd0sCRXpwhhlaEtaNyIKW6jGpwjWaQDUhQJ9nfikvg i34aOf7+yOz3JNio4Go4FMgkOc3MNU5dtbNDhCduz2NKXYSjoy9Ebhr8V5BqXqspyEan Tsqw== 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=J4oI+Klq7PXjhDoyPjalXgJwkXltU2p/kbThMSekDSk=; b=sOtR/+6qgRMQcVFadgP0G6eUD0V3hUWXDc6fzQc74TLJazCuNlY3O4ZSWNCzlqUda3 Hx+zT/35gjbCCegji7esWneyz4luSQ99i9qoiQ1K3j8HqrL+ayUD47D67Kb9uUEthRGd FOiFrOnOcdjcQlyC8KqQZAP/0auS3vPdb2HB/zwZjY8IvWKvICQawxcxhTD1yK6ouai3 n4qxCZoOp41iRg02D2wTmePk4iMQeIBT9dExuh+HGj2OGwhjZNjTV/w/EFYjiUzjN+E+ cFNg6qWuLy4B5/e8R5/8N2Y6Mf9oziawQxKQrSrYMHTjXRKriMOVFXBjwak5EINyeoWE Kj8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=SyD6Srfw; 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=kernel.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 c16si6884700pls.4.2021.05.21.05.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:50:55 -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=@kernel.org header.s=k20201202 header.b=SyD6Srfw; 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=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5649A6E500; Fri, 21 May 2021 12:50:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97ADE6E500; Fri, 21 May 2021 12:50:52 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A822D613E1; Fri, 21 May 2021 12:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601452; bh=Y6oR0c4fZFzazX3E5d47MSfaK8VBELYA/cqVKr86K0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SyD6SrfwUWsrUjTwyqnxtuT3D4gOGroTKnqxSpmqMuTgvKgJbFkfyT/dCHaspgSvp Gvc0+KJVKbvCAscrHU/G6A38DgOnXRYmmJKYHAXy2CyTAKtqtPEo69MPVO+cGpExM0 ZtLyWSTFM34U7t+BH0IZQ/IFul+wXktg5O6/WZ9aNqxHHsU9qqLhK0emt/zOE275dY KLAVHARpFGzLPSLtZdxxO0JXSJ89R9OU3ZKT+b4sTIKDW76DG3oULAPmEJrxGdTn55 +f6QLzq6dV4iPyAz9uMmMVTvzOAkTyE5UHy0hvWm2a+cz97NtE8FOKhVUA1RrU5+TN zDNxaAgGyvQew== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 09/13] drm/msm/disp/dpu1: Don't use DSC with mode_3d Date: Fri, 21 May 2021 18:19:41 +0530 Message-Id: <20210521124946.3617862-13-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We cannot enable mode_3d when we are using the DSC. So pass configuration to detect DSC is enabled and not enable mode_3d when we are using DSC We add a helper dpu_encoder_helper_get_dsc_mode() to detect dsc enabled and pass this to .setup_intf_cfg() Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 11 +++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 2 ++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 5 +++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h index ecbc4be98980..d43b804528eb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h @@ -336,6 +336,17 @@ static inline enum dpu_3d_blend_mode dpu_encoder_helper_get_3d_blend_mode( return BLEND_3D_NONE; } +static inline bool dpu_encoder_helper_get_dsc_mode(struct dpu_encoder_phys *phys_enc) +{ + struct drm_encoder *drm_enc = phys_enc->parent; + struct msm_drm_private *priv = drm_enc->dev->dev_private; + + if (priv->dsc) + return true; + + return false; +} + /** * dpu_encoder_helper_split_config - split display configuration helper function * This helper function may be used by physical encoders to configure diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c index b2be39b9144e..5fe87881c30c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c @@ -69,6 +69,8 @@ static void _dpu_encoder_phys_cmd_update_intf_cfg( intf_cfg.intf_mode_sel = DPU_CTL_MODE_SEL_CMD; intf_cfg.stream_sel = cmd_enc->stream_sel; intf_cfg.mode_3d = dpu_encoder_helper_get_3d_blend_mode(phys_enc); + intf_cfg.dsc = dpu_encoder_helper_get_dsc_mode(phys_enc); + ctl->ops.setup_intf_cfg(ctl, &intf_cfg); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c index aeea6add61ee..f059416311ee 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c @@ -121,7 +121,7 @@ static u32 dpu_hw_ctl_get_pending_flush(struct dpu_hw_ctl *ctx) return ctx->pending_flush_mask; } -static inline void dpu_hw_ctl_trigger_flush_v1(struct dpu_hw_ctl *ctx) +static void dpu_hw_ctl_trigger_flush_v1(struct dpu_hw_ctl *ctx) { DPU_REG_WRITE(&ctx->hw, CTL_DSC_FLUSH, BIT(0) | BIT(1) | BIT(2) | BIT(3)); @@ -522,7 +522,8 @@ static void dpu_hw_ctl_intf_cfg(struct dpu_hw_ctl *ctx, intf_cfg |= (cfg->intf & 0xF) << 4; - if (cfg->mode_3d) { + /* In DSC we can't set merge, so check for dsc too */ + if (cfg->mode_3d && !cfg->dsc) { intf_cfg |= BIT(19); intf_cfg |= (cfg->mode_3d - 0x1) << 20; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h index 806c171e5df2..347a653c1e01 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h @@ -39,6 +39,7 @@ struct dpu_hw_stage_cfg { * @mode_3d: 3d mux configuration * @merge_3d: 3d merge block used * @intf_mode_sel: Interface mode, cmd / vid + * @dsc: DSC is enabled * @stream_sel: Stream selection for multi-stream interfaces */ struct dpu_hw_intf_cfg { @@ -46,6 +47,7 @@ struct dpu_hw_intf_cfg { enum dpu_3d_blend_mode mode_3d; enum dpu_merge_3d merge_3d; enum dpu_ctl_mode_sel intf_mode_sel; + bool dsc; int stream_sel; }; From patchwork Fri May 21 12:49:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444683 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947403jac; Fri, 21 May 2021 05:51:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6KXLQhklIGLgqAwdEf2hrFX3nKdm/4y620CTRi7pA3bg1MA4TBizbMGXrUsf7NekCgkuw X-Received: by 2002:a63:58f:: with SMTP id 137mr9764277pgf.241.1621601464569; Fri, 21 May 2021 05:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601464; cv=none; d=google.com; s=arc-20160816; b=o5iO/SSFv85Sy1coScxV8fPHBhZ6RiX0RpJ4S/xcS3+3sYREqP+Vny3VzEs2yVpVT7 9fxMz3qE5xnVIGy7bIQss/Y+VQ0LBZT3EZfUGj/7l/Sh42ltGeVaolWUqL6b8VZWoIGI oxqyPNAavR7+9ynoLMzMaqPJkLeBGS56x4DzoMFs7tnu900MLAx9v2/lqIO6xQ8aW0VS yppMgxjjLGA3x+DP1m5RroM4lYLTMUh/v3ztMyytGRTxeNP46iWpc9ZPhdPDNNJt3VBt EJHdVCOeAIzk89KhmRIq8ijOzCTefV+qr6N9KrREzOE5py9HAUBCtVITlcx9el0DmF4v HOsg== 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=O4A+9gwJsQ4OBDbuJ782y0mHuZt/GRxOB0n79TvVweo=; b=VRl2M9bsmbZgzYuv4fe0YgSNzjvdrKgEaxyFpTjvC+2EuDy7JSwJ1/1E1baUMxFAez NHXSOs7OOYxBI9mGjJTP9AA8ZxZJN5NagZ0CkYEIsLMD838I+5N0Me3fAsvqEn6avyvm ssGWwX7QMUDl8emi3GIZ8R59Eo0tePDdm33ZVqHEWgXXv+eh5Tx2sxkEkhBorOuU6hxt gIVGjq6jefjEFGLHOVub+qf25yFr3Oxy6VTF8JcV15arKa3rZHktEXdvY0+xjejzeJgg N5Z6RxnXDEq24k+a5fZhsmSBc39EOwNtg6PmfsdvArJ7tHR8s1u0jOtN3VgshWLhMJev 1EaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=QUOI9BwL; 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=kernel.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 s7si6774446pfu.336.2021.05.21.05.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:51:04 -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=@kernel.org header.s=k20201202 header.b=QUOI9BwL; 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=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F245E6F645; Fri, 21 May 2021 12:51:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6EF396F645; Fri, 21 May 2021 12:51:01 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 7ACF7613DF; Fri, 21 May 2021 12:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601461; bh=3WhEDhnS7RTHdaVDcW/UbFzQLps8YMMTUjDx51lcUJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QUOI9BwLA3XMgriCsTlGzo4Ojgk83j2xh3TH+0xcN+5O5fIAkUABzXoaJdlQf6vCG oW5FnmkrOqfSTzAd54DiMtAQOvaA6sK3JdsXYk9AbXf8UHL2OBeFPgcvNf5MLL0zX6 oQjBXLuOXBOLXpuZT5E/uknzU2Nij7DukUEu9EtU4jN1IKVGzPRppyD+c30+j3+Jwp m+F0R9g8Cs+jRO3PSOrtyf0FeHe+2y+CoGBONDgEuKCPAemt2eElZrDNn7IjtaaJ1s ji4wo8YcaXsxWkU2IWXOGf4lzwdv7WCzI6+ELFjt2sX4pEqaPgr0IeWx0w80jXZolM jcxPW29wq5ECQ== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 10/13] drm/msm/disp/dpu1: Add support for DSC in encoder Date: Fri, 21 May 2021 18:19:43 +0530 Message-Id: <20210521124946.3617862-15-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When DSC is enabled in DT, we need to configure the encoder for DSC configuration, calculate DSC parameters for the given timing. This patch adds that support by adding dpu_encoder_prep_dsc() which is invoked when DSC is enabled in DT Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 190 +++++++++++++++++++- 1 file changed, 189 insertions(+), 1 deletion(-) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 8d942052db8a..18cb1274a8bb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -21,12 +21,17 @@ #include "dpu_hw_intf.h" #include "dpu_hw_ctl.h" #include "dpu_hw_dspp.h" +#include "dpu_hw_dsc.h" #include "dpu_formats.h" #include "dpu_encoder_phys.h" #include "dpu_crtc.h" #include "dpu_trace.h" #include "dpu_core_irq.h" +#define DSC_MODE_SPLIT_PANEL BIT(0) +#define DSC_MODE_MULTIPLEX BIT(1) +#define DSC_MODE_VIDEO BIT(2) + #define DPU_DEBUG_ENC(e, fmt, ...) DPU_DEBUG("enc%d " fmt,\ (e) ? (e)->base.base.id : -1, ##__VA_ARGS__) @@ -135,6 +140,7 @@ enum dpu_enc_rc_states { * @cur_slave: As above but for the slave encoder. * @hw_pp: Handle to the pingpong blocks used for the display. No. * pingpong blocks can be different than num_phys_encs. + * @hw_dsc Handle to the DSC blocks used for the display. * @intfs_swapped: Whether or not the phys_enc interfaces have been swapped * for partial update right-only cases, such as pingpong * split where virtual pingpong does not generate IRQs @@ -180,6 +186,7 @@ struct dpu_encoder_virt { struct dpu_encoder_phys *cur_master; struct dpu_encoder_phys *cur_slave; struct dpu_hw_pingpong *hw_pp[MAX_CHANNELS_PER_ENC]; + struct dpu_hw_dsc *hw_dsc[MAX_CHANNELS_PER_ENC]; bool intfs_swapped; @@ -566,6 +573,8 @@ static struct msm_display_topology dpu_encoder_get_topology( struct drm_display_mode *mode) { struct msm_display_topology topology = {0}; + struct drm_encoder *drm_enc; + struct msm_drm_private *priv; int i, intf_count = 0; for (i = 0; i < MAX_PHYS_ENCODERS_PER_VIRTUAL; i++) @@ -1008,7 +1017,8 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, struct dpu_hw_blk *hw_ctl[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_dspp[MAX_CHANNELS_PER_ENC] = { NULL }; - int num_lm, num_ctl, num_pp; + struct dpu_hw_blk *hw_dsc[MAX_CHANNELS_PER_ENC]; + int num_lm, num_ctl, num_pp, num_dsc; int i, j; if (!drm_enc) { @@ -1061,11 +1071,16 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, drm_enc->base.id, DPU_HW_BLK_DSPP, hw_dspp, ARRAY_SIZE(hw_dspp)); + num_dsc = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, + drm_enc->base.id, DPU_HW_BLK_DSC, hw_dsc, ARRAY_SIZE(hw_dsc)); for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) dpu_enc->hw_pp[i] = i < num_pp ? to_dpu_hw_pingpong(hw_pp[i]) : NULL; + for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) + dpu_enc->hw_dsc[i] = i < num_dsc ? to_dpu_hw_dsc(hw_dsc[i]) : NULL; + cstate = to_dpu_crtc_state(drm_crtc->state); for (i = 0; i < num_lm; i++) { @@ -1810,10 +1825,179 @@ static void dpu_encoder_vsync_event_work_handler(struct kthread_work *work) nsecs_to_jiffies(ktime_to_ns(wakeup_time))); } +static int dpu_encoder_dsc_update_pic_dim(struct msm_display_dsc_config *dsc, + int pic_width, int pic_height) +{ + if (!dsc || !pic_width || !pic_height) { + DPU_ERROR("invalid input: pic_width=%d pic_height=%d\n", + pic_width, pic_height); + return -EINVAL; + } + + if ((pic_width % dsc->drm.slice_width) || (pic_height % dsc->drm.slice_height)) { + DPU_ERROR("pic_dim=%dx%d has to be multiple of slice=%dx%d\n", + pic_width, pic_height, dsc->drm.slice_width, dsc->drm.slice_height); + return -EINVAL; + } + + dsc->drm.pic_width = pic_width; + dsc->drm.pic_height = pic_height; + + return 0; +} + +static void +dpu_encoder_dsc_pclk_param_calc(struct msm_display_dsc_config *dsc, u32 width) +{ + int slice_per_pkt, slice_per_intf; + int bytes_in_slice, total_bytes_per_intf; + + if (!dsc || !dsc->drm.slice_width || !dsc->slice_per_pkt) { + DPU_ERROR("Invalid DSC/slices\n"); + return; + } + + slice_per_pkt = dsc->slice_per_pkt; + slice_per_intf = DIV_ROUND_UP(width, dsc->drm.slice_width); + + /* + * If slice_per_pkt is greater than slice_per_intf then default to 1. + * This can happen during partial update. + */ + if (slice_per_pkt > slice_per_intf) + slice_per_pkt = 1; + + bytes_in_slice = DIV_ROUND_UP(dsc->drm.slice_width * + dsc->drm.bits_per_pixel, 8); + total_bytes_per_intf = bytes_in_slice * slice_per_intf; + + dsc->eol_byte_num = total_bytes_per_intf % 3; + dsc->pclk_per_line = DIV_ROUND_UP(total_bytes_per_intf, 3); + dsc->bytes_in_slice = bytes_in_slice; + dsc->bytes_per_pkt = bytes_in_slice * slice_per_pkt; + dsc->pkt_per_line = slice_per_intf / slice_per_pkt; +} + +static void +dpu_encoder_dsc_initial_line_calc(struct msm_display_dsc_config *dsc, + u32 enc_ip_width) +{ + int ssm_delay, total_pixels, soft_slice_per_enc; + + soft_slice_per_enc = enc_ip_width / dsc->drm.slice_width; + + /* + * minimum number of initial line pixels is a sum of: + * 1. sub-stream multiplexer delay (83 groups for 8bpc, + * 91 for 10 bpc) * 3 + * 2. for two soft slice cases, add extra sub-stream multiplexer * 3 + * 3. the initial xmit delay + * 4. total pipeline delay through the "lock step" of encoder (47) + * 5. 6 additional pixels as the output of the rate buffer is + * 48 bits wide + */ + ssm_delay = ((dsc->drm.bits_per_component < 10) ? 84 : 92); + total_pixels = ssm_delay * 3 + dsc->drm.initial_xmit_delay + 47; + if (soft_slice_per_enc > 1) + total_pixels += (ssm_delay * 3); + dsc->initial_lines = DIV_ROUND_UP(total_pixels, dsc->drm.slice_width); +} + +static bool +dpu_encoder_dsc_ich_reset_override_needed(struct msm_display_dsc_config *dsc, bool pu_en) +{ + /* As per the DSC spec, ICH_RESET can be either end of the slice line + * or at the end of the slice. HW internally generates ich_reset at + * end of the slice line if DSC_MERGE is used or encoder has two + * soft slices. However, if encoder has only 1 soft slice and DSC_MERGE + * is not used then it will generate ich_reset at the end of slice. + * + * Now as per the spec, during one PPS session, position where + * ich_reset is generated should not change. Now if full-screen frame + * has more than 1 soft slice then HW will automatically generate + * ich_reset at the end of slice_line. But for the same panel, if + * partial frame is enabled and only 1 encoder is used with 1 slice, + * then HW will generate ich_reset at end of the slice. This is a + * mismatch. Prevent this by overriding HW's decision. + */ + return pu_en && dsc && (dsc->drm.slice_count > 1) && + (dsc->drm.slice_width == dsc->drm.pic_width); +} + +static void dpu_encoder_dsc_pipe_cfg(struct dpu_hw_dsc *hw_dsc, + struct dpu_hw_pingpong *hw_pp, + struct msm_display_dsc_config *dsc, + u32 common_mode, bool ich_reset) +{ + if (hw_dsc->ops.dsc_config) + hw_dsc->ops.dsc_config(hw_dsc, dsc, common_mode, ich_reset); + + if (hw_dsc->ops.dsc_config_thresh) + hw_dsc->ops.dsc_config_thresh(hw_dsc, dsc); + + if (hw_pp->ops.setup_dsc) + hw_pp->ops.setup_dsc(hw_pp); + + if (hw_pp->ops.enable_dsc) + hw_pp->ops.enable_dsc(hw_pp); +} + +static void dpu_encoder_prep_dsc(struct dpu_encoder_virt *dpu_enc, + struct msm_display_dsc_config *dsc) +{ + /* coding only for 2LM, 2enc, 1 dsc config */ + struct dpu_encoder_phys *enc_master = dpu_enc->cur_master; + struct dpu_hw_dsc *hw_dsc[MAX_CHANNELS_PER_ENC]; + struct dpu_hw_pingpong *hw_pp[MAX_CHANNELS_PER_ENC]; + int this_frame_slices; + int intf_ip_w, enc_ip_w; + int ich_res, dsc_common_mode; + int pic_width, pic_height; + int i; + + for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) { + hw_pp[i] = dpu_enc->hw_pp[i]; + hw_dsc[i] = dpu_enc->hw_dsc[i]; + + if (!hw_pp[i] || !hw_dsc[i]) { + DPU_ERROR_ENC(dpu_enc, "invalid params for DSC\n"); + return; + } + } + + dsc_common_mode = 0; + pic_width = dsc->drm.pic_width; + pic_height = dsc->drm.pic_height; + + dpu_encoder_dsc_update_pic_dim(dsc, pic_width, pic_height); + + dsc_common_mode = DSC_MODE_MULTIPLEX | DSC_MODE_SPLIT_PANEL; + if (enc_master->intf_mode == INTF_MODE_VIDEO) + dsc_common_mode |= DSC_MODE_VIDEO; + + this_frame_slices = pic_width / dsc->drm.slice_width; + intf_ip_w = this_frame_slices * dsc->drm.slice_width; + + dpu_encoder_dsc_pclk_param_calc(dsc, intf_ip_w); + + /* + * dsc merge case: when using 2 encoders for the same stream, + * no. of slices need to be same on both the encoders. + */ + enc_ip_w = intf_ip_w / 2; + dpu_encoder_dsc_initial_line_calc(dsc, enc_ip_w); + + ich_res = dpu_encoder_dsc_ich_reset_override_needed(dsc, false); + + for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) + dpu_encoder_dsc_pipe_cfg(hw_dsc[i], hw_pp[i], dsc, dsc_common_mode, ich_res); +} + void dpu_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc) { struct dpu_encoder_virt *dpu_enc; struct dpu_encoder_phys *phys; + struct msm_drm_private *priv; bool needs_hw_reset = false; unsigned int i; @@ -1841,6 +2025,10 @@ void dpu_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc) dpu_encoder_helper_hw_reset(dpu_enc->phys_encs[i]); } } + + priv = drm_enc->dev->dev_private; + if (priv->dsc) + dpu_encoder_prep_dsc(dpu_enc, priv->dsc); } void dpu_encoder_kickoff(struct drm_encoder *drm_enc) From patchwork Fri May 21 12:49:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444684 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947477jac; Fri, 21 May 2021 05:51:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXt4fWsphAWsr4DhUoTBJSuxFzSRtydQVxPwFDkg5YdrHAZWo/InTAiY4NwLE7HPVoFUYW X-Received: by 2002:a17:90a:ae15:: with SMTP id t21mr11162274pjq.55.1621601470039; Fri, 21 May 2021 05:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601470; cv=none; d=google.com; s=arc-20160816; b=KSPS0XLEQ9jvDZa2CWLVo7cO+SC8GYSA7Mu3AB9gWWlQyIc8qTAtoDTrkZrEtPqrd7 0//ZBYidshHZ1ZwX40TlkMNtnZMpo23PXMKT+Pw8cyIIKKifidHszBXzZhclGpnoa3rf xoQYe54OkuQ6uJz1ZL1jrOdPDlq+gBCcgq3SaYeH4d4i06PjWhdwqYFgfH5SZgT7/483 CQUokKINL1p5jDzaKygeidXIDQf/shZcJmg7kV8Rw7kvYOkiHnmRjJylQ5NsDQ5o07uw RDhjTRp84v+9H7ikWVZp98VlRoEO/aCb1wxlutkibFGQW7H02775k/t4U5GV1PQFuTLg b/wg== 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=iimuAY9vsMYvuAUIInB0upgtFDgzNEGiZwmyEGL5iLQ=; b=w3g6sA1gIfFi4xlQ5Hi4baLbIbCLvABhyktcLiVePGG+oRdEaNOcGbP/yVNf9G6rfI KMkSW/f35vlZAC4p0VTqKTtPQAUBlrwpnd/3kiLNgNcbyre8Qml0YGmmsbYFEY+5xQIK 1Lo4EEaVFe1mgz+moRt1kihzH1cq23EGmh7gAZkkDWfx9cszEns3tO8xS4Lclm1Hzj1n T7yLIQdXxiOgF49/47KULyVeapQRYQesFNDf2OC9JwUG9ONVciZnV7OxPgYQxXzrhQqS gMkwT5T8Cvjcb6kdTYwQAzHI4ZBou2u/ThosWWW88vuP/Hp3FKWGI4pjpeJIbnklkBw8 peeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=FB68gwgt; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id s145si6522702pfs.223.2021.05.21.05.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:51:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=FB68gwgt; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF04E6F640; Fri, 21 May 2021 12:51:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id CDEAD6F642; Fri, 21 May 2021 12:51:05 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id E14876128A; Fri, 21 May 2021 12:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601465; bh=eVVDh8nCN1Yb9AXj+WoqxP1WMiIq4cunVQYwXJ411+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FB68gwgtGq+RZ4lPSxPU+13XhnB3Z1HeAi0q79m3DM6PjhpWtWjDip5fcFjxrhvM+ ol7wYkrEr/NS9MtlEPiMHD5yeRWP/rNHxZq/8s5zBSsycfFi/dKlY8U7G7Vp9LFHDK 0TPbbcvegHUcB+CFnPLq3eobXs3T2Qh0NrwKe3TXRhEBu9bWPlTlhlsmWZpbGuHNKV d+puPRLs5D9EuQjNB2ZGpFT8MHAOlRq50wK0+8TfTxTFhFHVKNumlwUfWr11TapcJp OHdKcxj4MVyXluooa23nXv8aiPKvyA1FHPCfRmUVf4GRGlqYtATn9Rt5czTjmcvivR q+TIbdNhsEpaQ== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 11/13] drm/msm/disp/dpu1: Add support for DSC in topology Date: Fri, 21 May 2021 18:19:44 +0530 Message-Id: <20210521124946.3617862-16-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" For DSC to work we typically need a 2,2,1 configuration. This should suffice for resolutions upto 4k. For more resolutions like 8k this won't work. Furthermore, we can use 1 DSC encoder in lesser resulutions, but that is not power efficient according to Abhinav, so it is recommended to always use 2 encoders. So for now we blindly create 2,2,1 topology when DSC is enabled Co-developed-by: Abhinav Kumar Signed-off-by: Abhinav Kumar Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 18cb1274a8bb..bffb40085c67 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -609,8 +609,22 @@ static struct msm_display_topology dpu_encoder_get_topology( topology.num_enc = 0; topology.num_intf = intf_count; + drm_enc = &dpu_enc->base; + priv = drm_enc->dev->dev_private; + if (priv && priv->dsc) { + /* In case of Display Stream Compression DSC, we would use + * 2 encoders, 2 line mixers and 1 interface + * this is power optimal and can drive upto (including) 4k + * screens + */ + topology.num_enc = 2; + topology.num_intf = 1; + topology.num_lm = 2; + } + return topology; } + static int dpu_encoder_virt_atomic_check( struct drm_encoder *drm_enc, struct drm_crtc_state *crtc_state, From patchwork Fri May 21 12:49:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444685 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947545jac; Fri, 21 May 2021 05:51:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbM1MaNFvyQDM0gLKW8iGe5WB6SYFdC3Hi0YxeOg/XChgKdy1iSl2QQSQrUN0aYJRoaL9l X-Received: by 2002:a17:902:541:b029:f0:3187:409b with SMTP id 59-20020a1709020541b02900f03187409bmr11990572plf.47.1621601474533; Fri, 21 May 2021 05:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601474; cv=none; d=google.com; s=arc-20160816; b=KfzUvmvhnaXNXkbaM7BpzDkwz9Tl2WY39LnMqGL3qyd9IeMNF+h0YDGMxhqmJsmMk7 T7ctNMnKjeSIwo9KtGX41uaZiL3xIe6/i+Y1ViYJ12lUIJGW0IGn7a3F4nZL8sTJYT5z BNulDzcP6ZIVO8op3ndqno/uhODba5G/iszXII6AEemIB2eDzusUztWw3kdDnpqcf03v Qv+9w3t0H7mqEYSRII9bU6ssKND8HGjhda4bLgM2oTMkCYpaF2nm+WdF6FaytA0fUHVb flQe67g9oOxzFC2XMxE09TrfB2jNadPZaN2RY8rpQB0cxHmN/CS+8llvAvA+HL4MkayH QwFg== 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=WbEkLtomeaFzULx7CohxWE8NUyRaWTzAcciIVzmhtww=; b=OWP2nUem22UHfvBqhUOBdumgZzXVlW2PFQ6kXWgwIJW1h4rAgotpaD1qDRlE8dBs9g /mRwLzAo5Mk0Yy4j6fpzwNhzqkKOG64+v3cGU5Wi40MwOuS7s8vbitkHhnz3LKXqkc8i 1AhIHyp+Oqx+OWV/0nR9ari6Gf4Z42NVwfFNzvY1WpjfJ/d164WqUdzQHG0909EezZzV WEd9Y7Rmkrc8AosMZX4VPTV0kTjiSToVX7oIsLq04F9NQR/z7NhF7Y9gx12VtlrIuM+G fpm0DDPfOaofJA2GchDHTV3mwTjP58IejWHqW226bNumab4bZf+7+gzdgBDP0tqJdnaP f0aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=X8O9zxzz; 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=kernel.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 d19si6872347pls.100.2021.05.21.05.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:51:14 -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=@kernel.org header.s=k20201202 header.b=X8O9zxzz; 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=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C072D6F642; Fri, 21 May 2021 12:51:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10A3D6F642; Fri, 21 May 2021 12:51:11 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F988613DE; Fri, 21 May 2021 12:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601470; bh=VAT+6TRJEy5p0xfa5NF7lAjHEvfhUuINzi99UFg1nws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8O9zxzzqcVkrceHF1QQ7lUyOOIQ3/UO3b+ofCxLgjbpBSwrJjyrYCiBsMaK1GtGy wqR6MB60CNfHqvN2Hn+LkUBOUeG9zHp11zOvgOM8hNKLKLB9NueARrqs/WEjW9W7c/ xNt8gFm1l6evsvj/lRNbkieAphJ3BzcucWhL9HOBr7Ozo85EQhVsxf0UAOsujYjWa4 CIv7rZPhk1kbYlG10oRUFMbeLYu5odGzqLQ7OMugPnLW3oFNC9CKN4Lo79WuFuioMR myP13sivRYBMcnrjwlhD7Aq7YnAsq3D8O14G0ecovFs5pziMtP+c+4lm5INLDlQbu0 SN24pwojeUbSw== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 12/13] drm/msm/dsi: Add support for DSC configuration Date: Fri, 21 May 2021 18:19:45 +0530 Message-Id: <20210521124946.3617862-17-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When DSC is enabled, we need to configure DSI registers accordingly and configure the respective stream compression registers. Add support to calculate the register setting based on DSC params and timing information and configure these registers. Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/dsi/dsi.xml.h | 10 +++ drivers/gpu/drm/msm/dsi/dsi_host.c | 118 ++++++++++++++++++++++++++--- 2 files changed, 118 insertions(+), 10 deletions(-) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/dsi/dsi.xml.h b/drivers/gpu/drm/msm/dsi/dsi.xml.h index 50eb4d1b8fdd..b8e9e608abfc 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.xml.h +++ b/drivers/gpu/drm/msm/dsi/dsi.xml.h @@ -2310,4 +2310,14 @@ static inline uint32_t REG_DSI_7nm_PHY_LN_TX_DCTRL(uint32_t i0) { return 0x00000 #define REG_DSI_7nm_PHY_PLL_PERF_OPTIMIZE 0x00000260 +#define REG_DSI_VIDEO_COMPRESSION_MODE_CTRL 0x0000029c + +#define REG_DSI_VIDEO_COMPRESSION_MODE_CTRL2 0x000002a0 + +#define REG_DSI_COMMAND_COMPRESSION_MODE_CTRL 0x000002a4 + +#define REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2 0x000002a8 + +#define REG_DSI_COMMAND_COMPRESSION_MODE_CTRL3 0x000002ac + #endif /* DSI_XML */ diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 864d3c655e73..e26545fc82e0 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -954,6 +954,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_dual_dsi) u32 va_end = va_start + mode->vdisplay; u32 hdisplay = mode->hdisplay; u32 wc; + u32 data; DBG(""); @@ -972,7 +973,69 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_dual_dsi) hdisplay /= 2; } + if (msm_host->dsc) { + struct msm_display_dsc_config *dsc = msm_host->dsc; + + /* update dsc params with timing params */ + dsc->drm.pic_width = mode->hdisplay; + dsc->drm.pic_height = mode->vdisplay; + + /* Divide the display by 3 but keep back/font porch and + * pulse width same + */ + h_total -= hdisplay; + hdisplay /= 3; + h_total += hdisplay; + ha_end = ha_start + hdisplay; + } + if (msm_host->mode_flags & MIPI_DSI_MODE_VIDEO) { + if (msm_host->dsc) { + struct msm_display_dsc_config *dsc = msm_host->dsc; + u32 reg, intf_width, slice_per_intf, width; + u32 total_bytes_per_intf; + + /* first calculate dsc parameters and then program + * compress mode registers + */ + intf_width = hdisplay; + slice_per_intf = DIV_ROUND_UP(intf_width, dsc->drm.slice_width); + + /* If slice_per_pkt > slice_per_intf, then use 1 + * This can happen during partial update + */ + if (dsc->slice_per_pkt > slice_per_intf) + dsc->slice_per_pkt = 1; + + dsc->bytes_in_slice = DIV_ROUND_UP(dsc->drm.slice_width * 8, 8); + total_bytes_per_intf = dsc->bytes_in_slice * slice_per_intf; + + dsc->eol_byte_num = total_bytes_per_intf % 3; + dsc->pclk_per_line = DIV_ROUND_UP(total_bytes_per_intf, 3); + dsc->bytes_per_pkt = dsc->bytes_in_slice * dsc->slice_per_pkt; + dsc->pkt_per_line = slice_per_intf / dsc->slice_per_pkt; + + width = dsc->pclk_per_line; + reg = dsc->bytes_per_pkt << 16; + reg |= (0x0b << 8); /* dtype of compressed image */ + + /* pkt_per_line: + * 0 == 1 pkt + * 1 == 2 pkt + * 2 == 4 pkt + * 3 pkt is not supported + * above translates to ffs() - 1 + */ + reg |= (ffs(dsc->pkt_per_line) - 1) << 6; + + dsc->eol_byte_num = total_bytes_per_intf % 3; + reg |= dsc->eol_byte_num << 4; + reg |= 1; + + dsi_write(msm_host, + REG_DSI_VIDEO_COMPRESSION_MODE_CTRL, reg); + } + dsi_write(msm_host, REG_DSI_ACTIVE_H, DSI_ACTIVE_H_START(ha_start) | DSI_ACTIVE_H_END(ha_end)); @@ -991,19 +1054,50 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_dual_dsi) DSI_ACTIVE_VSYNC_VPOS_START(vs_start) | DSI_ACTIVE_VSYNC_VPOS_END(vs_end)); } else { /* command mode */ + if (msm_host->dsc) { + struct msm_display_dsc_config *dsc = msm_host->dsc; + u32 reg, reg_ctrl, reg_ctrl2; + u32 slice_per_intf, bytes_in_slice, total_bytes_per_intf; + + reg_ctrl = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL); + reg_ctrl2 = dsi_read(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2); + + slice_per_intf = DIV_ROUND_UP(hdisplay, dsc->drm.slice_width); + bytes_in_slice = DIV_ROUND_UP(dsc->drm.slice_width * + dsc->drm.bits_per_pixel, 8); + dsc->drm.slice_chunk_size = bytes_in_slice; + total_bytes_per_intf = dsc->bytes_in_slice * slice_per_intf; + dsc->pkt_per_line = slice_per_intf / dsc->slice_per_pkt; + + reg = 0x39 << 8; + reg |= ffs(dsc->pkt_per_line) << 6; + + dsc->eol_byte_num = total_bytes_per_intf % 3; + reg |= dsc->eol_byte_num << 4; + reg |= 1; + + reg_ctrl |= reg; + reg_ctrl2 |= bytes_in_slice; + + dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg); + dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2, reg_ctrl2); + } + /* image data and 1 byte write_memory_start cmd */ - wc = hdisplay * dsi_get_bpp(msm_host->format) / 8 + 1; + if (!msm_host->dsc) + wc = hdisplay * dsi_get_bpp(msm_host->format) / 8 + 1; + else + wc = mode->hdisplay / 2 + 1; + + data = DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) | + DSI_CMD_MDP_STREAM0_CTRL_VIRTUAL_CHANNEL(msm_host->channel) | + DSI_CMD_MDP_STREAM0_CTRL_DATA_TYPE(MIPI_DSI_DCS_LONG_WRITE); - dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL, - DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) | - DSI_CMD_MDP_STREAM0_CTRL_VIRTUAL_CHANNEL( - msm_host->channel) | - DSI_CMD_MDP_STREAM0_CTRL_DATA_TYPE( - MIPI_DSI_DCS_LONG_WRITE)); + dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL, data); - dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_TOTAL, - DSI_CMD_MDP_STREAM0_TOTAL_H_TOTAL(hdisplay) | - DSI_CMD_MDP_STREAM0_TOTAL_V_TOTAL(mode->vdisplay)); + data = DSI_CMD_MDP_STREAM0_TOTAL_H_TOTAL(hdisplay) | + DSI_CMD_MDP_STREAM0_TOTAL_V_TOTAL(mode->vdisplay); + dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_TOTAL, data); } } @@ -2111,6 +2205,7 @@ int msm_dsi_host_modeset_init(struct mipi_dsi_host *host, struct msm_dsi_host *msm_host = to_msm_dsi_host(host); const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd; struct platform_device *pdev = msm_host->pdev; + struct msm_drm_private *priv; int ret; msm_host->irq = irq_of_parse_and_map(pdev->dev.of_node, 0); @@ -2130,6 +2225,9 @@ int msm_dsi_host_modeset_init(struct mipi_dsi_host *host, } msm_host->dev = dev; + priv = dev->dev_private; + priv->dsc = msm_host->dsc; + ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K); if (ret) { pr_err("%s: alloc tx gem obj failed, %d\n", __func__, ret); From patchwork Fri May 21 12:49:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 444686 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp947590jac; Fri, 21 May 2021 05:51:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxoabTHHsW9817JJbv7lgRTX+wycoQH5UNLnRwxw2027wpQggQQCx2K1gvoPpTDcJ3SRPJ X-Received: by 2002:a17:902:6bca:b029:ee:b72c:5585 with SMTP id m10-20020a1709026bcab02900eeb72c5585mr11903658plt.46.1621601477323; Fri, 21 May 2021 05:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601477; cv=none; d=google.com; s=arc-20160816; b=YTWG9o6g2LykjW/eO6t9Hq+BRQbNknc8ud5SUys77OA3MTnIQsqmoPYiQ5OLY+SiV6 1t+nJIvnkv1KDxBOVg5A2ms95gkXXcvBhKINE7gGeUytugrgkTy41s0pZztqntm5urUI tcwyGd0ZEZspEpVFBgLo/hAC7prB8KGiwDWzfdi7gWY5fVkjr++j1Ih9COFgNnJzthek /j68ri0ri1ihuNJv0lP+zBDzYe697oMhZKTOWn4cgnxYvNx+LPjR7mb7bNafEdjLsMhB l8+DDMg/W4+UqYJ9X/TiuWLRs42yxim8n7ZI5GbTIBmTYp6p/T/7Cz8ZP5tAfiiMMOGs e0ew== 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=Xa0r7CmGJ2U0ZfLVogGI8+ECXe3u9EpA8z+jooPuUYo=; b=OPo5zYG+SjyFN2EjDM53L8u7eU8UispG3s8o8l6Zlk4fTM4pVQclbbiM2g13FjQb78 0Lxx5/ymJ3PfPMvJB2XQmHQEgRIVz3oUzobXyChgf5D6Y69gmt3eI4PUsl9KBNR+E8S8 8jhwtF1Dh8NuffZ2FYzcN+GgsHY0e+s80tcOqhGq0/RJbA7s+jnWRpT6/SXs472v7CjD Pv/m4FNqJf/chrZuB7cIQFrLc2KqQuolqbbOcY/H+n5PulCzkXXeNp55P9SgwVHk0t1R hlA8hjzgzySVYVRrgAhkH/VhHsb+xRtcs6hZ3DstitkARwHIdUKYkypGjWZbkqvO92VU hY3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=eYH2aO+a; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n28si6775587pgf.393.2021.05.21.05.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 05:51:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=eYH2aO+a; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14D0B6F629; Fri, 21 May 2021 12:51:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABDB86F643; Fri, 21 May 2021 12:51:14 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B158B613DF; Fri, 21 May 2021 12:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621601474; bh=jEvngLW/cjGIBmD812MSfH6Z7qHrHgE9F0mc+LlnVCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYH2aO+avVrOJeVmpIWkod3vEau0fORf9Df3DZDMoskPVFvaUvPY+5szCcRutxyor my/mvi2OEBri3/ZHX84NlAG9J6Zi50Ukj4foiizCf540o36gs0yeyf2JOAjTkENiKr IEkFzsYiZ51NtQuzVrPhuQb3pDd/zTwNRyYjDAvn/zDDr82dpjYXzpg2ANpeadLb4Q vYGPdPWRxaonJ8oCAhedKvcyTFZrD0KLhqfFPSqGJF1QfvlPokiljPLqAx4I8l/h9j mGurVFDjsR6red27U+RBw8U0+HIeCtypozMPYBw84krdbWWpiGGB+LADU0cOc4AbTa erFTEMQAFEt+Q== From: Vinod Koul To: Rob Clark Subject: [RFC PATCH 13/13] drm/msm/dsi: Pass DSC params to drm_panel Date: Fri, 21 May 2021 18:19:46 +0530 Message-Id: <20210521124946.3617862-18-vkoul@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210521124946.3617862-1-vkoul@kernel.org> References: <20210521124946.3617862-1-vkoul@kernel.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: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When DSC is enabled, we need to pass the DSC parameters to panel driver as well, so add a dsc parameter in panel and set it when DSC is enabled Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/dsi/dsi_host.c | 5 +++++ include/drm/drm_panel.h | 7 +++++++ 2 files changed, 12 insertions(+) -- 2.26.3 diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index e26545fc82e0..7fc7002eda78 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1700,6 +1700,7 @@ static int dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *dsi) { struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + struct drm_panel *panel; int ret; if (dsi->lanes > msm_host->num_data_lanes) @@ -1719,6 +1720,10 @@ static int dsi_host_attach(struct mipi_dsi_host *host, if (msm_host->dev) queue_work(msm_host->workqueue, &msm_host->hpd_work); + panel = msm_dsi_host_get_panel(host); + if (panel) + panel->dsc = &msm_host->dsc->drm; + return 0; } diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 33605c3f0eba..27a7808a29f2 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -171,6 +171,13 @@ struct drm_panel { * Panel entry in registry. */ struct list_head list; + + /** + * @dsc: + * + * Panel DSC pps payload to be sent + */ + struct drm_dsc_config *dsc; }; void drm_panel_init(struct drm_panel *panel, struct device *dev,