Message ID | 20211116062256.2417186-14-vkoul@kernel.org |
---|---|
State | New |
Headers | show |
Series | drm/msm: Add Display Stream Compression Support | expand |
On 16/11/2021 09:22, 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 > > Signed-off-by: Vinod Koul <vkoul@kernel.org> > --- > drivers/gpu/drm/msm/dsi/dsi_host.c | 16 +++++++++++++++- > include/drm/drm_panel.h | 7 +++++++ > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c > index 2c14c36f0b3d..3d5773fcf496 100644 > --- a/drivers/gpu/drm/msm/dsi/dsi_host.c > +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c > @@ -2159,11 +2159,25 @@ 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 msm_drm_private *priv; > + struct drm_panel *panel; > int ret; > > msm_host->dev = dev; > + panel = msm_dsi_host_get_panel(&msm_host->base); > priv = dev->dev_private; > - priv->dsc = msm_host->dsc; > + > + if (panel && panel->dsc) { > + struct msm_display_dsc_config *dsc = priv->dsc; > + > + if (!dsc) { > + dsc = kzalloc(sizeof(*dsc), GFP_KERNEL); devm_kzalloc()? Or even simpler: embed msm_display_dsc_config into struct msm_dsi_host and use it only if dsc->drm is set (IOW the panel provided DSC data)? > + if (!dsc) > + return -ENOMEM; > + dsc->drm = panel->dsc; > + priv->dsc = dsc; > + msm_host->dsc = dsc; > + } > + } > > ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K); > if (ret) { > 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; > }; > > void drm_panel_init(struct drm_panel *panel, struct device *dev, >
On 16/11/2021 09:22, 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 Nit: I think patch description is a bit inaccurate, since we pass DSC parameters from panel to DSI host rather than other way around. > > Signed-off-by: Vinod Koul <vkoul@kernel.org> > --- > drivers/gpu/drm/msm/dsi/dsi_host.c | 16 +++++++++++++++- > include/drm/drm_panel.h | 7 +++++++ > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c > index 2c14c36f0b3d..3d5773fcf496 100644 > --- a/drivers/gpu/drm/msm/dsi/dsi_host.c > +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c > @@ -2159,11 +2159,25 @@ 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 msm_drm_private *priv; > + struct drm_panel *panel; > int ret; > > msm_host->dev = dev; > + panel = msm_dsi_host_get_panel(&msm_host->base); > priv = dev->dev_private; > - priv->dsc = msm_host->dsc; > + > + if (panel && panel->dsc) { > + struct msm_display_dsc_config *dsc = priv->dsc; > + > + if (!dsc) { > + dsc = kzalloc(sizeof(*dsc), GFP_KERNEL); > + if (!dsc) > + return -ENOMEM; > + dsc->drm = panel->dsc; > + priv->dsc = dsc; > + msm_host->dsc = dsc; > + } > + } > > ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K); > if (ret) { > 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; > }; > > void drm_panel_init(struct drm_panel *panel, struct device *dev, >
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 2c14c36f0b3d..3d5773fcf496 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2159,11 +2159,25 @@ 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 msm_drm_private *priv; + struct drm_panel *panel; int ret; msm_host->dev = dev; + panel = msm_dsi_host_get_panel(&msm_host->base); priv = dev->dev_private; - priv->dsc = msm_host->dsc; + + if (panel && panel->dsc) { + struct msm_display_dsc_config *dsc = priv->dsc; + + if (!dsc) { + dsc = kzalloc(sizeof(*dsc), GFP_KERNEL); + if (!dsc) + return -ENOMEM; + dsc->drm = panel->dsc; + priv->dsc = dsc; + msm_host->dsc = dsc; + } + } ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K); if (ret) { 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; }; void drm_panel_init(struct drm_panel *panel, struct device *dev,
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 <vkoul@kernel.org> --- drivers/gpu/drm/msm/dsi/dsi_host.c | 16 +++++++++++++++- include/drm/drm_panel.h | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletion(-)