Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1676139 > unrolled thread

[PATCH 3/8] drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0.

Started byEric Anholt <eric@anholt.net>
First post2017-06-27 22:10 +0200
Last post2017-06-29 11:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/8] drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0. Eric Anholt <eric@anholt.net> - 2017-06-27 22:10 +0200
    Re: [PATCH 3/8] drm/vc4: Use drm_mode_vrefresh() in DSI fixup,  in case vrefresh is 0. Andrzej Hajda <a.hajda@samsung.com> - 2017-06-29 11:30 +0200

#1676139 — [PATCH 3/8] drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0.

FromEric Anholt <eric@anholt.net>
Date2017-06-27 22:10 +0200
Subject[PATCH 3/8] drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0.
Message-ID<tX4Y9-5uo-7@gated-at.bofh.it>
I'm not sure what changed where I started getting vrefresh=0 from the
mode to be fixed up.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 629d372633e6..fca4d7fd677e 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -866,7 +866,9 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
 	adjusted_mode->clock = pixel_clock_hz / 1000 + 1;
 
 	/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
-	adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * mode->vtotal);
+	adjusted_mode->htotal = pixel_clock_hz / (drm_mode_vrefresh(mode) *
+						  mode->vtotal);
+
 	adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal;
 	adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1677554 — Re: [PATCH 3/8] drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0.

FromAndrzej Hajda <a.hajda@samsung.com>
Date2017-06-29 11:30 +0200
SubjectRe: [PATCH 3/8] drm/vc4: Use drm_mode_vrefresh() in DSI fixup, in case vrefresh is 0.
Message-ID<tXDVT-5Ni-7@gated-at.bofh.it>
In reply to#1676139
On 27.06.2017 21:58, Eric Anholt wrote:
> I'm not sure what changed where I started getting vrefresh=0 from the
> mode to be fixed up.

It can be a case of low pixel_clock value, maybe it should be
investigated further, unless there is execution path with forgotten
mode->vrefresh =

drm_mode_vrefresh(mode)

>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/vc4/vc4_dsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index 629d372633e6..fca4d7fd677e 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
> @@ -866,7 +866,9 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
>  	adjusted_mode->clock = pixel_clock_hz / 1000 + 1;
>  
>  	/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
> -	adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * mode->vtotal);
> +	adjusted_mode->htotal = pixel_clock_hz / (drm_mode_vrefresh(mode) *
> +						  mode->vtotal);
> +

I am not sure but I guess division by zero is also possible here.
I do not know if you need to handle interlaced/dblscan/vscan modes, but
maybe it would be safer to calculate adjusted_htotal according to:

adjusted_mode->htotal = pixel_clock_hz * mode->htotal / (mode->clock * 1000)

or sth similar.


Regards
Andrzej

>  	adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal;
>  	adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
>  

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web