t2linux/T2-Debian-and-Ubuntu-Kernel

iGPU is not active after upgrading to the latest kernel

Rom888 opened this issue · 47 comments

Rom888 commented

I have enabled the iGPU using this manual:
https://wiki.t2linux.org/guides/hybrid-graphics/#enabling-the-igpu

Today I upgraded the kernel to the latest
6.5.7-t2-jammy
and now I found that the system switched back to AMD dGPU.

There is still /etc/modprobe.d/apple-gmux.conf with the following contents:

# Enable the iGPU by default if present
options apple-gmux force_igd=y

Some additional info:

$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: NAVI14 (navi14, LLVM 15.0.7, DRM 3.54, 6.5.7-t2-jammy)
$ sudo lshw -C display | grep product:
product: Navi 14 [Radeon RX 5500/5500M / Pro 5500M]
product: CoffeeLake-H GT2 [UHD Graphics 630]

my pc:

macbook pro, 16 inch, 2019
model identifier: MacBookPro16.1
Intel Core i9 2.3g

Intel UHD graphics 630
AMD radeon pro 5500M

Does apple-os-set appear on boot

Rom888 commented

Yes

Rom888 commented

And it looks like Ubuntu sees the iGPU:

$ sudo lshw -C display | grep product:
product: Navi 14 [Radeon RX 5500/5500M / Pro 5500M]
product: CoffeeLake-H GT2 [UHD Graphics 630]
Rom888 commented

Also I had a crash and after that only the second monitor is available.
I think this is due to the AMD GPU.

What was your previous kernel version?

Rom888 commented

I don't remember exactly, maybe 6.2.*

Share ls /boot

Rom888 commented
ls -lah /boot
total 166M
drwxr-xr-x  4 root root 4.0K Oct 18 10:15 .
drwxr-xr-x 20 root root 4.0K Jul 21 11:04 ..
-rw-r--r--  1 root root 272K Sep 30 19:14 config-6.5.5-t2-jammy
-rw-r--r--  1 root root 272K Oct 14 14:15 config-6.5.7-t2-jammy
drwx------  5 root root 4.0K Jan  1  1970 efi
drwxr-xr-x  5 root root 4.0K Oct 18 10:15 grub
lrwxrwxrwx  1 root root   25 Jul 21 11:05 initrd.img -> initrd.img-6.4.3-t2-jammy
-rw-r--r--  1 root root  63M Oct 17 20:40 initrd.img-6.5.5-t2-jammy
-rw-r--r--  1 root root  63M Oct 18 10:15 initrd.img-6.5.7-t2-jammy
lrwxrwxrwx  1 root root   26 Aug 19 11:18 initrd.img.old -> initrd.img-6.4.11-t2-jammy
-rw-r--r--  1 root root 179K Feb  6  2022 memtest86+.bin
-rw-r--r--  1 root root 181K Feb  6  2022 memtest86+.elf
-rw-r--r--  1 root root 181K Feb  6  2022 memtest86+_multiboot.bin
-rw-r--r--  1 root root 7.6M Sep 30 19:14 System.map-6.5.5-t2-jammy
-rw-r--r--  1 root root 7.6M Oct 14 14:15 System.map-6.5.7-t2-jammy
lrwxrwxrwx  1 root root   22 Jul 21 11:05 vmlinuz -> vmlinuz-6.4.3-t2-jammy
-rw-r--r--  1 root root  12M Sep 30 19:14 vmlinuz-6.5.5-t2-jammy
-rw-r--r--  1 root root  12M Oct 14 14:15 vmlinuz-6.5.7-t2-jammy
lrwxrwxrwx  1 root root   23 Aug 19 11:18 vmlinuz.old -> vmlinuz-6.4.11-t2-jammy

You seem to be using 6.5.5 as the previous version of kernel. If you right click on terminal, can choose use discrete graphics card, and run the command to check the GPU in use, is it Intel?

Rom888 commented

Aditya, I don't see an option to use the discrete graphics card in my terminal menu.

Share journalctl -k --grep=gmux

Rom888 commented
$ journalctl -k --grep=gmux
Oct 18 16:36:07 mb kernel: apple_gmux: Found gmux version 5.0.0 [T2]
Oct 18 16:36:07 mb kernel: apple_gmux: Switching to IGD
Oct 18 16:36:10 mb kernel: Modules linked in: ip6t_REJECT nf_reject_ipv6 xt_hl ip6t_rt ipt_REJECT nf_reject_ipv4 xt_LOG nf_log_syslog nft_limit xt_limit xt_addrtype xt_tcpudp snd_hda_codec_hdmi xt_conntrack snd_hda_intel nf_conntrack snd_intel_dspcfg snd_intel_sdw_acpi nf_defrag_ipv6 snd_hda_codec nf_defrag_ipv4 nft_compat snd_hda_core apple_bce(C) snd_hwdep snd_pcm nf_tables snd_seq_midi snd_seq_midi_event hid_logitech_dj mei_pxp mei_hdcp binfmt_misc nfnetlink snd_rawmidi snd_seq hci_uart hid_generic snd_seq_device btqca brcmfmac snd_timer iTCO_wdt btrtl mei_me usbhid uas brcmutil intel_pmc_bxt btbcm snd spi_nor rapl nls_iso8859_1 applesmc hid usb_storage i915(+) btintel cfg80211 intel_cstate mtd 8250_dw iTCO_vendor_support soundcore mei intel_pch_thermal sbs amdgpu(+) bluetooth sbshc ecdh_generic ecc acpi_tad apple_gmux mac_hid amdxcp iommu_v2 drm_buddy gpu_sched drm_suballoc_helper drm_ttm_helper ttm drm_display_helper cec rc_core i2c_algo_bit drm_kms_helper parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4

I’ll ping the author of this driver

Cc @Redecorating

What does this command output?

DRI_PRIME=1 glxinfo | grep "OpenGL renderer"

Do you have any external displays connected to your macbook while booting?

https://github.com/0xbb/gpu-switch/blob/master/gpu-switch you can probably try using this to make it switch properly, although macos resets it

Rom888 commented
$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: NAVI14 (navi14, LLVM 15.0.7, DRM 3.54, 6.5.7-t2-jammy)
Rom888 commented

Do you have any external displays connected to your macbook while booting?

Yes

Rom888 commented

Also I would appreciate any suggestions on how to get my laptop's main screen back.
Now I don't have it, even if I disconnect the external monitor and reboot.

Try this

Boot into macOS Recovery
Open terminal there
Run nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00 (be very careful here)

boot into Linux.


$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"

OpenGL renderer string: NAVI14 (navi14, LLVM 15.0.7, DRM 3.54, 6.5.7-t2-jammy)

this means the igpu isn't working. maybe check

journalctl -k --grep=i915

this means the nvram stuff probably won't help as it sounds like the internal display successfully switches over to being connected to igpu, but the igpu isn't outputting anything to the display, and isn't available as a rendering device for some reason.

Rom888 commented

Just after reboot I see apple-os-set
and the GRUB menu on the laptop screen.

$ journalctl --no-pager -k --grep=i915
Oct 18 18:39:02 mb kernel: i915 0000:00:02.0: [drm] VT-d active for gfx access
Oct 18 18:39:02 mb kernel:  i915_driver_probe+0x6c7/0xc60 [i915]
Oct 18 18:39:02 mb kernel:  i915_pci_probe+0x111/0x1f0 [i915]
Oct 18 18:39:02 mb kernel:  i915_pci_register_driver+0x23/0x30 [i915]
Oct 18 18:39:02 mb kernel:  i915_init+0x34/0x120 [i915]
Oct 18 18:39:02 mb kernel:  ? __pfx_i915_init+0x10/0x10 [i915]
Oct 18 18:39:02 mb kernel: Modules linked in: ip6t_REJECT nf_reject_ipv6 xt_hl ip6t_rt ipt_REJECT nf_reject_ipv4 xt_LOG nf_log_syslog nft_limit snd_hda_codec_hdmi snd_hda_intel xt_limit snd_intel_dspcfg snd_intel_sdw_acpi xt_addrtype snd_hda_codec xt_tcpudp snd_hda_core apple_bce(C) snd_hwdep xt_conntrack snd_pcm nf_conntrack nf_defrag_ipv6 snd_seq_midi nf_defrag_ipv4 snd_seq_midi_event nft_compat snd_rawmidi snd_seq hci_uart snd_seq_device nf_tables mei_hdcp mei_pxp snd_timer btqca btrtl nfnetlink binfmt_misc brcmfmac iTCO_wdt snd spi_nor btbcm mei_me brcmutil intel_pmc_bxt btintel nls_iso8859_1 applesmc i915(+) intel_cstate mtd cfg80211 iTCO_vendor_support 8250_dw intel_pch_thermal mei soundcore bluetooth sbs ecdh_generic sbshc ecc acpi_tad apple_gmux amdgpu(+) mac_hid amdxcp iommu_v2 drm_buddy gpu_sched drm_suballoc_helper drm_ttm_helper ttm drm_display_helper cec rc_core i2c_algo_bit drm_kms_helper parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic xor raid6_pq libcrc32c nvme crc32_pclmul

And it looks like Ubuntu sees the iGPU:

$ sudo lshw -C display | grep product:
product: Navi 14 [Radeon RX 5500/5500M / Pro 5500M]
product: CoffeeLake-H GT2 [UHD Graphics 630]

Just after reboot I see apple-os-set

and the GRUB menu on the laptop screen.


$ journalctl --no-pager -k --grep=i915

Oct 18 18:39:02 mb kernel: i915 0000:00:02.0: [drm] VT-d active for gfx access

Oct 18 18:39:02 mb kernel:  i915_driver_probe+0x6c7/0xc60 [i915]```

these lines with the function+0x1234/0x1234 stuff look like a kernel bug/oops calltrace, do you know if you can send the whole log maybe? (journalctl -k > this_boot_logs.txt)

Oct 18 18:39:02 mb kernel:  i915_pci_probe+0x111/0x1f0 [i915]

Oct 18 18:39:02 mb kernel:  i915_pci_register_driver+0x23/0x30 [i915]

Oct 18 18:39:02 mb kernel:  i915_init+0x34/0x120 [i915]

Oct 18 18:39:02 mb kernel:  ? __pfx_i915_init+0x10/0x10 [i915]

Oct 18 18:39:02 mb kernel: Modules linked in: ip6t_REJECT nf_reject_ipv6 xt_hl ip6t_rt ipt_REJECT nf_reject_ipv4 xt_LOG nf_log_syslog nft_limit snd_hda_codec_hdmi snd_hda_intel xt_limit snd_intel_dspcfg snd_intel_sdw_acpi xt_addrtype snd_hda_codec xt_tcpudp snd_hda_core apple_bce(C) snd_hwdep xt_conntrack snd_pcm nf_conntrack nf_defrag_ipv6 snd_seq_midi nf_defrag_ipv4 snd_seq_midi_event nft_compat snd_rawmidi snd_seq hci_uart snd_seq_device nf_tables mei_hdcp mei_pxp snd_timer btqca btrtl nfnetlink binfmt_misc brcmfmac iTCO_wdt snd spi_nor btbcm mei_me brcmutil intel_pmc_bxt btintel nls_iso8859_1 applesmc i915(+) intel_cstate mtd cfg80211 iTCO_vendor_support 8250_dw intel_pch_thermal mei soundcore bluetooth sbs ecdh_generic sbshc ecc acpi_tad apple_gmux amdgpu(+) mac_hid amdxcp iommu_v2 drm_buddy gpu_sched drm_suballoc_helper drm_ttm_helper ttm drm_display_helper cec rc_core i2c_algo_bit drm_kms_helper parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic xor raid6_pq libcrc32c nvme crc32_pclmul

And it looks like Ubuntu sees the iGPU:


$ sudo lshw -C display | grep product:

product: Navi 14 [Radeon RX 5500/5500M / Pro 5500M]

product: CoffeeLake-H GT2 [UHD Graphics 630]

Rom888 commented

I see that the "load kernel modules" job failed during boot as well as the Tiny daemon.

$ systemctl --failed
  UNIT             LOAD   ACTIVE SUB    DESCRIPTION                        
● tiny-dfr.service loaded failed failed Tiny Apple silicon touch bar daemon

20231019_075016
20231019_075043

Rom888 commented

these lines with the function+0x1234/0x1234 stuff look like a kernel bug/oops calltrace, do you know if you can send the whole log maybe? (journalctl -k > this_boot_logs.txt)

boot-log.txt

Oct 18 18:39:02 mb kernel: i915 0000:00:02.0: [drm] VT-d active for gfx access
Oct 18 18:39:02 mb kernel: BUG: kernel NULL pointer dereference, address: 00000000000000d1
Oct 18 18:39:02 mb kernel: #PF: supervisor read access in kernel mode
Oct 18 18:39:02 mb kernel: #PF: error_code(0x0000) - not-present page
Oct 18 18:39:02 mb kernel: PGD 0 P4D 0 
Oct 18 18:39:02 mb kernel: Oops: 0000 [#1] PREEMPT SMP NOPTI
Oct 18 18:39:02 mb kernel: CPU: 4 PID: 380 Comm: systemd-udevd Tainted: G         C         6.5.7-t2-jammy #2
Oct 18 18:39:02 mb kernel: Hardware name: Apple Inc. MacBookPro16,1/Mac-E1008331FDC96864, BIOS 1916.80.2.0.0 (iBridge: 20.16.3045.0.0,0) 12/21/2022
Oct 18 18:39:02 mb kernel: RIP: 0010:device_del+0x40/0x3d0
Oct 18 18:39:02 mb kernel: Code: 41 54 49 89 fc 53 48 83 ec 28 4c 8b 77 40 4c 89 ef 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 e8 b5 f5 60 00 49 8b 54 24 48 <0f> b6 82 d0 00 00 00 a8 01 75 09 83 c8 01 88 82 d0 00 00 00 4c 89
Oct 18 18:39:02 mb kernel: RSP: 0018:ffffb516c0e23848 EFLAGS: 00010246
Oct 18 18:39:02 mb kernel: RAX: 0000000000000000 RBX: ffff9ae342b2cc00 RCX: 0000000000000000
Oct 18 18:39:02 mb kernel: RDX: 0000000000000001 RSI: ffffffffc219b9b4 RDI: 0000000000000000
Oct 18 18:39:02 mb kernel: RBP: ffffb516c0e23898 R08: 0000000000000000 R09: 0000000000000000
Oct 18 18:39:02 mb kernel: R10: 0000000000000000 R11: 0000000000000000 R12: ffff9ae342b2cc10
Oct 18 18:39:02 mb kernel: R13: ffff9ae342b2cc90 R14: ffff9ae342b2cc08 R15: 0000000000000000
Oct 18 18:39:02 mb kernel: FS:  00007f3844e318c0(0000) GS:ffff9ae6aeb00000(0000) knlGS:0000000000000000
Oct 18 18:39:02 mb kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Oct 18 18:39:02 mb kernel: CR2: 00000000000000d1 CR3: 00000001128b8006 CR4: 00000000003706e0
Oct 18 18:39:02 mb kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Oct 18 18:39:02 mb kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Oct 18 18:39:02 mb kernel: Call Trace:
Oct 18 18:39:02 mb kernel:  <TASK>
Oct 18 18:39:02 mb kernel:  ? show_regs+0x72/0x90
Oct 18 18:39:02 mb kernel:  ? __die+0x25/0x80
Oct 18 18:39:02 mb kernel:  ? page_fault_oops+0x154/0x4c0
Oct 18 18:39:02 mb kernel:  ? prb_read_valid+0x1c/0x30
Oct 18 18:39:02 mb kernel:  ? __irq_work_queue_local+0x43/0xf0
Oct 18 18:39:02 mb kernel:  ? do_user_addr_fault+0x334/0x6c0
Oct 18 18:39:02 mb kernel:  ? exc_page_fault+0x84/0x1b0
Oct 18 18:39:02 mb kernel:  ? asm_exc_page_fault+0x27/0x30
Oct 18 18:39:02 mb kernel:  ? device_del+0x40/0x3d0
Oct 18 18:39:02 mb kernel:  ? device_del+0x3b/0x3d0
Oct 18 18:39:02 mb kernel:  platform_device_del.part.0+0x18/0x90
Oct 18 18:39:02 mb kernel:  platform_device_unregister+0x20/0x40
Oct 18 18:39:02 mb kernel:  sysfb_disable+0x2f/0x90
Oct 18 18:39:02 mb kernel:  aperture_remove_conflicting_pci_devices+0xee/0x170
Oct 18 18:39:02 mb kernel:  drm_aperture_remove_conflicting_pci_framebuffers+0x15/0x20 [drm]
Oct 18 18:39:02 mb kernel:  i915_driver_probe+0x6c7/0xc60 [i915]
Oct 18 18:39:02 mb kernel:  i915_pci_probe+0x111/0x1f0 [i915]
Oct 18 18:39:02 mb kernel:  local_pci_probe+0x48/0xb0
Oct 18 18:39:02 mb kernel:  pci_device_probe+0xc8/0x280
Oct 18 18:39:02 mb kernel:  really_probe+0x1d2/0x440
Oct 18 18:39:02 mb kernel:  __driver_probe_device+0x8a/0x190
Oct 18 18:39:02 mb kernel:  driver_probe_device+0x23/0xd0
Oct 18 18:39:02 mb kernel:  __driver_attach+0x10f/0x220
Oct 18 18:39:02 mb kernel:  ? __pfx___driver_attach+0x10/0x10
Oct 18 18:39:02 mb kernel:  bus_for_each_dev+0x7a/0xe0
Oct 18 18:39:02 mb kernel:  driver_attach+0x1e/0x30
Oct 18 18:39:02 mb kernel:  bus_add_driver+0x127/0x240
Oct 18 18:39:02 mb kernel:  driver_register+0x64/0x140
Oct 18 18:39:02 mb kernel:  __pci_register_driver+0x68/0x80
Oct 18 18:39:02 mb kernel:  i915_pci_register_driver+0x23/0x30 [i915]
Oct 18 18:39:02 mb kernel:  i915_init+0x34/0x120 [i915]
Oct 18 18:39:02 mb kernel:  ? __pfx_i915_init+0x10/0x10 [i915]
Oct 18 18:39:02 mb kernel:  do_one_initcall+0x46/0x330
Oct 18 18:39:02 mb kernel:  ? kmalloc_trace+0x2a/0xb0
Oct 18 18:39:02 mb kernel:  do_init_module+0x6a/0x270
Oct 18 18:39:02 mb kernel:  load_module+0x20c4/0x23f0
Oct 18 18:39:02 mb kernel:  __do_sys_init_module+0x1ae/0x1e0
Oct 18 18:39:02 mb kernel:  ? __do_sys_init_module+0x1ae/0x1e0
Oct 18 18:39:02 mb kernel:  __x64_sys_init_module+0x1a/0x30
Oct 18 18:39:02 mb kernel:  do_syscall_64+0x59/0x90
Oct 18 18:39:02 mb kernel:  ? irqentry_exit_to_user_mode+0x17/0x20
Oct 18 18:39:02 mb kernel:  ? irqentry_exit+0x43/0x50
Oct 18 18:39:02 mb kernel:  ? exc_page_fault+0x95/0x1b0
Oct 18 18:39:02 mb kernel:  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
Oct 18 18:39:02 mb kernel: RIP: 0033:0x7f3844d26dce
Oct 18 18:39:02 mb kernel: Code: 48 8b 0d 65 20 0f 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 32 20 0f 00 f7 d8 64 89 01 48
Oct 18 18:39:02 mb kernel: RSP: 002b:00007ffed8ee96a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
Oct 18 18:39:02 mb kernel: RAX: ffffffffffffffda RBX: 000055ae977d8120 RCX: 00007f3844d26dce
Oct 18 18:39:02 mb kernel: RDX: 00007f3844f94441 RSI: 000000000079cb31 RDI: 00007f3842d46010
Oct 18 18:39:02 mb kernel: RBP: 00007f3842d46010 R08: 00007f384352a000 R09: 85ebca77c2b2ae63
Oct 18 18:39:02 mb kernel: R10: 00000000000274c1 R11: 0000000000000246 R12: 00007f3844f94441
Oct 18 18:39:02 mb kernel: R13: 000055ae976a59c0 R14: 000055ae977d8aa0 R15: 000055ae977d4840
Oct 18 18:39:02 mb kernel:  </TASK>
Oct 18 18:39:02 mb kernel: Modules linked in: ip6t_REJECT nf_reject_ipv6 xt_hl ip6t_rt ipt_REJECT nf_reject_ipv4 xt_LOG nf_log_syslog nft_limit snd_hda_codec_hdmi snd_hda_intel xt_limit snd_intel_dspcfg snd_intel_sdw_acpi xt_addrtype snd_hda_codec xt_tcpudp snd_hda_core apple_bce(C) snd_hwdep xt_conntrack snd_pcm nf_conntrack nf_defrag_ipv6 snd_seq_midi nf_defrag_ipv4 snd_seq_midi_event nft_compat snd_rawmidi snd_seq hci_uart snd_seq_device nf_tables mei_hdcp mei_pxp snd_timer btqca btrtl nfnetlink binfmt_misc brcmfmac iTCO_wdt snd spi_nor btbcm mei_me brcmutil intel_pmc_bxt btintel nls_iso8859_1 applesmc i915(+) intel_cstate mtd cfg80211 iTCO_vendor_support 8250_dw intel_pch_thermal mei soundcore bluetooth sbs ecdh_generic sbshc ecc acpi_tad apple_gmux amdgpu(+) mac_hid amdxcp iommu_v2 drm_buddy gpu_sched drm_suballoc_helper drm_ttm_helper ttm drm_display_helper cec rc_core i2c_algo_bit drm_kms_helper parport_pc ppdev lp drm parport efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic xor raid6_pq libcrc32c nvme crc32_pclmul
Oct 18 18:39:02 mb kernel:  nvme_core i2c_i801 spi_intel_pci thunderbolt i2c_smbus spi_intel intel_lpss_pci nvme_common xhci_pci xhci_pci_renesas intel_lpss_acpi video intel_lpss wmi idma64
Oct 18 18:39:02 mb kernel: CR2: 00000000000000d1
Oct 18 18:39:02 mb kernel: ---[ end trace 0000000000000000 ]---

I suspect this might be caused by https://github.com/t2linux/linux-t2-patches/blob/main/2009-apple-gmux-allow-switching-to-igpu-at-probe.patch.

@Rom888 if you change /etc/modprobe.d/apple-gmux.conf to have =n:

Enable the iGPU by default if present

options apple-gmux force_igd=n

does that make DRI_PRIME=1 glxinfo | grep "OpenGL renderer" say intel? If it doesn't, try without DRI_PRIME=1, and if that still doesn't say intel, can you check if the error message I quoted above is still in your logs?

Rom888 commented

I recently rebooted my laptop and left the login screen on for at least 10 minutes.
When I returned back, I found that the login screen had moved to the laptop monitor.
After logging in I found that the iGPU returned back.

I rebooted and now the iGPU is working, but now when using the Chrome browser I got a complete system freeze.

Should I still try it?
options apple-gmux force_igd=n

Rom888 commented

$ journalctl --boot 93716cef45b44283a184b536147ea7dc >/tmp/freez-log.txt

freez-log.txt

Rom888 commented

Now I again experienced a complete system freeze immediately after connecting the external monitor.

Rom888 commented

options apple-gmux force_igd=n

After the last freeze I lost the iGPU again and tried it:

$ cat /etc/modprobe.d/apple-gmux.conf
options apple-gmux force_igd=n

After reboot:

rom@mb:~$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: NAVI14 (navi14, LLVM 15.0.7, DRM 3.54, 6.5.7-t2-jammy)

rom@mb:~$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)

sounds like the hack to switch gpu at boot doesnt work anymore? For now if you want the igpu as the main gpu, use force_idg=n, and either use the nvram command in macOS recovery that aditya mentioned, or the gpu-switch script I linked to a few messages back to set the boot gpu.

Rom888 commented

Without the iGPU I had problems with suspend, so I prefer to use it.

Boot into macOS Recovery
Open terminal there
Run nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00 (be very careful here)

I did it as @AdityaGarg8 adviced and now:

If the laptop boots without an external monitor connected, then iGPU is a rendering device.
If the laptop boots with an external monitor connected, then amdGPU is a rendering device.

Can you try an LTS kernel

sudo apt remove tiny-dfr
sudo apt install t2-kernel-script-lts
update_t2_kernel --remove-current

After running, change force_idg=y, reboot into macOS, then back to Linux.

Rom888 commented

I did it.
Laptop boots without an external monitor connected.
After booting I saw only a black screen and a lit touchbar.
When I connected an external monitor, I found the initial screen there.
Renderer is amdGPU.

journalctl -k --grep=gmux

Rom888 commented
$ journalctl -k --grep=gmux
Oct 19 18:54:52 mb kernel: apple_gmux: Found gmux version 5.0.0 [T2]
Oct 19 18:54:52 mb kernel: apple_gmux: Switching to IGD
Oct 19 18:54:54 mb kernel: Modules linked in: hid_generic(+) snd_timer btbcm spi_nor brcmutil iTCO_wdt mei_me usbhid btintel intel_pmc_bxt rapl snd uas i915(+) applesmc(+) hid cfg80211 usb_storage intel_cstate mtd mei iTCO_vendor_support 8250_dw intel_pch_thermal soundcore bluetooth sbs ecdh_generic sbshc apple_gmux acpi_tad ecc amdgpu(+) apple_bl mac_hid iommu_v2 gpu_sched drm_buddy drm_ttm_helper ttm drm_display_helper cec rc_core i2c_algo_bit drm_kms_helper fb_sys_fops syscopyarea sysfillrect sysimgblt parport_pc ppdev lp parport drm efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic xor raid6_pq zstd_compress libcrc32c nvme crc32_pclmul nvme_core i2c_i801 spi_intel_pci spi_intel intel_lpss_pci thunderbolt i2c_smbus nvme_common xhci_pci xhci_pci_renesas intel_lpss_acpi video intel_lpss wmi idma64
Rom888 commented

And no the laptop screen in the display settings.

You want to downgrade to the previous kernel?

Rom888 commented

The latest kernel was better I think.

But that was causing issues right?

Rom888 commented

At least now with the latest kernel I understand the behavior:
If the laptop boots without an external monitor connected, then iGPU is a rendering device.
If the laptop boots with an external monitor connected, then amdGPU is a rendering device.

And I can use suspend and disconnect the external monitor if I need to reboot.

sudo apt install tiny-dfr
sudo apt install t2-kernel-script
update_t2_kernel

Run this to restore the latest kernel

Rom888 commented

uname -r
shows
6.5.7-t2-jammy
but not
6.5.7-2...

It would show 6.5.7-t2-jammy only

Rom888 commented

Okay,
Now laptop booted without an external monitor connected, but again, amdGPU is a rendering device :(
even with:

$ cat /etc/modprobe.d/apple-gmux.conf
options apple-gmux force_igd=n
Rom888 commented

Should I do it again?

Boot into macOS Recovery
Open terminal there
Run nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00 (be very careful here)

Yes

Rom888 commented

iGPU works now if the laptop boots without an external monitor connected.
Just for info: tiny-dfr did not work with amdGPU.

Rom888 commented

I made fresh install of ubuntu-23.04-6.4.8-t2-lunar and then upgraded to the latest v6.5.9-1 kernel.
It looks all right with the iGPU now, even with
options apple-gmux force_igd=y