x11-xserver-utils: Changes to 'debian-experimental'
debian/changelog | 7 +
xrandr/configure | 20 ++--
xrandr/configure.ac | 2
xrandr/xrandr.c | 260 +++++++++++++++++++++++++++++++++++++++-------------
xrandr/xrandr.man | 136 ++++++++++++++++-----------
5 files changed, 296 insertions(+), 129 deletions(-)
New commits:
commit 9f53940343444727eeb72633cc1448dc97e274fc
Author: Julien Cristau <jcristau@debian.org>
Date: Fri Jul 6 22:39:04 2007 +0200
Add closer for 430122.
diff --git a/debian/changelog b/debian/changelog
index bd89e7c..a343681 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
x11-xserver-utils (7.2-2) experimental; urgency=low
* Add xrandr 1.2.2.
+ + fixes xrandr(1), and thus closes: #430122.
- -- Julien Cristau <jcristau@debian.org> Fri, 06 Jul 2007 22:27:11 +0200
+ -- Julien Cristau <jcristau@debian.org> Fri, 06 Jul 2007 22:38:18 +0200
x11-xserver-utils (7.2-1) experimental; urgency=low
commit 13ae540b6f03866ee34e07c7de68c11b89733732
Author: Julien Cristau <jcristau@debian.org>
Date: Fri Jul 6 22:33:41 2007 +0200
Add xrandr 1.2.2.
diff --git a/debian/changelog b/debian/changelog
index df84310..bd89e7c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+x11-xserver-utils (7.2-2) experimental; urgency=low
+
+ * Add xrandr 1.2.2.
+
+ -- Julien Cristau <jcristau@debian.org> Fri, 06 Jul 2007 22:27:11 +0200
+
x11-xserver-utils (7.2-1) experimental; urgency=low
* Change versioning scheme, base it on the latest X katamari release.
diff --git a/xrandr/configure b/xrandr/configure
index aeeb231..17b3d59 100755
--- a/xrandr/configure
+++ b/xrandr/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for xrandr 1.2.1.
+# Generated by GNU Autoconf 2.61 for xrandr 1.2.2.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='xrandr'
PACKAGE_TARNAME='xrandr'
-PACKAGE_VERSION='1.2.1'
-PACKAGE_STRING='xrandr 1.2.1'
+PACKAGE_VERSION='1.2.2'
+PACKAGE_STRING='xrandr 1.2.2'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
ac_subst_vars='SHELL
@@ -1194,7 +1194,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures xrandr 1.2.1 to adapt to many kinds of systems.
+\`configure' configures xrandr 1.2.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1264,7 +1264,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xrandr 1.2.1:";;
+ short | recursive ) echo "Configuration of xrandr 1.2.2:";;
esac
cat <<\_ACEOF
@@ -1359,7 +1359,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-xrandr configure 1.2.1
+xrandr configure 1.2.2
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1373,7 +1373,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by xrandr $as_me 1.2.1, which was
+It was created by xrandr $as_me 1.2.2, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2043,7 +2043,7 @@ fi
# Define the identity of the package.
PACKAGE='xrandr'
- VERSION='1.2.1'
+ VERSION='1.2.2'
cat >>confdefs.h <<_ACEOF
@@ -4239,7 +4239,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by xrandr $as_me 1.2.1, which was
+This file was extended by xrandr $as_me 1.2.2, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4292,7 +4292,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-xrandr config.status 1.2.1
+xrandr config.status 1.2.2
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/xrandr/configure.ac b/xrandr/configure.ac
index 96443ff..965e270 100644
--- a/xrandr/configure.ac
+++ b/xrandr/configure.ac
@@ -22,7 +22,7 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ([2.57])
-AC_INIT(xrandr,[1.2.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xrandr)
+AC_INIT(xrandr,[1.2.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xrandr)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
diff --git a/xrandr/xrandr.c b/xrandr/xrandr.c
index 7754741..c3bc6dc 100644
--- a/xrandr/xrandr.c
+++ b/xrandr/xrandr.c
@@ -72,6 +72,22 @@ static char *order[6] = {
"vertical bgr",
"no subpixels"};
+static const struct {
+ char *string;
+ unsigned long flag;
+} mode_flags[] = {
+ { "+HSync", RR_HSyncPositive },
+ { "-HSync", RR_HSyncNegative },
+ { "+VSync", RR_VSyncPositive },
+ { "-VSync", RR_VSyncNegative },
+ { "Interlace", RR_Interlace },
+ { "DoubleScan", RR_DoubleScan },
+ { "CSync", RR_CSync },
+ { "+CSync", RR_CSyncPositive },
+ { "-CSync", RR_CSyncNegative },
+ { NULL, 0 }
+};
+
static void
usage(void)
{
@@ -120,8 +136,8 @@ usage(void)
fprintf(stderr, " <vdisp> <vsync-start> <vsync-end> <vtotal>\n");
fprintf(stderr, " [+HSync] [-HSync] [+VSync] [-VSync]\n");
fprintf(stderr, " --rmmode <name>\n");
- fprintf(stderr, " --addmode <output> <mode>\n");
- fprintf(stderr, " --delmode <output> <mode>\n");
+ fprintf(stderr, " --addmode <output> <name>\n");
+ fprintf(stderr, " --delmode <output> <name>\n");
#endif
exit(1);
@@ -244,6 +260,7 @@ struct _output {
name_t crtc;
crtc_t *crtc_info;
+ crtc_t *current_crtc_info;
name_t mode;
float refresh;
@@ -1220,6 +1237,56 @@ mark_changing_crtcs (void)
}
}
+/*
+ * Test whether 'crtc' can be used for 'output'
+ */
+Bool
+check_crtc_for_output (crtc_t *crtc, output_t *output)
+{
+ int c;
+ int l;
+ output_t *other;
+
+ for (c = 0; c < output->output_info->ncrtc; c++)
+ if (output->output_info->crtcs[c] == crtc->crtc.xid)
+ break;
+ if (c == output->output_info->ncrtc)
+ return False;
+ for (other = outputs; other; other = other->next)
+ {
+ if (other == output)
+ continue;
+
+ if (other->mode_info == NULL)
+ continue;
+
+ if (other->crtc_info != crtc)
+ continue;
+
+ /* see if the output connected to the crtc can clone to this output */
+ for (l = 0; l < output->output_info->nclone; l++)
+ if (output->output_info->clones[l] == other->output.xid)
+ break;
+ /* not on the list, can't clone */
+ if (l == output->output_info->nclone)
+ return False;
+ }
+
+ if (crtc->noutput)
+ {
+ /* make sure the state matches */
+ if (crtc->mode_info != output->mode_info)
+ return False;
+ if (crtc->x != output->x)
+ return False;
+ if (crtc->y != output->y)
+ return False;
+ if (crtc->rotation != output->rotation)
+ return False;
+ }
+ return True;
+}
+
crtc_t *
find_crtc_for_output (output_t *output)
{
@@ -1228,42 +1295,12 @@ find_crtc_for_output (output_t *output)
for (c = 0; c < output->output_info->ncrtc; c++)
{
crtc_t *crtc;
- int l;
- output_t *other;
crtc = find_crtc_by_xid (output->output_info->crtcs[c]);
if (!crtc) fatal ("cannot find crtc 0x%x\n", output->output_info->crtcs[c]);
- for (other = outputs; other; other = other->next)
- {
- if (other == output)
- continue;
-
- if (other->mode_info == NULL)
- continue;
-
- if (other->crtc_info != crtc)
- continue;
-
- /* see if the output connected to the crtc can clone to this output */
- for (l = 0; l < output->output_info->nclone; l++)
- if (output->output_info->clones[l] == other->output.xid)
- break;
- /* not on the list, can't clone */
- if (l == output->output_info->nclone) break;
- }
- if (other) continue;
-
-
- if (crtc->noutput)
- {
- /* make sure the state matches */
- if (crtc->mode_info != output->mode_info) continue;
- if (crtc->x != output->x) continue;
- if (crtc->y != output->y) continue;
- if (crtc->rotation != output->rotation) continue;
- }
- return crtc;
+ if (check_crtc_for_output (crtc, output))
+ return crtc;
}
return NULL;
}
@@ -1417,6 +1454,124 @@ set_screen_size (void)
#endif
+void
+disable_outputs (output_t *outputs)
+{
+ while (outputs)
+ {
+ outputs->crtc_info = NULL;
+ outputs = outputs->next;
+ }
+}
+
+/*
+ * find the best mapping from output to crtc available
+ */
+int
+pick_crtcs_score (output_t *outputs)
+{
+ output_t *output;
+ int best_score;
+ int my_score;
+ int score;
+ crtc_t *best_crtc;
+ int c;
+
+ if (!outputs)
+ return 0;
+
+ output = outputs;
+ outputs = outputs->next;
+ /*
+ * Score with this output disabled
+ */
+ output->crtc_info = NULL;
+ best_score = pick_crtcs_score (outputs);
+ if (output->mode_info == NULL)
+ return best_score;
+
+ best_crtc = NULL;
+ /*
+ * Now score with this output any valid crtc
+ */
+ for (c = 0; c < output->output_info->ncrtc; c++)
+ {
+ crtc_t *crtc;
+
+ crtc = find_crtc_by_xid (output->output_info->crtcs[c]);
+ if (!crtc)
+ fatal ("cannot find crtc 0x%x\n", output->output_info->crtcs[c]);
+
+ /* reset crtc allocation for following outputs */
+ disable_outputs (outputs);
+ if (!check_crtc_for_output (crtc, output))
+ continue;
+
+ my_score = 1000;
+ /* slight preference for existing connections */
+ if (crtc == output->current_crtc_info)
+ my_score++;
+
+ output->crtc_info = crtc;
+ score = my_score + pick_crtcs_score (outputs);
+ if (score > best_score)
+ {
+ best_crtc = crtc;
+ best_score = score;
+ }
+ }
+ /*
+ * Reset other outputs based on this one using the best crtc
+ */
+ if (output->crtc_info != best_crtc)
+ {
+ output->crtc_info = best_crtc;
+ (void) pick_crtcs_score (outputs);
+ }
+ return best_score;
+}
+
+/*
+ * Pick crtcs for any changing outputs that don't have one
+ */
+void
+pick_crtcs (void)
+{
+ output_t *output;
+
+ /*
+ * First try to match up newly enabled outputs with spare crtcs
+ */
+ for (output = outputs; output; output = output->next)
+ {
+ if (output->changes && output->mode_info && !output->crtc_info)
+ {
+ output->crtc_info = find_crtc_for_output (output);
+ if (!output->crtc_info)
+ break;
+ }
+ }
+ /*
+ * Everyone is happy
+ */
+ if (!output)
+ return;
+ /*
+ * When the simple way fails, see if there is a way
+ * to swap crtcs around and make things work
+ */
+ for (output = outputs; output; output = output->next)
+ output->current_crtc_info = output->crtc_info;
+ pick_crtcs_score (outputs);
+ for (output = outputs; output; output = output->next)
+ {
+ if (output->mode_info && !output->crtc_info)
+ fatal ("cannot find crtc for output %s\n", output->output.string);
+ if (!output->changes && output->crtc_info != output->current_crtc_info)
+ output->changes |= changes_crtc;
+ }
+}
+
int
main (int argc, char **argv)
{
@@ -1762,21 +1917,6 @@ main (int argc, char **argv)
if (sscanf (argv[i++], "%d", &m->mode.vTotal) != 1) usage();
m->mode.modeFlags = 0;
while (i < argc) {
- static const struct {
- char *string;
- unsigned long flag;
- } mode_flags[] = {
- { "+HSync", RR_HSyncPositive },
- { "-HSync", RR_HSyncNegative },
- { "+VSync", RR_VSyncPositive },
- { "-VSync", RR_VSyncNegative },
- { "Interlace", RR_Interlace },
- { "DoubleScan", RR_DoubleScan },
- { "CSync", RR_CSync },
- { "+CSync", RR_CSyncPositive },
- { "-CSync", RR_CSyncNegative },
- { NULL, 0 }
- };
int f;
for (f = 0; mode_flags[f].string; f++)
@@ -2003,18 +2143,7 @@ main (int argc, char **argv)
set_positions ();
set_screen_size ();
- /*
- * Pick crtcs for any changing outputs that don't have one
- */
- for (output = outputs; output; output = output->next)
- {
- if (output->changes && output->mode_info && !output->crtc_info)
- {
- output->crtc_info = find_crtc_for_output (output);
- if (!output->crtc_info)
- fatal ("cannot find crtc for output %s\n", output->output.string);
- }
- }
+ pick_crtcs ();
/*
* Assign outputs to crtcs
@@ -2118,6 +2247,8 @@ main (int argc, char **argv)
mode_width (mode, output->rotation),
mode_height (mode, output->rotation),
output->x, output->y);
+ if (verbose)
+ printf (" (0x%x)", mode->id);
if (output->rotation != RR_Rotate_0 || verbose)
{
printf (" %s",
@@ -2265,10 +2396,15 @@ 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.1fMHz\n",
+ printf (" %s (0x%x) %6.1fMHz",
mode->name, mode->id,
(float)mode->dotClock / 1000000.0);
+ for (f = 0; mode_flags[f].flag; f++)
+ if (mode->modeFlags & mode_flags[f].flag)
+ printf (" %s", mode_flags[f].string);
+ printf ("\n");
printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.1fKHz\n",
mode->width, mode->hSyncStart, mode->hSyncEnd,
mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000);
diff --git a/xrandr/xrandr.man b/xrandr/xrandr.man
index 228ec94..3780dd8 100644
--- a/xrandr/xrandr.man
+++ b/xrandr/xrandr.man
@@ -26,132 +26,156 @@
xrandr \- primitive command line interface to RandR extension
.SH SYNOPSIS
.B "xrandr"
-[-help] [-display \fIdisplay\fP]
-[-q] [-v]
-[--verbose]
-[--screen \fIsnum\fP]
+[\-help] [\-display \fIdisplay\fP]
+[\-q] [\-v]
+[\-\-verbose]
+[\-\-screen \fIsnum\fP]
.br
.B RandR version 1.2 options
.br
-[--prop]
-[--fb <width>x<height>]
-[--fbmm <width>x<height>]
-[--dpi <dpi>]
+[\-\-prop]
+[\-\-fb <width>x<height>]
+[\-\-fbmm <width>x<height>]
+[\-\-dpi <dpi>]
.br
.B Per-output options
.br
-[--output <output>]
-[--auto]
-[--mode <mode>]
-[--preferred]
-[--pos <x>x<y>]
-[--rate <rate>]
-[--reflect \fIreflection\fP]
-[--rotate \fIorientation\fP]
-[--left-of <output>\]
-[--right-of <output>\]
-[--above <output>\]
-[--below <output>\]
-[--off]
-[--crtc <crtc>]
+[\-\-output <output>]
+[\-\-auto]
+[\-\-mode <mode>]
+[\-\-preferred]
+[\-\-pos <x>x<y>]
+[\-\-rate <rate>]
+[\-\-reflect \fIreflection\fP]
+[\-\-rotate \fIorientation\fP]
+[\-\-left\-of <output>\]
+[\-\-right\-of <output>\]
+[\-\-above <output>\]
+[\-\-below <output>\]
+[\-\-same-as <output>\]
+[\-\-set <property> <value>]
+[\-\-off]
+[\-\-crtc <crtc>]
+[\-\-newmode <name> \fImode\fP]
+[\-\-rmmode <name>]
+[\-\-addmode <output> <name>]
+[\-\-delmode <output> <name>]
.br
.B RandR version 1.0 and version 1.1 options
.br
-[-o \fIorientation\fP]
-[-s \fIsize\fP]
-[-x] [-y]
+[\-o \fIorientation\fP]
+[\-s \fIsize\fP]
+[\-x] [\-y]
.SH DESCRIPTION
.I Xrandr
is used to set the size, orientation and/or reflection of the outputs for a
screen. It can also set the screen size.
There are a few global options; the rest modify a particular output and
follow the specification of that output on the command line.
-.IP --help
+.IP \-\-help
Print out a summary of the usage and exit.
-.IP -v
+.IP \-v
Print out the RandR version reported by the X server and exit.
-.IP --verbose
-causes xrandr to be more verbose. When used with -q (or without other
+.IP \-\-verbose
+causes xrandr to be more verbose. When used with \-q (or without other
options), xrandr will display more information about the server state. When
used along with options that reconfigure the system, progress will be
reported while executing the configuration changes.
-.IP -q
+.IP \-q
When this option is present, or when no configuration changes are requested,
xrandr will display the current state of the system.
-.IP "-screen \fIsnum\fP"
+.IP "\-screen \fIsnum\fP"
This option selects which screen to manipulate. Note this refers to the X
screen abstraction, not the monitor (or output).
.SH "RandR version 1.2 options"
These options are only available for X server supporting RandR version 1.2
or newer.
-.IP --prop
+.IP \-\-prop
This option causes xrandr to display the contents of properties for each
-output. --verbose also enables --prop.
-.IP "--fb <width>x<height"
+output. \-\-verbose also enables \-\-prop.
+.IP "\-\-fb <width>x<height>"
Reconfigures the screen to the specified size. All configured monitors must
fit within this size. When this option is not provided, xrandr computes the
smallest screen size that will hold the set of configured outputs; this
option provides a way to override that behaviour.
-.IP "--fbmm <width>x<height"
+.IP "\-\-fbmm <width>x<height>"
Sets the reported values for the physical size of the screen. Normally,
xrandr resets the reported physical size values to keep the DPI constant.
This overrides that computation.
-.IP "--dpi <dpi>"
+.IP "\-\-dpi <dpi>"
This also sets the reported physical size values of the screen, it uses the
specified DPI value to compute an appropriate physical size using whatever
pixel size will be set.
.PP
.B "Per-output options"
-.IP "--output <output>"
+.IP "\-\-output <output>"
Selects an output to reconfigure. Use either the name of the output or the
XID.
-.IP --auto
+.IP \-\-auto
For connected but disabled outputs, this will enable them using their
preferred mode (or, something close to 96dpi if they have no preferred
mode). For disconnected but enabled outputs, this will disable them.
-.IP "--mode <mode>"
+.IP "\-\-mode <mode>"
This selects a mode. Use either the name or the XID for <mode>
-.IP "--preferred"
-This selects the same mode as --auto, but it doesn't automatically enable or
+.IP "\-\-preferred"
+This selects the same mode as \-\-auto, but it doesn't automatically enable or
disable the output.
-.IP "--pos <x>x<y>"
+.IP "\-\-pos <x>x<y>"
Position the output within the screen using pixel coordinates.
-.IP "--rate <rate>
+.IP "\-\-rate <rate>"
This marks a preference for refresh rates close to the specified value, when
multiple modes have the same name, this will select the one with the nearest
refresh rate.
-.IP "--reflect \fIreflection\fP"
+.IP "\-\-reflect \fIreflection\fP"
Reflection can be one of 'normal' 'x', 'y' or 'xy'. This causes the output
contents to be reflected across the specified axes.
-.IP "--rotate \fIrotation\fP"
+.IP "\-\-rotate \fIrotation\fP"
Rotation can be one of 'normal', 'left', 'right' or 'inverted'. This causes
the output contents to be rotated in the specified direction.
-.IP "--left-of, --right-of, --above, --below <another output>"
+.IP "\-\-left\-of, \-\-right\-of, \-\-above, \-\-below, \-\-same-as <another output>"
Use one of these options to position the output relative to the position of
another output. This allows convenient tiling of outputs within the screen.
The position is always computed relative to the new position of the other
-output, so it is not valid to say --output a --left-of b --output
-b --left-of a.
-.IP "--off"
+output, so it is not valid to say \-\-output a \-\-left\-of b \-\-output
+b \-\-left\-of a.
+.IP "\-\-set <property> <value>"
+Sets an output property. Integer properties may be specified as a valid
+(see \-\-prop) decimal or hexadecimal (with a leading 0x) value. Atom properties
+may be set to any of the valid atoms (see \-\-prop). String properties may be
+set to any value.
+.IP "\-\-off"
Disables the output.
-.IP "--crtc <crtc>"
+.IP "\-\-crtc <crtc>"
Uses the specified crtc (either as an index in the list of CRTCs or XID).
In normal usage, this option is not required as xrandr tries to make
sensible choices about which crtc to use with each output. When that fails
for some reason, this option can override the normal selection.
+.IP "\-\-newmode <name> \fImode\fP"
+New modelines can be added to the server and then associated with outputs.
+This option does the former. The \fImode\fP is specified using the ModeLine
+syntax for xorg.conf: hdisp hsyncstart hsyncend htotal vdisp vsyncstart
+vsyncend vtotal \fIflags\fP. \fIflags\fP can be zero or more of +HSync,
+-HSync, +VSync, -VSync, Interlace, DoubleScan, CSync, +CSync, -CSync.
+.IP "\-\-rmmode <name>"
+This removes a mode from the server if it is otherwise unused.
+.IP "\-\-addmode <output> <name>"
+Add a mode to the set of valid modes for an output.
+.IP "\-\-delmode <output> <name>"
+Remove a mode from the set of valid modes for an output.
.PP
.SH "RandR version 1.1 options"
-These options are available for X server supporting RandR version 1.1 or
-older. They are still valid for newer X servers, but they don't
-.IP "-s <size index> or -s <width>x<height>"
+These options are available for X servers supporting RandR version 1.1 or
+older. They are still valid for newer X servers, but they don't interact
+sensibly with version 1.2 options on the same command line.
+.IP "\-s <size index> or \-s <width>x<height>"
This sets the screen size, either matching by size or using the index into
the list of available sizes.
-.IP "-o \fIrotation\fP"
+.IP "\-o \fIrotation\fP"
This specifies the orientation of the screen,
and can be one of normal, inverted, left or right.
-.IP -x
+.IP \-x
Reflect across the X axis.
-.IP -y
+.IP \-y
Reflect across the Y axis.
.SH "SEE ALSO"
Xrandr(3)
Reply to: