[PATCH xrandr] Split verbose mode printing into a helper function

2015-04-09 Thread Aaron Plattner
Combine the two forms of verbose mode printing into a single function.  Pass the
'current' and 'preferred' flags as arguments.  This fixes the code that prints
unassociated modes to print the flags as well.

Signed-off-by: Aaron Plattner 
---
 xrandr.c | 62 ++
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index 8a345427a226..5be2167d724f 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -566,7 +566,7 @@ mode_geometry (XRRModeInfo *mode_info, Rotation rotation,
 
 /* v refresh frequency in Hz */
 static double
-mode_refresh (XRRModeInfo *mode_info)
+mode_refresh (const XRRModeInfo *mode_info)
 {
 double rate;
 double vTotal = mode_info->vTotal;
@@ -592,7 +592,7 @@ mode_refresh (XRRModeInfo *mode_info)
 
 /* h sync frequency in Hz */
 static double
-mode_hsync (XRRModeInfo *mode_info)
+mode_hsync (const XRRModeInfo *mode_info)
 {
 double rate;
 
@@ -603,6 +603,30 @@ mode_hsync (XRRModeInfo *mode_info)
 return rate;
 }
 
+static void print_verbose_mode (const XRRModeInfo *mode, Bool current,
+   Bool preferred)
+{
+int f;
+
+printf ("  %s (0x%x) %6.3fMHz",
+   mode->name, (int)mode->id,
+   (double)mode->dotClock / 100.0);
+for (f = 0; mode_flags[f].flag; f++)
+   if (mode->modeFlags & mode_flags[f].flag)
+   printf (" %s", mode_flags[f].string);
+if (current)
+   printf (" *current");
+if (preferred)
+   printf (" +preferred");
+printf ("\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.2fHz\n",
+   mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal,
+   mode_refresh (mode));
+}
+
 static void
 init_name (name_t *name)
 {
@@ -3836,25 +3860,9 @@ main (int argc, char **argv)
for (j = 0; j < output_info->nmode; j++)
{
XRRModeInfo *mode = find_mode_by_xid 
(output_info->modes[j]);
-   int f;
-   
-   printf ("  %s (0x%x) %6.3fMHz",
-   mode->name, (int)mode->id,
-   (double)mode->dotClock / 100.0);
-   for (f = 0; mode_flags[f].flag; f++)
-   if (mode->modeFlags & mode_flags[f].flag)
-   printf (" %s", mode_flags[f].string);
-   if (mode == output->mode_info)
-   printf (" *current");
-   if (j < output_info->npreferred)
-   printf (" +preferred");
-   printf ("\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.2fHz\n",
-   mode->height, mode->vSyncStart, mode->vSyncEnd, 
mode->vTotal,
-   mode_refresh (mode));
+
+   print_verbose_mode (mode, mode == output->mode_info,
+   j < output_info->npreferred);
mode->modeFlags |= ModeShown;
}
}
@@ -3899,17 +3907,7 @@ main (int argc, char **argv)
XRRModeInfo *mode = &res->modes[m];
 
if (!(mode->modeFlags & ModeShown))
-   {
-   printf ("  %s (0x%x) %6.3fMHz\n",
-   mode->name, (int)mode->id,
-   (double)mode->dotClock / 100.0);
-   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.2fHz\n",
-   mode->height, mode->vSyncStart, mode->vSyncEnd, 
mode->vTotal,
-   mode_refresh (mode));
-   }
+   print_verbose_mode(mode, False, False);
}
exit (0);
 }
-- 
2.3.5

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] dix: Fix endianess detection

2015-04-09 Thread Adam Jackson
On Thu, 2015-04-09 at 15:33 +0200, Olivier Fourdan wrote:
> Make sure X_BIG_ENDIAN/X_LITTLE_ENDIAN are defined before actually using
> them.
> 
> Otherwise, byte order could be wrong even though endianess detection is
> correct.
> 
> Reported-by: Tim Waugh 
> Signed-off-by: Olivier Fourdan 

I'm a little wary of this.  Xarch.h doesn't have ifdef guards arounds
its definition of those, might be better to just include that after the
#undef X_BYTE_ORDER.

- ajax

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PULL] randr cleanups et al

2015-04-09 Thread Emil Velikov
Silly me forgot to add Keith to the Cc list.

Keith can you consider the pull request below.

Thanks
Emil


On 24 March 2015 at 17:52, Emil Velikov  wrote:
> Hi Keith,
>
> Various patches from me.
>
> Please consider pulling into master.
>
> The following changes since commit 0a78b599b34cc8b5fe6fe82f90e90234e8ab7a56:
>
>   int10: Fix error check for pci_device_map_legacy (2015-03-13 12:31:21 +1000)
>
> are available in the git repository at:
>
>   https://github.com/evelikov/xserver.git
>
> for you to fetch changes up to 23702dd2689e2e1e65be5767ac0303a985bb04a0:
>
>   randr: coding style fixes (2015-03-24 17:21:26 +)
>
> 
> Emil Velikov (6):
>   configure.ac: remove remaining TLS references
>   randr: remove chatty error messages
>   randr: use randr: prefix in ErrorF()
>   randr: use local variables where possible
>   randr: wrap long line
>   randr: coding style fixes
>
>  configure.ac| 16 +-
>  include/dix-config.h.in |  3 ---
>  m4/xorg-tls.m4  | 55 
> -
>  randr/rrcrtc.c  | 42 +++--
>  randr/rrscreen.c|  7 +++
>  5 files changed, 26 insertions(+), 97 deletions(-)
>  delete mode 100644 m4/xorg-tls.m4
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH] dix: Fix endianess detection

2015-04-09 Thread Olivier Fourdan
Make sure X_BIG_ENDIAN/X_LITTLE_ENDIAN are defined before actually using
them.

Otherwise, byte order could be wrong even though endianess detection is
correct.

Reported-by: Tim Waugh 
Signed-off-by: Olivier Fourdan 
---
 include/dix-config.h.in | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 1aa77a5..192c558 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -3,6 +3,14 @@
 #ifndef _DIX_CONFIG_H_
 #define _DIX_CONFIG_H_
 
+#ifndef X_BIG_ENDIAN
+#  define X_BIG_ENDIAN 4321
+#endif
+
+#ifndef X_LITTLE_ENDIAN
+#  define X_LITTLE_ENDIAN 1234
+#endif
+
 /* Support BigRequests extension */
 #undef BIGREQS
 
-- 
2.3.5

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel