Jump to content

New ATI Framebuffer Xcode project to start from


dong
 Share

125 posts in this topic

Recommended Posts

I'll check that and report back ASAP

 

Hehheh! Yeap, it worked! No kernel panic, and i got a nice weird display state :whistle:

I never imagined that seeing this would make me happy :whistle:

 

Considering this a success? I'll post the fixed source here later so everyone can try it with cards other than Mobility HD3650

 

Here's the Sourcecode.

For the record my log shows ASIC_Init Success as in your log dong. If you want the full log I can post it.

ATY_Init.zip

Link to comment
Share on other sites

I'm not believing! It is the best news of recent years! dong, thanoulas, slice, netkas, was everything that users ati mobility hd dreamed!

:):D :D

 

 

I test on my hd2400 mobility, how do I proceed?

Please thanoulas, show the miracle!!!

Link to comment
Share on other sites

You guys are far smarter than I could ever figure out. can you tell me what I would need to replace for my 3450HD Mobilty? and how does this need to be installed I want to test this myself.

Thanks, Mark

Link to comment
Share on other sites

You guys are far smarter than I could ever figure out. can you tell me what I would need to replace for my 3450HD Mobilty? and how does this need to be installed I want to test this myself.

Thanks, Mark

 

Guys, this is not even close to a driver yet. All it does is that it initialises the ATi cards by reading values from the BIOS. But it's a progress. And keep in mind I did not have anything to do with this, this is all dong's work.

 

If anyone still wants to try this out, build it with xcode, add your deviceID to the plist and load the kext in single user mode. See if it panics for you and report here your card and a log if possible. If all goes well you should see a weird display state. Yeah, that's good. And yeah, that's all it does for now.

Link to comment
Share on other sites

a doubt thanoulas and dong ... the values of the BIOS can help this? http://www.insanelymac.com/forum/index.php?showtopic=154469 or has nothing to do?

Still lack much for something permanent? What percentage of the project ready?

Sorry for many questions from noob ... Congratulations for the progress!

:(

 

ATY_Init was actually created after netkas's request in order to help initialize secondary ati video cards (like on crossfire) because the secondary cards do not POST. I guess it could help to read the connections and the DDC from the bios, but this is based on linux code and the necessary functions are missing. One would have to implement these functions in order to test anything.

 

As far as the project is concerned (which is different from ATY_Init) no news yet. When and IF we have any success, be sure that we'll post about it.

Link to comment
Share on other sites

anyone tried it with unposted card ?

 

Dong, can your driver set resolution (without interracting with os(IONDRV and friends)), just to complete card's initializing ?

 

hm, aty_init is subclass of iondrvframebuffer, and its not good for this case, it need to be subclass of iopcidevice

 

// made changes for aty_init to be child of IOPCIFamily, it all fine except panic in IOPCIFamily after ATIInit detached :rolleyes:

 

I have an idea how to identify posted card(and bypass asic_init for it)

 

Take a look at this pdf - http://www.phoenix.com/NR/rdonlyres/56E38D...specsbbs101.pdf

 

page 33

 

so, need to dump binimage from memory(so from posted card), map it into Option Rom header struct, then get offset to PCI Data Structure (at 018h), then map PCI data structure from binimage and get device-id (offset 06h) and compare it to device-id provided by osx, if they match - the card was posted, if dont - it wasnt.

 

in this case combo of two same card might not work(but in this case there can be an option in plist to disable this logic)

Link to comment
Share on other sites

hm, aty_init is subclass of iondrvframebuffer, and its not good for this case, it need to be subclass of iopcidevice

 

// made changes for aty_init to be child of IOPCIFamily, it all fine except panic in IOPCIFamily after ATIInit detached :)

 

I changed my code to convert the kext to IOPCIFamily child but i didn't get a kernel panic. The screen changed to the weird state, and after a couple of seconds it restarted on its own.. (I don't really know what happens when IOPCIFamily panics, was this it?)

 

So I added a couple of lines right before the return NULL at the end of the function:

device->terminate();

this->terminate();

 

and tried again. Initializes fine, no kp, and no restart.

 

Ignore this, it does panic. No clue why though..

 

I have an idea how to identify posted card(and bypass asic_init for it)

 

Take a look at this pdf - http://www.phoenix.com/NR/rdonlyres/56E38D...specsbbs101.pdf

 

page 33

 

so, need to dump binimage from memory(so from posted card), map it into Option Rom header struct, then get offset to PCI Data Structure (at 018h), then map PCI data structure from binimage and get device-id (offset 06h) and compare it to device-id provided by osx, if they match - the card was posted, if dont - it wasnt.

 

in this case combo of two same card might not work(but in this case there can be an option in plist to disable this logic)

 

Why read the option rom header, when we can read the device-id, vendor etc from the actual option rom (ATOMBIOS) that is already loaded in ATY_Init? We can get all the ATi devices through OSx and then compare them against the device-id we read from the atombios. If they don't match, then the card wasn't posted!

 

There you go, this should skip the asicinit function if the deviceID that was read from osx was the same as the one that was read from the bios

ATY_Init.zip

Link to comment
Share on other sites

Why read the option rom header, when we can read the device-id, vendor etc from the actual option rom (ATOMBIOS) that is already loaded in ATY_Init? We can get all the ATi devices through OSx and then compare them against the device-id we read from the atombios. If they don't match, then the card wasn't posted!

 

There you go, this should skip the asicinit function if the deviceID that was read from osx was the same as the one that was read from the bios

 

bin_image from ioreg will match to card always(if natit was set up properly) need to read posted bios from ram, for devid comparision.

 

I had to implement basic power management, now it semy works, i got blue screen on unposted card :)

Link to comment
Share on other sites

panic comes from

 

IOReturn IOPCIDevice::setPowerState( unsigned long powerState,

IOService * whatDevice )

 

this line

 

parent->setDevicePowerState( this, 1 );

 

when it tries to get call address for class function

Link to comment
Share on other sites

well, good news, booted with display connected only to posted card, then, when gui appeared, conencted monitor to unposted card and voila

 

Graphics/Displays:

 

ATI Radeon HD 2600 XT:

 

Chipset Model: ATI Radeon HD 2600

Type: Display

Bus: PCIe

Slot: Slot-1

PCIe Lane Width: x4

VRAM (Total): 256 MB

Vendor: ATI (0x1002)

Device ID: 0x9588

Revision ID: 0x0000

ROM Revision: 113-B1480A-236

EFI Driver Version: 01.00.236

Displays:

SyncMaster:

Resolution: 1680 x 1050 @ 60 Hz

Depth: 32-bit Color

Core Image: Hardware Accelerated

Mirror: Off

Online: Yes

Quartz Extreme: Supported

Rotation: Supported

Display Connector:

Status: No display connected

 

ATI Radeon HD 4850:

 

Chipset Model: ATI Radeon HD 4850

Type: Display

Bus: PCIe

Slot: Slot-1

PCIe Lane Width: x16

VRAM (Total): 512 MB

Vendor: ATI (0x1002)

Device ID: 0x9442

Revision ID: 0x0000

ROM Revision: 113-B1480A-236

EFI Driver Version: 01.00.236

Displays:

SyncMaster:

Resolution: 1680 x 1050 @ 60 Hz

Depth: 32-bit Color

Core Image: Hardware Accelerated

Main Display: Yes

Mirror: Off

Online: Yes

Quartz Extreme: Supported

Rotation: Supported

Display Connector:

Status: No display connected

 

http://img509.imageshack.us/my.php?image=d...cardworking.png

 

now need to make it all automatic.

Link to comment
Share on other sites

if anyone wanna test, here it is http://rapidshare.de/files/46797133/dual.tar.bz2.html

 

add your bios dump(of unposted carf) into natit as ATY,bin_image key, for your card section, atm it has bioses of 4850/4870/2600xt

 

add device-id of unposted card to ATY_Init.kext plist (replace 95881002 there)

 

boot single user, kextload natit

kextlaod aty_init

kextunload aty_init

exit

 

p.s. dont install aty_init to /S/L/E or /Extra , it has to be unloaded before continuing

Unposted card is the card which is not set as inital graphics port, the card which displays nothing on boot.

Link to comment
Share on other sites

if anyone wanna test, here it is add device-id of unposted card to ATY_Init.kext plist (replace 95881002 there)

Seems here it already limited aty_init to do things only to unposted card. If you want it to apply to any two different cards without specify device id in the plist. You can just modify the code posted by thanoulas a little bit, i.e., read the binImage from legacy address (which is from posted card) instead of IORegistry. I guess that is what you mean in previous posts.

 

Since your inbox is full, I reply your message here:

u have any idea why problems happen when aty_init wasnt unloaded and osx drivers alrady loaded ?
I have no idea on this ATM, but will try to research on it.

 

I made kext to set AAPL,card_posted=1 key for card , if asic_init was succesfull, and on start , kext checks if AAPL,card_posted =0 or not present, then it calls asic_init.
I just thought this too a few minutes ago, no wonder you already implemented it. ;)
Link to comment
Share on other sites

I'm curious, now that I have working 3d with the drivers that OHAI sent to me for my 4870x2 (pictures to verify will come tomorrow) and working Motmot and Quail, does this mean that using ATY_init could enable the second core on both 4870x2 and 3870x2? This probably wouldn't really benefit people with only 2 DVI ports right now until Apple decides to use some OpenCL or something, but could this enable the other 2 DVI ports on cards with 4 DVI ports? I think with Apple going with OpenCL and multiple GPUs that this could really help.

Link to comment
Share on other sites

strange thing, when aty_init attaches to more then one device, it says - Map IO memory failed, when tries to run first time, but second time(it happens right after first try) - all is ok, then i unlaod kext and boot, but instead of desktop i get blue screen (and desktop is loaded, i can see via vnc)

 

now code for that logic i described works too.

 

black knight, u will need to setup keys for second card too, and aty_init, so it can enable card for using for opencl, in snowleo.

u will need to set AAPL,card_posted=1 key for first(working) chip and AAPL,force_post=1 for second chip.

 

EDIT:

 

bad news - it doesnt work if u dont add ur devid into aty_init

 

good news - got it working without single user mode.(unloading via mach_init.d)

 

http://rapidshare.de/files/46799823/4last.tar.bz2.html

Link to comment
Share on other sites

Hehe, ATY,bin_image never really crossed my mind when I posted the source, cause I just have one card on my laptop and it reads my bios from the legacy address. Sorry for that, i guess the IOReg image is better since you can force the second card to initialize with its own atombios.

 

I was using a windows app the other day, which dumps the EDID from displays, and I saw an interesting thing in it. It scans the all the PCI option roms (we do know where they always reside, and the length is fixed) so i guess we could scan through it the same way, look for vendor 0x1002 and initialize only the card that is NOT in 0xC00000 ? That way we can ensure that we only initialize the second card, even if they are identical! I will start experimenting :D

 

EDIT:

We could even use it to initialize three - card configurations (CrossfireX) this way! (I guess... :P )

Link to comment
Share on other sites

got an idea how to detect posted card :P

 

bootloader passes framebuffer start address to kernel

 

memory regions in IODeviceMemory of card have one region pointing to framebuffer(or whatever ) start.

 

so, if this two value matches - card was posted.

 

this worked out :)

Link to comment
Share on other sites

here is sources, added iopciclassmatch , so it doesnt attached to hdmi audio.

posted card detection logic described in previous post.

 

if AAPL,card_posted key set for card, then kext will skip POSTing

 

if AAPL,force_post key set for card (and AAPL,card_posted isnt set), then kext will force POSTing card (mostly usefull for some debug purposes).

 

IOProbeScore increased to 65000, if u plan to use natit with it, set IOProbeScore in natit's plist to 65500.

 

Also kext check if devid of bin_image from ioreg matches card's devid.

 

Source: attachment.

 

how to use - install natit into Extra mkext (do u dont need to load it manualy)

 

boot single user mode, kextload aty_init.kext and kextunload aty_init.kext

 

type exit, enter.

 

issues : if aty_init.kext wasnt kextunloaded, gui will not appear, need to find out why or make a workaround.

initz.zip

Link to comment
Share on other sites

here is sources, added iopciclassmatch , so it doesnt attached to hdmi audio.

posted card detection logic described in previous post.

 

if AAPL,card_posted key set for card, then kext will skip POSTing

 

if AAPL,force_post key set for card (and AAPL,card_posted isnt set), then kext will force POSTing card (mostly usefull for some debug purposes).

 

IOProbeScore increased to 65000, if u plan to use natit with it, set IOProbeScore in natit's plist to 65500.

 

Also kext check if devid of bin_image from ioreg matches card's devid.

 

Source: soon, few things to test.

Great! I found most of what you did is beyond my current knowledge.

Link to comment
Share on other sites

Hey dong, maybe I found a problem in ur driver,

 

this

rhdRec.FBbase = (void *)FBmap->getPhysicalAddress()

 

FBmap->getPhysicalAddress() gives nothing that looks like address of framebuffer, so i had to implement it via IODeviceMemory

 

if( !( bar[0] = device->getDeviceMemoryWithIndex( 0 ) ) ) {

LOG( "Couldn't map BARi!\n" );

return NULL;

};

 

if (bar[ 0 ]->getPhysicalAddress() == PE_state.video.v_baseAddr) unposted = false;

 

look more at sources i posted.

Link to comment
Share on other sites

Hey dong, maybe I found a problem in ur driver,

 

this

rhdRec.FBbase = (void *)FBmap->getPhysicalAddress()

 

FBmap->getPhysicalAddress() gives nothing that looks like address of framebuffer, so i had to implement it via IODeviceMemory

 

 

 

look more at sources i posted.

 

this is actually:

rhdRec.FBbase = (void *)FBmap->getVirtualAddress()

 

was that a typo?

Link to comment
Share on other sites

what typo?

 

 

rhdRec.FBbase has address which doesnt match real framebuffer address.

 

I just compared the sources I have with the ones you posted, I haven't checked if the address that I get is the actual framebuffer address, but I just found a difference and pointed it out.

Your source has

rhdRec.FBbase = (void *)FBmap->getPhysicalAddress();

 

and mine

rhdRec.FBbase = (void *)FBmap->getVirtualAddress();

Link to comment
Share on other sites

 Share

×
×
  • Create New...