[PATCH] xrandr:an additional decimal for frequencies

Ville Syrjälä syrjala at sci.fi
Mon Feb 17 11:54:10 PST 2014


On Mon, Feb 17, 2014 at 03:00:37AM -0800, Kevin Mitchell wrote:
> I have an Samsung eh5000 HDTV that I connect to my Intel Mobile Ivy
> Bridge chipset via HDMI1 as reported by xrandr. Without modification
> xrandr reports the display's native resolution as
> 
> 1920x1080      60.0 +   59.9     30.0     24.0     30.0     24.0*
> 
> This is confusing because it lists 30.0 and 24.0 twice each. I
> discovered that I could switch to either one by specifying --rate
> 30/--rate 29.97 or --rate 24/--rate 23.98.
> 
> With the attached patch, I have added one more decimal everywhere a
> frequency is reported so that now it's clearer what the supported
> refresh rates are and how to switch to them:
> 
> 1920x1080     60.00 +  59.94    30.00    24.00    29.97    23.98*
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=75086
> 
> Signed-off-by: Kevin Mitchell <kevmitch at gmail.com>

I sent and identical (probably) patch [1] maybe half a year ago. Either
it just fell through the cracks or xrandr isn't maintained since one
cared enough to apply it. I also sent another patch [2] to make the
refresh rate for interlaced modes more accurate.

[1] http://lists.x.org/archives/xorg-devel/2013-May/036354.html
[2] http://lists.x.org/archives/xorg-devel/2013-May/036355.html

> ---
>  xrandr.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/xrandr.c b/xrandr.c
> index 0a182c3..b25da47 100644
> --- a/xrandr.c
> +++ b/xrandr.c
> @@ -1566,7 +1566,7 @@ crtc_apply (crtc_t *crtc)
>  	rr_outputs[o] = crtc->outputs[o]->output.xid;
>      mode = crtc->mode_info->id;
>      if (verbose) {
> -	printf ("crtc %d: %12s %6.1f +%d+%d", crtc->crtc.index,
> +	printf ("crtc %d: %12s %7.2f +%d+%d", crtc->crtc.index,
>  		crtc->mode_info->name, mode_refresh (crtc->mode_info),
>  		crtc->x, crtc->y);
>  	for (o = 0; o < crtc->noutput; o++)
> @@ -3641,7 +3641,7 @@ main (int argc, char **argv)
>  		    XRRModeInfo	*mode = find_mode_by_xid (output_info->modes[j]);
>  		    int		f;
>  		    
> -		    printf ("  %s (0x%x) %6.1fMHz",
> +		    printf ("  %s (0x%x) %7.2fMHz",
>  			    mode->name, (int)mode->id,
>  			    (double)mode->dotClock / 1000000.0);
>  		    for (f = 0; mode_flags[f].flag; f++)
> @@ -3652,10 +3652,10 @@ main (int argc, char **argv)
>  		    if (j < output_info->npreferred)
>  			printf (" +preferred");
>  		    printf ("\n");
> -		    printf ("        h: width  %4d start %4d end %4d total %4d skew %4d clock %6.1fKHz\n",
> +		    printf ("        h: width  %4d start %4d end %4d total %4d skew %4d clock %7.2fKHz\n",
>  			    mode->width, mode->hSyncStart, mode->hSyncEnd,
>  			    mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000);
> -		    printf ("        v: height %4d start %4d end %4d total %4d           clock %6.1fHz\n",
> +		    printf ("        v: height %4d start %4d end %4d total %4d           clock %7.2fHz\n",
>  			    mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal,
>  			    mode_refresh (mode));
>  		    mode->modeFlags |= ModeShown;
> @@ -3682,7 +3682,7 @@ main (int argc, char **argv)
>  			if (strcmp (jmode->name, kmode->name) != 0) continue;
>  			mode_shown[k] = True;
>  			kmode->modeFlags |= ModeShown;
> -			printf (" %6.1f", mode_refresh (kmode));
> +			printf (" %7.2f", mode_refresh (kmode));
>  			if (kmode == output->mode_info)
>  			    printf ("*");
>  			else
> @@ -3703,13 +3703,13 @@ main (int argc, char **argv)
>  
>  	    if (!(mode->modeFlags & ModeShown))
>  	    {
> -		printf ("  %s (0x%x) %6.1fMHz\n",
> +		printf ("  %s (0x%x) %7.2fMHz\n",
>  			mode->name, (int)mode->id,
>  			(double)mode->dotClock / 1000000.0);
> -		printf ("        h: width  %4d start %4d end %4d total %4d skew %4d clock %6.1fKHz\n",
> +		printf ("        h: width  %4d start %4d end %4d total %4d skew %4d clock %7.2fKHz\n",
>  			mode->width, mode->hSyncStart, mode->hSyncEnd,
>  			mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000);
> -		printf ("        v: height %4d start %4d end %4d total %4d           clock %6.1fHz\n",
> +		printf ("        v: height %4d start %4d end %4d total %4d           clock %7.2fHz\n",
>  			mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal,
>  			mode_refresh (mode));
>  	    }
> @@ -3799,7 +3799,7 @@ main (int argc, char **argv)
>  	    if (rate == rates[i])
>  		break;
>  	if (i == nrate) {
> -	    fprintf (stderr, "Rate %.1f Hz not available for this size\n", rate);
> +	    fprintf (stderr, "Rate %.2f Hz not available for this size\n", rate);
>  	    exit (1);
>  	}
>      }
> -- 
> 1.9.0.rc3
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel

-- 
Ville Syrjälä
syrjala at sci.fi
http://www.sci.fi/~syrjala/


More information about the xorg-devel mailing list