Override edid of built-in display

Fix the problem that the edid of the built-in display only provided 60hz mode when use Hybrid Graphics

It appears to be a Lenovo firmware issue and i try to fix it. This issue still reproducible on BIOS version GKCN58WW(22/12/16)
Lenovo Legion 5 Pro is a laptop which support a technology called "DDG" that can allow you switch between discrete graphics mode and hybrid mode (optiums).
In discrete graphics mode, the firmware provides the correct edid and anything works fine, the built-in display work well at 165hz.
But if switch to hybrid mode, the firmware provides a different edid, causing the built-in display only can work at 60hz.
So I extracted the edid file of discrete graphics mode and override the edid that built-in display provide to solve this problem.

Co-Authored-By: Jörg Thalheim <Mic92@users.noreply.github.com>
This commit is contained in:
ChaosAttractor 2022-12-16 07:59:45 +08:00
parent 1f60672721
commit 262146dc76
3 changed files with 18 additions and 0 deletions

View file

@ -7,8 +7,11 @@
../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/prime.nix
../../../common/pc/laptop ../../../common/pc/laptop
../../../common/pc/laptop/ssd ../../../common/pc/laptop/ssd
./edid
]; ];
hardware.amdgpu.loadInInitrd = lib.mkDefault false;
hardware.nvidia.prime = { hardware.nvidia.prime = {
amdgpuBusId = "PCI:6:0:0"; amdgpuBusId = "PCI:6:0:0";
nvidiaBusId = "PCI:1:0:0"; nvidiaBusId = "PCI:1:0:0";

Binary file not shown.

View file

@ -0,0 +1,15 @@
{ config, pkgs, lib, ...}:
let
# This file was obtained from the display while "DDG" mode was enabled.
chip_edid = pkgs.runCommandNoCC "chip_edid" { } ''
mkdir -p $out/lib/firmware/edid
cp ${./16ach6h.bin} $out/lib/firmware/edid/16ach6h.bin
'';
in
{
hardware.firmware = [ chip_edid ];
boot.kernelParams = [ "drm.edid_firmware=edid/16ach6h.bin" ];
boot.initrd.extraFiles."lib/firmware/edid/16ach6h.bin".source = pkgs.runCommandLocal "chip_edid" { } "cp ${./16ach6h.bin} $out";
}