weston fbdev: Instead of less than 1 Hz use default refresh rate

Submitted by Oliver Smith on April 17, 2017, 11:11 a.m.

Details

Message ID 82fb4765-ff9b-a39f-e375-fc8eed90cbe3@bitmessage.ch
State Accepted
Commit a5066e00e8fdd8775d3c784a1c0cf1a07fa6dacb
Headers show
Series "weston fbdev: Instead of less than 1 Hz use default refresh rate" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Oliver Smith April 17, 2017, 11:11 a.m.
I ran Weston on a Nexus 4 mobile phone, with a native GNU/Linux userland,
and the latest Android kernel for that device from LineageOS [1].

calculate_refresh_rate() returned 1 (mHz), which gets rounded to 0 Hz later
and results in nothing being drawn to the screen.

This patch makes sure, that there is at least a refresh rate of 1 Hz, because
it returns the default refresh rate of 60 Hz otherwise.

[1]: https://github.com/LineageOS/lge-kernel-mako

Signed-off-by: Oliver Smith <ollieparanoid@bitmessage.ch>
---
 libweston/compositor-fbdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 32d71e0..e80a504 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -253,7 +253,8 @@  calculate_refresh_rate(struct fb_var_screeninfo *vinfo)
 		if (refresh_rate > 200000)
 			refresh_rate = 200000; /* cap at 200 Hz */
 
-		return refresh_rate;
+		if (refresh_rate >= 1000) /* at least 1 Hz */
+			return refresh_rate;
 	}
 
 	return 60 * 1000; /* default to 60 Hz */

Comments

On 4/17/17 1:11 PM, Oliver Smith wrote:
> I ran Weston on a Nexus 4 mobile phone, with a native GNU/Linux userland,
> and the latest Android kernel for that device from LineageOS [1].
> 
> calculate_refresh_rate() returned 1 (mHz), which gets rounded to 0 Hz later
> and results in nothing being drawn to the screen.
> 
> This patch makes sure, that there is at least a refresh rate of 1 Hz, because
> it returns the default refresh rate of 60 Hz otherwise.
> 
> [1]: https://github.com/LineageOS/lge-kernel-mako
> 
> Signed-off-by: Oliver Smith <ollieparanoid@bitmessage.ch>

We’ll just pretend I know what I’m doing:
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>

And pushed:
47bbdc72..a5066e00  master -> master

Thanks,


> ---
>   libweston/compositor-fbdev.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> index 32d71e0..e80a504 100644
> --- a/libweston/compositor-fbdev.c
> +++ b/libweston/compositor-fbdev.c
> @@ -253,7 +253,8 @@ calculate_refresh_rate(struct fb_var_screeninfo *vinfo)
>   		if (refresh_rate > 200000)
>   			refresh_rate = 200000; /* cap at 200 Hz */
>   
> -		return refresh_rate;
> +		if (refresh_rate >= 1000) /* at least 1 Hz */
> +			return refresh_rate;
>   	}
>   
>   	return 60 * 1000; /* default to 60 Hz */
>