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

Support Custom modeline #333

Open
FlyingWombat opened this issue May 8, 2024 · 5 comments
Open

Support Custom modeline #333

FlyingWombat opened this issue May 8, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@FlyingWombat
Copy link

My display needs custom modeline timings set to work properly (my gpu can't reclock its memory). I'm just checking out Niri, but even if I don't end up using Niri long-term, this will be helpful for others.

An example config could be something like this:

output "DP-1" {
    mode "1332.75 3840 3888 3920 4000 2160 2163 2168 2314 +HSync -VSync"
}
@YaLTeR
Copy link
Owner

YaLTeR commented May 8, 2024

Hm, I'm not sure off the bat how to do that, might need Smithay support.

@YaLTeR YaLTeR added the enhancement New feature or request label May 8, 2024
@FlyingWombat
Copy link
Author

Sway/wlroots supports it with output DP-1 modeline <modeline>. That might be useful for reference.

Should I create a related issue in Smithay?

@YaLTeR
Copy link
Owner

YaLTeR commented May 8, 2024

I'll ask in the Smithay room. Maybe it can already do it.

@FlyingWombat
Copy link
Author

FYI, I found out that linux can load custom edid firmware in KMS -- so it isn't strictly necessary to configure custom modelines from the compositor. That said, it will be much more user friendly to be able to set it from the compositor.


Here is some more info for anyone else who comes across this thread.

Having the kernel load custom edid firmware was easy. Just put the .bin in /usr/lib/firmware/edid/ and add drm.edid_firmware=edid/your_edid.bin to kernel cmdline.

The trouble comes in getting a proper edid binary. You can try edid-generator or building one from scratch, but most will be better off editing a copy of the existing firmware. You can grab a connection's edid with e.g. cat /sys/class/drm/card2-DP-5/edid > edid.bin.

In my case, I had to edit it by hand with a hex editor. None of the edid editors I found worked properly. wxEDID doesn't support DisplayID extension blocks -- though it may work for edid bins only containing EDID with CTA extension. CRU on wine supported all the exensions, but rewrote the entire edid assuming my display was a generic analog CRT. There is also edid-generator, but I didn't try that because I wanted to keep the other display properties from the original edid.

If one of the above tools I mentioned works for you, lucky you! Else, you can use a hex editor and follow the byte-maps described on Wikipedia's EDID and DisplayID pages. To help guide the edits, and to validate the changes use edid-decode. When you are done make sure to update the checksum bytes, if edid-decode says they don't match.

@edrex
Copy link

edrex commented Jun 3, 2024

@FlyingWombat I went down the edid rabbit hole several years ago to add a missing half-res mode to my hidpi laptop panel. It worked but I don't recall what method I used to modify the edid file. I admire your determination :D Good job documenting the process; it's rather esoteric. Agreed that modelines in compositor are a desirable feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants