尽管收到损坏的 EDID,如何强制启用 HDMI 音频(英特尔卡)

尽管收到损坏的 EDID,如何强制启用 HDMI 音频(英特尔卡)

当直接连接到我的显卡时,我的显示器发送的 EDID 没问题,我将其转储到/lib/firmware/edid/viewsonic.bin.

我想通过 KVM 切换器、HDMI 音频提取器和 HDMI 分配器访问我的显示器。通过这种设置,我的计算机接收到的 EDID 已损坏,甚至 UEFI 也无法检测到我的屏幕已打开。

drm_kms_helper.edid_firmware=edid/viewsonic.bin video=HDMI-A-1:D我通过附加到我的内核引导行找到了解决方法。多亏了这条线,Linux 中的 HDMI 视频输出就可以了。

但是,HDMI 音频不起作用。 Pulseaudio 设置为正确的接收器,该接收器被检测为已拔出(不可用)。

我尝试了以下操作,没有发生任何变化:

  • 在initramfs中添加edid文件,以便更早加载EDID
  • xrandr --output HDMI-1 --set audio on

我能够完成所有这些工作的唯一方法是使用直接插入计算机的显示器进行启动(不强制执行 EDID),并在启动完成后返回到我的设置。但是,在暂停或长时间闲置后,声音无论如何都会消失,然后我无法使其再次工作。

感谢您提出的任何建议!


也许相关:

$ pactl list sinks
Sink #0         
    State: RUNNING                                                                   
    Name: alsa_output.pci-0000_00_1f.3.hdmi-stereo
    Description: Audio interne Digital Stereo (HDMI)
    Driver: module-alsa-card.c                                      
    Sample Specification: s16le 2ch 44100Hz   
    Channel Map: front-left,front-right               
    Owner Module: 7
    Mute: no                           
    Volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
            balance 0,00          
    Base Volume: 65536 / 100% / 0,00 dB
    Monitor Source: alsa_output.pci-0000_00_1f.3.hdmi-stereo.monitor
    Latency: 39654 usec, configured 40000 usec
    Flags: HARDWARE DECIBEL_VOLUME LATENCY SET_FORMATS
    Properties:                 
            alsa.resolution_bits = "16"         
            device.api = "alsa"
            device.class = "sound"
            alsa.class = "generic"          
            alsa.subclass = "generic-mix"                              
            alsa.name = "HDMI 0"              
            alsa.id = "HDMI 0"                  
            alsa.subdevice = "0"                                       
            alsa.subdevice_name = "subdevice #0"
            alsa.device = "3"        
            alsa.card = "0"                         
            alsa.card_name = "HDA Intel PCH"
            alsa.long_card_name = "HDA Intel PCH at 0xdf240000 irq 325"
            alsa.driver_name = "snd_hda_intel"
            device.bus_path = "pci-0000:00:1f.3"
            sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
            device.bus = "pci"                       
            device.vendor.id = "8086"        
            device.vendor.name = "Intel Corporation"
            device.product.id = "a170"                          
            device.product.name = "Sunrise Point-H HD Audio"          
            device.form_factor = "internal"    
            device.string = "hdmi:0"                                                         
            device.buffering.buffer_size = "352800"
            device.buffering.fragment_size = "176400"
            device.access_mode = "mmap+timer"
            device.profile.name = "hdmi-stereo"                              
            device.profile.description = "Digital Stereo (HDMI)"
            device.description = "Audio interne Digital Stereo (HDMI)"
            alsa.mixer_name = "Realtek ALC1150"
            alsa.components = "HDA:10ec0900,1462da12,00100001 HDA:80862809,80860101,00100000"        
            module-udev-detect.discovered = "1"
            device.icon_name = "audio-card-pci"      
    Ports :                                  
            hdmi-output-0: HDMI / DisplayPort (priority: 5900, not available)
    Active port: hdmi-output-0                                  
    Formats:                                                          
            pcm                                

编辑:使用 edid_firmware 选项启动时,未设置字段(结果与 eld#2.0 和其他 2.* 相同):

$ grep eld_valid /proc/asound/card0/eld#2.0
monitor_present         0
eld_valid               0

但是,当直接连接显示器并使用或不使用启动参数进行启动时,eld#2.0 的结果现在是有效字段:

$ cat /proc/asound/card0/eld\#2.0 
monitor_present         1
eld_valid               1
monitor_name            VX2703 SERIES
connection_type         HDMI
eld_version             [0x2] CEA-861D or below
edid_version            [0x3] CEA-861-B, C or D
manufacture_id          0x635a
product_id              0xf62b
port_id                 0x0
support_hdcp            0
support_ai              0
audio_sync_delay        0
speakers                [0x1] FL/FR
sad_count               1
sad0_coding_type        [0x1] LPCM
sad0_channels           2
sad0_rates              [0x1ee0] 32000 44100 48000 88200 96000 176400 192000
sad0_bits               [0xe0000] 16 20 24

aplay -l 输出

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC1150 Analog [ALC1150 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1150 Digital [ALC1150 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ edid-decode /lib/firmware/edid/viewsonic.bin
Extracted contents:
header:          00 ff ff ff ff ff ff 00
serial number:   5a 63 2b f6 01 01 01 01 19 17
version:         01 03
basic params:    80 3c 22 78 2e
chroma info:     b2 05 a3 56 4f 9e 28 0f 50 54
established:     bf ef 80
standard:        b3 00 a9 40 95 00 90 40 81 80 81 40 71 4f 01 01
descriptor 1:    02 3a 80 18 71 38 2d 40 58 2c 45 00 55 50 21 00 00 1e
descriptor 2:    00 00 00 ff 00 54 38 47 31 33 32 35 30 30 34 32 30 0a
descriptor 3:    00 00 00 fd 00 32 4c 0f 53 12 00 0a 20 20 20 20 20 20
descriptor 4:    00 00 00 fc 00 56 58 32 37 30 33 20 53 45 52 49 45 53
extensions:      01
checksum:        f2

Manufacturer: VSC Model f62b Serial Number 16843009
Made week 25 of 2013
EDID version: 1.3
Digital display
Maximum image size: 60 cm x 34 cm
Gamma: 2.20
DPMS levels: Off
Supported color formats: RGB 4:4:4, YCrCb 4:4:4
Default (sRGB) color space is primary color space
First detailed timing is preferred timing
Established timings supported:
  720x400@70Hz
  640x480@60Hz
  640x480@67Hz
  640x480@72Hz
  640x480@75Hz
  800x600@56Hz
  800x600@60Hz
  800x600@72Hz
  800x600@75Hz
  832x624@75Hz
  1024x768@60Hz
  1024x768@70Hz
  1024x768@75Hz
  1280x1024@75Hz
  1152x870@75Hz
Standard timings supported:
  1680x1050@60Hz
  1600x1200@60Hz
  1440x900@60Hz
  1400x1050@60Hz
  1280x1024@60Hz
  1280x960@60Hz
  1152x864@75Hz
Detailed mode: Clock 148.500 MHz, 597 mm x 336 mm
               1920 2008 2052 2200 hborder 0
               1080 1084 1089 1125 vborder 0
               +hsync +vsync 
Serial number: T8G132500420
Monitor ranges (GTF): 50-76Hz V, 15-83kHz H, max dotclock 180MHz
Has 1 extension blocks
Checksum: 0xf2 (valid)

CEA extension block
Extension version: 3
30 bytes of CEA data
  Video data block
    VIC  16 1920x1080@60Hz (native)
    VIC   5 1920x1080i@60Hz 
    VIC   4 1280x720@60Hz 
    VIC   3 720x480@60Hz 
    VIC   2 720x480@60Hz 
    VIC   7 1440x480i@60Hz 
    VIC   6 1440x480i@60Hz 
    VIC  31 1920x1080@50Hz 
    VIC  20 1920x1080i@50Hz 
    VIC  19 1280x720@50Hz 
    VIC  18 720x576@50Hz 
    VIC  17 720x576@50Hz 
    VIC  22 1440x576i@50Hz 
    VIC  21 1440x576i@50Hz 
    VIC   1 640x480@60Hz 
  Audio data block
    Linear PCM, max channels 2
    Supported sample rates (kHz): 192 176.4 96 88.2 48 44.1 32
    Supported sample sizes (bits): 24 20 16
  Speaker allocation data block
    Speaker map: FL/FR
  Vendor-specific data block, OUI 000c03 (HDMI)
    Source physical address 1.0.0.0
Underscans PC formats by default
Basic audio support
Supports YCbCr 4:4:4
Supports YCbCr 4:2:2
1 native detailed modes
Detailed mode: Clock 148.500 MHz, 597 mm x 336 mm
               1920 2008 2052 2200 hborder 0
               1080 1084 1089 1125 vborder 0
               +hsync +vsync 
Detailed mode: Clock 74.250 MHz, 597 mm x 336 mm
               1920 2008 2052 2200 hborder 0
                540  542  547  562 vborder 0
               +hsync +vsync interlaced 
Detailed mode: Clock 74.250 MHz, 597 mm x 336 mm
               1280 1390 1430 1650 hborder 0
                720  725  730  750 vborder 0
               +hsync +vsync 
Detailed mode: Clock 27.000 MHz, 597 mm x 336 mm
                720  736  798  858 hborder 0
                480  489  495  525 vborder 0
               -hsync -vsync 
Detailed mode: Clock 148.500 MHz, 597 mm x 336 mm
               1920 2448 2492 2640 hborder 0
               1080 1084 1089 1125 vborder 0
               +hsync +vsync 
Checksum: 0x4d (valid)

EDID block does NOT conform to EDID 1.3!
    Name descriptor not terminated with a newline

编辑:挖掘内核端

经过进一步挖掘,似乎一切都始于 linux-source-4.12/drivers/gpu/drm/i915/intel_ddi.c。的返回值I915_READ(HSW_AUD_PIN_ELD_CP_VLD) & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe)决定是否输出“has_audio”。由于还没有,因此intel_audio_codec_enable不会调用该函数。我尝试强制调用它。之后,ELD 已正确配置并在 中报告有效/proc/asound/card0/eld#2.0。 Pulseaudio 不再说输出是拔掉插头。但它仍然不起作用,并且出现错误:[drm:pipe_config_err [i915]]错误has_audio 不匹配(预期 0,发现 1)这很正常,因为我已经适应了它。所以,我不知道,也许我可以使用英特尔GPU工具手动更改HSW_AUD_PIN_ELD_CP_VLD,但我更喜欢询问更了解的人。

答案1

我在 IRC 上从 freenode 上的 #intel-gfx 得到了答案。问题是 i915 模块以及其他模块正在调用 drm_(do_)get_edid,它忽略了提供给 drm_kms_helper 的 edid 固件。

已经有补丁了对于linux(我将其应用到linux 4.12并解决了较小的冲突)来改变这种行为。它需要重建 linux-source/drivers/gpu/drm/ 下的所有模块并添加新的启动参数:drm.edid_firmware=edid/viewsonic.bin 之后,音频输出被标记为可用并且声音正常。这样问题就解决了。我希望这个补丁能被接受!

答案2

部分答案:

EDID 包含音频信息,特别是您用 列出的 CEA 音频扩展块edid-decode。该数据由内核驱动程序提取并提供给 ALSA 作为ELD(“类似 EDID 的数据”)。您可以使用以下命令查看当前的 ELD(并测试它们是否存在):

cat /proc/asound/card*/eld\#*

您还可以使用此界面更改一些 ELD 数据,例如

echo 'audio_sync_delay 23' | sudo tee /proc/asound/card0/eld#3.2

因此,如果由于某种原因您的内核启动 EDID 未转换为 ELD,则 HDMI 声音输出将无法工作。

可能还有其他原因导致它不起作用;在这种情况下,我建议完全停止 Pulseaudio(或使用pasuspender),并尝试在 ALSA 级别进行调查。aplay --dump-hw-params -D ...可能有帮助。

我不知道有什么方法可以像使用 EDID 那样强制使用自定义 ELD 覆盖 ELD,而且我不确定这种方法是否存在。

换句话说,我不知道如何解决该问题,但也许这些信息可以让您知道在哪里寻找更多信息。

相关内容