dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Martin Kepplinger <martin.kepplinger@puri.sm>,
	marex@denx.de,  stefan@agner.ch, airlied@linux.ie,
	daniel@ffwll.ch, shawnguo@kernel.org
Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-imx@nxp.com
Subject: Re: [PATCH] drm: mxsfb: Add interconnect path request
Date: Tue, 01 Dec 2020 12:20:18 +0100	[thread overview]
Message-ID: <0a7f2c0e8618f89c1e2eede661cf5a59d68cecad.camel@pengutronix.de> (raw)
In-Reply-To: <20201201103757.32165-1-martin.kepplinger@puri.sm>

Am Dienstag, den 01.12.2020, 11:37 +0100 schrieb Martin Kepplinger:
> Add interconnect support to mxsfb so that it is able to request enough
> bandwidth to DDR for display output to work.
> 
> Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
> ---
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c | 33 +++++++++++++++++++++++++++++++
>  drivers/gpu/drm/mxsfb/mxsfb_drv.h |  2 ++
>  drivers/gpu/drm/mxsfb/mxsfb_kms.c | 13 ++++++++++++
>  3 files changed, 48 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 6faf17b6408d..b05e8e5f1e38 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -15,6 +15,7 @@
>  #include <linux/of_device.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/interconnect.h>
>  
> 
> 
> 
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_bridge.h>
> @@ -311,6 +312,34 @@ static const struct of_device_id mxsfb_dt_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mxsfb_dt_ids);
> 
> +
> +static int mxsfb_init_icc(struct platform_device *pdev)
> +{
> +	struct drm_device *drm = platform_get_drvdata(pdev);
> +	struct mxsfb_drm_private *mxsfb = drm->dev_private;
> +	int ret;
> +
> +	/* Optional interconnect request */
> +	mxsfb->icc_path = devm_of_icc_get(&pdev->dev, "lcdif-dram");
> +	if (IS_ERR(mxsfb->icc_path)) {
> +		ret = PTR_ERR(mxsfb->icc_path);
> +		if (ret == -EPROBE_DEFER)
> +			return ret;
> +
> +		mxsfb->icc_path = NULL;
> +		dev_dbg(drm->dev,
> +			"No interconnect may cause display underflows!\n");
> +	}
> +
> +	ret = icc_set_bw(mxsfb->icc_path, 0, MBps_to_icc(700));

Shouldn't this be proportional to the current mode, instead of a fixed
value? 700MB looks like 1080p@60Hz@32bpp with a bit of headroom, but
there are many valid use-cases where significantly smaller displays are
connected to the eLCDIF. Also it doesn't cover the case where an
overlay is active, which needs additional bandwidth.

> +	if (ret) {
> +		dev_err(drm->dev, "%s: icc_set_bw failed: %d\n", __func__, ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
[...]
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
> @@ -310,6 +311,12 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
>  	struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(crtc->dev);
>  	struct drm_device *drm = mxsfb->drm;
>  	dma_addr_t paddr;
> +	int ret;
> +
> +	ret = icc_enable(mxsfb->icc_path);
> +	if (ret)
> +		dev_err_ratelimited(drm->dev, "%s: icc_enable failed: %d\n",
> +				    __func__, ret);

Why ratelimited? I wouldn't expect atomic enable/disable to be called
often enough for this to make any difference.

Regards,
Lucas

> 
>  	pm_runtime_get_sync(drm->dev);
>  	mxsfb_enable_axi_clk(mxsfb);

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2020-12-01 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 10:37 [PATCH] drm: mxsfb: Add interconnect path request Martin Kepplinger
2020-12-01 11:20 ` Lucas Stach [this message]

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=0a7f2c0e8618f89c1e2eede661cf5a59d68cecad.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=martin.kepplinger@puri.sm \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    /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).