Realview and OpenGL in Solidworks in Parallels on the Hackintosh

Those orange lines in a Solidworks drawing when mousing over a part… they were taking FOREVER to render! So, I did a lot of research, and this is what I found:

  • RealView was greyed out:
  • Solidworks was using Software OpenGL with no way of disabling it:

Now I have an Nvidia GForce GTX 770 graphics card in my Hackintosh. It’s not the best, but it’s also no slouch and it certainly is capable of doing the nice stuff with Solidworks… with a registry hack or two…

DISCLAIMER – I’m not sitting in front of your computer. You are. If anything stops working or breaks after following my instructions, it’s all your fault, not mine.

  1. Solidworks supports the really high-end Nvidia cards. This means the Quadro series mainly. The GTX 770 isn’t supported. However, it’s closely related to a Quadro. Over to Wikipedia, and we discover that it’s closest relative is the Quadro K5000:  This gives us some really usefull information. We’re going to make Solidworks think we’re running a Quadro K5000!
  2. Now we need to hack the registry. Open it using regedit and BACK UP YOUR REGISTRY!!! DO IT!!!
  3. Under HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks <your Solidworks version>\Performance\Graphics\Hardware\Current, copy the value for the Renderer string:  in our case, it’s “Parallels using NVIDIA GeForce GTX 770 OpenGL Engine”
  4. Under HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks <your Solidworks version>\Performance\Graphics\Hardware\Gl2Shaders\NV40 find the Quadro K5000 key and note the value for the Workarounds DWord:In our case, it’s 40408
  5. Right click on the  HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks <your Solidworks version>\Performance\Graphics\Hardware\GI2Shaders\Other and select “New” and “Key”. Paste the value that you copied from step 3, but remove reference to OpenGL. In our case it becomes “Parallels using NVIDIA GeForce GTX 770” (Without the quots)
  6. Right click in the right window and select “New” and “DWORD (32-bit) Value”. Name the new DWord “Workarounds” (without the quotes) and set its value to the value found in step 4 (in our case, 40408):
  7. Now select HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks <your Solidworks version>\Performance\Graphics\Hardware\Parallels and NVIDIA Corporation and set the “Workarounds” DWord value to the value found in step 4 (Again, in our case, 40408):
  8. Now select HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks <your Solidworks version>\Performance\Graphics\Hardware\Parallels Inc. and NVIDIA Corporation and set the “Workarounds” DWord” value to the value found in step 4 (Again, in our case, 40408):
  9. Exit Regedit. This saves the registry

You now have working hardware OpenGL:and working RealView:This should work for other card models too, provided you select the correct Workarounds value

Sapphire HD6670 on OS X 10.7.5 – Enabling the HDMI port

One of the problems using the Apple drivers drivers is that they are produced for a very small subset of cards that Apple support. My particualr card has three ports, HDMI, DVI and VGA. While it’s possible to get this particular Sapphire HD6670 card mostly supported by setting it’s personality to Pithecia in the boot plist, there will be no output from the HDMI port, as the Pithecia personality is for a card with DisplayPort, DVI and VGA.

So….some hacking is required……..

1. Dump the personality out of the kext.

To get a list of the supported personalities, you will need to dump them out of the kext. Download ati-personality.pl (Google it), and run it against /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ATI6000Controller – the bit I’m interested in is as follows:

Kext /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ATI6000Controller
Personality: Pithecia
ConnectorInfo count in decimal: 3
Disk offset in decimal 181984
0000000    00  04  00  00  04  03  00  00  00  01  00  00  21  03  02  04
0000010    04  00  00  00  14  02  00  00  00  01  00  00  00  00  04  03
0000020    10  00  00  00  10  00  00  00  00  01  00  00  00  00  00  01
0000030

The three lines of hex detail the configuration of each port. Taking the first line, it can be broken down as follows::

Connector                00  04  00  00
ATY, Control Flags    04  03  00  00
Features                   00  01
Unknown                  00  00
Transmitter               21
Encoder                   03
Hotplug ID               02
Sense ID                  04

2. Dump the card BIOS

You will need a dos boot USB drive (Google it), and atiflash.exe (Google it). boot off the dos drive, and run

atiflash -s o atirom.rom 20000

3. Get the card details out of the BIOS

Boot back into OS X, and run redsock_bios_decoder agains the BIOS (Google it). The output of mine looks like this:

198X14A5.S23:

AMD HD6770 2G

Subsystem Vendor ID: 174b
 Subsystem ID: e198
Object Header Structure Size: 203
Connector Object Table Offset: 34
Router Object Table Offset: 0
Encoder Object Table Offset: 9d
Display Path Table Offset: 12
Connector Object Id [12] which is [HDMI_TYPE_A]
 encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x12 [duallink 0x2] enc 0x4)] linkb: false
Connector Object Id [4] which is [DVI_D]
 encoder obj id [0x1e] which is [INTERNAL_UNIPHY (osx txmit 0x10 [duallink 0x0] enc 0x0)] linkb: false
Connector Object Id [5] which is [VGA]
 encoder obj id [0x15] which is [INTERNAL_KLDSCP_DAC1 (osx txmit 0x00 enc 0x10?)] linkb: false

Run radion_bios_decode against the BIOS. The output of mine looks like this:

ATOM BIOS Rom: 
    SubsystemVendorID: 0x174b SubsystemID: 0xe198
    IOBaseAddress: 0x0000
    Filename: 198X14A5.S23
    BIOS Bootup Message: 
AMD HD6770 2G                                                               

PCI ID: 1002:6758
Connector at index 0
    Type [@offset 44274]: HDMI-A (11)
    Encoder [@offset 44278]: INTERNAL_UNIPHY2 (0x21)
    i2cid [@offset 44348]: 0x94, OSX senseid: 0x5
Connector at index 1
    Type [@offset 44284]: DVI-D (3)
    Encoder [@offset 44288]: INTERNAL_UNIPHY (0x1e)
    i2cid [@offset 44375]: 0x92, OSX senseid: 0x3
Connector at index 2
    Type [@offset 44294]: VGA (1)
    Encoder [@offset 44298]: INTERNAL_KLDSCP_DAC1 (0x15)
    i2cid [@offset 44402]: 0x90, OSX senseid: 0x1

We now have all of the information we need.

4. The Connector

OK, so both BIOS decodes tell us that connector 0 is the HDMI connector. Looking at the Pithecia dump, we can see this is set to 00 04 00 00

But what does this mean?

Well, the connector type is defined as follows:

LVDS            02 00 00 00
DVI_DUAL    04 00 00 00
VGA             10 00 00 00
SVIDEO        80 00 00 00
DVI               00 02 00 00
DP               00 04 00 00
HDMI           00 08 00 00

So we can see that it’s set to Display Port. We want HDMI, so were going to use 00 08 00 00

5. The ATY and Control Flags

Again, looking at the Pithecia dump, we see that the control flags for connector 0 are set to 04 03 00 00.

What does this mean?

The ATY and control flags are defined as follows:

LVDS           40 00 00 00 or 00 01 00 00
DVI_DUAL    16 00 00 00 or 14 00 00 00 or 14 02 00 00
VGA             10 00 00 00
S-Video        02 00 00 00
DVI-?            14 00 00 00 or 14 02 00 00 or 04 02 00 00 or 16 00 00 00
DisplayPort   00 01 00 00 or 04 01 00 00 or 04 03 00 00 or 06 04 00 00 or 00 04 00 00
HDMI            00 02 00 00 or 04 02 00 00

Again, we can see that it’s set to Display Port. We want HDMI, so were going to use 04 02 00 00 as this is the option that enable HDMI audio

6. The Features

Again, looking at the Pithecia dump, we see that the features for connector 0 are set to 00 01.

What does this mean?

The features are defined as follows:

FIRST NUMBER

FEATURE_USE_INTERNAL                 01
FEATURE_USE_RGB_ON_YUV          04
FEATURE_USE_BACKLIGHT              08
FEATURE_BACKLIGHT_INVERTED    10
FEATURE_USE_CLAMSHELL             20

SECOND NUMBER

LVDS            09
DVI_DUAL    00
VGA             00
SVIDEO        04
DVI               00
DP               00
HDMI           00

As none of the options for the first number are relevant, we’ll use 00 for that, and )) for the second, as we’re setting it for HDMI, so we will use 00 00

7. Unknown.

It’s unknown. Who cares? leave it at 00 00

8. Transmitter.

Now we look at the decodes, and see this for connector 0:

encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x12 [duallink 0x2] enc 0x4)] linkb: false

Look at the bold text.

So we’ll use 12

9. Encoder

Again, we look at the decodes, and see this for connector 0:

encoder obj id [0x21] which is [INTERNAL_UNIPHY2 (osx txmit 0x12 [duallink 0x2] enc 0x4)] linkb: false

Look at the bold text.

So we’ll use 04

10. Hotplug ID.

This must be a unique value for each connector. Leave it as it, 02

11. Sense ID.

Again, we look at the decodes, and see this for connector 0:

i2cid [@offset 44348]: 0x94, OSX senseid: 0x5

Look at the bold text.

So we’ll use 05

12. Putting it all together

So what we have is this:

Connector                00  08  00  00
ATY, Control Flags    04  02  00  00
Features                   00  01
Unknown                  00  00
Transmitter               02
Encoder                   04
Hotplug ID               02
Sense ID                  05

to give us:

00  08  00  00  04  02  00  00  00  01  00  00  02  04  02  05

13. So how do I get this working exactly?

Download HexEdit (Google it).

Backup /System/Library/Extensions/ATI6000Controller.kext

Open /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ATI6000Controller with HexEdit

replace all instances of:

00  04  00  00  04  03  00  00  00  01  00  00  21  03  02  04

with:

00  08  00  00  04  02  00  00  00  01  00  00  02  04  02  05

Save your edited ATI6000Controller in a location that your are able to, as you won’t be able to save it in /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/

Open a terminal, and copy your saved ATI6000Controller to /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS/ using sudo

touch /System/Library/Extensions

Reboot.

OS X on SSDs

I recently replaced the boot drives of my 17″ MacBook Pro, 15″ MacBook Pro and Hackintosh with SSDs. I have replaced the Superdrives on both MacBooks with cradles holding 750GB 7200RPM SATA HDDs, so I wasn’t too worried about having giant-capacity SSDs, I basically just needed enough to hold the OS and Applications. Consequently, a good balance of price and capacity at the time (Dec 2012) was 128GB Sandisk SATA 3 drives. Yes, the MacBooks are not SATA 3, but my Hackintosh is.

I am a great fan of partitioning, coming from a Solaris background (Back when Sun was good), and consequently, partitioned both the SSD boot drive and the HDD, as follows:

SSD:

Boot – 60GB
Applications – 50GB
FastAccess – 18GB

HDD:

Swap – 24GB (MacBook Pro) 72GB (Hackintosh) (3 X amount of RAM)
Users – Remainder of disk

The reason the swap partition is so high will become apparent later

So….

Build the OS in the usual way, onto the Boot partition on the SSD.

Move Applications.

There is no real need to move the applications, I just prefer to in order to compartmentalise things

When all is complete, and you have rebooted, move the applications to the Applications partition:

cd /Volumes/Applications
sudo ditto /Applications .

Next, make sure that the Applications partition mounts on /Applications at boot. First find the GUID of the Applications partition. Open Disk Utility, highlight the Applications partition, and click File -> Get info. Highlight the value of the Universal Unique Identifier parameter, and hit Command-c to copy it to the clipboard.

Add the following line to /etc/fstab (“sudo vifs” will open it for editing):

 UUID=<Universal Unique Identifier from above> /Applications hfs rw 0 2

Empty the /Applications directory, so that it works correctly as a mount point:

 cd /Applications
 sudo rm -rf *

Reboot. Run Software Update, and update everything. The first part is now complete.

In part 2, we move users, swapfile, sleepimage and tmp files off the SSD, add TRIM support and switch off access time recording for files on SSD partitions

Move Users.

Run the following command:

 sudo ditto /Users /Volumes/Users

Then open System Preferences, click on Users and Groups, Unlock to make changes, right click on each user to open Advanced Options, and change the Home Directory to the correct path

Reboot

Move Swapfile.

The swapfiles are usually located in /var/vm. Obviously, we want them off the SSD, so we’ll put them in the Swap partition we created on the spinny disk

Run the following commands:

 cd /System/Library/LaunchDaemons
 sudo cp com.apple.dynamic_pager.plist com.apple.dynamic_pager.plist.bak
 sudo plutil -convert xml1 com.apple.dynamic_pager.plist

Edit com.apple.dynamic_pager.plist. Replace

 <string>/sbin/dynamic_pager</string>
 <string>-F</string>
 <string>/private/var/vm/swapfile</string>

with

 <string>/bin/bash</string>
 <string>-c</string>
 <string>/bin/wait4path /Volumes/Swap/ &amp;&amp; /sbin/dynamic_pager -F /Volumes/Swap/swapfile</string>

Reboot

Move sleepimage

When the system hibernates, it saves the contents of memory to disk. The size of this file varies, but can be up to the the size of system RAM. This is why the Swap partition is so big – we’re going to put this file there (Usual location is /var/vm)

Run the following command:

sudo pmset -a hibernatefile /Volumes/Swap

Reboot

Move tmp files

tmp files live until reboot. we don’t really want them on the SSD, they can also go on the spinny drive.

Run the following commands:

 sudo ditto /private/tmp /Volumes/Users/tmp
 sudo rm -rf /private/tmp
 sudo ln -s /Volumes/Users/tmp /private/tmp

Reboot

Add TRIM Support

Download Trim Enabler

Install it

Switch it on.

Reboot

Switch off File Access Time Recording

In /Library/LaunchDaemons, create the following files:

com.apple.noatime1.plist

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
   <dict>
     <key>Label</key>
     <string>com.apple.noatime1</string>
     <key>ProgramArguments</key>
     <array>
       <string>mount</string>
       <string>-vuwo</string>
       <string>noatime</string>
       <string>/</string>
     </array>
     <key>RunAtLoad</key>
    <true/>
   </dict>
 </plist>

com.apple.noatime2.plist

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
   <dict>
     <key>Label</key>
     <string>com.apple.noatime2</string>
     <key>ProgramArguments</key>
     <array>
       <string>mount</string>
       <string>-vuwo</string>
       <string>noatime</string>
       <string>/Applications</string>
     </array>
     <key>RunAtLoad</key>
    <true/>
   </dict>
 </plist>

com.apple.noatime3.plist

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
   <dict>
     <key>Label</key>
     <string>com.apple.noatime3</string>
     <key>ProgramArguments</key>
     <array>
       <string>mount</string>
       <string>-vuwo</string>
       <string>noatime</string>
       <string>/Volumes/FastAccess</string>
     </array>
     <key>RunAtLoad</key>
    <true/>
   </dict>
 </plist>

Reboot

DONE!

Installing OS X Lion 10.7.4 on a Gigabyte X58A-UD3R Motherboard

I’ve been playing with Hackintoshes for quite a while now. Things have got a lot easier since the early days, but there are still a lot of quirks to it. The following is the installation procedure I followed for my set up. Of note is that I have a fairly problematic video card, based on the Radeon HD6670, mine is a Sapphire, PN 299-1E198-300SA.

Gather Your Prerequisites:

You will need:

  • An already functioning OS X machine (Easiest is to install 10.6 by following the procedures at http://tonymacx86.com for Snow Leopard)
  • An 8GB USB key for the installation media
  • Another USB key for the rest of what is required
  • myHack from http://myhack.sojugarden.com/
  • 10.7 installation media – You can buy this from Apple, or visit a torrent site
  • Your computer, based on an Gigabyte X58A-UD3R motherboard
  • From http://tonymacx86.comyou will need:
    • The correct DSDT for your board and BIOS version
    • Multibeast

Build Your Installation Media

If you don’t already have access to an OS X machine, build your Snow Leopard machine, or you can run up a VM. Once you have this going, follow the myHack instructions to build your installation binaries on the 8GB USB stick

Installing

When the Chameleon Bootloader starts counting down (While prompting you to hit any key to define boot parameters), go ahead an hit any key. If you don’t the boot WILL fail…

At the “Boot: ” prompt, type “-v -f cpus=1 arch=i386” – this also works as a general rule of thumb for ALL first-time boots.

Select your target, and let it build. Go and have a coffee. By the time you’ve finished your coffee, it will be asking you if you want to use a generic Extra directory – of course you do! Next it will ask if you want to remove the AppleTyMCEDriver.kext – May as well keep it. Do you want to remove the AppleUpstreamUserClient.kext? No…..I think we’ll keep that too……Restart when prompted

Configuring

When the Chameleon Bootloader starts counting down (While prompting you to hit any key to define boot parameters), go ahead an hit any key. If you don’t the boot WILL fail…

At the “Boot: ” prompt, type: “-v GraphicsEnabler=n cpus=1” (Minus the quotes)

Be prepared for much Matrix like crud scrolling on your screen. Eventually, you will get to the usual OS X initial account setup. Answer the questions. If you don’t know how to, give up, and go back to Windoze, OS X is not for you.

Right, you’ve got it booted, now the fun starts. There are a few initial considerations in order to achieve a clean boot, and also ensure that you can upgrade using the combo updater: The first is the DSDT. Remember that DSDT you downloaded for your board and firmware version? Copy it to the /Extra directory, ensuring it is named DSDT.aml. Remember, sudo is your friend. This will remove the requirement for the “cpus=1” boot flag. The second is to add some info specific to the Sapphire Radeon HD6670 graphics card. Edit /Extra/org.chameleon.Boot.plist, again, remember sudo is your friend. Just above the </dict> tag, add the following keys:

   <key>AtiConfig</key>
   <string>Pithecia</string>
   <key>AtiPorts</key>
   <string>3</string>

This will remove the requirement for the “GraphicsEnabler=No” boot flag, and ensure that you have a fully functioning graphics card Third, we want to be able to run the combo update without get a kernel panic. This requires a model identifier that is compatible, and the default model identifier (4,1) is not. So, again, editing org.chameleon.Boot.plist, just above the closing </dict> tag, add the following key:

    <key>SMBIOS</key>
    <string>/Extra/smbios.plist</string>

Now, add /Extra/smbios.plist – touch and edit, or just vi will do it. Give it the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>SMbiosversion</key>
    <string>MP51.007F.B03</string>
    <key>SMboardproduct</key>
    <string>Mac-F221BEC8</string>
    <key>SMfamily</key>
    <string>MacPro</string>
    <key>SMproductname</key>
    <string>MacPro5,1</string>
</dict>
</plist>

This will ensure that you can install the 10.7.4 combo update Now reboot. No boot flags required!

Combo Update and Kext Installation

OK, you’ve rebooted, you’ve got a flash OS X 10.7.0 Lion Hackintosh. You want 10.7.4, though. That’s easy, just run the combo updater you’ve already downloaded – Simple, isn’t it! Reboot Now, you’re ready to install the network, sound and SATA kexts. Note that you need to do this AFTER running the update. The updaters usually blow away the modified kexts.

Fire up Multibeast. Of note here is the Disk kext. You have two choices to make, “3rd Party SATA”, or “3rd Party eSATA”. Selecting “3rd Part SATA” will enable the eSATA ports, but they will not be hot-swappable. Using the eSATA option will make all of the SATA ports hot-swappable, except for those controlled by the Southbridge.  Make the following selections:

Multibeast Selections for X58A-UD3R

Reboot, and that’s it, all done!