sonnyp / linux-minibook-x

Linux for the Chuwi MiniBook X 2023 / N100
29 stars 1 forks source link

90 Hz EDID File Test #7

Open maxexcloo opened 1 month ago

maxexcloo commented 1 month ago

I've been attempting to try 90 Hz on my MiniBook X in Silverblue, the problem is I currently don't have a working EDID file - if anyone has windows on their laptop they could do the 90 Hz fix and export the EDID as a .bin, more information here:

https://forum.chuwi.com/t/minibook-x-2023-50hz-choppy-ghosting/41613/7?u=maxexcloo

For Fedora Silverblue, this is how far I've gotten so far:

https://foosel.net/til/how-to-override-the-edid-data-of-a-monitor-under-linux/

sudo mkdir -p /etc/firmware/edid
sudo cp modified-edid.bin /etc/firmware/edid/edid.bin
sudo rpm-ostree initramfs-etc --track /etc/firmware/edid/edid.bin
sudo rpm-ostree kargs --append-if-missing=drm.edid_firmware=DSI-1:/etc/firmware/edid/edid.bin
thomholwerda commented 1 month ago

I've tried to load the 90Hz edid listed in the Chuwi forum thread using the link provided - adding the kernel argument drm.edid_firmware=DSI-1:edid/edid.bin, and while that kernel argument is listed as applied, and the edid file should technically be loaded, I'm still only getting 50Hz.

This is on Fedora 40 KDE using Wayland.

sleeply4cat commented 1 month ago

There is some issue with changing modes from the Intel video driver, the display times out when driver sends command. Haven't checked details btw

maxexcloo commented 1 month ago

This has been driving me mad for a few days, do you have any links for info on this?

sleeply4cat commented 1 month ago

The story is short, if you try to change the configuration by standard xrandr commands, you receive 'DSI link not ready' error in dmesg. Here is the source of that message: https://github.com/torvalds/linux/blob/7ee332c9f12bc5b380e36919cd7d056592a7073f/drivers/gpu/drm/i915/display/icl_dsi.c#L833

maxexcloo commented 1 month ago

Is this affecting wayland sessions also?

sleeply4cat commented 1 month ago

Can't say for sure, but 'video' kernel parameter which suggested for changing refresh rate for wayland is being ignored too. Maybe the whole video system works in some fallback mode, idk Still work on tablet switch support, have no opportunity to take a new project

sleeply4cat commented 3 weeks ago

Workaround for changing display refresh rate:

  1. unzip the patched video bios into /lib/firmware/ vbt.zip
  2. add i915.vbt_firmware=vbt into kernel parameters
  3. update-grub2 It will make display work with about 95 Hz

How to customize it by youself if you want another refresh rate or if my video bios doesn't work with your laptop:

  1. make it show additional logs: add drm.debug=0x14 into kernel parameters
  2. reboot and look into dmesg for similar line: [ 4.015160] i915 0000:00:02.0: [drm:parse_generic_dtd [i915]] Found panel mode in BIOS VBT generic dtd table: "1200x1920": 50 136887 1200 1240 1252 1268 1920 2125 2127 2159 0x8 0x5 From where it's printed: click How to parse this line: click How refresh rate is being calculated: click (I couldn't use it properly)
  3. dump your video bios from like /sys/kernel/debug/dri/1/i915_vbt. There are tools to decompile it (like intel_vbt_decode), but you are not allowed to, according to the file header.
  4. take the clock value (136887) from the step 2, write it in hex (2 16 B7) and reverse bytes order (B7 16 02)
  5. open the vbios dump with hex editor (apt install hexedit, for example) and search (/) for that bytes. They are located near to 1F 60 address in my dump
  6. change the clock (I just typed 00 00 04 'cause I failed to calculate the proper value) and save (F2).

Probably, it's not correct to edit only the clock timing and left others unchanged, but I couldn't match vbios values with the cvt ones. If someone could calculate or bruteforce values for exact 90 Hz, it would be fine. It's clearly possible to add another modes into empty segments, but I afraid switching between predefined modes would be affected by the same bug as defining new ones.

thomholwerda commented 3 weeks ago

I tried your steps on Fedora 40 KDE (Wayland) and no luck here. I put your firmware file vbt inside /lib/firmware, added the kernel parameter, and rebooted - but no luck. Still says 50Hz. I did also run:

sudo restorecon -R /usr/lib/firmware
sudo dracut -f

As that seems needed on Fedora, but that didn't help either. Does the vbt file need to be in a subdirectory perhaps?

sleeply4cat commented 3 weeks ago

no idea about Fedora, I use last Ubuntu with 6.9.1 kernel and Wayland. Here the path is relative to /lib/firmware, maybe in your system things are different. "vbt" is just a name for temporary file I created, abbreviation for "video bios table". Probably it's more accurate to put it into /lib/firmware/i915, I didn't try.

What variant did you try, patched file or full workflow? If first, maybe you have incompatible bios version with my one. However, I think driver just didn't receive new table due to some naming differences..

Check dmesg about video modes. Check documentation for your distro. Check i915 module parameters in debugfs maybe, don't know if helpful. Try Ubuntu maybe lol

My beginning point was here, at the section 6.18.