[PATCH 1/2] xrandr: Use more decimal places when printing various rates
Ville Syrjälä
ville.syrjala at linux.intel.com
Thu Feb 20 09:00:21 PST 2014
On Thu, Feb 20, 2014 at 08:51:57AM -0800, Aaron Plattner wrote:
> On 02/20/2014 12:47 AM, Ville Syrjälä wrote:
> > On Wed, Feb 19, 2014 at 04:22:19PM -0800, Aaron Plattner wrote:
> >> On 05/31/2013 07:01 AM, ville.syrjala at linux.intel.com wrote:
> >>> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >>>
> >>> Using just one decimal place for dotclock and refresh rates loses quite
> >>> a bit of information. When dealing with 60Hz vs. 59.94Hz refresh rate
> >>> modes for example, it's useful to see at least two decimal places. For
> >>> the dotclock in similar cases, three decimal places seems quite a bit
> >>> better than just one.
> >>>
> >>> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >>> ---
> >>> xrandr.c | 18 +++++++++---------
> >>> 1 file changed, 9 insertions(+), 9 deletions(-)
> >>>
> >>> diff --git a/xrandr.c b/xrandr.c
> >>> index 94e5c2e..9467c29 100644
> >>> --- a/xrandr.c
> >>> +++ b/xrandr.c
> >>> @@ -1564,7 +1564,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 %6.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++)
> >>> @@ -3589,7 +3589,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) %6.3fMHz",
> >>> mode->name, (int)mode->id,
> >>> (double)mode->dotClock / 1000000.0);
> >>> for (f = 0; mode_flags[f].flag; f++)
> >>> @@ -3600,10 +3600,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 %6.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 %6.2fHz\n",
> >>> mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal,
> >>> mode_refresh (mode));
> >>> mode->modeFlags |= ModeShown;
> >>> @@ -3630,7 +3630,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 (" %6.2f", mode_refresh (kmode));
> >>> if (kmode == output->mode_info)
> >>> printf ("*");
> >>> else
> >>> @@ -3651,13 +3651,13 @@ main (int argc, char **argv)
> >>>
> >>> if (!(mode->modeFlags & ModeShown))
> >>> {
> >>> - printf (" %s (0x%x) %6.1fMHz\n",
> >>> + printf (" %s (0x%x) %6.3fMHz\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 %6.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 %6.2fHz\n",
> >>> mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal,
> >>> mode_refresh (mode));
> >>> }
> >>> @@ -3747,7 +3747,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);
> >>
> >> This is referring to an RandR 1.1 rate, which is returned by the server
> >> as a signed short. It'll never match if the user specifies anything
> >> other than an even decimal, so it doesn't really make sense to print
> >> more digits here.
> >
> > 'rate' can be whatever the user specified, so ideally we should print it
> > with the same precision that the user used. But doing that seems more
> > trouble that it's worth. And if we don't go that dar, then I don't see
> > any problem with printing it using the same precision that is used
> > everywhere else.
> >
> > But I don't really care that much. If you prefer to drop this hunk, I'm
> > fine with that.
>
> That's fair. I pushed these changes:
>
> remote: Updating patchwork state for http://patchwork.freedesktop.org/project/Xorg/list/
> remote: I: patch #13760 updated using rev 8f9b993342fddfceaa1afbec2996ce10038f10d7.
> remote: I: patch #13761 updated using rev 00c795e99fe29ecd56e05e915e508c7af0ac39ad.
> remote: I: 2 patch(es) updated to state Accepted.
> To git.freedesktop.org:/git/xorg/app/xrandr
> 7ede207f9064..00c795e99fe2 master -> master
Thanks.
>
> >>> exit (1);
> >>> }
> >>> }
> >>>
>
> --
> Aaron
--
Ville Syrjälä
Intel OTC
More information about the xorg-devel
mailing list