Jump to content
dong

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

901 posts in this topic

Recommended Posts

Advertisement
Would you mind helping me with an off-topic xcode build problem? Thing is that I cannot build IOGraphicsFamily, but we need it to cure the Intel GMA 5700 HD Graphics video problems. Feel free to PM when you want to help (I'm just looking for someone to make it build without the errors due to missing header files). Thanks.

Figure that some other ppl may also encounter such compilation problems, I decide to share my experience here.

The last time I do the compilation was a couple years ago and not much can be remembered. So I downloaded the source code from apple's site and try to compile it again today.

 

My system is still in 10.6.3, so I downloaded the corresponding IOGraphicsFamily package. A initial compilation produced all kinds of errors and warnings including the one you mentioned. So I need to check each of them and fix it.

 

From my past experience, it is an fact that those header files are really missing in our system's framework folder where the compiler is trying to search. But these files actually have a copy in the IOGraphicsFamily project itself. To solve the problem, simply copy them to the system path. Open a terminal, cd to the project directory and do below things:

cd IOGraphicsFamily

sudo cp ./IOKit/graphics/*.h /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/graphics/

sudo cp ./IOKit/i2c/*.h /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/i2c/

 

Here, I not only copied the missing header files, also overwrote those already existing header files. I only find out that I need do this after I encounter a lot errors without a clue and finally it turns out that these existing header files are not updated to correct version by Mac OSX's system update at all.

 

That's all header files from the package itself. There is another missing header file, IOHibernatePrivate.h, which can not be found here. I googled and get it from apple's xnu source:

http://www.opensource.apple.com/source/xnu...ernatePrivate.h

Here, xnu-1504.3.12 is the version for 10.6.3. You should check your version by typing "uname -a" in terminal.

So copy it to system path as well. Since I downloaded it to my Desktop, I type:

sudo cp ~/Desktop/IOHibernatePrivate.h /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/

 

All missing header file problems should be solved. Now check other errors.

 

A bunch of errors can be solved by editing IOKit/graphics/IOGraphicsPrivate.h:

 

1. comment out the line: extern "C" ppnum_t pmap_find_phys(pmap_t map, addr64_t va);

 

2. Add another include file: #include <kern/thread_call.h>

 

3. Add below declarations:

OS_INLINE
uint64_t
__OSAbsoluteTime(AbsoluteTime	abstime)
{
return (*(uint64_t *)&abstime);
}

#define AbsoluteTime_to_scalar(x)    (*(uint64_t *)(x))

#ifdef ADD_ABSOLUTETIME

#define AsUInt64(x)	 (x)

#else

static inline const UInt64& AsUInt64(const AbsoluteTime& rhs)
{
return reinterpret_cast<const uint64_t&>(rhs);
}

static inline UInt64& AsUInt64(AbsoluteTime& rhs)
{
return reinterpret_cast<uint64_t&>(rhs);
}

static inline void absolutetime_to_nanoseconds(const AbsoluteTime& abs, UInt64* ns)
{
absolutetime_to_nanoseconds(AsUInt64(abs), ns);
}

static inline void nanoseconds_to_absolutetime(UInt64 ns, AbsoluteTime* abs)
{
nanoseconds_to_absolutetime(ns, reinterpret_cast<uint64_t*>(abs));
}

static inline void clock_get_uptime(AbsoluteTime* abs)
{
clock_get_uptime(reinterpret_cast<uint64_t*>(abs));
}

static inline void clock_interval_to_deadline(uint32_t interval, uint32_t scale_factor, AbsoluteTime* result)
{
clock_interval_to_deadline(interval, scale_factor, reinterpret_cast<uint64_t*>(result));
}

static inline void clock_interval_to_absolutetime_interval(uint32_t interval, uint32_t scale_factor, AbsoluteTime* result)
{
clock_interval_to_absolutetime_interval(interval, scale_factor, reinterpret_cast<uint64_t*>(result));
}

/*
static inline void clock_delay_until(const AbsoluteTime& deadline)
{
clock_delay_until(AsUInt64(deadline));
}
*/
static inline boolean_t	thread_call_enter1_delayed(thread_call_t call, thread_call_param_t param1, const AbsoluteTime& deadline)
{
return thread_call_enter1_delayed(call, param1, AsUInt64(deadline));
}

static inline void ADD_ABSOLUTETIME(AbsoluteTime* time, const AbsoluteTime* offset)
{
*reinterpret_cast<uint64_t*>(time) += *reinterpret_cast<const uint64_t*>(offset);
}

static inline void SUB_ABSOLUTETIME(AbsoluteTime* time, const AbsoluteTime* offset)
{
*reinterpret_cast<uint64_t*>(time) -= *reinterpret_cast<const uint64_t*>(offset);
}

static inline int64_t CMP_ABSOLUTETIME(const AbsoluteTime* lhs, const AbsoluteTime* rhs)
{
return (*reinterpret_cast<const uint64_t*>(lhs) - *reinterpret_cast<const uint64_t*>(rhs));
}

#endif

 

After editing, copy it again to the system path:

sudo cp ./IOKit/graphics/IOGraphicsPrivate.h /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/graphics/

 

There is still a problem related to "clock_delay_until". I can solve it the same way as shown in above code with the part that is commented out, but that will produce another error where the function clock_delay_until is referenced (it's confused when there are 2 overloaded versions of the function clock_delay_until). I did not figure out an elegant way to solve this. What I did is to edit IOFramebuffer.cpp, change the line:

clock_delay_until(deadline);

into

clock_delay_until(__OSAbsoluteTime(deadline));

 

Finally, there is an undefined function: vm_map_wire

I googled and find its declaration:

void vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,

vm_prot_t access_type, boolean_t user_wire);

Since it's one of the low-level VM map API of the system, it should exist somewhere in the kernel already. So I simply add the declaration right before the function where vm_map_wire is used:

extern "C" {

void vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,

vm_prot_t access_type, boolean_t user_wire);

}

After all these editing, the target "IOGraphicsFamily" compiled without errors, but still produced a lot of warnings. I checked them and don't think those are big problems.

Share this post


Link to post
Share on other sites

Hi all,

 

Has anyone tried this driver (10.5 or 10.6) on a Mobility Radeon HD 5730? I skimmed through the topic and it seems like only earlier ATI Mobility cards were tested. I'd really like to have a proper screen resolution on my lappi :)

Share this post


Link to post
Share on other sites

i've installed snowleopard 10.6.2 in my dell and the main lack is the display resolution.

im using chameleon 2 rc5 autoresolution by lebidou

the display native res is 1600x900. but i cant get more than 1152x864 with graphicsenabler=yes

without efi injection (graphicsenabler=no) i get the radeonHD.kext build from last trunk loaded, but i get nothing but a black screen. i can log in to SL via screensharing from my mac mini and make a radeondump with verbose level 4.

in system profiler, the card and the display shows and the resolution is the correct 1600x900, but the screen still black (i mean black image but with backlight on). i think this mean that the edid code is right.

in another thread dong suggested that maybe the FrameBuffer was located in a wrong memory address, or something like that.

http://www.insanelymac.com/forum/index.php...0586&st=620

 

how can i debug or look for these values and try to find out whats wrong? i have xcode installed in i can build and make some tweaks as long as im being pointed to the right direction.

 

@dong: please if you can help on this!

radeonHD_verbose4_buffer_grande.txt

Share this post


Link to post
Share on other sites

hi, i still trying to get my lap working.

i've received myy displayport to vga adapter, so i tried with ati kexts from 10.6.2 an graphicsenabler=yes and i get same black screen as with radeonHD from dong, but in the external monitor i get fullres QE/CE enabled

in system info i get listed the panel cld with fullres and QE/CE enabled too.

i think that im having the same problem as radeonHD. so im trinog to get help to debug and find the problem

here goes attached my ioreg.

hope this helps to find why the screen is black in both, radeonHD and vanilla kexts

ioreg_ati_kexts.txt

Share this post


Link to post
Share on other sites

@lseba,

 

As I suspected, the ATI card on notebooks only work with monitor connected to displayport. I think you don't need RadeonHD. GraphicsEnabler=Yes alone can enable QE/CI on external monitor.

Share this post


Link to post
Share on other sites

@kizwan

i know i dont need radeonHD. i already have qe/ci working with graphicsenaqbler.

i never could use radeonHDS because the only thing i got was a black screen as with vanilla kext. so i thougth that the problem can be solved to radeonHD maby it can work with vanilla kext too, o viceversa.

Share this post


Link to post
Share on other sites
i know i dont need radeonHD. i already have qe/ci working with graphicsenaqbler.

Yes, with external monitor connected to displayport only.

i never could use radeonHDS because the only thing i got was a black screen as with vanilla kext. so i thougth that the problem can be solved to radeonHD maby it can work with vanilla kext too, o viceversa.

Unfortunately, RadeonHD can't work with vanilla kext. If you want to use RadeonHD & internal LCD, you will need to use GraphicsEnabler=No (default). You will get full resolutions support but no QE/CI. Anyway by reading this thread there are a couple of ATI card which won't work with RadeonHD. I don't know whether they installed it not properly, not booting in 32bit mode or the card actually is not supported.

 

You can look in log files (kernel.log or system.log) to see debug messages generate by RadeonHD.

Share this post


Link to post
Share on other sites

i've tried radeonhd without vanilla kext and without graphicsenabler. in radeonHD was loaded. got radeondump log and i was able to get to gui via vnc from my mac mini, but in the laptop all i got was black screen. same as with vanilla kext.

so, what i think is that the problem is tha same.

im trying to say that if the problem with radeonHD can be solved, maybe it will be the same problem with vanilla kexts

Share this post


Link to post
Share on other sites
im trying to say that if the problem with radeonHD can be solved, maybe it will be the same problem with vanilla kexts

Yes I do think it can be solved but I'm afraid we might need to look into the driver (vanilla kext). Unfortunately I don't have skill on driver programming.

 

I'm on 10.6.4, ATIRadeonX2000.kext cause kernel panic when I boot without GraphicsEnabler=Yes. With GraphicsEnabler=Yes, I got the same experience, black screen. When I removed ATI4500Controller.kext & ATIRadeonX2000.kext, replaced it with RadeonHD.kext, boot in 32bit mode, I got full resolutions support on internal monitor but no QE/CI. Last week I installed MacBookAir update (to be precise using pacifist - installed only ATI4500Controller.kext & ATIRadeonX2000.kext). After that no kernel panic anymore if boot without GraphicsEnabler=Yes but the same issue, black screen.

Share this post


Link to post
Share on other sites

well, i dont have the knowledge either to program a driver. i don exctly know how the driver works, but i think that i have two displays connected to my lap. one works, the other doesnt. maybe someone more experienced than me can look at the ioreg dump and detect a flag or a wrong value in the display section that leads to the problem

and thats what i hope.

Share this post


Link to post
Share on other sites
maybe someone more experienced than me can look at the ioreg dump and detect a flag or a wrong value in the display section that leads to the problem

and thats what i hope.

Yeah, I hope the same thing too. I'm also hoping someone with advanced skill to look into the driver. What I know is that iMac with ATI mobility graphic card doesn't use LVDS connector, it use displayport instead. I also read that vanilla driver doesn't support LVDS. I believe 99% it is true because if it does, we should see monitor/display connected to ATI card in IOReg but unfortunately not. Don't get me wrong. I'm hoping the same thing too & to be honest I haven't given up yet.

Share this post


Link to post
Share on other sites
Guest NeatMonster

Hi, I've an ATi Radeon Mobility HD 4570. I've deleted all ATI*.kext. I'm trying to install RadeonHD.kext but Mac OS X tells me it can't be installed. Please help me and tell me if I can get QE. Thanks in advance.

Share this post


Link to post
Share on other sites

@neatmonster

osx says so because it detected that the ownership and permissions of radeonHD.kext are wrong. installit with kexthelper . no QE with radeonHD

 

@kizwan

I also read that vanilla driver doesn't support LVDS. I believe 99% it is true because if it does, we should see monitor/display connected to ATI card in IOReg but unfortunately not

 

that is not true. my display panel shows up in ioreg. it is attached in my first post. ioreg shows 2 dispalys one is external via displayport and the other is internal-lvds

 

thats why i think it could be fixed

Share this post


Link to post
Share on other sites
that is not true. my display panel shows up in ioreg. it is attached in my first post. ioreg shows 2 dispalys one is external via displayport and the other is internal-lvds

 

thats why i think it could be fixed

You're very lucky. Most probably your internal LCD is connected to displayport. I have found several notebook use displayport instead conventional lvds. Most of us couldn't get the internal display detected at all. Do you mind posting IOReg dump using IORegistryExplorer? It is hard to look in text-base file. Have you tried using display override to force load the EDID value of your internal LCD?

Share this post


Link to post
Share on other sites
Guest NeatMonster
@neatmonster

osx says so because it detected that the ownership and permissions of radeonHD.kext are wrong. installit with kexthelper . no QE with radeonHD

 

Many thanks, it works now. I was realy... Never solutions for Quartz Extreme ? So sad :(.

Share this post


Link to post
Share on other sites
Figure that some other ppl may also encounter such compilation problems, I decide to share my experience here.

The last time I do the compilation was a couple years ago and not much can be remembered. So I downloaded the source code from apple's site and try to compile it again today.

 

My system is still in 10.6.3, so I downloaded the corresponding IOGraphicsFamily package. A initial compilation produced all kinds of errors and warnings including the one you mentioned. So I need to check each of them and fix it.

 

From my past experience, it is an fact that those header files are really missing in our system's framework folder where the compiler is trying to search. But these files actually have a copy in the IOGraphicsFamily project itself. To solve the problem, simply copy them to the system path. Open a terminal, cd to the project directory and do below things:

cd IOGraphicsFamily

sudo cp ./IOKit/graphics/*.h /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/graphics/

sudo cp ./IOKit/i2c/*.h /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/i2c/

 

Here, I not only copied the missing header files, also overwrote those already existing header files. I only find out that I need do this after I encounter a lot errors without a clue and finally it turns out that these existing header files are not updated to correct version by Mac OSX's system update at all...

Thank you SO much for this, but I am hesitant to overwrite files. That's why I started to write some command line tools, but now I'm stuck getting a IOFBConnectRef connectRef from either a io_service_t or io_connect_t Do you happen to know how to do this? This is what I tried (in a nut shell):

IOMasterPort(MACH_PORT_NULL, &masterPort);
service = IOServiceGetMatchingService(masterPort, IOServiceMatching("IOFramebuffer"));

   if (service)
{
	kr = IOServiceOpen(service, mach_task_self(), 0, &connect);

	if (kr)
	{		
		gConnectRefDict = CFDictionaryCreateMutable(kCFAllocatorDefault, (CFIndex) 0,
													(CFDictionaryKeyCallBacks *) 0,
													(CFDictionaryValueCallBacks *) 0 );

		if (gConnectRefDict)
		{
			printf("Have gConnectRefDict\n");

			CFDictionarySetValue(gConnectRefDict, (const void *) (uintptr_t) connect, connectRef);

			connectRef = IOFBConnectToRef(connect);
                      }
	}
	IOServiceClose(connect);
   }
   IOObjectRelease(service);

But I keep getting a segmentation fault. And what I want to do, is to read IOFBConnect to see what values are being used.

 

@Kizwan: I think it's this "IODisplayConnectFlags" = <c4410000> vs "IODisplayConnectFlags" = <84410000> we're looking for. The latter being external DVI as that's what I see here with a Samsung SyncMaster connected to my hack.

 

And "IODisplayConnectFlags" is defined in IOGraphicsTypes.h as kIODisplayConnectFlagsKey so we might/should be able to find more about it. Like in IODisplay:Start in IODisplay.cpp where I found this:

[	fConnection->getAttributeForConnection(kConnectionFlags, &connectFlags);
uint32_t flagsData = (uint32_t) connectFlags;
setProperty(kIODisplayConnectFlagsKey, &flagsData, sizeof(flagsData));

Which basically means that we can change it by using the 'flgs' (kConnectionFlags) parameter (on the display wranger?) to change it.

Share this post


Link to post
Share on other sites

I have been following this post this month, I really must commend mainly Dong and all the others who have been working and making this progress. just brilliant...

 

On another note... The Specs for my system are as follows:

 

Inspiron 6400

1.83 reads as 1.92 GHz Intel Core 2 Duo

ATI Radeon X1400 256MB

4 GB 667 MHZ DDR2 SDRAM

Leopard 10.5.8

- Ideneb 10.5.8

- VoodooPS2, VoodooTSCSync

- ATIRadeonX1000 (7145)

- 10.5.x RadeonHD.kext (posted by Dong to fix hardware cursor, added my EDID)

 

I just installed Snow Loeopard 10.6.4

- [url=&quot;http://www.insanelymac.com/forum/topic/279450-why-insanelymac-does-not-support-tonymacx86/&quot;]#####[/url] Method/[url=&quot;http://www.insanelymac.com/forum/topic/279450-why-insanelymac-does-not-support-tonymacx86/&quot;]#####[/url].

- Disabled Graphics enabler option in the com.apple.plist in /Extra folder

- 10.6.x RadeonHD.kext (posted by Dong to fix hardware cursor, added my EDID optiona

 

THANKS DONG & OTHERS

 

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

 

PROBLEMS:

 

10.5.8

 

- I may need some advice on a power managment, I only see VoodooBattery.kext, I find my cpu is running hot really quick as compared when running the 10.6. Please Help

 

-Not sure if you were able to get Wireless/or this other Card slot working, not the card reader the other one next to it.

 

10.6

 

-Dong, if I am not mistaken you have a smiliar system, I have tried all that I have read concerning enabling Quartz in 10.6, I am not sure what I have done wrong, I am able to change my resolution from 800x600 up to 1440x900, but I still don't have Quartz.

 

OSx86 tools worked at some point but now gives the error Can’t make "The domain/default pair of (com.apple.windowserver, QuartzGLEnabled) does not exist" into type boolean. (-1700)"

- I tried following "michaspoli post Feb 17 2010" and used ALL the ATI.* Kext from Snow Leopard Server Install DISC

 

- In ATIRadeonX1000 Kext installed on the 10.6, the IOPCIMatch string starts with "0x71871002 0x72101002 0x71DE1002 0x71451002" while on the 10.5.8 it starts with "0x71451002"

 

Any assistance from you or anyone else would be greatly appreciated.

Share this post


Link to post
Share on other sites
@Kizwan: I think it's this "IODisplayConnectFlags" = <c4410000> vs "IODisplayConnectFlags" = <84410000> we're looking for. The latter being external DVI as that's what I see here with a Samsung SyncMaster connected to my hack.

On my Dell, it only have VGA & HDMI port. I checked on my Acer Aspire 9420 (have nvidia, display working), the IODisplayConnectFlags = <84490000> on internal LCD. I will try inject both IODisplayConnectFlags (including <c4410000>) using LegacyIOGraphicsFamily.kext (Thanks to you & fred). :)

Share this post


Link to post
Share on other sites

@kizwan

 

here im attaching my ioregistryexplorer file

there are two appledisplay

the firstone is the laptop display :

DisplayProductId 0x214

 

the other one is an axternal monitor via displayport to vga adaptor

 

hope someone can decipher something out of this

Luis_Sebastian_Cuello___s_iMac.ioreg.zip

Share this post


Link to post
Share on other sites

OK..I got it fully working...Quartz Enabled and everything...I am trying to get the sound working...everything tried so far has failed

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×