lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <bf5c60fb64278fc4894098f50add801f6365d823.1498574041.git.joabreu@synopsys.com>
Date:   Tue, 27 Jun 2017 15:36:07 +0100
From:   Jose Abreu <Jose.Abreu@...opsys.com>
To:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:     Jose Abreu <Jose.Abreu@...opsys.com>,
        Carlos Palminha <CARLOS.PALMINHA@...opsys.com>,
        Alexey Brodkin <Alexey.Brodkin@...opsys.com>,
        Daniel Vetter <daniel.vetter@...ll.ch>,
        Dave Airlie <airlied@...ux.ie>
Subject: [PATCH] drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback

Currently we expect that clock driver produces the exact same value
as we are requiring. There can, and will, be some deviation however
so we need to take into account that instead of rejecting the mode.

According to HDMI spec we have a max of +-0.5% for the pixel clock
frequency variation. Lets take that into an advantage and use it
to calculate how much deviation we can support.

This patch was based on today's drm-misc-next.

Signed-off-by: Jose Abreu <joabreu@...opsys.com>
Cc: Carlos Palminha <palminha@...opsys.com>
Cc: Alexey Brodkin <abrodkin@...opsys.com>
Cc: Daniel Vetter <daniel.vetter@...ll.ch>
Cc: Dave Airlie <airlied@...ux.ie>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 611af74..20528ba 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -69,12 +69,13 @@ static enum drm_mode_status arc_pgu_crtc_mode_valid(struct drm_crtc *crtc,
 {
 	struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
 	long rate, clk_rate = mode->clock * 1000;
+	long diff = clk_rate / 200; /* +-0.5% allowed by HDMI spec*/
 
 	rate = clk_round_rate(arcpgu->clk, clk_rate);
-	if (rate != clk_rate)
-		return MODE_NOCLOCK;
+	if ((max(rate, clk_rate) - min(rate, clk_rate)) < diff)
+		return MODE_OK;
 
-	return MODE_OK;
+	return MODE_NOCLOCK;
 }
 
 static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc)
-- 
1.9.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ