Jump to content

Editing Custom connector info for Intel HD 3000 Graphics (sandy bridge, OSX Lion)


  • Please log in to reply
211 replies to this topic

#21
IGP3000

IGP3000

    InsanelyMac Protégé

  • Donators
  • 16 posts

Do u use board id in SMBIOS.plist?

<key>SMboardproduct</key>
		<string>Mac-94245B3640C91C81</string>


Yes - use
<key>SMboardproduct</key>
		<string>Mac-942459F8199B171B</string>

But how do I get output of the nm command ??

#22
iLeopod

iLeopod

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 435 posts
  • Gender:Male
  • Location:Germany
  • Interests:ileopod.wordpress.com
Are u using Lion?

#23
IGP3000

IGP3000

    InsanelyMac Protégé

  • Donators
  • 16 posts

How can I find the number for 10.6.8 ??
Everything works now except the the edit of the connector info.


As I wrote earlier 10.6.8....

#24
iLeopod

iLeopod

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 435 posts
  • Gender:Male
  • Location:Germany
  • Interests:ileopod.wordpress.com
Im not sure but , maybe the 10.6.8 driver is still the same as the 10.6.7.

#25
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male
I thought it was clear from post #1 that this thread is about the 10.7 drivers and is not applicable to the older versions.

#26
IGP3000

IGP3000

    InsanelyMac Protégé

  • Donators
  • 16 posts

I thought it was clear from post #1 that this thread is about the 10.7 drivers and is not applicable to the older versions.


Yes you was clear, but after that came 10.6.8 that have a mix of 10.7 drivers...

I still need the index number to the PlatformInformationList for 10.6.8.
Anybody that knows how to find that index number?

#27
iLeopod

iLeopod

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 435 posts
  • Gender:Male
  • Location:Germany
  • Interests:ileopod.wordpress.com
When the command no work this means that the 10.6.8 driver don't support this. But when the press is right u can get Lion on Wednesday.

#28
dougaa

dougaa

    InsanelyMac Geek

  • Donators
  • 179 posts
I have a GA-H67A-UD3H-B3 motherboard, and I found the connector table to use for DVI as the main display:
0000000: 0102 0300 1007 0000 1007 0000  ............
000000c: 0205 0000 0004 0000 0700 0000  ............
0000018: 0304 0000 0004 0000 0900 0000  ............
0000024: 0406 0000 0004 0000 0900 0000  ............
0000030: 0000 0000 0000 0000 0000 0000  ............
For DVI, I removed the connector entry for the LVDS display, and shifted the remaining entries up.

#29
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

For DVI, I removed the connector entry for the LVDS display, and shifted the remaining entries up.

Great, so your DVI port was in the same order as in post #7. I suspect the layout is the same for all sandy bridge desktops that have dvi&dp&hdmi. The motherboards without dp might be more interesting.

#30
131

131

    InsanelyMac Protégé

  • Members
  • PipPip
  • 52 posts
i am downloading xcode 4.0.2 for testing how to edit conector info, i think i can do it.

By the way, dear bcc9, i think my MB is as same as you, GA-H67MA-UD2H-B3, if i can believe the result i will get as same as you( i mean appleintersnbgraphicsfb.kext)?

If the result is same, can you upload your woking kext named appleintelsnbgraphicsfb.kext? my cpu is i3 2105 ES, with HD3000 device id is 0x0112.

Thank you very much.

#31
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male
Sorry, no, my modified kext will do you no good as I modified mine for displayport use, per post #1, and you just finished writing that you are using DVI. Besides, the whole point of this thread is to show you how to edit your own kext, not to offer up a binary patch that nobody understands how to maintain.

#32
131

131

    InsanelyMac Protégé

  • Members
  • PipPip
  • 52 posts
Thanks for bcc9. i got my DVI work :P 

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

Last login: Tue Jul 19 13:52:16 on console

188:~ ye$ cd /System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/MacOS

188:MacOS ye$ nm -arch x86_64 AppleIntelSNBGraphicsFB | grep 'D _PlatformInformationList'

0000000000029600 D _PlatformInformationList

188:MacOS ye$ lipo -detailed_info AppleIntelSNBGraphicsFB

Fat header in: AppleIntelSNBGraphicsFB

fat_magic 0xcafebabe

nfat_arch 2

architecture x86_64

	cputype CPU_TYPE_X86_64

	cpusubtype CPU_SUBTYPE_X86_64_ALL

	offset 4096

	size 283552

	align 2^12 (4096)

architecture i386

	cputype CPU_TYPE_I386

	cpusubtype CPU_SUBTYPE_I386_ALL

	offset 290816

	size 294736

	align 2^12 (4096)

188:MacOS ye$ /code]



So i got the disk address is 0x29600+4096=173568.



let's go on

188:MacOS ye$ dd if=AppleIntelSNBGraphicsFB of=/tmp/table bs=1 skip=173568 count=60

60+0 records in

60+0 records out

60 bytes transferred in 0.000395 secs (151876 bytes/sec)

188:MacOS ye$ cd /tmp

188:tmp ye$ xxd -c 12 < table > hex

188:tmp ye$ cat hex

0000000: 0102 0300 1007 0000 1007 0000  ............

000000c: 0205 0000 0004 0000 0700 0000  ............

0000018: 0304 0000 0004 0000 0900 0000  ............

0000024: 0406 0000 0004 0000 0900 0000  ............

0000030: 0000 0000 0000 0000 0000 0000  ............



BY THE WAY, the code above had been edited, i want 0205 (DVI)work, so i should put it in row2, right?



xxd -c 12 -r hex >! table

% dd if=table of=/System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/MacOS/AppleIntelSNBGraphicsFB bs=1 seek=173568 conv=notrunc



here i got the information 



60+0 records 

60+0 records out



and 

% touch /System/Library/Extensions  it show me need permission, so i put sudo touch /System/Library/Extensions



i need reboot  for test.



After reboot, thanks for bcc9, i SUCCEED!  Thanks for every one!


#33
guymass

guymass

    InsanelyMac Protégé

  • Members
  • Pip
  • 13 posts
Hello, I have a DELL (R15) N5110 notebook which has HD3000 as one of its graphics cards. I have installed Lion DP4 on it, and it has this 5 sec delay. This was not happening on Lion DP3.

I wanted to ask if someone can help in fixing this issue. my table is not like the one on this post. My nm command produced something a bit different.

00000000000c5a9 t __GLOBAL__D_PlatformInformationList which I believe the address was 0x0c5a9 + 4096 =54697

My table is different, so can this technique be used the same? and how do I know which connector is causing the problem.

I would appreciate any help.

#34
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,281 posts
  • Gender:Male

00000000000c5a9 t __GLOBAL__D_PlatformInformationList which I believe the address was 0x0c5a9 + 4096 =54697

My table is different, so can this technique be used the same? and how do I know which connector is causing the problem.

I would appreciate any help.

If that's your output, it's because you didn't type the nm command as in post #1. Looks like you flubbed the grep part.
It's nonsense to think your table is different, the table is statically hard-coded into the driver.
Post #1 does already show exactly what to type for DP4, you should be able to follow along... (You could even skip the nm step as the number is going to be as shown in post #1).



BY THE WAY, the code above had been edited, i want 0205 (DVI)work, so i should put it in row2, right?

Yes, for dvi as the primary output, row 3 would be moved to row 2, and you'd adjust the connector count and remaining rows. Looks like you got it.

#35
rimmi2002

rimmi2002

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 153 posts

Some prerequisites:

  • Installation of OSX Developer tools (if you need to lookup a PlatformInformationList that has not already been done by someone else)
  • Understanding of hex editing
  • Ability to troubleshoot by looking at ioregistry
As of the 10.7 developer preview code, the intel driver uses Smboardproduct (aka board-id in the ioregistry) to determine the display connectors that are available via the Intel HD 3000 graphics hardware. Actually there's also AAPL,snb-platform-id in the ioregistry that achieves the same result, but I'm going to ignore that for now.

Older code (10.6 including the 2011 MBP sandy bridge update) seems to strictly rely upon the os-info ioregistry entry for this information. I have not, and probably won't, look into editing os-info to change connector information.

With a 10.7 based version of AppleIntelSNBGraphicsFB.kext, the code uses the board-id as an index into the PlatformInformationList[] table. This table is pretty handy, and looks like:
/* 12 byte connectorinfo */
typedef struct {
	   char byte0;
	   char byte1; /* i2cid? */
	   char unused[2];
	   uint32	   connectortype;	/* The connector type, see below */
	   char byte[4];
} connectorinfo_t;

/* 60 byte total */
typedef struct {
	char byte0; /* Presence? */
	char byte1; /* For display pipe max connector index? */
	char byte2; /* Usable Connector count */
	char byte3; /* Appears unused */
	char byte[8];
	connectorinfo_t connectors[4];
} PlatformInformationList_type;

PlatformInformationList_type PlatformInformationList[8];

where integers are represented in intel little-endian byte order, and bit 0 is the LSB.
In English, there are 8 tables in the list, each 60 bytes long. Each 60 byte table entry starts with a 12 byte header, followed by 4 connector information blocks. The connector information blocks are each 12 bytes long.

The connectorytype field appears to use the same codes as the ATI driver, where the only used values used by the driver thus far are:

#define CONNECTORTYPE_LVDS 0x00000002 /* Ie internal Low Voltage display, such as laptop */
#define CONNECTORTYPE_DP 0x00000400 /* Displayport */
#define CONNECTORTYPE_HDMI 0x00000800

If you don't set your board-id to a recognized value, a default connector table is instead taken from the address PlatformInformationDefault. THe default table only has 1 usable connector so this is likely to give you reduced functionality.

Setting SMboardproduct to various sandy bridge board-ids defines the index into PlatformInformationList[]. Interestingly only indexes 0 thru 5 are currently allowed (even though there are two more table entries...) In any case, for the purpose of this note, we'll use index 0 by setting the board-id to the MacBookPro8,1 value. In smbios.plist:
<key>SMboardproduct</key>
		<string>Mac-94245B3640C91C81</string>

Unfortunately all 8 table entries use an LVDS connector for the first value, and the driver seems to malfunction if you have nothing plugged into this port. In my case I would see the kernel log fill up with errors about a stuck ring:
kernel[0]: WaitForStamp: Overflowed waiting for stamp 0x2f3 on Main ring: called from
...
kernel[0]: Looks like Main ring is stuck waiting on an event
kernel[0]: After attempt to clear wait condition = 0x00003001 no longer waiting
And it would get re-stuck every 5 seconds or so. More importantly this would make the graphics unusably slow unless I unplugged the display for > 5 seconds first. At that point the stuck ring problem would "heal"... Using a dual-head setup also seems to avoid this problem.

However, rather than hot-plugging the graphics display upon every boot, one can instead modify the above table to avoid this problem.

First we find the PlatformInformationList table. In the example below I'm using DP4:
% cd /System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/MacOS
% nm -arch x86_64 AppleIntelSNBGraphicsFB | grep 'D _PlatformInformationList'
00000000000295f0 D _PlatformInformationList
% lipo -detailed_info AppleIntelSNBGraphicsFB
Fat header in: AppleIntelSNBGraphicsFB
fat_magic 0xcafebabe
nfat_arch 2
architecture x86_64
	cputype CPU_TYPE_X86_64
	cpusubtype CPU_SUBTYPE_X86_64_ALL
	offset 4096
	size 283008
	align 2^12 (4096)
architecture i386
	cputype CPU_TYPE_I386
	cpusubtype CPU_SUBTYPE_I386_ALL
	offset 290816
	size 293092
	align 2^12 (4096)
%
So now we know the disk address for this table is:
0x295f0+4096=173552
Since there are 8 tables of 60 bytes, we could dump 8*60=480 bytes to see all 8 tables. Since I've chosen to work on the first entry, I'll dump just 60 bytes.
ALso since each connector is 12 bytes, I dump 12 bytes per line for our viewing pleasure.
% dd if=AppleIntelSNBGraphicsFB of=/tmp/table bs=1 skip=173552 count=60
60+0 records in
60+0 records out
60 bytes transferred in 0.000142 secs (422955 bytes/sec)
% cd /tmp
% xxd -c 12 < table > hex
% cat hex
0000000: 0102 0400 1007 0000 1007 0000  ............
000000c: 0503 0000 0200 0000 3000 0000  ........0...
0000018: 0205 0000 0004 0000 0700 0000  ............
0000024: 0304 0000 0004 0000 0900 0000  ............
0000030: 0406 0000 0004 0000 0900 0000  ............
%
In the above table you can see that 4 connectors are marked usable, 1 LVDS and 3 DP. On my h67 motherboard, I have 4 connectors: VGA, DVI, DP and HDMI. The DVI, DP and HDMI connectors all work with the DP connectortype shown in this table (the intel driver doesn't seem to use the connectortype for much).

I believe I can tell which of the above entries match my hardware by checking which entry has av-signal-type set, (or when AAPL,DisplayPipe != 0xffff?). I certainly can by exhausting testing of the combinations...

Now, to remove the problematic LVDS entry, I edit the hex file, producing:
0000000: 0102 0300 1007 0000 1007 0000  ............
000000c: 0304 0000 0004 0000 0900 0000  ............
0000018: 0205 0000 0004 0000 0700 0000  ............
0000024: 0406 0000 0004 0000 0900 0000  ............
0000030: 0000 0000 0000 0000 0000 0000  ............
In the above I moved the hex from the 3rd connector (row 4) to the first (row 2), zeroed the hex in row 5, and subtracted 1 from the connector count in row 0.

Now I write back the result:
xxd -c 12 -r hex >! table
% dd if=table of=/System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/MacOS/AppleIntelSNBGraphicsFB bs=1 seek=173552 conv=notrunc
% touch /System/Library/Extensions
Viola, 3 working connectors and no driver hangs, instead of 1 broken connector & 3 working connectors with driver hangs.



Great work Bcc9. I have a i2500k on GA-Z68MA-UD2H-B3 Mobo. I used your method to get my hex table.

Sorry I am new to hex editing and don't know how to edit the table. I was wondering if someone can please guide me.

I tired to find if the table file exists somewhere, but either its hidden or its exist in the /System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/MacOS folder under the tmp folder. I found a few hex editors, but didn't want to go about editing the original AppleIntelSNBGraphicsFB file.

If someone can please tell where is the file that I need to hex edit it'll be great. I have 3 display ports only. (VGA, DVI, HDMI) so I am planning on zeroing out the the bottom two lines. Moving 0205 0000 0004 0000 0700 0000 (which I am assuming is the DVI port) as line # 2 and then subtracting the count by 2. Please let me know if this is correct. I have attached my terminal output below. Once again thanks so much for your help.

Attached File  Terminal.jpg   52.53KB   237 downloads

#36
rimmi2002

rimmi2002

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 153 posts
Alrite I got hexedit and opened up AppleIntelSNBGraphicsFB and changed the entrees individually.

My original output for the connectors was:

0000000: 0102 0400 1007 0000 1007 0000  ............
000000c: 0503 0000 0200 0000 3000 0000  ........0...
0000018: 0205 0000 0004 0000 0700 0000  ............
0000024: 0304 0000 0004 0000 0900 0000  ............
0000030: 0406 0000 0004 0000 0900 0000  ............

Now my output looks like:
0000000: 0102 0300 1007 0000 1007 0000  ............
000000c: 0205 0000 0004 0000 0700 0000  ............
0000018: 0304 0000 0004 0000 0900 0000  ............
0000024: 0406 0000 0004 0000 0900 0000  ............
0000030: 0000 0000 0000 0000 0000 0000  ............


I changed one of the IOPCIPrimaryMatch device ID to 0x0112 form 0x0102.

I got native resolution for my monitor. However no video playback. Anyway to activate videoplayback or is this the best we can do?


Also bccc9..had a questions if you can please help me out.

I put in this command: (count = 96)
dd if=AppleIntelSNBGraphicsFB of=/tmp/table bs=1 skip=173568 count=96

This is the output I got

0000000: 0102 0400 1007 0000 1007 0000  ............
000000c: 0503 0000 0200 0000 3000 0000  ........0...
0000018: 0205 0000 0004 0000 0700 0000  ............
0000024: 0304 0000 0004 0000 0900 0000  ............
0000030: 0406 0000 0004 0000 0900 0000  ............
000003c: 0102 0100 1007 0000 1007 0000  ............
0000048: 0503 0000 0200 0000 3000 0000  ........0...
0000054: 0000 0000 0100 0000 4000 0000  ........@...

Seems like this code in the one that is execute when there is no display that is found?

000003c: 0102 0100 1007 0000 1007 0000  ............
0000048: 0503 0000 0200 0000 3000 0000  ........0...

Any benefit in changing it? I changed it to-

000003c: 0102 0100 1007 0000 1007 0000  ............
0000048: 0205 0000 0004 0000 0700 0000  ........0...

Still didn't get any video playback.

Also in my AppleIntelSNBGraphicsFB the code was repeated twice. One is earlier in the file (which is what is output with bcc9's method - I tested it) The second in much later in the file.

There were two occurences of:

0000000: 0102 0400 1007 0000 1007 0000  ............
000000c: 0503 0000 0200 0000 3000 0000  ........0...
0000018: 0205 0000 0004 0000 0700 0000  ............
0000024: 0304 0000 0004 0000 0900 0000  ............
0000030: 0406 0000 0004 0000 0900 0000  ............
000003c: 0102 0100 1007 0000 1007 0000  ............
0000048: 0503 0000 0200 0000 3000 0000  ........0...

I changed them both to
0000000: 0102 0300 1007 0000 1007 0000  ............
000000c: 0205 0000 0004 0000 0700 0000  ............
0000018: 0304 0000 0004 0000 0900 0000  ............
0000024: 0406 0000 0004 0000 0900 0000  ............
0000030: 0000 0000 0000 0000 0000 0000  ............
000003c: 0102 0100 1007 0000 1007 0000  ............
0000048: 0205 0000 0004 0000 0700 0000  ........0...

First time I got a kernel panic on startup telling me to restart. On restart it went through. Still no video. I tried to change all 3 occurrences of <key>IOPCIPrimaryMatch</key> <string>0x01128086</string>. Went back 1024x768. So Went back to my baseline.....


So still no luck with video playback. Any advice from anyone?

#37
dougaa

dougaa

    InsanelyMac Geek

  • Donators
  • 179 posts

So still no luck with video playback. Any advice from anyone?


When you say video playback, what exactly are you doing? Then what happens when you try? Any error message? Anything show up in the logs? (Use the Console utility to look at the logs.)

#38
rimmi2002

rimmi2002

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 153 posts

When you say video playback, what exactly are you doing? Then what happens when you try? Any error message? Anything show up in the logs? (Use the Console utility to look at the logs.)


Just a black screen with audio only on mplayerx or vlc. Will check in console utility.

#39
dougaa

dougaa

    InsanelyMac Geek

  • Donators
  • 179 posts

Just a black screen with audio only on mplayerx or vlc. Will check in console utility.

I did a quick check with VLC in both Snow Leopard and Lion, and didn't notice any problems. I used a .mp4 file with no DRM. I'm using device-id injection in the DSDT. For Lion I patched the connector list in AppleIntelSNBGraphicsFB.kext (as described in this thread), and for Snow Leopard I used device-properties in the boot plist to define AAPL,os-info. I have a GA-H67A-UD3H-B3 motherboard and i5-2500K CPU, and I'm using the DVI connector.

#40
rimmi2002

rimmi2002

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 153 posts
I noticed bcc mention that this might be different for boards without a display port. Mine has only three connectors. VGA/DVI/HDMI. When the above layout I (01, 02, 03, 04, 00) I get both VGA and DVI to work. Didn't test HDMI. I'll try different combos i guess 03 first and then 04 first and see it makes a difference.

I'm assuming you are also changing the information in info.plist you add your device id. Mine is 0x0112. Or are no alterations being made to info.plist.

Also was curious in smbios.plist what mac model and and smproductid are people using?





0 user(s) are reading this topic

0 members, 0 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