linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Vinod Koul <vkoul@kernel.org>, Rob Clark <robdclark@gmail.com>
Cc: linux-arm-msm@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Jonathan Marek <jonathan@marek.ca>,
	Abhinav Kumar <abhinavk@codeaurora.org>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org
Subject: Re: [REPOST PATCH v4 02/13] drm/msm/dsi: Pass DSC params to drm_panel
Date: Mon, 21 Feb 2022 15:37:37 +0300	[thread overview]
Message-ID: <813297ce-c0fa-e805-eec9-1dbc31860f8f@linaro.org> (raw)
In-Reply-To: <20220210103423.271016-3-vkoul@kernel.org>

On 10/02/2022 13:34, Vinod Koul wrote:
> 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
> 
> Also, fetch and pass DSC configuration for DSI panels to DPU encoder,
> which will enable and configure DSC hardware blocks accordingly.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  2 ++
>   drivers/gpu/drm/msm/dsi/dsi.c           |  5 +++++
>   drivers/gpu/drm/msm/dsi/dsi.h           |  1 +
>   drivers/gpu/drm/msm/dsi/dsi_host.c      | 22 ++++++++++++++++++++++
>   drivers/gpu/drm/msm/msm_drv.h           |  8 ++++++++
>   include/drm/drm_panel.h                 |  7 +++++++
>   6 files changed, 45 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 47fe11a84a77..ef6ddac22767 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -578,6 +578,8 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>   			MSM_DISPLAY_CAP_CMD_MODE :
>   			MSM_DISPLAY_CAP_VID_MODE;
>   
> +		info.dsc = msm_dsi_get_dsc_config(priv->dsi[i]);
> +
>   		if (msm_dsi_is_bonded_dsi(priv->dsi[i]) && priv->dsi[other]) {
>   			rc = msm_dsi_modeset_init(priv->dsi[other], dev, encoder);
>   			if (rc) {
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
> index 052548883d27..3aeac15e7421 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi.c
> @@ -20,6 +20,11 @@ bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
>   	return !(host_flags & MIPI_DSI_MODE_VIDEO);
>   }
>   
> +struct msm_display_dsc_config *msm_dsi_get_dsc_config(struct msm_dsi *msm_dsi)
> +{
> +	return msm_dsi_host_get_dsc_config(msm_dsi->host);
> +}
> +
>   static int dsi_get_phy(struct msm_dsi *msm_dsi)
>   {
>   	struct platform_device *pdev = msm_dsi->pdev;
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
> index c8dedc95428c..16cd9b2fce86 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.h
> +++ b/drivers/gpu/drm/msm/dsi/dsi.h
> @@ -152,6 +152,7 @@ int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
>   int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
>   void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host);
>   void msm_dsi_host_test_pattern_en(struct mipi_dsi_host *host);
> +struct msm_display_dsc_config *msm_dsi_host_get_dsc_config(struct mipi_dsi_host *host);
>   
>   /* dsi phy */
>   struct msm_dsi_phy;
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 27553194f9fa..7e9913eff724 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -2059,9 +2059,24 @@ 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 drm_panel *panel;
>   	int ret;
>   
>   	msm_host->dev = dev;
> +	panel = msm_dsi_host_get_panel(&msm_host->base);
> +
> +	if (panel && panel->dsc) {
> +		struct msm_display_dsc_config *dsc = msm_host->dsc;
> +
> +		if (!dsc) {
> +			dsc = devm_kzalloc(&msm_host->pdev->dev, sizeof(*dsc), GFP_KERNEL);
> +			if (!dsc)
> +				return -ENOMEM;
> +			dsc->drm = panel->dsc;
> +			msm_host->dsc = 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);
> @@ -2626,3 +2641,10 @@ void msm_dsi_host_test_pattern_en(struct mipi_dsi_host *host)
>   		dsi_write(msm_host, REG_DSI_TEST_PATTERN_GEN_CMD_STREAM0_TRIGGER,
>   				DSI_TEST_PATTERN_GEN_CMD_STREAM0_TRIGGER_SW_TRIGGER);
>   }
> +
> +struct msm_display_dsc_config *msm_dsi_host_get_dsc_config(struct mipi_dsi_host *host)
> +{
> +	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
> +
> +	return msm_host->dsc;
> +}
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index 384f9bad4760..e7a312edfe67 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -119,6 +119,7 @@ struct msm_display_topology {
>    *                      based on num_of_h_tiles
>    * @is_te_using_watchdog_timer:  Boolean to indicate watchdog TE is
>    *				 used instead of panel TE in cmd mode panels
> + * @dsc:		DSC configuration data for DSC-enabled displays
>    */
>   struct msm_display_info {
>   	int intf_type;
> @@ -126,6 +127,7 @@ struct msm_display_info {
>   	uint32_t num_of_h_tiles;
>   	uint32_t h_tile_instance[MAX_H_TILES_PER_DISPLAY];
>   	bool is_te_using_watchdog_timer;
> +	struct msm_display_dsc_config *dsc;
>   };
>   
>   /* Commit/Event thread specific structure */
> @@ -365,6 +367,7 @@ void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi
>   bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi);
>   bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
>   bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi);
> +struct msm_display_dsc_config *msm_dsi_get_dsc_config(struct msm_dsi *msm_dsi);
>   #else
>   static inline void __init msm_dsi_register(void)
>   {
> @@ -393,6 +396,11 @@ static inline bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
>   {
>   	return false;
>   }
> +
> +static inline struct msm_display_dsc_config *msm_dsi_get_dsc_config(struct msm_dsi *msm_dsi)
> +{
> +	return NULL;
> +}
>   #endif
>   
>   #ifdef CONFIG_DRM_MSM_DP
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 4602f833eb51..eb8ae9bf32ed 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;

This is not a blocker or a request for a change, just a kind of thought:

I've been looking onto this change for a while from the following point 
of view. I'd like to switch DSI driver to use panel 
bridge/drm_bridge_connector(). This simplifies handling of DRM bridge 
chains.

Also since DSC can be consumed not by the panel itself, but by the next 
bridge in chain (e.g. it's supported on the DSI input by the ANX7625 
bridge), using drm_panel doesn't look completely correct.

So, I have been looking for a better way to pass DSC configuration.

For DSI we can use struct mipi_dsi_device (together with the rest of 
data we are passing from DSI device driver to DSI host). This would 
allow both DSI panels and DSI bridges to pass the DSC config to the 
previous deivce in chain (DSI host).

Any comments/thoughs?

Note, for DP this problem doesn't exist. The DSC config is a part of 
DPDC, so it will be parsed by the msm/dp driver in a natural way.


>   };
>   
>   void drm_panel_init(struct drm_panel *panel, struct device *dev,


-- 
With best wishes
Dmitry

  parent reply	other threads:[~2022-02-21 12:37 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 10:34 [REPOST PATCH v4 00/13] drm/msm: Add Display Stream Compression Support Vinod Koul
2022-02-10 10:34 ` [REPOST PATCH v4 01/13] drm/msm/dsi: add support for dsc data Vinod Koul
2022-02-10 11:07   ` Dmitry Baryshkov
2022-02-17 20:06   ` Abhinav Kumar
2022-02-21  2:17   ` Dmitry Baryshkov
2022-02-10 10:34 ` [REPOST PATCH v4 02/13] drm/msm/dsi: Pass DSC params to drm_panel Vinod Koul
2022-02-10 10:43   ` Dmitry Baryshkov
2022-02-17  0:27   ` Abhinav Kumar
2022-02-21 12:37   ` Dmitry Baryshkov [this message]
2022-03-03 19:08     ` Abhinav Kumar
2022-02-10 10:34 ` [REPOST PATCH v4 03/13] drm/msm/disp/dpu1: Add support for DSC Vinod Koul
2022-02-16 18:57   ` Abhinav Kumar
2022-02-16 19:46     ` Dmitry Baryshkov
2022-02-17  4:20       ` Vinod Koul
2022-02-10 10:34 ` [REPOST PATCH v4 04/13] drm/msm/disp/dpu1: Add support for DSC in pingpong block Vinod Koul
2022-02-16 19:49   ` Abhinav Kumar
2022-02-17  4:21     ` Vinod Koul
2022-02-10 10:34 ` [REPOST PATCH v4 05/13] drm/msm/disp/dpu1: Add DSC for SDM845 to hw_catalog Vinod Koul
2022-02-16 19:42   ` [Freedreno] " Abhinav Kumar
2022-02-10 10:34 ` [REPOST PATCH v4 06/13] drm/msm/disp/dpu1: Add DSC support in hw_ctl Vinod Koul
2022-02-16 19:52   ` [Freedreno] " Abhinav Kumar
2022-02-17 22:20   ` Marijn Suijten
2022-03-24 16:24     ` Vinod Koul
2022-02-10 10:34 ` [REPOST PATCH v4 07/13] drm/msm/disp/dpu1: Add support for DSC in encoder Vinod Koul
2022-02-10 11:13   ` Dmitry Baryshkov
2022-02-16 19:54   ` [Freedreno] " Abhinav Kumar
2022-02-17  6:08     ` Vinod Koul
2022-02-17 22:32   ` Marijn Suijten
2022-03-23 14:40     ` Vinod Koul
2022-03-24 15:41       ` Vinod Koul
2022-02-21  1:41   ` Dmitry Baryshkov
2022-02-10 10:34 ` [REPOST PATCH v4 08/13] drm/msm/disp/dpu1: Don't use DSC with mode_3d Vinod Koul
2022-02-10 10:55   ` Dmitry Baryshkov
2022-02-17  3:11   ` Abhinav Kumar
2022-02-17  6:10     ` Vinod Koul
2022-02-17  6:33       ` Abhinav Kumar
2022-02-17  7:12         ` Dmitry Baryshkov
2022-02-18 20:46           ` Abhinav Kumar
2022-02-18 21:21             ` Dmitry Baryshkov
2022-02-18 21:29               ` [Freedreno] " Abhinav Kumar
2022-02-18 21:36                 ` Dmitry Baryshkov
2022-02-10 10:34 ` [REPOST PATCH v4 09/13] drm/msm: Add missing structure documentation Vinod Koul
2022-02-10 10:39   ` Dmitry Baryshkov
2022-02-17  3:12   ` Abhinav Kumar
2022-02-17 22:34   ` Marijn Suijten
2022-02-10 10:34 ` [REPOST PATCH v4 10/13] drm/msm/disp/dpu1: Add support for DSC in topology Vinod Koul
2022-02-10 10:47   ` Dmitry Baryshkov
2022-02-17 21:44   ` Marijn Suijten
2022-03-23 11:38     ` [Freedreno] " Vinod Koul
2022-02-17 22:37   ` Marijn Suijten
2022-03-23 11:39     ` Vinod Koul
2022-02-10 10:34 ` [REPOST PATCH v4 11/13] drm/msm/disp/dpu1: Add DSC support in RM Vinod Koul
2022-02-17  3:14   ` Abhinav Kumar
2022-02-17  3:21   ` Abhinav Kumar
2022-02-10 10:34 ` [REPOST PATCH v4 12/13] drm/msm/dsi: add mode valid callback for dsi_mgr Vinod Koul
2022-02-17  3:17   ` Abhinav Kumar
2022-02-10 10:34 ` [REPOST PATCH v4 13/13] drm/msm/dsi: Add support for DSC configuration Vinod Koul
2022-02-17  3:44   ` [Freedreno] " Abhinav Kumar
2022-02-17  6:19     ` Vinod Koul
2022-02-17  9:27   ` Marijn Suijten
2022-02-17 10:51     ` [Freedreno] " Vinod Koul
2022-02-17 14:38       ` Marijn Suijten
2022-02-21  2:11   ` Dmitry Baryshkov
2022-03-24 15:45     ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=813297ce-c0fa-e805-eec9-1dbc31860f8f@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=abhinavk@codeaurora.org \
    --cc=airlied@linux.ie \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jonathan@marek.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).