1. 09 Jan, 2022 1 commit
  2. 12 Aug, 2019 1 commit
    • Vladimir Panteleev's avatar
      xrandr: Fix deleting inactive monitors · 829ed54d
      Vladimir Panteleev authored and Matt Turner's avatar Matt Turner committed
      
      
      The following commands did not behave correctly:
      
      xrandr --setmonitor empty auto none
      xrandr --delmonitor empty
      
      The second command failed with "No monitor named 'empty'". This
      occurred because get_monitors was invoked with its get_active argument
      set to False, which caused it to not retrieve inactive monitors. Thus,
      inactive monitors could not be deleted.
      
      Fix this bug by invoking get_monitors (and, thus, XRRGetMonitors) with
      get_active = False, thus enabling deletion of disabled monitors.
      
      Signed-off-by: Matt Turner's avatarMatt Turner <mattst88@gmail.com>
      829ed54d
  3. 03 Mar, 2019 1 commit
    • Adam Simpkins's avatar
      xrandr: fix crash if some modes cannot be found · 9e5fa7c8
      Adam Simpkins authored and Alan Coopersmith's avatar Alan Coopersmith committed
      
      
      When printing modes in "xrandr -q", check to see if we failed to look up
      mode information from a mode XID.  Previously the command would
      dereference null and crash if the mode information could not be found.
      
      When using an external HDMI monitor on a laptop with a Skylake Intel
      graphics chipset "xrandr -q" occasionally is unable to look up mode
      information for some of the modes.  It seems likely there is some other
      sort of library or driver issue causing these lookup failures, but this
      change to xrandr at least prevents it from segfaulting.
      
      Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
      9e5fa7c8
  4. 12 Sep, 2018 1 commit
    • Peter Hutterer's avatar
      init the name to 0 · a2134406
      Peter Hutterer authored
      
      
      There are a few conditions where coverity finds a use of an uninitialized
      field of the name_t struct. These are rather messy combinations of conditions,
      so let's go with the simple solution here and just init everything to 0.
      This may still have side-effects but at least they'll be more obvious than the
      previous "use whatever memory is leftover from breakfast".
      
      This patch also adds a missing init_name(), much for the same reason.
      
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      a2134406
  5. 27 Feb, 2018 4 commits
  6. 01 Jun, 2017 1 commit
  7. 24 Mar, 2017 1 commit
    • Giuseppe Bilotta's avatar
      xrandr: suppress misleading indentation warning · 215a01f1
      Giuseppe Bilotta authored and Adam Jackson's avatar Adam Jackson committed
      
      
      When printing out rotations, we print a space before any item other than
      the first, and set `first = False` in each block where we print.
      However, this is done in the same line as the conditional that checks if
      first is set, which may give the impression that the assignment is also
      under the conditional. This is not the case, and recent GCC warns about
      this.
      
      Move the assignment to after we print the value we want to print, which
      (1) doesn't mislead about the indentation, and
      (2) makes logical sense as the _next_ entry is what won't be the first.
      
      Signed-off-by: Giuseppe Bilotta's avatarGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
      215a01f1
  8. 20 Oct, 2015 1 commit
    • Chris Wilson's avatar
      Only use the current information when setting modes · d62030b5
      Chris Wilson authored and Adam Jackson's avatar Adam Jackson committed
      
      
      Before we change the state (e.g. adding a mode or applying one to an
      output), we query the screen resources for the right identifiers. This
      should only use the current information rather than force a reprobe on
      all hardware - not only can that reprobe be very slow (e.g. EDID
      timeouts on the order of seconds), but it may perturb the setup that the
      user is trying to configure.
      
      Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
      d62030b5
  9. 01 Jul, 2015 2 commits
    • Chris Wilson's avatar
      Mark all CRTC as currently unused for second picking CRTC pass · 3d03be78
      Chris Wilson authored and Adam Jackson's avatar Adam Jackson committed
      
      
      We perform two passes over the CRTC in order to find the preferred CRTC
      for each enabled output. In the first pass, we try to preserve the
      existing output <-> CRTC relationships (to avoid unnecessary flicker).
      If that pass fails, we try again but with all outputs first disabled.
      However, the logic to preserve an active CRTC was not disabled along
      with the outputs - meaning that if one was active but its associated
      output was disabled by the user, then that CRTC would remain unavailable
      for other outputs. The result would be that we would try to assign more
      CRTC than available (i.e. if the user request 3 new HDMI outputs on a
      system with only 3 CRTC, and wished to switch off an active internal
      panel, we would report "cannot find CRTC" even though that configuration
      could be established.)
      
      Reported-and-tested-by: default avatarNathan Schulte <nmschulte@gmail.com>
      Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
      3d03be78
    • Chris Wilson's avatar
      Mark disabling an output as a change in its CRTC · 53ef3fc1
      Chris Wilson authored and Adam Jackson's avatar Adam Jackson committed
      
      
      When an output is disabled via the cmdline, we can use that information
      to prevent assigning the current CRTC to the output and free it up for
      reuse by other outputs in the first pass of picking CRTC.
      
      Reported-and-tested-by: default avatarNathan Schulte <nmschulte@gmail.com>
      Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
      53ef3fc1
  10. 22 Apr, 2015 1 commit
  11. 31 Mar, 2015 2 commits
  12. 30 Mar, 2015 1 commit
  13. 02 Aug, 2014 1 commit
  14. 25 Jun, 2014 2 commits
  15. 30 Apr, 2014 1 commit
    • Dominik Behr's avatar
      xrandr: use full range for gamma table generation · 792f05ea
      Dominik Behr authored
      
      
      Calculate gamma table using full [0,65536) range and do not make any
      assumptions about relation of gamma table size and significant bits.
      
      Gamma table size has nothing to do with number of significant bits in hardware.
      In particular we are dealing now with gamma table that has 17 entries and 8
      bit precision, there are other GPUs with 10 bit precision and less than 256
      entries using partial linear approximation. Deriving assumed gamma table
      significant bits from size of gamma table leads to incorrect calculations and
      loss of precision. Also XRandR specification never mentions that gamma tables
      need to be power of 2.
      
      Signed-off-by: Dominik Behr's avatarDominik Behr <dbehr@chromium.org>
      Reviewed-by: default avatarStéphane Marchesin <marcheu@chromium.org>
      792f05ea
  16. 29 Mar, 2014 1 commit
  17. 12 Mar, 2014 1 commit
  18. 20 Feb, 2014 2 commits
  19. 07 Jan, 2014 3 commits
  20. 13 Jul, 2013 3 commits
    • Alan Coopersmith's avatar
      0e0b4734
    • Alan Coopersmith's avatar
      Declare capability_name() as returning const char * · 38772ec3
      Alan Coopersmith authored
      
      
      Only used as an argument to printf.   Clears gcc warnings:
      xrandr.c: In function ‘capability_name’:
      xrandr.c:237:2: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
      xrandr.c:239:2: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
      xrandr.c:241:2: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
      xrandr.c:243:2: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
      xrandr.c:245:5: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
      
      Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
      38772ec3
    • Thomas Fischer's avatar
      Bug 56923 - Make command line options consistent (single vs double dash) · f53d8511
      Thomas Fischer authored and Alan Coopersmith's avatar Alan Coopersmith committed
      
      
      Most of xrandr's command line options follow the system of single
      dashes for single character options (e.g. "-v") and double dashes for
      long options ("--version").  The only exceptions are "-display" and
      "-help", most likely for historical reasons.  To make the behavior
      consistent across all options, the following patch adds "--display"
      and "--help" as alternatives to the current inconsistency.  The man
      page got updated as well, recommending double-dash variants for both
      options. The old behavior is still supported, so the patch should not
      break any existing usage/script.
      
      Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
      f53d8511
  21. 02 Jun, 2013 1 commit
  22. 06 May, 2013 1 commit
  23. 28 Feb, 2013 1 commit
    • Aaron Plattner's avatar
      Print spaces between XA_ATOM property values · eb17ad8a
      Aaron Plattner authored
      Commit b26fd532
      
       redid how xrandr prints
      properties.  It neglected to put spaces between the values of XA_ATOM
      properties, so they all run together.  For example,
      
          audio: auto
              supported: force-dvioffautoon
      
      Fix this by putting a space after each atom name.  In addition, some drivers
      create property values with spaces in them, so put commas between entries to
      disambiguate.  For example,
      
          Broadcast RGB: Automatic
              supported: Automatic, Full, Limited 16:235
      
      Do the same for properties with multiple valid ranges.
      
      Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
      Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      eb17ad8a
  24. 12 Feb, 2013 5 commits
    • Aaron Plattner's avatar
      Cast XID to unsigned int to suppress a printf warning · bd166184
      Aaron Plattner authored
      Sorry I forgot about this in commit 138b6252
      
      .
      That change introduced a warning:
      
        xrandr.c|645 col 5| warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘XID’ [-Wformat]
      
      Fix that by just casting the XID to unsigned int.
      
      Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
      Reviewed-by: Daniel Dadap's avatarDaniel Dadap <ddadap@nvidia.com>
      bd166184
    • Aaron Plattner's avatar
      Bug #37043: adjust refresh rates for doublescan and interlace · 7fd4f18b
      Aaron Plattner authored
      
      
      These two flags halve and double, respectively, the effective refresh rate of a
      mode.
      
      Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
      Reviewed-by: Daniel Dadap's avatarDaniel Dadap <ddadap@nvidia.com>
      7fd4f18b
    • Aaron Plattner's avatar
      Bug #14118: print usage() to stdout, proper errors for bad arguments · b2f0bd19
      Aaron Plattner authored
      
      
      Print the usage() text to stdout instead of stderr, and then only if -help is
      specified.  Also allow --help for consistency.
      
      For other command line syntax errors, introduce a new helper function argerr()
      that prints errors of the form
      
        xrandr: %s
        Try './xrandr --help' for more information.
      
      and exits.  Use that to print proper error messages.
      
      Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
      Reviewed-by: Daniel Dadap's avatarDaniel Dadap <ddadap@nvidia.com>
      b2f0bd19
    • Aaron Plattner's avatar
      Bug #11397: check that numeric --orientation arguments are in range · 0a26e076
      Aaron Plattner authored
      
      
      The only valid parameters to -o (--orientation) are 0, 1, 2, 3, normal, left,
      inverted, and right.  xrandr converts the strings to numbers and then checks
      that they're within range, but doesn't validate them if it was numeric to begin
      with.
      
      Move the range check outside of the if statement so that out-of-range numeric
      values are rejected properly.
      
      Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
      Reviewed-by: Daniel Dadap's avatarDaniel Dadap <ddadap@nvidia.com>
      0a26e076
    • Aaron Plattner's avatar
      xrandr: Fix variable declaration warnings · dac72dbb
      Aaron Plattner authored
      
      
      There are piles of places in the code where a variable shadows either another
      variable or a global function:
      
        xrandr.c:545:35: warning: declaration of ‘index’ shadows a global declaration [-Wshadow]
        xrandr.c:574:9: warning: declaration of ‘index’ shadows a global declaration [-Wshadow]
        xrandr.c:967:19: warning: declaration of ‘gamma’ shadows a global declaration [-Wshadow]
        xrandr.c:1329:16: warning: declaration of ‘gamma’ shadows a global declaration [-Wshadow]
        xrandr.c:2055:28: warning: declaration of ‘outputs’ shadows a global declaration [-Wshadow]
        xrandr.c:2068:29: warning: declaration of ‘outputs’ shadows a global declaration [-Wshadow]
        xrandr.c:2928:16: warning: declaration of ‘output’ shadows a previous local [-Wshadow]
        xrandr.c:2995:15: warning: declaration of ‘output’ shadows a previous local [-Wshadow]
        xrandr.c:3016:15: warning: declaration of ‘j’ shadows a previous local [-Wshadow]
        xrandr.c:3018:19: warning: declaration of ‘rotations’ shadows a previous local [-Wshadow]
        xrandr.c:3116:15: warning: declaration of ‘crtc’ shadows a previous local [-Wshadow]
        xrandr.c:3170:8: warning: declaration of ‘k’ shadows a previous local [-Wshadow]
        xrandr.c:3243:20: warning: declaration of ‘mode’ shadows a previous local [-Wshadow]
      
      'index' and 'gamma' are C library functions:
      
        index (3)            - locate character in string
        gamma (3)            - (logarithm of the) gamma function
      
      The rest of these are either variables or function parameters.
      
      When possible, move the declaration of a variable into the block where it is
      used, including in cases where the same variable is used in multiple blocks but
      the later block doesn't depend on the value from the earlier block.
      
      In a few cases, rename the variable in the outer scope to be more specific (e.g.
      output -> config_output) so the more generic variable in the inner scope (e.g.
      the 'output' variable used to iterate over all outputs) doesn't have to change.
      
      Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
      Reviewed-by: default avatarAndy Ritger <aritger@nvidia.com>
      dac72dbb
  25. 06 Feb, 2013 1 commit