Jump to content

ATI HD framebuffer driver (10.5/10.6) with source code


dong
 Share

900 posts in this topic

Recommended Posts

toshiba satellite A300D-21H with ATI Mobility Radeon HD3650 (PCIID: 1002:9591)

osx version 10.5.8 iDeneb 1.6 (with ATY_Init present)

more details about configuration could be found here

 

Update:

current version working garanteed only if kext's rescan boot option provided (-f), otherwise it may stuck without switching to graphics and desktop.

possible "magic number" driver priority option is too low?

 

yes, it works for me, but somehow not stable enough. Usually I get a Kernel Panic during boot. What I found is that if I start with -s (single user mode) and then continue to boot than it works

 

the problem appeared to be not related directly to radeonHD, but to overall system behavior under 9.8.0 - the system is AMD dual(only!) core has to be warmed up before it stops crashing with KP happening. it takes usually for 5-10 minutes after first power up, while all re-boots will ends up with KP and message on the screen, no matter if system managed to popup desktop or just in a boot stage. after warm up process, system works, stable, all kexts loaded successfully and reboot progress fast and reliable. anybody observe same behavior?

 

it's discovered and confirmed as IOKit issue from 9.8.0, so if your system is AMD processor based one, avoid using System.kext from 9.8.0 and stay with System.kext from 9.5.0, but kernel (patched for AMD of course) could be any one (personally using 9.8.0 build by BigB)

Link to comment
Share on other sites

Hi I'm thinking on try to get Qe/Ci working in my ati x1200 and I was wondering if you know how to do it, I've been searching and I found somethign of add my device ID to the x1000 kext but, I didn't install any x1000 kext because those was interfering with the FB so, can you help me? I'm gonna let my system profile.

 

Chipset model: Radeon X1200

Type: Display

Bus: PCI

VRAM (total): 128 MB

Vendor: ATI (0x1002)

Device ID: 0x791e

Revision ID: 0x0000

Display:

Resolution: 1440 x 900 @ 60 Hz

Depth: 32-Bit Color

Core Image: Software

Main display: Yes

Mirror: Off

Online: Yes

Quartz Extreme: Not Supported

 

Thanks in advance.

Link to comment
Share on other sites

Any work-around for the HD3200??

 

It is working on Amilo Sa 3650 with ATI HD 3200, But the cursor problem is the same.

It is working the same on iAtkos 10.5.7 and 10.6.2.

 

Thanks for the Kext, Hoping to get better.

 

You need to change enableHWCursor as false in Plist under UserOptions

 

I have the same problem on HD 3200, I tried changing "enableHWCursor" but it came back to original after reboot (Kext is there but resolution is 1024 x 768).

Can you tell me exactly how to solve this.

Link to comment
Share on other sites

;);) U R The Best Man everyone is complaining about something wanted to let you know how much i appreciate the kext working 100% on 10.5.7 after I changed value to false on hwcursor at first I had the color block mouse lol that sucked but thats for not following the directions. BUT THANKS YOUR THE MAN!! :):thumbsup_anim:

Link to comment
Share on other sites

QUOTE (osmar @ Nov 2 2009, 11:25 AM)

28/10/09-RadeonHD.kext 10.6 Work ten, all resolutions, but mouse cursor is a colored stain ,but work/

I've made this:Try set "enableHWCursor" in Info.plist to "false" / Not Work

 

 

Did you rebuild the kernel cache after set "enableHWCursor" in Info.plist to "false"? In 10.6, you must touch /S/L/E sometimes.

 

 

The touch in S/L/E worked! It is the solution. It works for me.

 

Now, it's all ok! ;)

 

Thanks a lot, ;)

Link to comment
Share on other sites

Well ATIRadeonX2000.kext has a dependency on the ATI Framebuffer which the earlier accelerators didn't afaik. Specifically the set_display_mode_and_vram() function, which fails if the ATI FB is missing. I have build RadeonHD with more logging code to see the differences with and without the accelerator, the jury is still out though :-)

so it's much, much more practical to erm "tweak" the existing files for specific cards, than to attempt the impossible.

I actually agree with you. I have no wills to port acceleration code. However, it's hard to determine what is demanded from FB driver by ATIRadeonX2000.kext. Today, when I'm in the process of porting ATIFramebuffer code, I notice ATIRadeonX2000.kext (ATIRadeonX1000.kext is not) is using a IOReg entry set by ATIFramebuffer. This entry is "ATY,drvincom". It's related to ringBuffer and some Power attribute setup. I'm not clear if this is important and if it's the only missing part that we should take care.

Code from ATIFramebuffer.kext:

IOReturn ATIFramebuffer::handleExternalCall(unsigned long a1, void *a2, void *a3) {
if (!a2 || !a3) return kIOReturnBadArgument;
return (ATIController *)a3->handleExternalCall(a1, a2);
}

typedef struct {													//size 8
IOReturn (*handleExternalCall)(unsigned long,void *,void *);	//0
ATIController	*Controller;									//4
} DRVINCOM;

IOReturn ATIFramebuffer::initializeConfigurations(void) {
UInt32 data = 0;
IOPCIDevice *device = Controller->getPCIDevice();
if (getRegistryProperty(device, "no-hotplug-support", &data, 4)) hotPlugFlags |= 2;
if (getRegistryProperty(device, "AAPL00,no-hotplug-support", &data, 4)) hotPlugFlags |= 2;
if (getRegistryProperty(device, "AAPL01,no-hotplug-support", &data, 4)) hotPlugFlags |= 2;
if (getRegistryProperty(device, "AAPL00,no-hotplug-interrupt", &data, 4)) hotPlugFlags |= 4;
if (getRegistryProperty(device, "AAPL01,no-hotplug-interrupt", &data, 4)) hotPlugFlags |= 4;
if (getRegistryProperty(device, "AAPL00,IgnoreConnection", &data, 4)) Controller->connectorsOnOff(data, false);
if (getRegistryProperty(device, "AAPL01,IgnoreConnection", &data, 4)) Controller->connectorsOnOff(data, false);
if (crtc.indxe == 0) copyProperty(device, this, "AAPL00,display-alias", "AAPL,display-alias");
else copyProperty(device, this, "AAPL01,display-alias", "AAPL,display-alias");

initializeScalerInfo();
if (crtc.index == 0) {
	initializeBootOptions();
	probeConnections();

	DRVINCOM temp;
	temp.handleExternalCall = &ATIFramebuffer::handleExternalCall;
	temp.Controller = Controller;
	device->setProperty("ATY,drvincom", &temp, 8);
}
initializeOutputs();
initializeMemoryPartition();
initializeDisplayParameters(&crtc.dispPara);
initializeStartupDisplayMode();
return kIOReturnSuccess;
}

Code from ATI4800Controller.kext:

void ATI4800Controller::hwInitializeRingBuffer(unsigned long a1, unsigned char *a2, unsigned long a3) {
RV770SharedInterrupt *itrr;

UInt32 v1 = regr32(0x3E00);
UInt32 v2 = regr32(0x3E18);
int iCount = interrupts->getCount();	//var_20
regw32(0x3E18, v2 & ~ 1);
regw32(0x3E00, v1 & ~ 1);
regw32(0x3E08, 0);
regw32(0x3E0C, 0);
int i;
for (i = 0;i < iCount;i++)
	if ((itrr = OSDynamicCasr(RV770SharedInterrupt, interrupts->getObject(i))))
		itrr->setPulseInterrupt((a3 != 0));
regw32(0x3E00, (a3 * 2) | ((1 << 31) + (1 << 16)));
regw32(0x3E04, a1 >> 8);
if (a3) {
	memTable->198 = a3;
	memTable->19C = 4 << a3;
	memTable->1A4 = a2;
	memTable->1A0 = a1;
	regw32(0x3E18, v2);
	regw32(0x3E00, (a3 * 2) | ((1 << 31) + (1 << 16) + 1));
} else {
	memTable->19C = 4;
	memTable->1A4 = a2;
	memTable->1A0 = a1;
	regw32(0x3E18, v2);
}
}

IOReturn ATI4800Controller::setRingBufferEnabled(bool a1) {
hwInitializeRingBuffer(memTable->1A0, memTable->1A4, (a1)?memTable->198:0);
return kIOReturnSuccess;
}

IOReturn ATI4800Controller::handleExternalCall(unsigned long a1, void *a2) {
if (!a2) return kIOReturnBadArgument;
switch (a1) {
	case 'eivr':
		setRingBufferEnabled((*a2 != 0));
		return kIOReturnSuccess;
	case 'eidc':
	case 'eidh':
	case 'gclk':
	case 'eavp':
	case 'euvd':
		powerMan->setAttribute(a1, *a2);
		return kIOReturnSuccess;
	case 'ggrt':
		getRingBufferBytes();
		return kIOReturnSuccess;
	case 'sgrt':
		useSystemMemoryForRingBuffer(a2);
		return kIOReturnSuccess;
	default:
		super::handleExternalCall(a1, a2);
		return kIOReturnUnsupported;
}
}

And code from ATIRadeonX2000.kext:

bool ATIRadeonX2000::getNdrvCallProperty(void) {
if (FBInfo.handleExternalCall && FBInfo.Controller) return true;
OSData *data = OSDynamicCast(OSData, device->getProperty("ATY,drvincom"));
DRVINCOM *info = (DRVINCOM *)data->getBytesNoCopy();
FBInfo.handlExternalCall = info->handleExternalCall;
FBInfo.Controller = info->Controller;
if (FBInfo.handleExternalCall && FBInfo.Controller) return true;
return false;
}

void ATIRadeonX2000::lock_busy(void) {		//sub_20A2C
IOLockLock(lock);
super::lock_busy();
}

void ATIRadeonX2000::unlock_busy(void) {	//sub_20A52
super::unlock_busy();
IOLockUnLock(lock);
}

bool ATIRadeonX2000::display_mode_will_change(long a1) {	//offset 0x570
lock_busy();
while (cdContext) {
	cdContext->teardown();
	cdContext = cdContext->next;
}
if (getNdrvCallProperty() && this->19E0)
	FBInfo.handExternalCall('gclk', &this->19E0, FBInfo.Controller);
if (this->1320) disable_GPUSensor();
FEDSShutdown();
bool ret = super::display_mode_will_change(a1);
if (hardware->powerOff() && ret) ret = true;
else ret = false;
this->84 = 0;
if (getNdrvCallProperty()) disableInterruptHubAgp();
bool var_19 = false;
hardware->setVirtualSpaceReady(&var_19);
if (bltMgr) {
	IODelete(bltMgr, ATIR600AtomicBltMgr, 1);
	bltMgr = NULL;
}
if (bltMgrX) {
	hardware->getHWDisplay()->setAMDBltManager(NULL);
	bltMgrX->release();
	bltMgrX = NULL;
}
freeAllLocalCommandBuffers();
this->19B0 = 0x2000;
if (cmdPool) {
	cmdPool->release();
	cmdPool = NULL;
}
HWMemory->free(&memElement[0], NULL);
HWMemory->free(&memElement[1], NULL);
HWMemory->free(&memElement1, NULL);
HWMemory->free(&memElement2, NULL);
if (this->12D8) {
	HWMemory->free(&memElement3, NULL);
	this->12D8 = 0;
	this->12E4 = 0;
}
HWMemory->disableAllocations(false);
HWMemory->setVirtualSpace(NULL,NULL);
unlock_busy();
return ret;
}

bool ATIRadeonX2000::display_mode_did_change(void) {	//offset 0x574
ATIRadeonX2000HWDisplay  *display = hardware->getHWDisplay();	//edi
lock_busy();
display->detectBuiltIn();
HWMemory->setVirtualSpace(this->FC, mem);
bool ret = initialize_hardware();
if (getNdrvCallProperty())
	enableInterruptHubAgp();
if (!this->19AE && !allocMoreLocalCommandBuffers(this->19B0)) ret = false;
cmdPool = new AMDDRMDMACommandPool;
cmdPool->init(this, hardware->getHWDRMDMA());
bltMgrX = new ATIRRadeonX2000BltMgr;
bltMgrX->init(this);
hardware->getHWDisplay()->setAMDBltManager(bltMgrX);
bltMgr = new ATIR600AtomicBltMgr;
bltMgr->Initialize(this);
if (display->FEDSIsRequired() && ret && !FEDSConfigure()) ret = false;
if (this->1320) {
	if (ecx = getPeriodValue("polling-period"))
		this->1310 = *(ecx + 4) / 15625 + *ecx * 1000;
	if (ecx = getPeriodValue("sample-period"))
		this->1314 = *(ecx + 4) / 15625 + *ecx * 1000;
	enable_GPUSensor();
}
if (!super::display_mode_did_change()) ret = false;
if (getNdrvCallProperty() && !this->19E0)
	FBInfo.handExternalCall('gclk', &this->19E0, FBInfo.Controller);
unlock_busy();
return ret;
}

Link to comment
Share on other sites

Sadkiller I have the same problem in my other Hackintosh, I don't know why, I have the same video card (x1200) in the 2 computers, when boot with -v it hangs on a line like this "IOKitwaitquiet() timed out waiting to write kernel symbols"

please help!!!!!!!!

ok thanks

 

I found something here, haven't tried yet but I will.

http://www.hackint0sh.org/f181/79556.htm

Link to comment
Share on other sites

OSData *data = OSDynamicCast(OSData, device->getProperty("ATY,drvincom"));

DRVINCOM *info = (DRVINCOM *)data->getBytesNoCopy();

 

DRVINCOM == DRIVer INternal COMmunication? I wonder.

 

Thanks for the info. I'll have a look around.

 

Just passing a reference to the controller for X2000 to use?

Link to comment
Share on other sites

DRVINCOM == DRIVer INternal COMmunication? I wonder.

 

Thanks for the info. I'll have a look around.

 

Just passing a reference to the controller for X2000 to use?

It's not so simple. You have to implement the "handleExternalCall" function in the code as well. I did not reverse all the implementations in ATI's Controller class. We have to write our own version of this function.
Link to comment
Share on other sites

It's not so simple. You have to implement the "handleExternalCall" function in the code as well. I did not reverse all the implementations in ATI's Controller class. We have to write our own version of this function.

 

 

Okay. Are you moving RadeonHD to a subclass of IOFrameBuffer and replacing the ndrv routines?

Link to comment
Share on other sites

Okay. Are you moving RadeonHD to a subclass of IOFrameBuffer and replacing the ndrv routines?
Yes. I'm trying to use the reversed ATIFramebuffer and ATIController code as a template. It's a little complicated than what I expected. As far as now, I already managed to turn all linux code except the ATOMBIOS decoder part into c++ class wrapped version, thus it will better cooperate with IOKit stuff.

There is a rough correspondence relationship between the ATI classes and the rhd classes, like:

ATIFramebuffer <-> rhdFramebuffer (a new class I created)

ATIController <-> rhdRec

ATIConnector <-> rhdConnector

ATIConnection <-> rhdOutput

ATIPanel <-> rhdMonitor

Link to comment
Share on other sites

hi dong, where you found a reversed framebuffer? i just doing a hypoprion reversing with ida, can you say me where can i find your? thanks..

so already modded the binary code in hypoprion but a have some problem with debugger, ida allow to debug mach-o executable, kext binari was rejected as bad mach-o.. can you give me some advices ??

 

berst regards

Link to comment
Share on other sites

hi dong, where you found a reversed framebuffer? i just doing a hypoprion reversing with ida, can you say me where can i find your? thanks..
I'm using ida too. But debug kext is certainly impossible here. The only way to debug kernel driver is the apple's way: two machine debug.
Link to comment
Share on other sites

hello dong, ive installed RadeonHD.kext to my DV7t 2000 CTO

i got a black screen so i removed the ATIRadeonX2000.kext

 

after that i got resolution change enabled...

everything works except QE

here are the results from sys profiler:

 

----------------------------------------------------------------

 

Mobility Radeon HD 4500 Series:

 

Chipset Model: Mobility Radeon HD 4500 Series

Type: Display

Bus: PCIe

PCIe Lane Width: x16

VRAM (Total): 256 MB

Vendor: ATI (0x1002)

Device ID: 0x9553

Revision ID: 0x0000

Displays:

Display:

Resolution: 1600 x 900

Depth: 32-bit Color

Core Image: Software

Main Display: Yes

Mirror: Off

Online: Yes

Quartz Extreme: Not Supported

---------------------------------------------------------------

 

is there anyway i can get QE working? is it because of the ATIRadeonX2000.kext, if so can you give me a link to one that would work with my card (Dev id: 0x95531002).

 

 

Thanks a lot mate..

Link to comment
Share on other sites

Thank you!! It does work on 3450/3470 Mobile. But there is one strange problem in 10.6.1. Grab can not get right pictures, all images are blank. Any ideas?

 

 

Please can you tell me what have you done to get it works?? :)

Because here i can get my EDID for my ATI HD 3470, i dont know why, it give me kernel panic when i install the RadeonHD

 

PLEEEEAAASEEE

Link to comment
Share on other sites

Please can you tell me what have you done to get it works?? ;)

Because here i can get my EDID for my ATI HD 3470, i dont know why, it give me kernel panic when i install the RadeonHD

 

PLEEEEAAASEEE

 

Hi!

 

Yeah please, i'm a bit of a newb when it comes to osx86, if you could post a kind of step by step instruction then that'd be amazing :) I've got a Lenovo T400 with Mobility 3470

 

Cheers,

 

Chris.

Link to comment
Share on other sites

Please can you tell me what have you done to get it works?? ;)

Because here i can get my EDID for my ATI HD 3470, i dont know why, it give me kernel panic when i install the RadeonHD

 

PLEEEEAAASEEE

 

 

My computer is lenovo T400 and I installed 10/28/2009 driver using kext helper b7.

Link to comment
Share on other sites

My computer is lenovo T400 and I installed 10/28/2009 driver using kext helper b7.

 

I have the same computer - can you confirm you have been able to enter the native 1280x800 resolution? I have tried installing the 10/28/2009 with kext utlity (i think it's the same as helper...) and nothing has changed!!! Do you need to remove any kexts from the S/L/E folder?? Or change any preferences somewhere?

 

Sorry if these questions are obvious...I just want my T400 to be a good hackintosh!

 

Chris.

Link to comment
Share on other sites

My computer is lenovo T400 and I installed 10/28/2009 driver using kext helper b7.

 

Thanks a lot for replaying...

 

but you just install it... you haven't change anything??? (sorry for my english)

 

I have a toshiba A300 with HD 3470 and i've install the RadeonHD.kext but i've read here in this forum that whe have to change something in the info.plist and i thing its true because here i install it with kext helper b7 but just the first time it works when i reboot....kernel panic :(

 

Can you help me with that???? pleeeaasee :rolleyes:

 

than you

Link to comment
Share on other sites

 Share

×
×
  • Create New...