Audio

儘管收到損壞的 EDID,如何強制啟用 HDMI 音頻(英特爾卡)

  • September 10, 2017

我的顯示器直接連接到我的顯卡時發送的 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(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

應用 -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)是正常的,因為我對其進行了調整。所以,我不知道,也許我可以用intel gpu工具手動更改HSW_AUD_PIN_ELD_CP_VLD,但我更喜歡問更了解的人。

我從 freenode 上的#intel-gfx 獲得了關於 IRC 的答案。問題是 i915 模組以及其他模組正在呼叫 drm_(do_)get_edid,它忽略了提供給 drm_kms_helper 的 edid 韌體。

有一個適用於 linux 的更新檔(我將它應用到 linux 4.12 並解決了輕微的衝突)來改變這種行為。它需要重建 linux-source/drivers/gpu/drm/ 下的所有模組並添加一個新的啟動參數:drm.edid_firmware=edid/viewsonic.bin 之後,音頻輸出被標記為可用並且聲音正常。所以問題就解決了。我希望這個更新檔會被接受!

部分答案:

EDID 包含音頻資訊,特別是您列出的 CEA 音頻擴展塊edid-decode。該數據由核心驅動程序提取並作為ELD(“類似 EDID 的數據”)提供給 ALSA。您會看到目前的 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,而且我不確定這種方法是否存在。

換句話說,我不知道如何解決這個問題,但也許這些資訊可以讓您了解在哪裡尋找更多資訊。

引用自:https://unix.stackexchange.com/questions/391326