Jump to content

New ATI Framebuffer Xcode project to start from


  • Please log in to reply
122 replies to this topic

#61
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
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.images...cardworking.png

now need to make it all automatic.

#62
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
if anyone wanna test, here it is http://rapidshare.de...al.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.

#63
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

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. ;)

#64
Black Knight

Black Knight

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 287 posts
  • Gender:Male
  • Location:Charlotte, NC, USA
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.

#65
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
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...st.tar.bz2.html

#66
thanoulas

thanoulas

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts
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 )

#67
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
when i read expansion rom from pci config space, i get 0x00000000 value ;(

#68
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
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 :)

#69
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
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.

Attached Files



#70
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

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.

#71
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
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.

#72
thanoulas

thanoulas

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts

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?

#73
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
what typo?


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

#74
thanoulas

thanoulas

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts

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();


#75
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
ah well... anyway it has wrong values, with virtual too :(

#76
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

ah well... anyway it has wrong values, with virtual too :happymac:


This is interesting. It looks like you need "WithRegister" to get correct IO memory map, but "WithIndex" to get correct FB memory map. For my x1400, "WithIndex" works for both IO and FB. Anyway, the FB map base is obviously in fact not needed by rhdAtomInit, thus a wrong value did not cause problems.

I have a question, what are the usage of "device->retain();" and "bar[ 0 ]->retain();" in your code? There is no corresponding "release()", would that be a reason that the kext won't be unloaded automatically?

#77
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
well... that was in code which I used as example of using IODevicememory, bar->retain is useless yeah :rolleyes:

problems with unloading existed before it, it even not unloading problem, the problem is that if X2000 loads durring ATY_init is in memory (maybe not even attached), then OSX cant get to gui


i just checked instances number of aty_init class after kextloading it, it's 0, means kexts unattached from device, but still present in memory. wtf.

#78
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

well... that was in code which I used as example of using IODevicememory, bar->retain is useless yeah :rolleyes:

problems with unloading existed before it, it even not unloading problem, the problem is that if X2000 loads durring ATY_init is in memory (maybe not even attached), then OSX cant get to gui


i just checked instances number of aty_init class after kextloading it, it's 0, means kexts unattached from device, but still present in memory. wtf.

Did you check the instances number of the provider "device"? Maybe Any unreleased class in a kext could cause unload problem. Also I still suggest comment out all atomSaveRegister related codes as it allocates memory but not releases them in rhdAtomInit().

#79
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
>Did you check the instances number of the provider "device"?

Ahm....how to check ?

#80
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

>Did you check the instances number of the provider "device"?

Ahm....how to check ?

ioreg | grep IOPCIDevice
type it before and after kextload ATY_Init.kext
and look for the line corresponding to the video card, for me it's like:
| | | +-o VID@0 <class IOPCIDevice, registered, matched, active, busy 0, retain 13>
check how the retain count changes.

You may need release your bar[0] even without retain it. Well, I tested it, still same problem. Even if you load ATY_Init without doing the initialization thing, the gui will be destroyed.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy