External monitor not working Nvidia Optimus

I have a Intel/Nvidia Optimus machine with debian linux:
My Nvidia-prime is working properly but my HDMI external monitor is not working (Actually my xrandr can detect HDMI input but the the monitor is still not working)
Screenshot from 2022-06-05 05-18-03
I found one possible reason is that In the log my HDMI input is using snd_hda_intel kernel instead of the nvidia, anyone knows how to fix this?

01:00.1 Audio device: NVIDIA Corporation GK107 HDMI Audio Controller (rev a1)
	Subsystem: Apple Inc. GK107 HDMI Audio Controller
	Flags: bus master, fast devsel, latency 0, IRQ 17, IOMMU group 1
	Memory at c1080000 (32-bit, non-prefetchable) [size=16K]
	Capabilities: [60] Power Management version 3
	Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [78] Express Endpoint, MSI 00
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel

nvidia-bug-report.log.gz

I am having a Optimus machine with Intel/Nvidia graphics card:

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 650M Mac Edition] (rev a1)

And my xrandr can detect the external monitor and its resolutions.

According to the logs, the monitor is detected fine and working.
-but-
You’re running proprietary Apple hardware, those have their own, shady methods of gpu switching, differing on every model. Please post the exact mac book model.

Yes, thank you so much for this reply! I am running linux on a MacBook Pro 15" (Early 2013) with i7-3740QM CPU:

$ sysctl -a | grep brand
machdep.cpu.brand_string: Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz
machdep.cpu.brand: 0

Are there any ways I can locate the bug in the log? I am now running with Nvidia-PRIME:

PRIME is required to use both monitors at the same time. See http://us.download.nvidia.com/XFree86/Linux-x86_64/455.45.01/README/randr14.html for more information. For a basic PRIME config, try running ‘nvidia-xconfig --prime’.

Please try it and if issue still persists, please share new bug report…

And I am connecting my nvidia card with the PCI bridge following this post: https://askubuntu.com/a/613573/744764, but I have multiple PCI express bridges on my machine (I connected my Nvidia card to one of them):

$ sudo lshw -businfo -class bridge -class display
Bus info          Device     Class          Description
=======================================================
pci@0000:00:00.0             bridge         3rd Gen Core processor DRAM Controller
pci@0000:00:01.0             bridge         Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
pci@0000:01:00.0             display        GK107M [GeForce GT 650M Mac Edition]
pci@0000:00:01.1             bridge         Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
pci@0000:05:00.0             bridge         DSL3510 Thunderbolt Controller [Cactus Ridge 4C 2012]
pci@0000:06:00.0             bridge         DSL3510 Thunderbolt Controller [Cactus Ridge 4C 2012]
pci@0000:06:03.0             bridge         DSL3510 Thunderbolt Controller [Cactus Ridge 4C 2012]
pci@0000:06:04.0             bridge         DSL3510 Thunderbolt Controller [Cactus Ridge 4C 2012]
pci@0000:06:05.0             bridge         DSL3510 Thunderbolt Controller [Cactus Ridge 4C 2012]
pci@0000:06:06.0             bridge         DSL3510 Thunderbolt Controller [Cactus Ridge 4C 2012]
pci@0000:00:01.2             bridge         Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
pci@0000:00:02.0             display        3rd Gen Core processor Graphics Controller
pci@0000:00:1c.0             bridge         7 Series/C216 Chipset Family PCI Express Root Port 1
pci@0000:00:1c.1             bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 2
pci@0000:00:1f.0             bridge         HM77 Express Chipset LPC Controller

Like said, this is Apple hardware and in this case no Optimus system, it has a real hardware switch driven by the apple-gmux kernel driver which explains the model specific differences:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/apple-gmux.c#n311

Since you’re running with everything switched to the nvidia gpu, prime can’t be used. The hdmi problem seems to be an known issue with your model:
https://forums.developer.nvidia.com/t/no-signal-with-hdmi-or-dp-0-ports-on-macbookpro10-1-gt-650m-only-dp-1-works/49777/5

Some useful info aboutt your model:
https://wiki.archlinux.org/title/MacBookPro10,x

1 Like

Thanks for great research on this topic! I see that it has been a known bug for Macbook linux users.

Are there any ways to fix this since https://wiki.archlinux.org/title/MacBookPro10,x reads

Note: In order to plug in an external display, you will need to have the NVIDIA card powered on as the HDMI and thunderbolt outputs are hardwired to use the NVIDIA card.
Actually when I connect HDMI on boot, the booting process got stuck.

  1. Based on https://forums.developer.nvidia.com/t/no-signal-with-hdmi-or-dp-0-ports-on-macbookpro10-1-gt-650m-only-dp-1-works/49777/5 I am guessing switching to nouveau driver should be a solution, if that is true how I can swtich to nouveau driver properly?
  2. If my linux won’t boot when I connect with HDMI, how I can check what is going on in the log?

I found for debian linux my HDMI port is not working while my mini display port is working perfectly with a same external monitor.

Yeah, that was the work around people seemed to use with your model.
I was in a rush so I couldn’t finish my post, there are some oddities with your specific macbook model: while it should be supported by apple-gmux, in fact it bails out with “no gmux found” in dmesg. So I suspect your model has a different gmux chip that is unknown to the driver so switching is incomplete. In the apple-gmux docs linked, it is documented that on some models, the DDC and Main connection can be switched seperately, this might apply to yours. If only DDC is switched, the monitor can be detected but not used.
Don’t know why this works with nouveau (if it does), might have a workaround applied.
So I guess when trying to get the hdmi port working, the apple-gmux devs should be contacted, why the gmux doesn’t get detected and what to do about it.

1 Like

For Macbook users’ reference (debian).

By the end of the day I still cannot fix this bug with the apple-gmux team. And they claimed for HDMI port there gmux never works.

I tested the functioning for my minidisplay port with this Macbook 2013. I found the when using [display port] (DisplayPort - Wikipedia) as input on the monitor side, it works perfect. I have two mini-display ports and one HDMI. port.

  1. HDMI → HDMI monitor
    HDMI port on macbook works
  2. mini-DP → HDMI monitor
    One of mini-DPs on my macbook works while the other one does not.
  3. mini-DP → display port
    All two min-DPs on my macbook work.

In sum, I believe in debian system, the port on the monitor side really matters. And in my setting, the display port on monitor side works the best. (And all three port works on under macOS for sure)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.