Jump to content

Intel Framebuffer patching using WhateverGreen


headkaze
486 posts in this topic

Recommended Posts

21 hours ago, najeeb_anwer said:
  1. Alternatively, is there a way to set the internal display to a lower (scaled) resolution using Whatevergreen properties, so that a smaller framebuffer memory would work?

The Dell XPS 13 9300 has a new BIOS from Sep 4. Did you update the BIOS?

 

A scaled resolution would still use the larger resolution timing of the laptop display. You would need to create an actual timing. Create an override EDID with the smaller timing and place it in a Display override file (like what SwitchResX does). Your laptop display might not like it, but it might at least boot. Then you can use screen sharing to make further modifications.

 

Attached is a BBEdit worksheet that shows how to extract the BIOS from the Dell updater and find the Setup variables for DVMT. I don't know if that helps if you can't even log into the EFI Shell to change the values. I suppose you could boot into Linux to change the values (if the Setup variable is not write protected at that point)?

 

XPS_13_9300.worksheet

Link to comment
Share on other sites

2 hours ago, joevt said:

The Dell XPS 13 9300 has a new BIOS from Sep 4. Did you update the BIOS?

 

A scaled resolution would still use the larger resolution timing of the laptop display. You would need to create an actual timing. Create an override EDID with the smaller timing and place it in a Display override file (like what SwitchResX does). Your laptop display might not like it, but it might at least boot. Then you can use screen sharing to make further modifications.

 

Attached is a BBEdit worksheet that shows how to extract the BIOS from the Dell updater and find the Setup variables for DVMT. I don't know if that helps if you can't even log into the EFI Shell to change the values. I suppose you could boot into Linux to change the values (if the Setup variable is not write protected at that point)?

 

XPS_13_9300.worksheet

 

1. Yes, I did update to the latest BIOS from Dell (1.2.0)

 

2. Can I use the EDID injection in Whatevergreen (AAPL00,override-no-connect) to do this? If so, how would I determine the values to inject? I want to set the resolution to 1920x1200 for the internal display only.

 

3. Thanks for the worksheet, but I had already figured out the setup vars that need to be modified; the problem is that I can't find a way to actually modify the values since none of the programs (*.efi) that have setup_var in them will load - this laptop does not have a legacy boot option ROM which is what I think is required. How would I try to do this in Linux? I have Ubuntu 20.04 installed.

Link to comment
Share on other sites

On 9/28/2020 at 1:39 PM, najeeb_anwer said:

 

1. Yes, I did update to the latest BIOS from Dell (1.2.0)

 

2. Can I use the EDID injection in Whatevergreen (AAPL00,override-no-connect) to do this? If so, how would I determine the values to inject? I want to set the resolution to 1920x1200 for the internal display only.

 

3. Thanks for the worksheet, but I had already figured out the setup vars that need to be modified; the problem is that I can't find a way to actually modify the values since none of the programs (*.efi) that have setup_var in them will load - this laptop does not have a legacy boot option ROM which is what I think is required. How would I try to do this in Linux? I have Ubuntu 20.04 installed.

I've never tried EDID injection with Whatevergreen.

You need an EDID editor to create the EDID.

CRU for Windows.

AWEDIDEditor.app for macOS or Windows.

edidutil.sh is a bash script I made.

edid-decode is the best command line viewer for EDID since it can decode almost everything.

 

Start with the existing EDID from the laptop display. Remove timings that you don't want (such as the high resolution ones). If it includes low res timings then you can keep those and you're done. Otherwise you need to make a low res timing. Are there many laptop displays that support different timings? If yours doesn't support different timings then this won't work. The editor may include a timing calculator. If not, you can use an external one. Does edid-decode have a timing calculator? Maybe there's one in the code that isn't accessible from command line? You can use SwitchResX to create a timing. I can do it on my Mac.

 

506614340_1920x1200CVT-RB.png.429436067d6e6787fc77862c88ef8823.png

 

For changing the setup vars in an OS, I believe the OS needs to be using UEFI mode. In Linux, I believe you can access the vars using sysfs

https://unix.stackexchange.com/questions/414799/efi-variable-entries-in-sys-firmware-efi-efivars

 

First, you want to verify that the variables are readable and are as expected. In UEFIShell, the dmpstore command can be used to view the contents:

dmpstore -b -all Setup

The output looks like this:

Variable NV+RT+BS 'EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:Setup'

 

In linux or macOS, you can use this script:

[[ -f ~/Downloads/gfxutil.sh ]] && source ~/Downloads/gfxutil.sh

getvar () {
	thevar=""
	theflags=""
	thevarname=$1
	thevarguid=${thevarname%:*}
	thevarname=${thevarname#*:}

	if [[ -d /sys/firmware/efi/efivars ]]; then
		thevar=$(xxd -p -c 99999999 "/sys/firmware/efi/efivars/${thevarname}-${thevarguid}")
		theflags=${thevar:0:8}
		thevar=${thevar:8}
	else
		thevar=$(nvramp ${thevarguid}:${thevarname} | xxd -p -c 99999999)
	fi
}

putvar () {
	if [[ -d /sys/firmware/efi/efivars ]]; then
		sudo xxd -p -r > "/tmp/${thevarname}-${thevarguid}" <<< "${theflags}${thevar}"
	else
		sudo nvram "${thevarguid}:${thevarname}=$(sed -E 's/(..)/%\1/g' <<< ${thevar})"
	fi
}

dumpbyte () {
	local theoffset=$1
	echo 0x${thevar:$((theoffset * 2)):2}
}

setbyte () {
	local theoffset=$1
	local thebyte=$(printf "%02x" $(($2)))
	thevar=${thevar:0:$((theoffset * 2))}${thebyte}${thevar:$((theoffset * 2 + 2))}
}

#=========

getvar EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:Setup

echo -n "${theflags}${thevar}" | xxd -p -r > ~/SetupVar_before.bin
echo 'flags:"'$theflags'"'

echo before 0xA4:$(dumpbyte 0xA4) # expect 0xfe = 60M
echo before 0xA5:$(dumpbyte 0xA5) # expect 0x02 = 256M
setbyte 0xA4 0x4 # 128M
echo after 0xA4:$(dumpbyte 0xA4)
echo -n "${theflags}${thevar}" | xxd -p -r > ~/SetupVar_after.bin

echo diffs:
eval $(cmp -l ~/SetupVar_before.bin ~/SetupVar_after.bin | perl -nE '/(\d+) *(\d+) *(\d+)/ && print "echo \$(printf 0x%08x \$((10#" . $1 . " - 1))) \$(printf 0x%02x \$((8#" . $2 . "))) \$(printf 0x%02x \$((8#" . $3 . ")))\n"')

#=========

#putvar

In Linux, the first four bytes are flags and should be 07 which means:

EFI_VARIABLE_NON_VOLATILE, EFI_VARIABLE_BOOTSERVICE_ACCESS, and EFI_VARIABLE_RUNTIME_ACCESS (or NV+RT+BS)

 

If the script appears to do the modification properly (you are satisfied with before and after differences), then uncomment the putvar command and execute it. Do not restart until you verify that getvar returns what you wrote to the Setup variable.

 

Edited by joevt
corrected putvar for linux
  • Like 1
Link to comment
Share on other sites

4 hours ago, joevt said:

For changing the setup vars in an OS, I believe the OS needs to be using UEFI mode. In Linux, I believe you can access the vars using sysfs

https://unix.stackexchange.com/questions/414799/efi-variable-entries-in-sys-firmware-efi-efivars

 

First, you want to verify that the variables are readable and are as expected. In UEFIShell, the dmpstore command can be used to view the contents:


dmpstore -b -all Setup

The output looks like this:


Variable NV+RT+BS 'EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:Setup'

 

 

Thanks for the information you have provided. Rather than attempt the EDID mods, I wanted to first see if I could change the setup vars as you suggested.

 

I ran the dmpstore command in the OpenShell.efi provided with the OpenCore distribution and it did print the output you specified, along with several lines of hex dump.

 

I then booted macOS and downloaded gfxutil.sh to ~/Downloads and then ran the script you have provided. This is the output I get:

 

flags:""

before 0xA4:0x00

before 0xA5:0x00

after 0xA4:0x04

diffs:

0x000000a4 0x00 0x04

This is not what I expected; 0xA4 should be 0xfe and 0xA5 should be 0x02, correct? What am I doing wrong?

Link to comment
Share on other sites

@joevt If I run your script on Ubuntu, I get the following:

 

flags:"07000000"
before 0xA4:0x00
before 0xA5:0x00
after 0xA4:0x04
diffs:
0x000000a8 0x00 0x04

The output of one of the commands in your script looks like this:

 

najeeb_anwer@Dell-XPS-13-9300:~/Downloads$ xxd -p -c 99999999 "/sys/firmware/efi/efivars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9"
07000000130100010100000000010201200001010601020101000000000000000000000001010100010101010101010101010101000101000000000000009411000000000000000000000000000001000000000000000000000001000002501000000002000349002900000000000103160b0b0b0303030300000c00010101010000000000012010000000010303490029000000000000000f17170b02010203000b0d0001010101000000000002301000000000020349002900000000000000160b0b0b030303030000000001010101000000000002301000000000020349002900000000000000160b0b0b03030303000000000101010100000000000d00000000000000000000000000000000000061440038005600310030004c000000000000000000000000000000000000000000010210000e005000510052005300540055005600570058005900000102030405060708090a0000200401000000000000f8240101020000000001000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000000060310000c005000510052005300540055005600570058005900000102030405060708090a0c00300208030000000000f82401ff00000000000e000000000000000000000000000000000000694100310036005600300034004500000000000000000000000000000000000000030310007200510051005200530054005500560057005800590000010203040506070000000000500409090000000000f824010003000000000c000000000000000000000000000000000000613600420046003100310035005400320000000000000000000000000000000000010236000c005000510052005300540055005600570058005900000102030405060708090a0c00500100000000000000f8240100030000010002010600000005002c20000007000a010001000000000000000000000000000100000001000100006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b0016000800c20264021e006e00cf001e002b004c001e000b0016000800c800d007c800d007c800d007c800d007c800d007c800d007c800d007c800d007c800d007c800c800c800c800c800c80001000037474b645f7701050a01000107080001010100000048410101015a6e6e6e006ef401000001103201027d007d007d00000100641e003f47645a5f00003f47645a5f00000000000001003f47645a5f003f47645a5f003232463c41003232463c4100013f4767616400013c4150464b00013c4150464b00013c4150464b00013c4150464b00000000000001010000000000000100000000000001640000c80044004400440010000000000100000000000000000000000009a00f00003075000009090000b00430750000b004b004e8030107ffff307500003232323207504100000001687070707868707474800000000000000000000000000000000000000000000000000000000000000000ff0000ff0000ff0000ff0000ff0000ff000000000000000000000001000000000000010001000000c80001000001010100000101000000010138386101610100001a1a200220021c1c0100000000000001000100010001002a2a2a2ac200c200c200c20019191919c001c001c001c0011c1c1c1cf401881343b61769bce87e2600000000000100000000000001000000000000000100f3330200080001f4010000dc050000dc05000000000101010101000002000000010001000000010000000100010000008500000000000000000000000001000000000100010100020000000000010064000000000000000000000101000100000101020000000100000000000000000000000000000e0e01010101340034001d001c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

 

Link to comment
Share on other sites

The equivalent command on macOS outputs this:

najeeb_anwer@Najeebs-MacBook-Air Downloads % nvramp EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:Setup | xxd -p -c 99999999

130100010100000000010201200001010601020101000000000000000000000001010100010101010101010101010101000101000000000000009411000000000000000000000000000001000000000000000000000001000002501000000002000349002900000000000103160b0b0b0303030300000c00010101010000000000012010000000010303490029000000000000000f17170b02010203000b0d0001010101000000000002301000000000020349002900000000000000160b0b0b030303030000000001010101000000000002301000000000020349002900000000000000160b0b0b03030303000000000101010100000000000d00000000000000000000000000000000000061440038005600310030004c000000000000000000000000000000000000000000010210000e005000510052005300540055005600570058005900000102030405060708090a0000200401000000000000f8240101020000000001000000000000000000000000000000000000610000000000000000000000000000000000000000000000000000000000000000060310000c005000510052005300540055005600570058005900000102030405060708090a0c00300208030000000000f82401ff00000000000e000000000000000000000000000000000000694100310036005600300034004500000000000000000000000000000000000000030310007200510051005200530054005500560057005800590000010203040506070000000000500409090000000000f824010003000000000c000000000000000000000000000000000000613600420046003100310035005400320000000000000000000000000000000000010236000c005000510052005300540055005600570058005900000102030405060708090a0c00500100000000000000f8240100030000010002010600000005002c20000007000a010001000000000000000000000000000100000001000100006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b00160008006402c2021e006e00cf001e002b004c001e000b0016000800c20264021e006e00cf001e002b004c001e000b0016000800c800d007c800d007c800d007c800d007c800d007c800d007c800d007c800d007c800d007c800c800c800c800c800c80001000037474b645f7701050a01000107080001010100000048410101015a6e6e6e006ef401000001103201027d007d007d00000100641e003f47645a5f00003f47645a5f00000000000001003f47645a5f003f47645a5f003232463c41003232463c4100013f4767616400013c4150464b00013c4150464b00013c4150464b00013c4150464b00000000000001010000000000000100000000000001640000c80044004400440010000000000100000000000000000000000009a00f00003075000009090000b00430750000b004b004e8030107ffff307500003232323207504100000001687070707868707474800000000000000000000000000000000000000000000000000000000000000000ff0000ff0000ff0000ff0000ff0000ff000000000000000000000001000000000000010001000000c80001000001010100000101000000010138386101610100001a1a200220021c1c0100000000000001000100010001002a2a2a2ac200c200c200c20019191919c001c001c001c0011c1c1c1cf401881343b61769bce87e2600000000000100000000000001000000000000000100f3330200080001f4010000dc050000dc05000000000101010101000002000000010001000000010000000100010000008500000000000000000000000001000000000100010100020000000000010064000000000000000000000101000100000101020000000100000000000000000000000000000e0e01010101340034001d001c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

 

Link to comment
Share on other sites

 

11 hours ago, najeeb_anwer said:

 

Thanks for the information you have provided. Rather than attempt the EDID mods, I wanted to first see if I could change the setup vars as you suggested.

 

I ran the dmpstore command in the OpenShell.efi provided with the OpenCore distribution and it did print the output you specified, along with several lines of hex dump.

 

I then booted macOS and downloaded gfxutil.sh to ~/Downloads and then ran the script you have provided. This is the output I get:

 


flags:""

before 0xA4:0x00

before 0xA5:0x00

after 0xA4:0x04

diffs:

0x000000a4 0x00 0x04

This is not what I expected; 0xA4 should be 0xfe and 0xA5 should be 0x02, correct? What am I doing wrong?

 

Nope, you did everything right.  The values are not as expected, so you did not save changes.

 

The problem is that your system has multiple varstores.

 

VarStoreEFI: VarStoreId: 0x1 [EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9], Attrubutes: 7, Size: 797, Name: Setup
VarStoreEFI: VarStoreId: 0x2 [72C5E28C-7783-43A1-8767-FAD73FCCAFA4], Attrubutes: 7, Size: 421, Name: SaSetup
VarStoreEFI: VarStoreId: 0x3 [B08F97FF-E6E8-4193-A997-5E9E9B0ADB32], Attrubutes: 7, Size: 2A6, Name: CpuSetup
VarStoreEFI: VarStoreId: 0x4 [5432122D-D034-49D2-A6DE-65A829EB4C74], Attrubutes: 7, Size: 8F, Name: MeSetup
VarStoreEFI: VarStoreId: 0x5 [4570B7F1-ADE8-4943-8DC3-406472842384], Attrubutes: 7, Size: 823, Name: PchSetup
VarStoreEFI: VarStoreId: 0x6 [AAF8E719-48F8-4099-A6F7-645FBD694C3D], Attrubutes: 7, Size: 2, Name: SiSetup
VarStoreEFI: VarStoreId: 0x7 [EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9], Attrubutes: 7, Size: 1, Name: PciBusSetup
VarStore:    VarStoreId: 0x8 [E59376D7-2DD9-42A3-9EC8-1D71D5E3C1EC], Size: 0x2, Name: OsProfile
VarStoreEFI: VarStoreId: 0x9 [B08F97FF-E6E8-4193-A997-5E9E9B0ADB32], Attrubutes: 3, Size: 10, Name: CpuSetupSgxEpochData
VarStoreEFI: VarStoreId: 0xA [EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9], Attrubutes: 7, Size: 7, Name: TcgSetup
VarStore:    VarStoreId: 0xB [64192DCA-D034-49D2-A6DE-65A829EB4C74], Size: 0x8, Name: IccAdvancedSetupDataVar
VarStore: VarStoreId: 0x100B [EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9], Size: 0x98, Name: SetupVolatileData
VarStore: VarStoreId: 0x100C [EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9], Size: 0x2C, Name: SetupCpuFeatures
VarStore: VarStoreId: 0x10E2 [EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9], Size: 0x1, Name: BootTime
VarStore: VarStoreId: 0x1108 [5432122D-D034-49D2-A6DE-65A829EB4C74], Size: 0xD, Name: MeSetupStorage
VarStore: VarStoreId: 0x110B [8BE4DF61-93CA-11D2-AA0D-00E098032B8C], Size: 0x1, Name: SecureBoot
VarStore: VarStoreId: 0x110F [90D93E09-4E91-4B3D-8C77-C82FF10E3C81], Size: 0x5, Name: CpuSmm
VarStore: VarStoreId: 0x1124 [6339D487-26BA-424B-9A5D-687E25D740BC], Size: 0x1, Name: TCG2_CONFIGURATION
VarStore: VarStoreId: 0x13BD [B08F97FF-E6E8-4193-A997-5E9E9B0ADB32], Size: 0x8, Name: CpuSetupVolatileData
VarStore: VarStoreId: 0x13DC [EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9], Size: 0x2, Name: TbtSetupVolatileData
VarStore: VarStoreId: 0xF000 [E770BB69-BCB4-4D04-9E97-23FF9456FEAC], Size: 0x1, Name: SystemAccess

 

The VarStore you want for DVMT stuff has id 0x2

One Of: DVMT Pre-Allocated, VarStoreInfo (VarOffset/VarName): 0xA4, VarStore: 0x2, QuestionId: 0x240, Size: 1, Min: 0x0, Max 0xFE, Step: 0x0

Which has name "72C5E28C-7783-43A1-8767-FAD73FCCAFA4:SaSetup". I guess Attributes: 7 also means "NV+RT+BS" so it should have write access in an OS.

VarStoreEFI: VarStoreId: 0x2 [72C5E28C-7783-43A1-8767-FAD73FCCAFA4], Attrubutes: 7, Size: 421, Name: SaSetup

So, in the commands I gave, replace EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:Setup with 72C5E28C-7783-43A1-8767-FAD73FCCAFA4:SaSetup

 

You can dump all the EFI variables by using the following commands in EFI Shell (try different fs numbers until you find a file system that belongs to an EFI Partition or a FAT partition which you will have write access to, use vol to check the volume name, or ls to check the contents):

fs0:
dmpstore > dmpstore.txt

Hopefully 72C5E28C-7783-43A1-8767-FAD73FCCAFA4:SaSetup will be among them and have the expected values at offset 0xA4.

 

11 hours ago, najeeb_anwer said:

Just FYI, I got the gfxutil.sh script from https://forums.macrumors.com/threads/documentation-on-all-parameters-for-nvram.2239034/ and gfxutil from https://github.com/acidanthera/gfxutil/releases and they are both in ~/Downloads.

 

I modified the scripts to reference the correct location for both gfxutil.sh and gfxutil.

Yup, you did that right. The script is also at https://gist.github.com/joevt/477fe842d16095c2bfd839e2ab4794ff with instructions.

Looks like it's working correctly for you.

 

 

Link to comment
Share on other sites

@joevt Thanks again for the great information.

I updated the script you provided with the new variable GUID and name. This is the output (on macOS):

najeeb_anwer@Najeebs-MacBook-Air Downloads % ./set-dvmt.sh
flags:""
before 0xA4:0x02
before 0xA5:0x02
after 0xA4:0x04
diffs:
0x000000a4 0x02 0x04

Again, not what I expected; it appears that DVMT pre-alloc is 64MB which is different than the default specified in the BIOS dump. Although, it is consistent with what is reported by Whatevergreen in ioreg:

885790582_ScreenShot-IOREGIGPU.png.abef2288b31e89c256ecc11d523e2e08.png

 

The full output for this variable is:

najeeb_anwer@Najeebs-MacBook-Air Downloads % nvramp 72C5E28C-7783-43A1-8767-FAD73FCCAFA4:SaSetup | xxd -p -c 99999999
0600000000000000010202000000000000000000000000000000000000000000000000000000000000000000000000528a0000000001020003000301000001010101ff0000ff000000000000000404040403030303020202020101010100000000000000000202020201010101ffffffff0101010101010101000000000000000000004b4b4b4b0100020003000300000000000a000a000a000a0004040404001a000b000202010101000000020000020201000000010200010404040404040404070707070707070702020202020202020000000003000101032c016400021f00010001000100000000000001010100010100000000010101010101010102020202c800c800c800c8000101010102020202c800c800c800c80000000000000000000001040000000001000001cc300201010001010300000000000004000000000000000001640001010100010101010101010101010101010101010101010101000000000100000000000001000001000100000100000001010001010004000000010a00de000000000000ffffffffffffffffffffffffffffffff0a0a0606acacd4d4dddd0a0a0606acacd4d4dddd01000200300140000000000001000000010000000b00010000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010707070707070707070707070707070707070707070707070707070707070707070707070707070702020202020202020202020202020202020202020707070707070707070707070707070707070707070707070707070707070707070707070707070702020202020202020202020202020202020202020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

What do you think? Should I go ahead and write to the var?

Edited by najeeb_anwer
Link to comment
Share on other sites

@joevt I un-commented the last line of the script that runs the putvar function and this is the result:

najeeb_anwer@Dell-XPS-13-9300:~/Downloads$ ./set-dvmt.sh 
flags:"07000000"
before 0xA4:0x02
before 0xA5:0x02
after 0xA4:0x04
diffs:
0x000000a8 0x02 0x04
./set-dvmt.sh: line 21: /sys/firmware/efi/efivars/SaSetup-72c5e28c-7783-43a1-8767-fad73fccafa4: Operation not permitted

This is on Ubuntu. Is there a way to get around the "Operation not permitted" error?
 

Link to comment
Share on other sites

11 hours ago, najeeb_anwer said:

What do you think? Should I go ahead and write to the var?

Maybe check some other values belonging to SaSetup to see that they make sense.

echo $thevar | xxd -p -r | xxd

 

5 hours ago, najeeb_anwer said:

@joevtThis is on Ubuntu. Is there a way to get around the "Operation not permitted" error?

This usually means sudo is missing. Try this version (I haven't verified it so please check results before rebooting):

putvar () {
	if [[ -d /sys/firmware/efi/efivars ]]; then
		sudo xxd -p -r > "/tmp/${thevarname}-${thevarguid}" <<< "${theflags}${thevar}"
	else
		sudo nvram "${thevarguid}:${thevarname}=$(sed -E 's/(..)/%\1/g' <<< ${thevar})"
	fi
}

 

5 hours ago, najeeb_anwer said:

@joevt No problem, I tried it on macOS and it worked! Thanks.

Now that the DVMT prealloc is set to 128MB, let's see if I can get the internal display to work :)

How did you get the screenshot from IORegistryExplorer.app without the internal display working? Screen sharing?

Does IORegistryExplorer.app show a new value for fw-dvmt-preallocated-memory now?

Link to comment
Share on other sites

8 hours ago, joevt said:

How did you get the screenshot from IORegistryExplorer.app without the internal display working? Screen sharing?

Does IORegistryExplorer.app show a new value for fw-dvmt-preallocated-memory now?

 

@joevt The attached USB-C (DP) monitor works, it's just the internal display that is not working.

1719302677_ScreenShot2-Graphics-Displays.png.1b771b2b1596bb0db3d8733dc768bda6.png

The IORegistryExplorer does show the new value for DVMT prealloc:

1581668848_ScreenShot-IOREGIGPUDVMTUpdate.thumb.png.18e6fb9d02725b8325542a0b4fc809a8.png

Link to comment
Share on other sites

The internal display now works!

1423577573_ScreenShot2020-09-30at1_01_26PM.png.1228c5b9a30481231add9d7087b84764.png

I used Hackintool to generate a new Display injector kext (attached) and added that to OC/Kexts and my config.plist.

Display-4d10-14cc.kext

I changed the framebuffer-stolenmem to 64MB and enabled verbose (-v) in the boot-args.

1837546611_ScreenShot2020-09-30at1_07_07PM.thumb.png.7e8f2f6c5019d19ccaac555987a13d7c.png

 

Thanks @joevt for all your help.

Edited by najeeb_anwer
Link to comment
Share on other sites

4 hours ago, najeeb_anwer said:

 

@joevt The attached USB-C (DP) monitor works, it's just the internal display that is not working.

 

The IORegistryExplorer does show the new value for DVMT prealloc:

 

 

So 64 MB was enough for one display but not two? Does Windows have the same problem?

 

To be clear, many of the properties shown in IORegistryExplorer.app are created by Lilu + Whatevergreen. I guess if they don't exist on a real Mac then it means they are usually for debug purposes (to tell you what the DVMT prealloc is, etc.)

 

3 hours ago, najeeb_anwer said:

The internal display now works!

 

I used Hackintool to generate a new Display injector kext (attached) and added that to OC/Kexts and my config.plist.

Display-4d10-14cc.kext

I changed the framebuffer-stolenmem to 64MB and enabled verbose (-v) in the boot-args.

 

Thanks @joevt for all your help.

I'm glad you got it working.

 

The display injector doesn't seem to download as a valid kext and I can't identify the archive format.

 

The DeviceProperties in the config.plist that are created by the user and added by OpenCore exist to tell Lilu + WhateverGreen what to do (and also the Apple Intel graphics drivers). Another method to add device properties without a boot loader like OpenCore or Clover is to save the properties in NVRAM (in the 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:AAPL,PathProperties#### variables). There are methods in my gfxutil.sh script to do that (for instance, on a real Mac I could set some properties for some devices but I haven't had to do that yet).

 

Link to comment
Share on other sites

29 minutes ago, joevt said:

So 64 MB was enough for one display but not two? Does Windows have the same problem?

The internal display has always worked in both Windows and Ubuntu. This was a macOS only problem.

 

To be honest, I don't know if the internal display working on macOS was a result of the increased DVMT pre-alloc or because I injected EDID and alternate resolutions using the injector kext. I'm just glad it's working.

 

30 minutes ago, joevt said:

The display injector doesn't seem to download as a valid kext and I can't identify the archive format.

I have attached it as a ZIP archive.

 

Display-4d10-14cc.kext.zip

Link to comment
Share on other sites

@joevt So, unfortunately, things are not as rosy as I thought.

The internal display works great while I am also connected to the external USB-C monitor.

If I boot macOS with just the internal display (no external display connected) then the internal display is scrambled and unusable.

It appears that I have made some mistake in the display injector kext so that the timing for the internal display is messed up? But why would it work properly if the external display is connected?

Your insights would be greatly appreciated.

Link to comment
Share on other sites

3 hours ago, najeeb_anwer said:

@joevt So, unfortunately, things are not as rosy as I thought.

The internal display works great while I am also connected to the external USB-C monitor.

If I boot macOS with just the internal display (no external display connected) then the internal display is scrambled and unusable.

It appears that I have made some mistake in the display injector kext so that the timing for the internal display is messed up? But why would it work properly if the external display is connected?

Your insights would be greatly appreciated.

I don't know. Maybe remove the IODisplayEDID and the scale resolutions? You can do scale resolutions with SwitchResX afterward.

Link to comment
Share on other sites

I found this post: 

I did what the author suggested; I removed the display injector kext and instead placed the attached file in /System/Library/Displays/Contents/Resources/Overrides/DisplayVendorID-4d10.

DisplayProductID-14cc

That works. The EDID is injected properly as well as the Display Name that I specified.

1173309444_ScreenShot2020-10-02at11_34_57AM.png.da061da134eda22a3d8174f9948b7d05.png

1826278420_ScreenShot2020-10-02at11_44_23AM.thumb.png.32a60ad8c20477914f61abcab002b92f.png

This is how it shows up in IORegistryExplorer:

55124652_ScreenShot2020-10-02at11_27_00AM.thumb.png.f6dd70d66f1c0ffdc6fa773232bd6ef7.png

 

Unfortunately, it still only works if the external display is connected. If I boot with just the internal display, the screen is scrambled.

 

Link to comment
Share on other sites

On 9/30/2020 at 11:19 PM, najeeb_anwer said:

@joevt So, unfortunately, things are not as rosy as I thought.

The internal display works great while I am also connected to the external USB-C monitor.

If I boot macOS with just the internal display (no external display connected) then the internal display is scrambled and unusable.

It appears that I have made some mistake in the display injector kext so that the timing for the internal display is messed up? But why would it work properly if the external display is connected?

Your insights would be greatly appreciated.

 

It is an known issue on quite a few laptops on Ice Lake platforms, regardless of the resolution of your built-in display.

Link to comment
Share on other sites

  • 2 weeks later...
On 7/25/2020 at 12:22 AM, MisterKeeks said:

I really wonder what controls AppleDisplay vs AppleBacklightDisplay... On my laptops this seems to be picked up automatically.

 

Anybody has a good answer to this?

Using CLOVER on Optiplex 3030 AiO I get AppleDisplay, and no backlight after wake up

i3-4160 / HD 4400

 

My System Properties shows correct connection as Thunderbolt/Displayport and display name is recognized as "Optiplex 3030" with correct resolution etc

 

I tried Hackintool "Display Injector" codeless kext (force load in Clover from Library\Extensions)

Shows as not loaded & still just AppleDisplay in IORegistry

Edited by sebus
Link to comment
Share on other sites

  • 1 month later...

Lesson Learned: Start UHD/HD framebuffer patching with SMBIOS MacMini8,1

 

Been a while since I visited this thread and wanted to post something I discovered while patching the framebuffer on an HP EliteDesk 800 G3 Mini (i7-7700T HD630 Kabylake): I discovered that initially setting SMBIOS MacModel to MacMini8,1 with WEG boot-arg igfxagdc=0 is a very "forgiving" SMBIOS for framebuffer patching.  Using MM8,1 (even though it's not the correct SMBIOS for Kabylake CPU power management) made framebuffer patching much easier.  I found with MM8,1 that I could reliably remote desktop into my hack after booting to black screen, so that it was easy to make framebuffer config changes to continue my framebuffer experimentation.  After finding working WEG framebuffer patching with MM8,1, I then switched to iMac18,2 (the best CPU power management match for my i7-7700T) and my framebuffer patching continued to work fine.

 

For whatever reason, my first attempts to find correct framebuffer patches with SMBIOS iMac18,2 prevented me from remoting into my rig when incorrect framebuffer patches resulted in booting to black screen.

 

I hope this helps others.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

With the newest version of WEG i got a black screen after boot for several minutes. adding -igfxblr seems to fix the issue.

 

Another thing is I have to disable dedicated GPU to make sleep work else laptop wakes up with black screen and then reboot with this KP:

panic(cpu 2 caller 0xffffff801d56ea25): userspace watchdog timeout: no successful checkins from com.apple.WindowServer in 120 seconds
service: com.apple.logd, total successful checkins since wake (130 seconds ago): 14, last successful checkin: 0 seconds ago
service: com.apple.WindowServer, total successful checkins since wake (130 seconds ago): 2, last successful checkin: 120 seconds ago

Backtrace (CPU 2), Frame : Return Address
0xffffff803bd9b670 : 0xffffff801a2b9aed mach_kernel : _handle_debugger_trap + 0x3dd
0xffffff803bd9b6c0 : 0xffffff801a3fc6e3 mach_kernel : _kdp_i386_trap + 0x143
0xffffff803bd9b700 : 0xffffff801a3ecd1a mach_kernel : _kernel_trap + 0x55a
0xffffff803bd9b750 : 0xffffff801a25ea2f mach_kernel : _return_from_trap + 0xff
0xffffff803bd9b770 : 0xffffff801a2b938d mach_kernel : _DebuggerTrapWithState + 0xad
0xffffff803bd9b890 : 0xffffff801a2b9678 mach_kernel : _panic_trap_to_debugger + 0x268
0xffffff803bd9b900 : 0xffffff801aabe434 mach_kernel : _panic_with_thread_context
0xffffff803bd9b970 : 0xffffff801d56ea25 com.apple.driver.watchdog : __ZN10IOWatchdog14userspacePanicEP8OSObjectPvP25IOExternalMethodArguments.cold.1 + 0x27
0xffffff803bd9b980 : 0xffffff801d56e678 com.apple.driver.watchdog : __ZN10IOWatchdog35userspaceDisableUserspaceMonitoringEP8OSObjectPvP25IOExternalMethodArguments
0xffffff803bd9b9a0 : 0xffffff801aa4569e mach_kernel : __ZN12IOUserClient14externalMethodEjP25IOExternalMethodArgumentsP24IOExternalMethodDispatchP8OSObjectPv + 0x1de
0xffffff803bd9b9f0 : 0xffffff801d56dab4 com.apple.driver.watchdog : __ZN20IOWatchdogUserClient14externalMethodEjP25IOExternalMethodArgumentsP24IOExternalMethodDispatchP8OSObjectPv + 0x7c
0xffffff803bd9bb20 : 0xffffff801aa4f86b mach_kernel : _is_io_connect_method + 0x35b
0xffffff803bd9bc80 : 0xffffff801a3a7d81 mach_kernel : _iokit_server_routine + 0x4d81
0xffffff803bd9bd90 : 0xffffff801a2bf0e7 mach_kernel : _ipc_kobject_server + 0x337
0xffffff803bd9be00 : 0xffffff801a295905 mach_kernel : _ipc_kmsg_send + 0x115
0xffffff803bd9be60 : 0xffffff801a2ad012 mach_kernel : _mach_msg_overwrite_trap + 0x2d2
0xffffff803bd9bef0 : 0xffffff801a3d0ec3 mach_kernel : _mach_call_munger64 + 0x273
0xffffff803bd9bfa0 : 0xffffff801a25f216 mach_kernel : _hndl_mach_scall64 + 0x16
      Kernel Extensions in backtrace:
         com.apple.driver.watchdog(1.0)[7AE04EA4-D026-39A0-B2D5-5C9E4EE72967]@0xffffff801d56d000->0xffffff801d56efff

Process name corresponding to current thread: watchdogd
Boot args: -v keepsyms=1 alcid=15 brcmfx-country=DE brcmfx-aspm -igfxblr chunklist-security-epoch=0 -chunklist-no-rev2-dev

Mac OS version:
20C69

Kernel version:
Darwin Kernel Version 20.2.0: Wed Dec  2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64
Kernel UUID: 82E2050C-5936-3D24-AD3B-EC4EC5C09E11
KernelCache slide: 0x000000001a000000
KernelCache base:  0xffffff801a200000
Kernel slide:      0x000000001a010000
Kernel text base:  0xffffff801a210000
__HIB  text base: 0xffffff801a100000
System model name: MacBookPro16,3 (Mac-E7203C0F68AA0004)
System shutdown begun: NO
Panic diags file available: YES (0x0)
Hibernation exit count: 0

System uptime in nanoseconds: 848878637159
Last Sleep:           absolute           base_tsc          base_nano
  Uptime  : 0x000000c5a51c186b
  Sleep   : 0x000000a49855cb54 0x00000008d1353bce 0x0000000000000000
  Wake    : 0x000000a49ac96fb3 0x0000000051af3664 0x000000a49962868e
last started kext at 718873478841: >!UAudio    401.4 (addr 0xffffff7fba70f000, size 307200)
last stopped kext at 806476866983: xyz.racermaster.NoTouchID    1.0.3 (addr 0xffffff801e458000, size 24576)
loaded kexts:

If GPU is disabled then I have to replug or power off and on the monitor to work again, sleep is working fine.

Link to comment
Share on other sites

  • 2 weeks later...
On 1/24/2021 at 1:54 PM, Neblogas said:

With the newest version of WEG i got a black screen after boot for several minutes. adding -igfxblr seems to fix the issue.

I'm not familiar with that bootflag.   Where's it documented and what does it do?  Also, what chipset and CPU in your system?  Are you referring to your W.I.P. Laptop with i710510u?

 

EDIT: For others wondering about -igfxblr boot flag, I found it documented here as a WhateverGreen v1.4.6 addition.  Not sure why this didn't appear in my original search.

Edited by tonyx86
Added link to -igfxblr boot flag
Link to comment
Share on other sites

×
×
  • Create New...