Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laptop embeded display does not function when booted with external display already plugged in. #9284

Open
4 of 6 tasks
RileyMathews opened this issue Feb 1, 2025 · 10 comments
Labels
bug Something isn't working

Comments

@RileyMathews
Copy link

Already reported ? *

  • I have searched the existing open and closed issues.

Regression?

I don't know, I started using Hyprland only recently

System Info and Hyprland Version

System/Version info Hyprland 0.47.1 built from branch at commit 75dff72 (version: bump to 0.47.1). Date: Wed Jan 29 23:19:39 2025 Tag: v0.47.1, commits: 5756 built against: aquamarine 0.7.2 hyprlang 0.6.0 hyprutils 0.5.0 hyprcursor 0.1.11 hyprgraphics 0.1.1

no flags were set

System Information:
System name: Linux
Node name: picard
Release: 6.12.10-arch1-1
Version: #1 SMP PREEMPT_DYNAMIC Sat, 18 Jan 2025 02:26:57 +0000

GPU information:
00:02.0 VGA compatible controller [0300]: Intel Corporation Raptor Lake-S UHD Graphics [8086:a788] (rev 04) (prog-if 00 [VGA controller])
DeviceName: VGA compatible controller
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD103M / GN21-X11 [GeForce RTX 4090 Laptop GPU] [10de:2757] (rev a1) (prog-if 00 [VGA controller])
NVRM version: NVIDIA UNIX x86_64 Kernel Module 565.77 Wed Nov 27 23:33:08 UTC 2024

os-release: NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

plugins:

Description

This is highly likely due to my specific hardware (I am sure this is something nvidia specific, and yes I'm already slightly regretting this laptop choice). When I boot my laptop without an external display connected everything works fine. At that point I can even plug in my external monitor and hyprland detects it and continues running no issue. However if I boot with the external monitor plugged in then my embedded display 'stops working'. What I mean by that is it appears to still be trying to render workspaces. I can move windows to it and get them back with hotkeys. But the resolution reported for the monitor is 0x0 and it renders nothing while the backlight is still on. The logs mention a lot about requested modes for eDP-2 not working so there is something there hyprland is trying to do but just fails to get anything to work.

Another odd issue that may or may not be related. When everything works fine waybar also pops up as normal with no issues. However when this issue happens waybar also fails to launch. I have also attached its output from trying to manually start it in case it provides any clues but it may or may not be helpful.

I have tried my best to try all of the things mentioned in the nvidia section of the wiki. I have attached relevant files there as well so we can make sure I am following those guidelines properly as well.

How to reproduce

  1. Boot my laptop with external monitor plugged into to mini display port.
  2. Start hyprland from the tty
  3. Embedded display does not 'work'.

I understand reproduction is likely only possible on my hardware. I'll try to be as responsive as I can about trying anything to help fix.

Attach not paste

  • I understand that all text files must be attached, and not pasted directly. If not respected, this issue will likely get closed as spam

Checklist of files to include below

  • Hyprland config - hyprctl systeminfo -c (always include)
  • Crash report (always include in case of crash)
  • Video (always include in case of a visual bug)
  • Logs (might contain useful info such as errors)

Additional info & File uploads

hyprland.log

no crash report, hyprland still runs in this case

no video needed. Other than described issue hyprland 'works'

hyprland_config_dump.txt

hyprctl_monitors_output.txt

waybar-log.txt

mkinitcpio-conf.txt

modprobe-conf.txt

@RileyMathews RileyMathews added the bug Something isn't working label Feb 1, 2025
@RileyMathews
Copy link
Author

RileyMathews commented Feb 1, 2025

One thing I forgot to mention initially is I have tried this with 'hybrid' and 'nvidia' graphics modes provided by the system76-utility. Any time I switched I tried the provided config files first and then also tried adding the fbdev=1 parameter manually as recommended by the hyprland wiki as the system76 utility did not add them by default. So that bit of the modprobe file was manually added by me. All of the combinations of 'hybrid' vs 'nvidia' as well as with and without the fbdev parameter produce the same issue for me. The 'integrated' graphics mode just has other issues and doesn't even work well in Xorg for me so I am not as concerned about trying to get that working in wayland. But if trying to get that working would provide helpful information I can try exploring that path as well. I suspect I just need to play around with different intel driver options and module parameters and just haven't put the time in as I usually prefer hybrid or nvidia modes anyways.

@ikalco
Copy link
Contributor

ikalco commented Feb 2, 2025

try setting your intel gpu as the primary gpu (https://wiki.hyprland.org/Configuring/Multi-GPU/)
something like AQ_DRM_DEVICES="/dev/dri/card2"

if that doesn't work then can you give 2 more trace logs, without the above env var btw
(https://wiki.hyprland.org/Crashes-and-Bugs/#obtaining-a-trace-log)

  • 1st of you booting the laptop with the external display connected
  • 2nd of you connecting the external display after boot

@RileyMathews
Copy link
Author

RileyMathews commented Feb 2, 2025

Hmm so its interesting. When I try just the intel card only the embeded display works as in the embedded display is on and working but no external display detected at all. out of curiosity I tried the nvidia card as well in the env var and then only the external display worked.

Here are the two traces

hyprland-monitor-before-boot.log

hyprland-monitor-after-boot.log

Edit: this was all in the system76 hybrid mode. I’m guessing the intel GPU just wouldn’t function at all in the nvidia mode so didn’t try that.

@ikalco
Copy link
Contributor

ikalco commented Feb 2, 2025

make sure you use both AQ_TRACE=1 and HYPRLAND_TRACE=1 for the logs

@RileyMathews
Copy link
Author

So before I was setting the variables in my hyprland conf file but should I be setting them before hand? Here are the files with me exporting the variables on the tty before starting hyprland. Let me know if you still aren't seeing what you expect.

hyprland-monitor-after-boot.log

hyprland-monitor-before-boot.log

@ikalco
Copy link
Contributor

ikalco commented Feb 2, 2025

So before I was setting the variables in my hyprland conf file but should I be setting them before hand?

It's kinda finicky but to be safe you should set them before, preferably in tty like you did

it looks like the "after" logs use intel gpu as primary and the "before" logs use nvidia as primary, is that intentional?
its also weird cause the intel gpu changes from /dev/dri/card1 to /dev/dri/card2, maybe the hybrid mode is reset when an external monitor is plugged in at boot?

also the "after" logs seem fine cause intel is primary, both screens should be working...
generally pretty weird, but try again for both before and after with AQ_DRM_DEVICES set to the intel gpu

@RileyMathews
Copy link
Author

Hmm that is interesting and wasn't intentional on my part. However, you saying that made me think to search around for other people having issues with external monitors when using the intel gpu only and what I found may help explain a bit. Apparently on most system76 machines the external display ports are hardwired to the nvidia gpu only which may explain why the nvidia driver takes over when it detects an internal monitor on boot? I'm also now realizing that I've not really consciously noticed but the tty always runs on the external display when I boot with the external monitor plugged in. Maybe if I can figure out a way to force the tty to the intel gpu/embedded monitor that would solve the problem even if external displays are present? I'll try poking around a bit more and try your suggestion again with setting the card. I might need to figure out how to make my boot stable without the kernel parameter on the boot config first though...

Another possible explanation that I just realized was something I've almost forgotten. When I first put arch on this system I actually had issues with it booting until after following some random advice I found in the arch forums I put the 'nvidia_drm.modeset=1' kernel parameter directly in my systemd boot config instead of just in modprobe. I'm not entirely sure what this did but it fixed the issue when my system not booting reliably so I left it there. I'm curious now if maybe something with that is making the nvidia driver take over earlier in the boot process somehow? Like maybe if I can find another way to make my boot stable without that parameter the intel driver will take over? At this point I'm getting a little out of my depth of linux knowledge.

Those things at least might give me leads to follow. I'll try your suggestion some more. If any of the above sparked more thoughts feel free to let me know in the meantime. I'll keep poking around and report back if I find any more helpful info.

@RileyMathews
Copy link
Author

Ok so I still don't fully understand what is happening but I did get this working. What I had to do was make my AQ_DRM_DEVICES contain BOTH the intel and nvidia card paths and I always need the intel card first. You are correct in having noticed my hardware's quirk where the intel and nvidia cards swap numbers depending on which system76 mode I am booting in but as long as I do whichever number intel got first things just seem to work. I can even make it switch between nvidia rendering or intel rendering and only nvidia when using 'prime-run' by commenting out/in the nvidia specific environment variables in my config. I may end up trying to find a way to automate setting the DRI_DEVICES env variable in my tty by reading the pci cards and matching up to make sure the intel card always gets put first but that shouldn't be too hard.

So all of that to say I think with the knowledge I gained here I can probably get this working and pretty automated by writing my own glue scripts that run on my tty startup to set the env variable making sure intel is always first in the list. However it might be helpful for less technical users if hyprland could detect this kind of setup and figure this out itself? Or at the very least I think documentation/faq could be updated with a note that with some hybrid setups you may need to include both cards? I think this section of docs would be a good candidate for calling this out? https://wiki.hyprland.org/Configuring/Multi-GPU/#telling-hyprland-which-gpu-to-use. That section calls out that you CAN put multiple cards but the explanation isn't entirely clear that you may want to do it to even get multi monitor to work. When I first read that section it made me think more along the lines of its more of a true fallback for if one card can't be found at all. If you think a doc update is appropriate feel free to either run with it yourself or if you would prefer I can figure out how to make a PR to the docs myself. Just let me know how you think is best to proceed here.

@ikalco
Copy link
Contributor

ikalco commented Feb 5, 2025

that gpu ordering and selection issue is probably related to this drm issue which I remember someone mentioning previously on HL issue tracker

when I get the time I'll implement a solution, probably similar to kwin's solution

@RileyMathews
Copy link
Author

Thanks a ton! The documentation update essentially 'fixes' my specific issue by providing the education on how to correctly configure hyprland. So feel free to either close this issue or keep it open if you still want to use this issue to track making the code a bit smarter around laptop displays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants