lkml.org 
[lkml]   [2019]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drm/komeda: Adds more check in mode_valid
Date
This patch adds the checks for vrefresh, crtc_hdisplay and crtc_vdisplay.

Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.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
\
 
 \ /
  Last update: 2019-07-26 10:06    [W:0.036 / U:30.772 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site