[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1564128364-23055-1-git-send-email-lowry.li@arm.com>
Date: Fri, 26 Jul 2019 08:06:16 +0000
From: "Lowry Li (Arm Technology China)" <Lowry.Li@....com>
To: 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>
CC: "Julien Yin (Arm Technology China)" <Julien.Yin@....com>,
"Jonathan Chai (Arm Technology China)" <Jonathan.Chai@....com>,
Ayan Halder <Ayan.Halder@....com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
nd <nd@....com>
Subject: [PATCH] drm/komeda: Adds more check in mode_valid
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;
--
1.9.1
Powered by blists - more mailing lists