字体:  

针对共享内存的显卡,转一份外网贴子.以共同学习.

gemini_ 发表于: 2008-7-23 23:26 来源: 远景无限博客

我的机器AMD4000+ ASUS M2N-MX SE 集成了6150SE 加了8139网卡.
用K版,LEO4ALL V3都可以成功.但有显卡一直找不到好的驱动,今天看到一处贴子:
http://forum.insanelymac.com/index.php?showtopic=102006&st=60
感觉还不错.认为有必要学习,尝试一下,先转来贴子(E文水平有限,翻译不好,但能粗略看懂,不提供翻译了)
You probably wont have QE/CI after this, but you might. I dont, and I am stuck at 1024x768 with minimal OpenGL acceleration. What it does get shared memory card users is 80% of the way there, IMHO. Plus, proof of concept that it is possible to get stock (well....hacked stock anyway) drivers working with shared memory. You still need a valid injector of some sort like NVInject or PCEFI and a working NVCAP. This guide assumes you have all this already.

And instead of mentioning people at the end where nobody reads because they already know what to even though they have not read that part,
I'd like to thank jonniecarcinogen, Scott Angel, gotoh, MeDevil, Chu-Nan,Toh and InsanelyMac. None of whom I have ever met or corresponded with  
I could not have gotten this far without your help, your kexts, your posts, your files and your willingness to let others benefit from what you have learned.

Let's start with my relevant hardware:
Compaq Presario F500 GF596UA
AMD TK-53 Dual Core 64 bit proc @ 1.7GHz
2048MB (2GB) DDR2 ram in dual channel mode
NVidia GeForce 6100 Go (PCIe) w/128MB shared only memory (PCI ID 0x024710de)
1280x800 native resolution internal panel
External VGA (NOT DVI) connector
External S-Video (via dongle)
External HDMI (via dongle)
The dongle is factory supplied

The External VGA is primary
The internal panel is secondary
The S-Video is 3rd
The HDMI is 4th
(according to ioreg)

Software:
Leo4allv3 10 TOH kernel, flags: maxmem=1791 cpus=2 idlehalt=0 -v
Ch-Nan's IOPCFamily kexts
MeDevil's NForce test
NVidia drivers & Open GL framekwork from latest NVinstaller .41 (OpenGL framework v1.5.6.20.0)
PCEFIv8
removed ApplePS2 kext & most thermal kexts I can find

!!!!!!!!!!!!!!!!!BACK UP YOUR DRIVERS BEFORE YOU DO ANY OF THIS!!!!!!!!!!!!!!!!!!!! Save them on a flash drive or keep them on your desktop in a locked folder so they are less likely to be changed on accident.

1>
We start by finding the ID of the unsupported shared memory video card without the vendor ID. Mine is 0247.
Next, Find the closest compatible supported non-shared memory card. The closest I could find was an NVidia 6100. The PCI ID for that supported card is 0244. If you cant find an exact match, go down, not up. I.E. If you cant find an ID for a non-shared 5750, go with a non-shared 5700 that is on the supported list. If there is no 5700, go to 5600, etc...

2>
Edit the Info.plist for NVDAResman and IONDRVSupport. Add your unsupported card ID+vendorID (mine is 0x024710de) to the Info.plist as you normally would.
NOTE: You dont have to edit the Info.plist for IONDRV. I changed the IOPCIClassMatch to IOPCIMatch and changed the value as above to be sure. Cuz' I'm like that.

3>
Edit the executable in the respective bundles with a hex editor, such as 0xED
When I say executable, I mean the binary file inside the kext that matches the name of the kext. For example. In NVDAResman it is located at:
./NVDAResman.kext/Contents/MacOS/NVDAResman
For IONDRVSupport the executable is located at:
./IONDRVSupport.kext/IONDRVSupport

Use one of the following two methods to do a search and replace. Search for the supported card's ID (0244) and replace it with the unsupported card's ID (0247)

3a> Surgical Method (long and tedious, took me about 3 hours for all 15 kexts/bundles/plugins below)
Find every occurence of the SUPPORTED card's ID inside each executable and make a judgement call about wether that particular value should be changed or not. If it looks to be part of a look up table. For example, there are other supported card ID's in close proximity to the one you are changing. My THEORY is that a group of cards may or may not support a particular function inside the executable. Whether or not that function is supported by that card is determined by it's inclusion or exclusion in one or more look-up tables inside the executable.

3b> SPAM method (quick and dirty, took me about 15 mins for all 15 kexts)
Do a global search and replace inside each executable. Search for the supported card's ID (0244 in my case) and replace each and every occurrence without regard, to the unsupported card's ID (0247 for me)

It is worthy of noting that both methods have produced the same results thus far. Though, for sure, gotoh is putting my IP on a DOS list for posting the spam method.  

3c> OPTIONAL
Repeat the above steps for ALL the rest of the NVIDIA kexts (and bundles and plugins). I will list them all here:
(INFO: I dont think the Info.plist in any of the bundles needs to be modified. Just the executables within, and quite frankly, im not even sure about that.)

GeForce.kext
GeForce2MXGLDriver.bundle *you can probably safely ignore this one
GeForce3GLDriver.bundle *this one too
GeForce7***GLDriver.bundle
GeForce8***GLDriver.bundle
GeForceFXGLDriver.bundle
GeForceGA.plugin
GeForceVADriver.bundle
IONDRVSupport.kext
NVDANV10Hal.kext
NVDANV20Hal.kext
NVDANV30Hal.kext
NVDANV40Hal.kext
NVDANV50Hal.kext
NVDAResman.kext
IOGraphicsFamily.kext

INFORMATIONAL:
3c1>You know that crap that you see when booting with -v "Matching Service Count =" whatever. Well, 5 of those come from these HAL's If you put your video card's ID in the Info.plist for each HAL, even if you dont think your card needs it, you should see "Matching Service Count=5" 6 times. Since there are 6 lines, it makes me wonder if the matching service count number should really be 6. Perhaps another Kext/bundle/plugin/framework is involved that I have not identified yet. The OpenGL frameworks are the first to come to my mind, as they are included with the NVidia distribution.
3c2>Some source would be nice here, so the surgical method could be made painless.  

4> Edit the Info.plist in NVDAResman.kext. Look for the section IOKitPersonalities.
4a> The first section should be entitled NVidiaRM. Inside there, you will find an array named "IONameMatch" On one of the lines, you should see the value "NVDA,NVMac" Change this to the name your INJECTOR has assigned to the primary display. Usually, this is NVDA,Display-A. I have seen some injectors that name this value NVDA,NVPR.
4b> The second section is named NVidiaRMPCIMatch. If you followed the directions in step 2, your unsupported card's ID+vendor ID should already be in the IOPCIPrimaryMatch value. In my case, this would be 0x024710de. If it is not already there, add it now.
4c> The third section should be entitled NVidiaRMTwinView. Inside there, you will find an array named "IONameMatch" On one of the lines, you should see the value "NVDA,NVMac" Change this to the name your INJECTOR has assigned to the secondary display. Usually, this is NVDA,Display-B. I have seen some injectors that name this value NVDA,NVSE.

NOTE:
If this step is not completed correctly, the machine may boot completely in text mode, meaning no graphics at all. If you see a lot of disk activity that eventually ends, but no graphics, this is probably what has happened. Press the power button momentarily and then the enter key. If this is what happened, your machine should shut down safely.
The other thing that happens when this is not completed right, is the machine seizes up 100% when NVDAResman has completed loading. You will know this has happened, when the machine halts disk and screen activity after dsmos is loaded. Your only option is to hold the power button down for 5-7 seconds to do a hard shutdown. Try the NVPR/NVSE values, or try reversing them. I.E. step 4a becomes NVDA,Display-B and step 4c becomes NVDA,Display-A.

NOTE:
I would recommend doing steps 5 and 6 in single-user mode. Kext helper is cool, but it seems to choke when you move to many at once. If you have some other method of replacing all the kexts at once, go right ahead. I have also had my machine lock up during installation and removal of video driver kext.s

5> Remove all Macvidia or NVidia or whatever drivers you are currently using. DO NOT remove your injector (not an issue if you are using PCEFI), Eg. Titan, Natit or NVInject.
NOTE:
This has only been tested so far with PCEFI. Kext style Injector users are encouraged to experiment and post results back. Be sure as always to include as much information about your setup as possible.

6> Copy the hacked video driver kexts into your /System/Library/Extensions dir. The bare minimum, without anything else you need is IONDRVSupport. Then Resman. The HAL's third and the Ge's last. If you want to install them in sections, use that order. Or, for the purposes of this guide, install IONDRV and Resman at the same time.
NOTE:
Because I am lazy, I created a symbolic link named /sle that points to this directory. It might make your life easier too. (ln -s /System/Library/Extensions /sle)

7>MATH TIME!!!! You are going to need to make a permanent change to your boot process. It's a kernel parameter named "maxmem". This keeps OSX from trampling on the shared video memory. First of all, set your BIOS to the amount of ram you want set aside for your video card. Take that number and add 1 to it for safety. You dont have to, but I do. In my case, I have my BIOS set for 128MB. Plus 1 for 129. Subtract 129 from the total amount of RAM in your system in megabytes. In my case i have 2GB or 2048MB of RAM. I subtract 129 from 2048 and I have my maxmem value of 1919. My new kernel parm is maxmem=1919.
注:com.apple.Boot.plist( 位置/Library/Preferences/SystemConfiguration/)kernel flags 字段下加入 maxmem=****(不加空格)如:
<key>Kernel Flags</key>
<string>maxmem=1790</string>
修改之前可以先尝试一下:在进入Leopard前按f8,然后输入 maxmem=****,暂时***内存数量,修改com.apple.Boot.plist是为了让系统自动***,免去每次开机都要输入的麻烦。
maxmem取于内存减显存减1

NOTE:
I strongly advise the use of boot plists during experimentation. I have included copies of them as well. They go in your /Library/Preferences/SystemConfiguration dir and they save a whole lot of typos. Where you would normally enter kernel flags and parms, you enter "config=" and the name of the plist in the above directory you want to use. Some have different values for maxmem, others boot into single-user mode, etc... If you are not using EFI, edit them and remove the device properties. If you are using EFI, and you are not doing this on my laptop, you should edit them as appropriate.  I have tried to name them to make them easy to use and remember.

8> Delete /System/Library/Extensions.mkext. Reset your permissions, rebuild your kextcache. Alternately, use the d script below to do this. (See the scripts attachment below. Comments are welcome about them too). Reboot. Halt the boot process. Enter any flags or kernel parms you normally would plus the maxmem plus -f (see why I love boot plists?) Or use a version of my boot plists customized for your machine and type: config=reconfig

You should have 1024x768x32 with stock/hacked NVidia drivers and shared memory. Maybe you will luck out and get QE/CI too. In a perfect world, where your NVCap is correct, you should get native resolution support too.

If you get a panic on reboot, and it appears to be from NVDAResman, try deleting GeForce.kext Maybe use the surgical method on that one and try again. You should not need it to complete the boot process or get native resolution support, unless I am mistaken.

And lest your heathen eyes think this be nut'n but skulduggery, smoke and mirrors, I am including my ioreg dumps. (Yes, my home wireless network is really named jackass2)

I put this out to the community hoping that others can add to it, correct it and improve it. Maybe someone could write a script or a prog that would change only the values needed for proper operation, edit the Info.plists, delete, copy, rebuild the cache, etc... Maybe someone else can get it to actually work!  

All constructive comments are welcome.

I dont know if this is appropriate in this forum, but I am soliciting donations. Paypal style: g33k [at] azcomputerg33k [dot] com. Even if it is just a dollar. I'm a victim of the economy, having lost my job recently. If this leads to the eventual resolution of this shared (memory HAHAHA) conundrum, I'll give you my Swiss bank account number and you can all get together and deposit several hundred million there. Alternatively, if you want to hire me as a telecommuting technical writer, an SQL Server or Sybase DBA or a lin/win/unix admin, PM me here. My wife thanks you, as do I.

-w00f

I wrote all these scripts. They are MINE MINE MINE!!! I'm not responsible if you are an idiot and mis-use them. Nor am I responsible if you are smart and mis-use them. In general, mis-use is bad. Be a good person and dont mis-use anything. Unless you need to. In which case, it's probably OK. Just dont mention my name.

  nvi.zip ( 74.2K ) Number of downloads: 17


SCRIPTS:
Copy these to /usr/bin. Edit them and improve them and share them.
a does the fsck after single user boot
b mounts root volume as R/W
c mounts /dev/disk1s1, an MSDOS file system on /fd (I used this to mount flash drives in single user)
d resets permissions, deletes and rebuilds kext caches and delayed shared cache for i386 and x86_64
e show the last few lines of the system log a page at a time.
f create ioreg files (for debugging purposes) and zip them into a single file in /tmp. You can upload these diagnostic files to forums or email them to others so that they may assist you better with technical issues.

BOOT PLISTS:
Copy these to /Library/Preferences/SystemConfiguration
com.apple.Boot This is the default plist that is parsed when the system boots normally (Mine has stable EFI string, maxmem=1791 idlehalt=0 -v)
reconfig Same as com.apple.Boot, but with -f flag to rebuild kernel caches
single Single user mode
singlesafe Single user safe mode boot
test contains different flags or maybe a different EFI string, whatever I need to experiment with.
testr Same as test, but with the -f flag

[ 本帖最后由 gemini_ 于 2008-7-23 23:49 编辑 ]

最新回复

纸杯 at 2008-7-23 23:30:58
看不懂!用不上!纯支持!
gemini_ at 2008-7-23 23:34:03
马马虎虎.有结果了再来回报.有好心的E文水平强的同人,帮翻译下更好.
youminbuluo at 2008-7-23 23:36:28
此贴作者的理念是:由天显卡共享内存,应把内存最大值***出来.留出显存所用.在XP下,查看内存都是去了显存后的值.

对于N卡,则共享显存调到最低,显卡性能最高
其实显卡性能主要由位宽决定,显存是纯属YY的,没什么用的
gemini_ at 2008-7-23 23:42:04
共享内存的显卡现在是驱动问题,不是多少分配多少显存性能更高.
我的是6150SE 驱动试了N个没结果.试试这个再说

[ 本帖最后由 gemini_ 于 2008-7-23 23:58 编辑 ]
youminbuluo at 2008-7-23 23:45:25
我对集成显卡不够了解
就知道intel的和Nforce的
skyskai at 2008-7-24 01:45:56

QUOTE:

原帖由 gemini_ 于 2008-7-23 23:42 发表
共享内存的显卡现在是驱动问题,不是多少分配多少显存性能更高.
我的是6150SE 驱动试了N个没结果.试试这个再说
我的也是,C61芯片的集成显卡。6150SE on nfouce 430 chipset。

无奈,随便找了块便宜的7300GS卡就完美驱动了。决定不在集显上再花功夫了。似乎还没有人成功的。
绝梦方空 at 2008-7-24 04:27:42
貌似 是中文的比较好一点
wcccys at 2008-7-24 15:42:41
看不大懂。。。
gemini_ at 2008-7-24 23:16:16
还是没有成功
gemini_ at 2008-7-27 12:24:42
没有.那几个文件需要用十六位修改.我找不准位置
wcccys at 2008-7-27 14:05:04
看不大明白。。
wrhzt at 2008-7-28 14:40:10
高手出来翻译一下,解救一下使用6150集成显卡的人
cmise at 2008-7-28 18:12:49
花大精力搞集显,还不如换块廉价的独显,少了很多问题.