[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <13323280.1D6Sk5SDY4@e123338-lin.cambridge.arm.com>
Date: Thu, 3 Oct 2019 17:05:40 +0000
From: Mihail Atanassov <Mihail.Atanassov@....com>
To: "Lowry Li (Arm Technology China)" <Lowry.Li@....com>
CC: Liviu Dudau <Liviu.Dudau@....com>,
"james qian wang (Arm Technology China)" <james.qian.wang@....com>,
"maarten.lankhorst@...ux.intel.com"
<maarten.lankhorst@...ux.intel.com>,
"seanpaul@...omium.org" <seanpaul@...omium.org>,
"airlied@...ux.ie" <airlied@...ux.ie>,
Brian Starkey <Brian.Starkey@....com>,
Ayan Halder <Ayan.Halder@....com>,
"Jonathan Chai (Arm Technology China)" <Jonathan.Chai@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"Julien Yin (Arm Technology China)" <Julien.Yin@....com>,
nd <nd@....com>
Subject: Re: [PATCH] drm/komeda: Adds more check in mode_valid
On Friday, 26 July 2019 09:06:16 BST Lowry Li (Arm Technology China) wrote:
> This patch adds the checks for vrefresh, crtc_hdisplay and crtc_vdisplay.
>
> Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@....com>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 28 +++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> index 2fed1f6..017f6b6 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> @@ -403,11 +403,37 @@ unsigned long komeda_crtc_get_aclk(struct komeda_crtc_state *kcrtc_st)
> struct komeda_dev *mdev = crtc->dev->dev_private;
> struct komeda_crtc *kcrtc = to_kcrtc(crtc);
> struct komeda_pipeline *master = kcrtc->master;
> - unsigned long min_pxlclk, min_aclk;
> + struct komeda_compiz *compiz = master->compiz;
> + unsigned long min_pxlclk, min_aclk, delta, full_frame;
> + int hdisplay = m->hdisplay;
>
> if (m->flags & DRM_MODE_FLAG_INTERLACE)
> return MODE_NO_INTERLACE;
>
> + full_frame = m->htotal * m->vtotal;
> + delta = abs(m->clock * 1000 - m->vrefresh * full_frame);
> + if (m->vrefresh && (delta > full_frame)) {
> + DRM_DEBUG_ATOMIC("mode clock check error!\n");
> + return MODE_CLOCK_RANGE;
> + }
> +
> + if (kcrtc->side_by_side)
> + hdisplay /= 2;
> +
> + if (!in_range(&compiz->hsize, hdisplay)) {
> + DRM_DEBUG_ATOMIC("hdisplay[%u] is out of range[%u, %u]!\n",
> + hdisplay, compiz->hsize.start,
> + compiz->hsize.end);
> + return MODE_BAD_HVALUE;
> + }
> +
> + if (!in_range(&compiz->vsize, m->vdisplay)) {
> + DRM_DEBUG_ATOMIC("vdisplay[%u] is out of range[%u, %u]!\n",
> + m->vdisplay, compiz->vsize.start,
> + compiz->vsize.end);
> + return MODE_BAD_VVALUE;
> + }
> +
> min_pxlclk = m->clock * 1000;
> if (master->dual_link)
> min_pxlclk /= 2;
>
LGTM,
Reviewed-by: Mihail Atanassov <mihail.atanassov@....com>
--
Mihail
Powered by blists - more mailing lists