为什么xrandr错误“BadMatch”,“BadName”,“Gamma Failed”发生?

我没有找到这样的错误的单一解决方案,尽管有相当多的用户拥有它们。

所以我想尝试自己找一个解决方案。 但是,我不知道它们为什么会发生……

有谁知道为什么? 你没有说出每个错误发生的原因,只有一个会很棒!

例子:

BadMatch错误:

X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 150 (RANDR) Minor opcode of failed request: 18 (RRAddOutputMode) Serial number of failed request: 18 Current serial number in output stream: 19 

BadName错误:

 Error of failed request: BadName (named color or font does not exist) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 11 (RRQueryOutputProperty) Serial number of failed request: 39 Current serial number in output stream: 39 

Gamma失败错误:

 xrandr: Failed to get size of gamma for output default Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080 default connected primary 1920x1080+0+0 0mm x 0mm 1920x1080 0.0* 

最低信息

您将询问一个问题,然后添加此命令生成的链接

sudo apt-get install pastebinit; sudo sh -c "lsb_release -sd; dmidecode -s system-product-name; echo ==; lshw -c display; echo ==; xrandr --verbose; echo ==; cat /etx/X11/xorg.conf" | tee ~/Desktop/ubuntu-graphic-info.txt | pastebinit


故障排除

小谈

比我想象的复杂很多,因为我尝试使用xrandr玩我的英特尔GPU一段时间。 有时,我会遇到意外错误。 这是我的经历的总结。

根据我的理解,这是一个简化的完整堆栈列表。

 xrandr └─ Xorg (w/ driver specific module) └─ kernel └─ driver │ graphic card └─ cables (kvm switch/connection adapter) └─ monitor 

它实际上是一个很大的故障排除堆栈,更难以使用旧硬件和滚动的专有驱动程序更新,即使DB-15 VGA电缆(或廉价电缆)中的错误引脚接触也会产生影响。 实际上,我在Ask Ubuntu中阅读的大多数问题都是关于监视器中丢失/错误的EDID数据,指责:电缆(kvm交换机/连接适配器)。 您可以从xrandr --verbose输出中快速注意到。

许多情况也是驱动程序限制某些模式,因为来自Monitor的EDID数据不完整/部分错误(制造商错误),用户通过编写自定义xorg.conf来覆盖:模式,HSync和VSync,EDID,DPI …取决于驱动程序(例如nvidia可以从监视器IgnoreEDID)

我建议您阅读高级用户或提供帮助的用户:

  • Ubuntu Wiki:X故障排除 (相当陈旧和通用)
  • KMS UXA DRM OMG WTF BBQ? / Linux图形由Dream Chip Technologies GmbH的Martin Fiedler在Chemnitzer Linux-Tage 2014中揭开神秘色彩

注意:

阅读提供解决方案的旧文档和post时要小心。 更好的是,查找正在使用的特定驱动器的文档。

  • validation发布日期,上次编辑日期或软件版本。
  • modesetDRIfb (帧缓冲)驱动程序类型。 (请注意,我不是专家)。
  • Xorg在自动配置方面做了很多工作,因此默认情况下不会创建xorg.conf 。 即使用户已经创建了一个,他也不应该创建所有部分,而只是覆盖所需的部分。 它是一种动态配置。

我对那些xrandr / X错误的虚拟理解

儿子( xrandr )似乎没有意识到他父亲能够或将同意购买他(所有驾驶员的能力),所以他只是去找他的妈妈(Xorg)并要求她向他父亲询问他想要的东西。 因此,以下任何一种情况都会发生:

  • 高比例:儿子→(:)接受)妈妈→(:)接受)爸爸,每个人都很开心!
  • 低比例:儿子→(:|接受)妈妈→(XD拒绝)爸爸,生活有时很难!
  • 罕见的情况:儿子→(X /拒绝)妈妈-x-(:|中立)爸爸,计划B的时间!

因此,当Xorg或Driver无法处理或拒绝xrandr请求时,我们会收到这些错误:

  • 当前的Xorg设置
  • 驱动能力
  • 图形适配器function
  • 监控function来自EDID
  • 其中一个包括xrandr错误

收集通用图形的调试信息!

为什么? 我看了很多与xrandr分辨率相关的问题,他们缺少关于完整堆栈设置的大量信息。 考虑集仅提到最后一个失败的命令。 甚至,我建议将完整的输出放在问题中,以便我们可以搜索相似之处并链接相关问题。

如果未找到EDID数据,请从以下位置开始:

  • 监视器如何物理连接,即使用KVM? 任何连接适配器ex。 HDMI转VGA?
  • 你试过另一根电缆吗?
  • 什么是显示器品牌/型号?

这里列出了一些有用的命令

  1. 背景信息

     sudo dmidecode -s system-product-name lsb_release -sd Xorg -version xrandr -v sudo lshw -c display 
  2. 基本信息

     xrandr --verbose cat /etx/X11/xorg.conf more /var/log/Xorg.0.log 
  3. 调试命令和选项

     sudo apt-get install edid-read ls /sys/class/drm/*/edid | xargs -i{} sh -c "echo {}; parse-edid < {}" xrandr --verbose ... xtrace xrandr --verbose ... #no need, only to compare between releases for changes, the default driver parameters sudo sh -c "ls /sys/module//parameters/ | xargs -L1 -i{} sh -c 'echo -n {} \" \" ; cat /sys/module//parameters/{}'" # additional desktop environment setting, for general cases, gnome/unity cat ~/.config/monitors.xml cat /etc/gnome-settings-daemon/xrandr/monitors.xml gsettings list-recursively org.gnome.settings-daemon.plugins.xrandr 
  4. 高级调试选项

    Option "ModeDebug" "true"添加到xorg.conf Section "Device" ,有关详细信息,请参阅下面的nvidia debug。

nvidia图形的附加调试信息!

  • cat /proc/driver/nvidia/version用于精确版本
  • 将nvidia调试信息激活到/var/log/Xorg.0.log

     gksu nvidia-settings # go to X configuration then export, copy only device section sudo mkdir /etc/X11/xorg.conf.d/ sudo vim /etc/X11/xorg.conf.d/90_my_nvidia_hacks.conf # paste the device section Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "NVS 3100M" Option "ModeDebug" "true" EndSection # add to it this line `Option "ModeDebug" "true"` 
  • 完整文档位于file:///usr/share/doc/nvidia-*/html/ ,查找相同的运行版本,可用选项和默认设置有很多变化。


带有Intel驱动程序的调试测试用例

这是一个我可以重现它的情况,它似乎是xrandr bug。 从xtraceXorg.0.log可以清楚地Xorg.0.log ,帧缓冲区在第一个组合中没有resize。

 #Seems a bug in xrandr #Xorg error when changing to bigger resolution without changing a previously defined scale. #----------- #system info $ xrandr --version xrandr program version 1.4.3 Server reports RandR version 1.4 $ sudo sh -c "lsb_release -dc;echo; uname -a; Xorg -version;echo; lshw -C display" Description: Ubuntu 15.10 Codename: wily Linux BlueSkies 4.2.0-25-generic #30-Ubuntu SMP Mon Jan 18 12:31:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux X.Org X Server 1.17.2 Release Date: 2015-06-16 X Protocol Version 11, Revision 0 Build Operating System: Linux 3.13.0-68-generic x86_64 Ubuntu Current Operating System: Linux BlueSkies 4.2.0-25-generic #30-Ubuntu SMP Mon Jan 18 12:31:50 UTC 2016 x86_64 Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.2.0-25-generic root=UUID=9f0530d5-e0eb-43fa-b99b-000fa742cf10 ro persistent quiet splash vt.handoff=7 Build Date: 12 November 2015 05:33:29PM xorg-server 2:1.17.2-1ubuntu9.1 (For technical support please see http://www.ubuntu.com/support) Current version of pixman: 0.32.6 Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. *-display description: VGA compatible controller product: 3rd Gen Core processor Graphics Controller vendor: Intel Corporation physical id: 2 bus info: pci@0000:00:02.0 version: 09 width: 64 bits clock: 33MHz capabilities: msi pm vga_controller bus_master cap_list rom configuration: driver=i915 latency=0 resources: irq:26 memory:f6400000-f67fffff memory:e0000000-efffffff ioport:f000(size=64) $ sudo sh -c "ls /sys/module/i915/parameters/ | xargs -L1 -i{} sh -c 'echo -n {} \" \" ; cat /sys/module/i915/parameters/{}'" disable_display N disable_power_well 1 disable_vtd_wa N edp_vswing 0 enable_cmd_parser 1 enable_execlists 0 enable_fbc -1 enable_hangcheck Y enable_ips 1 enable_ppgtt 1 enable_psr 0 enable_rc6 3 fastboot N invert_brightness 0 load_detect_test N lvds_channel_mode 0 lvds_downclock 0 lvds_use_ssc -1 mmio_debug 0 modeset -1 nuclear_pageflip N panel_ignore_lid 1 prefault_disable N preliminary_hw_support 0 reset Y semaphores -1 use_mmio_flip 0 vbt_sdvo_panel_type -1 verbose_state_checks Y $ modinfo i915 filename: /lib/modules/4.2.0-25-generic/kernel/drivers/gpu/drm/i915/i915.ko license: GPL and additional rights description: Intel Graphics author: Intel Corporation author: Tungsten Graphics, Inc. firmware: i915/skl_dmc_ver1.bin srcversion: BB05D6968744E69AEA30DC2 ... depends: drm_kms_helper,drm,video,i2c-algo-bit intree: Y vermagic: 4.2.0-25-generic SMP mod_unload modversions $ xrandr Screen 0: minimum 8 x 8, current 1726 x 768, maximum 32767 x 32767 LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 309mm x 173mm 1366x768 60.07*+ 40.02 1360x768 59.80 59.96 1280x720 60.00 1024x768 60.00 1024x576 60.00 960x540 60.00 800x600 60.32 56.25 864x486 60.00 640x480 59.94 720x405 60.00 680x384 60.00 640x360 60.00 DP1 disconnected (normal left inverted right x axis y axis) DP2 disconnected (normal left inverted right x axis y axis) DP3 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) HDMI2 disconnected (normal left inverted right x axis y axis) HDMI3 disconnected (normal left inverted right x axis y axis) VGA1 connected 360x200+1366+0 (normal left inverted right x axis y axis) 410mm x 230mm 1366x768 59.79 + 1280x1024 60.02 1280x720 60.00 1024x768 60.00 800x600 60.32 640x480 60.00 720x400 70.08* VIRTUAL1 disconnected (normal left inverted right x axis y axis) Other info not collected $ grep intel /var/log/Xorg.0.log #------------------------- #case reproducing & debug ## 1st combination different mode & same scale $ xrandr --output VGA1 --mode 720x400 --right-of LVDS1 --scale 0.5x0.5 $ xtrace xrandr --verbose --output VGA1 --mode 1366x768 --right-of LVDS1 --scale 0.5x0.5 000:<:0030: 28: RANDR-Request(140,21): SetCrtcConfig crtc=0x00000040 timestamp=0x00000000 config timestamp=0x00010a4d x=0 y=0 mode=0x00000000 rr=Rotate_0 outputs=; 000:>:0030:32: Reply to SetCrtcConfig: status=Success(0x00) screen 0: 1726x768 453x202 mm 96.57dpi crtc 1: 720x400 70.08 +1366+0 "VGA1" 000:<:0031: 20: RANDR-Request(140,7): SetScreenSize window=0x000000d9 width=1726 height=768 width[mm]=453 height[mm]=202 000:<:0032: 32: RANDR-Request(140,21): SetCrtcConfig crtc=0x00000040 timestamp=0x00000000 config timestamp=0x00010a4d x=1366 y=0 mode=0x000000fc rr=Rotate_0 outputs=0x0000004a; 000:>:0032:32: Reply to SetCrtcConfig: status=Success(0x00) screen 0: 2049x768 538x202 mm 96.57dpi crtc 1: 1366x768 59.79 +1366+0 "VGA1" 000:<:002f: 4: Request(36): GrabServer 000:<:0030: 20: RANDR-Request(140,7): SetScreenSize window=0x000000d9 width=2049 height=768 width[mm]=538 height[mm]=202 000:<:0031: 32: RANDR-Request(140,21): SetCrtcConfig crtc=0x00000040 timestamp=0x00000000 config timestamp=0x00010a4d x=1366 y=0 mode=0x000000f8 rr=Rotate_0 outputs=0x0000004a; 000:>:0030:Error 8=Match: major=140, minor=7, bad=217 000:>:0031:32: Reply to SetCrtcConfig: status=Success(0x00) X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 7 (RRSetScreenSize) Serial number of failed request: 48 Current serial number in output stream: 49 ## 2nd combination same mode & different scale $ xtrace xrandr --verbose --output VGA1 --mode 1366x768 --right-of LVDS1 --scale 1x1 $ xtrace xrandr --verbose --output VGA1 --mode 1366x768 --right-of LVDS1 --scale 0.5x0.5 screen 0: 2732x768 718x202 mm 96.57dpi crtc 1: 1366x768 59.79 +1366+0 "VGA1" 000:<:002f: 4: Request(36): GrabServer 000:<:0030: 20: RANDR-Request(140,7): SetScreenSize window=0x000000d9 width=2732 height=768 width[mm]=718 height[mm]=202 000:<:0031: 56: RANDR-Request(140,26): SetCrtcTransform crtc=0x00000040 transform={matrix=1.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000;}; filter name='nearest' filter params=; 000:<:0032: 32: RANDR-Request(140,21): SetCrtcConfig crtc=0x00000040 timestamp=0x00000000 config timestamp=0x00010a4d x=1366 y=0 mode=0x000000f8 rr=Rotate_0 outputs=0x0000004a; 000:>:0032:32: Reply to SetCrtcConfig: status=Success(0x00) 000:<:0030: 28: RANDR-Request(140,21): SetCrtcConfig crtc=0x00000040 timestamp=0x00000000 config timestamp=0x00010a4d x=0 y=0 mode=0x00000000 rr=Rotate_0 outputs=; 000:>:0030:32: Reply to SetCrtcConfig: status=Success(0x00) screen 0: 2049x768 538x202 mm 96.57dpi crtc 1: 1366x768 59.79 +1366+0 "VGA1" 000:<:0031: 20: RANDR-Request(140,7): SetScreenSize window=0x000000d9 width=2049 height=768 width[mm]=538 height[mm]=202 000:<:0032: 56: RANDR-Request(140,26): SetCrtcTransform crtc=0x00000040 transform={matrix=0.500000,0.000000,0.000000,0.000000,0.500000,0.000000,0.000000,0.000000,1.000000;}; filter name='bilinear' filter params=; 000:<:0033: 32: RANDR-Request(140,21): SetCrtcConfig crtc=0x00000040 timestamp=0x00000000 config timestamp=0x00010a4d x=1366 y=0 mode=0x000000f8 rr=Rotate_0 outputs=0x0000004a; 000:>:0033:32: Reply to SetCrtcConfig: status=Success(0x00) $ tail /var/log/Xorg.0.log ##1st [ 6644.557] (II) intel(0): resizing framebuffer to 1726x768 [ 6644.560] (II) intel(0): switch to mode 720x400@70.1 on VGA1 using pipe 1, position (1366, 0), rotation normal, reflection none [ 6660.882] (II) intel(0): switch to mode 1366x768@59.8 on VGA1 using pipe 1, position (1366, 0), rotation normal, reflection none ##2nd [ 6804.638] (II) intel(0): resizing framebuffer to 2732x768 [ 6804.647] (II) intel(0): switch to mode 1366x768@59.8 on VGA1 using pipe 1, position (1366, 0), rotation normal, reflection none [ 6817.753] (II) intel(0): resizing framebuffer to 2049x768 [ 6817.757] (II) intel(0): switch to mode 1366x768@59.8 on VGA1 using pipe 1, position (1366, 0), rotation normal, reflection none 

来自其他问题的显着案例

  • xrandr: Failed to get size of gamma for output default

    驱动程序支持或没有驱动器加载问题,这是着名的nomodeset和旧图形。 没有KMS, xrandr不能正常工作。 指标:

    1. sudo lshw -c display可能是*-display UNCLAIMED也是driver= empty。
    2. maximum 1920 x 1080缓冲区大小正是屏幕尺寸最小,大多数图形现在maximum 8192 x 8192maximum 16384 x 16384甚至32Kx32K。
    3. 没有常规的连接名称default
    4. 使用OpenGL软件渲染器,检查glxinfo ,例如: Gallium3D/llvmpipe

    重现类似的问题

    创建Ubuntu虚拟机而不安装guest虚拟机添加/模块(包括vbox图形驱动程序)。 这将是非常缓慢,真正的机器也会发生同样的情况。

  • X Error of failed request: BadMatch (invalid parameter attributes) (RRQueryOutputProperty)

    xrandr --output .. --set 一起使用的错误属性名称,用户应首先使用xrandr --prop检查可用属性。 同样的案例解决了:

    无法改变笔记本电脑的亮度

    可用属性取决于使用的驱动程序和适配器,因此它可能是先前驱动程序问题的结果,因为没有向xrandr声明属性。

    重现类似的问题

     xrandr --output  --set whatever 0 
  • X Error of failed request: BadMatch (invalid parameter attributes) (RRAddOutputMode)

    我目前的理论,计划在我有空的时候测试。 记录在这里。 所以我不会忘记,其他人可能会给出一些反馈。

    由于EDIDvalidation,驱动程序拒绝它时xrandr .. --addmode产生错误xrandr .. --addmode 。 我注意到nvidia在启用“ModeDebug”后删除了一些模式。 或者:

    1. 来自显示器的EDID数据并不完美
    2. 驱动程序在处理EDID时不够强大
    3. 生成的模式条目不在EDID中声明的监视范围内

    (1和2)解决方案是自定义覆盖Hsync / Vsync / PixelClock或完成本地EDID文件,一些驱动程序可以忽略EDID。

    (3)解决方案是尝试不同的模式输入。 注意区别

     $ cvt 1280 800 60 # 1280x800 59.81 Hz (CVT 1.02MA) hsync: 49.70 kHz; pclk: 83.50 MHz Modeline "1280x800_60.00" 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync $ gtf 1280 800 60 # 1280x800 @ 60.00 Hz (GTF) hsync: 49.68 kHz; pclk: 83.46 MHz Modeline "1280x800_60.00" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync # reduce mode only for flat monitors $ cvt -r 1280 800 60 # 1280x800 59.91 Hz (CVT 1.02MA-R) hsync: 49.31 kHz; pclk: 71.00 MHz Modeline "1280x800R" 71.00 1280 1328 1360 1440 800 803 809 823 +hsync -vsync 

    有些情况只是通过将vsync更低一点来解决,例如1280 800 59.80