Jump to content
496 posts in this topic

Recommended Posts

Added registers

void Gen11::hwInitializeCState()
{
	FunctionCast(hwInitializeCState, callback->ohwInitializeCState)( );
	
	//some adlp addresses
	NBlue::callback->writeReg32(0x8f074,0x86fc0);
	NBlue::callback->writeReg32(0x8f034,0xc003b400);
	NBlue::callback->writeReg32(0x8f004,0x1240108);
	NBlue::callback->writeReg32(0x8f008,0x512050d4);
	NBlue::callback->writeReg32(0x8f03c,0xc003b300);
	NBlue::callback->writeReg32(0x8f00c,0x584c57fc);
	NBlue::callback->writeReg32(0x5f074,0x96fc0);
	NBlue::callback->writeReg32(0x5f034,0xc003df00);
	NBlue::callback->writeReg32(0x5f004,0x214c2114);
	NBlue::callback->writeReg32(0x5f038,0xc003e000);
	NBlue::callback->writeReg32(0x5f008,0x22402208);
	NBlue::callback->writeReg32(0x5f03c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f00c,0x241422fc);
	NBlue::callback->writeReg32(0x5f040,0xc0033100);
	NBlue::callback->writeReg32(0x5f010,0x26f826cc);
	NBlue::callback->writeReg32(0x5f474,0x9efc0);
	NBlue::callback->writeReg32(0x5f434,0xc003df00);
	NBlue::callback->writeReg32(0x5f404,0xa968a930);
	NBlue::callback->writeReg32(0x5f438,0xc003e000);
	NBlue::callback->writeReg32(0x5f408,0xaa5caa24);
	NBlue::callback->writeReg32(0x5f43c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f40c,0xac30ab18);
	NBlue::callback->writeReg32(0x5f440,0xc0033100);
	NBlue::callback->writeReg32(0x5f410,0xaf14aee8);
	NBlue::callback->writeReg32(0x5f874,0x53fc0);
	NBlue::callback->writeReg32(0x5f83c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f80c,0x25202408);
	NBlue::callback->writeReg32(0x5f840,0xc0033100);
	NBlue::callback->writeReg32(0x5f810,0x280427d8);
	NBlue::callback->writeReg32(0x5fc3c,0xc0032c00);
	NBlue::callback->writeReg32(0x5fc0c,0x95209408);
	NBlue::callback->writeReg32(0x5fc40,0xc0033100);
	NBlue::callback->writeReg32(0x5fc10,0x980497d8);
	
	NBlue::callback->writeReg32(0x60400,0x8a000006);
	NBlue::callback->writeReg32(0x60000,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60004,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60008,0x0a4f0a2f);
	NBlue::callback->writeReg32(0x6000c,0x06d5063f);
	NBlue::callback->writeReg32(0x60010,0x06d50000);
	NBlue::callback->writeReg32(0x60014,0x06480642);
	NBlue::callback->writeReg32(0x60028,0x00000000);
	NBlue::callback->writeReg32(0x60030,0x7e5d159e);
	NBlue::callback->writeReg32(0x60034,0x00800000);
	NBlue::callback->writeReg32(0x60040,0x0007c1cd);
	NBlue::callback->writeReg32(0x60044,0x00080000);
	NBlue::callback->writeReg32(0xc7204,0x00000067);
	NBlue::callback->writeReg32(0xc7208,0x07d00001);
	
	NBlue::callback->writeReg32(0x46140,0x10000000);
	NBlue::callback->writeReg32(0x45400,0x00000401);
	NBlue::callback->writeReg32(0x45404,0x00000c03);
	NBlue::callback->writeReg32(0x45408,0x40000000);
	NBlue::callback->writeReg32(0x4540c,0x00000401);
	
	//common
	NBlue::callback->writeReg32(0x45520,2);
	
	hwConfigureCustomAUX(ccont,true);
}

Got finally

(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 4579 ][setGammaTable       ] (channelCount=3, dataCount=1024, dataWidth=10, data=0xffffff99d1044800) fCRTCIndex=0 syncToVBL=1
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 4579 ][setGammaTable       ] (channelCount=3, dataCount=1024, dataWidth=10, data=0xffffff99d1044800) fCRTCIndex=0 syncToVBL=0

Log starts at 11:04:35.394634+0100, boot on black screen with square mouse

x.log kern_gen11.cpp

 

[EDIT] I have obtained only one time this result, at next boot with same configs I've not obtained the second syncToVBL=0 but only one row with syncToVBL=1

Very strange..

Edited by Stezza88

Updated at last version.. sometimes the second call to set gammatable syncToVBL=0 comes Called and sometimes not... this time not.

weird, have tried the different conn patches you proposed to me and the patch to camelia, nothing changed

x.log kern_gen11.cpp

Edited by Stezza88

on linux you will find code like this

 

if (DISPLAY_VER(dev_priv) == 13)

 

os x tgl driver seems to miss those fixes and addresses. until  DISPLAY_VER 12 things kinda work

but for DISPLAY_VER +13 they don't

 

solution is look at linux and try fix tgl os x code

 

but since you still use this bad hack

__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj

 

nvm linux

Edited by jalavoui

Might be lock or signaling mechanism, it literally says doorbell...it's something to do with power states, the function itself could probably just be setting the power well to the expected state. That could be why it bypasses the boot hang.

But you don't have the need of this doorbell.. so in your system the powerwellstate is already configured with the expected state.. and in mine not.. it's strange..

Edited by Stezza88

remove that call to {"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

and try this patch

 

find

0f 84 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

rep

48 e9 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

patch is based on

image.png.d8410d64de0d1dfe00c282a9690df724.png

 

the linux logs are consistent with this settings

image.png.d8eaaa7801b50280a3829af875452645.png

 

image.png.bafc4c3725b18d165356c0a68200f7d4.png

 

image.png.59c9998bfbade9dff2cdf0377a5c2925.png

 

as for the registers that need tobe changed idk. hope someone find them

 

here's the linux log with the card id

image.png.9ed4e7822d7c5de5d1ba2c3e4860fa0a.png

 

+

 

image.png.3f49a7e1a6da698ede0435f6f22c6b2d.png

 

image.png.9faa455942e695d564d87c96183b7da8.png

 

the platform is ALDERLAKE_P but the gpu id is

image.png.84e02b823d5549413345274bab2d6745.png

 

more linux code to check...

Edited by jalavoui
38 minutes ago, jalavoui said:

remove that call to {"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

and try this patch

 

find

0f 84 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

rep

48 e9 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

patch is based on

image.png.d8410d64de0d1dfe00c282a9690df724.png

 

and there's this possibility also

image.png.d8eaaa7801b50280a3829af875452645.png

 

image.png.bafc4c3725b18d165356c0a68200f7d4.png

 

 

 

as for the registers that need tobe changed idk. hope someone find them

 

here's the linux answer

image.png.9ed4e7822d7c5de5d1ba2c3e4860fa0a.png

 

+

 

image.png.3f49a7e1a6da698ede0435f6f22c6b2d.png

 

image.png.9faa455942e695d564d87c96183b7da8.png

 

you can start looking for ALDERLAKE_P linux fixes and display 13 fixes

 

I think i'm unable to do anything of what you say XD i'm an half developer i think

Edited by Stezza88

With my logs i Hope to help you to find a way to make a driver for all of these generations so to be more general purpose possible.. if you create a driver that cover and works for all of these gens i think you can achieve some Money also.. and i think that i've learned few things from you which was important to me..

Edited by Stezza88

hang on boot ? did you remove tgl graph card ids from nblue ? (mean only use card id on tgl frame and leave others empty)

 

looking at linux code better keep

 

{"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

 

till a better solution come out. i'll test this on tgl maybe not important at framebuffer stage

 

display 13 checks...

linux as lots of code checks like in this sample for display >=13

image.png.d496d60628251bacd9d304c2776ab7bf.png

 

question here is what will need tobe changed in mac os x tgl so it can work ?

 

Edited by jalavoui
  • Like 1

What do you mean for "did you remove tgl graph card ids from nblue ?" I removed all ids in gen7tgl, tglle and put mine 0xA7A08086 in tglle

 

Mmio base means the base where the register locations are starting? And infact my linux syslog confirm that i'm in version >= 13, infact the base is 0x5f000.. or i tell wrong?

//some adlp addresses
	NBlue::callback->writeReg32(0x8f074,0x86fc0);
	NBlue::callback->writeReg32(0x8f034,0xc003b400);
	NBlue::callback->writeReg32(0x8f004,0x1240108);
	NBlue::callback->writeReg32(0x8f008,0x512050d4);
	NBlue::callback->writeReg32(0x8f03c,0xc003b300);
	NBlue::callback->writeReg32(0x8f00c,0x584c57fc);
	NBlue::callback->writeReg32(0x5f074,0x96fc0);
	NBlue::callback->writeReg32(0x5f034,0xc003df00);
	NBlue::callback->writeReg32(0x5f004,0x214c2114);
	NBlue::callback->writeReg32(0x5f038,0xc003e000);
	NBlue::callback->writeReg32(0x5f008,0x22402208);
	NBlue::callback->writeReg32(0x5f03c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f00c,0x241422fc);
	NBlue::callback->writeReg32(0x5f040,0xc0033100);
	NBlue::callback->writeReg32(0x5f010,0x26f826cc);
	NBlue::callback->writeReg32(0x5f474,0x9efc0);
	NBlue::callback->writeReg32(0x5f434,0xc003df00);
	NBlue::callback->writeReg32(0x5f404,0xa968a930);
	NBlue::callback->writeReg32(0x5f438,0xc003e000);
	NBlue::callback->writeReg32(0x5f408,0xaa5caa24);
	NBlue::callback->writeReg32(0x5f43c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f40c,0xac30ab18);
	NBlue::callback->writeReg32(0x5f440,0xc0033100);
	NBlue::callback->writeReg32(0x5f410,0xaf14aee8);
	NBlue::callback->writeReg32(0x5f874,0x53fc0);
	NBlue::callback->writeReg32(0x5f83c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f80c,0x25202408);
	NBlue::callback->writeReg32(0x5f840,0xc0033100);
	NBlue::callback->writeReg32(0x5f810,0x280427d8);
	NBlue::callback->writeReg32(0x5fc3c,0xc0032c00);
	NBlue::callback->writeReg32(0x5fc0c,0x95209408);
	NBlue::callback->writeReg32(0x5fc40,0xc0033100);
	NBlue::callback->writeReg32(0x5fc10,0x980497d8);
	
	NBlue::callback->writeReg32(0x60400,0x8a000006);
	NBlue::callback->writeReg32(0x60000,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60004,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60008,0x0a4f0a2f);
	NBlue::callback->writeReg32(0x6000c,0x06d5063f);
	NBlue::callback->writeReg32(0x60010,0x06d50000);
	NBlue::callback->writeReg32(0x60014,0x06480642);
	NBlue::callback->writeReg32(0x60028,0x00000000);
	NBlue::callback->writeReg32(0x60030,0x7e5d159e);
	NBlue::callback->writeReg32(0x60034,0x00800000);
	NBlue::callback->writeReg32(0x60040,0x0007c1cd);
	NBlue::callback->writeReg32(0x60044,0x00080000);
	NBlue::callback->writeReg32(0xc7204,0x00000067);
	NBlue::callback->writeReg32(0xc7208,0x07d00001);
	
	NBlue::callback->writeReg32(0x46140,0x10000000);
	NBlue::callback->writeReg32(0x45400,0x00000401);
	NBlue::callback->writeReg32(0x45404,0x00000c03);
	NBlue::callback->writeReg32(0x45408,0x40000000);
	NBlue::callback->writeReg32(0x4540c,0x00000401);
Edited by Stezza88

I forgot to uncomment customAUX method, but something is changed in the result, like the scale of the square mouse that now is appropriated.. always boot on black screen

Here calculated current pixelclock etc values are correct

 

(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelController.cpp : 6001 ][hwCRTCToIODetailedTi] pixelClock = 787400000
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelController.cpp : 6096 ][hwCRTCToIODetailedTi] return
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod] Current:
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  active h=2560, v=1600
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scaled h=0, v=0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  pixelClock 787400000
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scalerFlags 0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  signalConfig 0

 

Adding only

{"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

kern_gen11.cpp x.log

Edited by Stezza88

Adding some requests to resolve some kp

{"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},
{"__ZN24AppleIntelBaseController35hwCRTCToIODetailedTimingInformationEP21AppleIntelFramebufferP29IODetailedTimingInformationV2", releaseDoorbell},
{"__ZN24AppleIntelBaseController15enableVDDForAuxEP14AppleIntelPort", releaseDoorbell},
{"__ZN24AppleIntelBaseController16hwUpdateRegCacheEP21AppleIntelFramebufferP21AppleIntelDisplayPath",releaseDoorbell},

And changing r3 connector 0 to (because if not were booting in a complete black screen)

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00

I have got various call to setgammatable with syncToVBL=0 at the end of the log, but always boot on black screen with square mouse (with appropriate scale an other time)

 

But now I've got a bug on calculated current pixelclock etc values

(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod] Current:
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  active h=1850933354, v=47729463
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scaled h=-1788460650, v=-129
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  pixelClock -51418302080
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scalerFlags 0xffffff80
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  signalConfig 0x197c4265

Here the driver was running good

Log starts at 21:47:01.698215+0100

kern_gen11.cpp x.log

Edited by Stezza88

Now, with only

{"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},
{"__ZN24AppleIntelBaseController15enableVDDForAuxEP14AppleIntelPort", releaseDoorbell},

Got "pipe0 not enabled" message instead of calculated pixel clock and boot with black screen and square mouse

(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelController.cpp : 5910 ][hwCRTCToIODetailedTi] FB0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelController.cpp : 5925 ][hwCRTCToIODetailedTi] Pipe0 not enabled
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod] Current:
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  active h=0, v=0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scaled h=0, v=0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  pixelClock 0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scalerFlags 0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  signalConfig 0

x.log kern_gen11.cpp

Edited by Stezza88

I've understand that this (it contains useful register for adl - they are in my linux sys log)

{"__ZN24AppleIntelBaseController16hwUpdateRegCacheEP21AppleIntelFramebufferP21AppleIntelDisplayPath",releaseDoorbell},

enable my pipe0

 

but this

{"__ZN24AppleIntelBaseController35hwCRTCToIODetailedTimingInformationEP21AppleIntelFramebufferP29IODetailedTimingInformationV2", releaseDoorbell},

give to me wrong calculated pixelclock so i think that instead of the doorbell should be better to implement the method.

 

I've tryed to implement it but it doesn't work like

void AppleIntelhwCRTCToIODetailedTimingInformation(void *that, int64_t param1){
	functioncast .. (that, param1)
}

maybe i'm no good

Edited by Stezza88

If you help me to understand how to implement this method, i guess i have good logs @jalavoui

It is needed to calculate right pixelclock, scale etc , and it do by itself (instead of your crt patch)

{"__ZN24AppleIntelBaseController35hwCRTCToIODetailedTimingInformationEP21AppleIntelFramebufferP29IODetailedTimingInformationV2", AppleIntelhwCRTCToIODetailedTimingInformation, this-> oAppleIntelhwCRTCToIODetailedTimingInformation},

?? AppleIntelhwCRTCToIODetailedTimingInformation(void *that, ?? param1){
	FunctionCast .. (that, param1)
}
Edited by Stezza88
×
×
  • Create New...