Jump to content

Guide for enabling VGA, DVI, DP and HDMI in Intel HD4000 GPU


EMlyDinEsH

Recommended Posts

Hi everyone, 

 

           This is a guide for enabling the ports VGA and HDMI/audio for Notebooks with Intel HD4000 GPU, which is based on my experience and details found by our hackintosh community making the guide in a way so everyone can understand. I will try to improve this guide and add more details when i find something.

 

Needed:

 

Section - 1:

INFORMATION ABOUT THE CONNECTORS FROM APPLE KEXT "AppleIntelFramebufferCapri":

 

Lets first take a look at the connectors found and used by Apple in "AppleIntelFramebufferCapri" kext. The values which we need to consider and relevant from Apple framebuffer kext are Connectors types and its number for detecting Display ports.

 

Connectors number values:

0503 - LVDS (Laptop built-in display)
0602 - VGA 
0205/0406/0304 - HDMI/DVI/DP

Connectors Type values:

DVI/DP  - 0004
DVI DUAL LINK - 0400
HDMI - 0008 and 06
VGA  - 1000/0010/0001

Section - 2:

CONNECTORS VALUES FOR DISPLAY PORTS DETECTION:

// LVDS, works with any one of the below values

05 03 00 00 02 00 00 00 30 02 00 00

05 03 00 00 02 00 00 00 30 00 00 00

01 00 00 00 02 00 00 00 30 00 00 00

01 00 00 00 02 00 00 00 30 02 00 00

 

Port values XX XX can be any one from '02 05/ 03 04/ 04 06' for DVI/DP/HDMI.

// DVI, works with any one of the below values

XX XX 00 00 00 04 00 00 81 00 00 00

XX XX 00 00 00 04 00 00 07 01 00 00 

XX XX 00 00 00 04 00 00 07 01 00 00 

 

// HDMI

XX XX 00 00 00 08 00 00 06 00 00 00

 

Connector type values XX XX can be any one from '10 00/ 00 10/ 00 01' for VGA.

// VGA, works with any one of the below values

06 02 00 00 02 00 00 00 30 02 00 00

06 02 00 00 02 00 00 00 30 00 00 00

06 02 00 00 XX XX 00 00 07 01 00 00

06 02 00 00 XX XX 00 00 07 00 00 00

06 02 00 00 XX XX 00 00 81 00 00 00

06 02 00 00 XX XX 00 00 06 00 00 00

06 02 00 00 XX XX 00 00 09 00 00 00

 

Section - 3:

EXPLAINING THE PATCH PROCESS OF CONNECTORS TABLE:

 

Below, we have the Connector table from AppleIntelFramebufferCapri kext for platform-id 09 00 66 01. The reason for taking this platform-id as an example is because it has only three connectors so it matches laptops connectors. (Next close match/better platform-id is 03)

 

Original:

09 00 66 01 01 03 03 03 00 00 00 04 
00 00 00 01 00 00 00 20 10 07 00 00 
10 07 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 F0 D9 05 00 00 00 00 00 
01 00 00 00 02 00 00 00 30 00 00 00 
02 05 00 00 00 04 00 00 07 01 00 00 
03 04 00 00 00 04 00 00 07 01 00 00

Let me explain the above table by each line

 

09 00 66 01 01 03 03 03 00 00 00 04

 

In this, we have information regarding platform id of HD4000 (09 00 66 01) and number of Connectors(Ports) which is 03. We can edit this port number to be 3 or less and overriding the respective lines of the port with '0' values which will eventually remove that port from the connectors frame buffer table.

 

Note: 

Each connector table of platform-id has some lines like above which varies for each version of AppleIntelFramebufferCapri kext and I don't know what these are but they are needed, so don't do any changes to this.

00 00 00 01 00 00 00 20 10 07 00 00 

10 07 00 00 00 00 00 00 00 00 00 00 

00 00 00 00 F0 D9 05 00 00 00 00 00 

 

Next

01 00 00 00 02 00 00 00 30 00 00 00

 

Note: Some notebooks may need the value "05 03 00 00 02 00 00 00 30 00 00 00" for the LVDS to work, so you might be using the platform id 03 00 66 01 because of that, so you can still edit the connector with this value and proceed with platform id 09 (or) edit platform id 03 tables using same ideas explained here for platform id 09.

 

The above line represents Laptop display (LVDS) which works fine, so we don't need to change anything here. But, if you find your LVDS is not working then try experiment with other LVDS values I've mentioned above.

 

02 05 00 00 00 04 00 00 07 01 00 00 

03 04 00 00 00 04 00 00 07 01 00 00

 

The above 2 lines represent Display ports DVI and HDMI, but in HDMI only Video will work default so we we need to use modify the connector type values like below for Audio.

 

0205/0304/0406 00 00 00 08 00 00 06 00 00 00
( or )
0205/0304/0406 00 00 00 08 00 00 xx xx 00 00 where xx are default values
 
Here we have edited connectors table for HDMI and VGA:
 
Edited connectors table for GPU for the Platform id 09 00 66 01

09 00 66 01 01 03 03 03 00 00 00 04 
00 00 00 01 00 00 00 20 10 07 00 00 
10 07 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 F0 D9 05 00 00 00 00 00 
01 00 00 00 02 00 00 00 30 00 00 00 
06 02 00 00 00 01 00 00 09 00 00 00 
03 04 00 00 00 08 00 00 06 00 00 00

(or)

09 00 66 01 01 03 03 03 00 00 00 04 
00 00 00 01 00 00 00 20 10 07 00 00 
10 07 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 F0 D9 05 00 00 00 00 00 
01 00 00 00 02 00 00 00 30 00 00 00 
02 05 00 00 00 08 00 00 06 00 00 00 / 02 05 00 00 00 08 00 00 07 01 00 00
06 02 00 00 00 01 00 00 09 00 00 00 

Edited connectors table for the Platform id 03 00 66 01
Original:

03 00 66 01 01 02 04 02 00 00 00 04 
00 00 00 01 00 00 00 20 10 07 00 00 
10 07 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 
05 03 00 00 02 00 00 00 30 00 00 00 
02 05 00 00 00 04 00 00 07 04 00 00 
03 04 00 00 00 04 00 00 81 00 00 00 
04 06 00 00 00 04 00 00 81 00 00 00

Edited:

03 00 66 01 01 02 04 02 00 00 00 04 
00 00 00 01 00 00 00 20 10 07 00 00 
10 07 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 
05 03 00 00 02 00 00 00 30 00 00 00 
06 02 00 00 00 01 00 00 09 00 00 00 
03 04 00 00 00 08 00 00 81 00 00 00 
04 06 00 00 00 08 00 00 81 00 00 00

(or)

03 00 66 01 01 02 04 02 00 00 00 04
00 00 00 01 00 00 00 20 10 07 00 00
10 07 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
05 03 00 00 02 00 00 00 30 00 00 00
02 05 00 00 00 08 00 00 06 00 00 00 / 02 05 00 00 00 08 00 00 07 04 00 00 
06 02 00 00 00 01 00 00 09 00 00 00
04 06 00 00 00 08 00 00 81 00 00 00

NOTE:

For detecting LVDS, HDMI and VGA connectors, you have to try each value from "Connectors values" of Section-2 to find out on which connector your notebook is using what in order to make them work. You can experiment with other connectors tables found in the Apple frame buffer kext as well(which are 12 in number) using the "Connectors values" info of Section-2 to find even better one, because every notebook is not going deal VGA and HDMI similarly.

 

In Mountain Lion 10.8.2 and all later releases, VGA is totally unsupported due to changes made by Apple in the HD4000 graphics drivers.

 

 

Section - 4:

STEPS FOR PATCHING THE KEXT:

  1. Get the File "AppleIntelFramebufferCapri" from AppleIntelFramebufferCapri.kext/Contents/MacOS folder and place it in some place(Ex:-Desktop) for patching
  2. Open the above file from the Hex fiend application
  3. Press Command + F for searching
  4. Enter Original Connectors table values in Find Box and edited Connectors table values in replace box then Click on Replace all button
  5. Now save the file and copy back the file to the Folder AppleIntelFramebufferCapri.kext/Contents/MacOS
  6. Install the patched Kext 

 

NOTE:

Display's won't detect automatically, so we have to detect manually by going to the Display preferences and Click on Detect Display button.

 

In Mountain Lion, we don't see Detect Display button at Display preferences. For getting this button, hold the ALT key at Display preferences to display the "Detect" button.

 

For HDMI Audio:

We need a DSDT patch for HDEF and patched AppleHDA (VoodooHDA might also work).

 

For this, follow my guides for patching AppleHDA: AppleHDA Guide

 

Hope this guide helps for people trying to get VGA and HDMI with audio.

 

Credit goes to  bcc9, RevoGirl(R.I.P), toldeda and others.

  • Like 2
Link to comment
Share on other sites

My Dell E6430 laptop is now working with internal display, external HDMI, and DVI through a port replicator!  A couple of comments on the guide:

 

First, I believe the reference made in this guide about "rev 09" is incorrect.  While I do have "rev 09" on my "0166" device (as shown by lspci -nn), my platform ID for Framebuffer is actually "3".  So it may be true that a majority are rev 09 but I don't think that helps with the platform selection - you just have to do trial and error to get it right.  3 is a good start since it supports 4 different ports.  See this post at insanelymac for details on the different platform IDs. 

 

Next, this guide only discusses 3 possible ports, but some platform IDs, including the one for mine, actually support 4 ports.  So in the the guide above, just go one line of Hex further than the examples shown if you are using a 4 port platform. 

 

I was unable to get VGA working alongside the internal display.  I think that they may be internally linked in my laptop.  In fact, using the Fn F8 key combo switches between them.  It's pretty ugly display and then it promptly breaks, though.  So probably not wise to use.  But perhaps not too surprising since I am not aware of any Apple laptops that have HD4000 and a VGA port.  I'd be interested to know if anyone has actually been able to discretely get the VGA and internal displays working independently. 

 

Now for my port replicator, if I boot up in the port replicator, everything works great.  If I try to dock into it with the computer already booted up, the Hacintosh thinks it is going for extended displays instead of switching the internal display off.  Even if I close the lid/display, the display stays lit and extended display is active.  And the worst is if I try to undock after booting up with it docked - no switching to internal display which means I need to force a reboot.  So there's some handoff issues that would be nice to figure out. 

 

And just to confirm, I was able even to get the HDMI audio working using the combination of this post and the one about patching AppleHDA binary.  And while I don't expect to do that often (most of the time either laptop on the road or in the office docked), it is very cool that I can do that. 

 

UPDATE

I forgot to check both DVI on my dock.  I checked today and both work at the same time!  I can't yet tell if either are working with Dual-Link DVI (since I don't have a device that requires dual-link - yet!) but very excited to have both displays working well.  If I could get the docking and undocking actions working well, this would be perfect.

/UPDATE

Link to comment
Share on other sites

@ktbos

Well, the reason for starting with '09' was matching revision id  which is not mandatory but i thought its best to use matching id, and I know that '03' works for most of them but the difference between '03' and '09' is that they are using different values for LVDS detection other than both works fine for every other values from the people i know. So, if we swap the values of LVDS  from '03' to '09' then it also works fine, that's why i have included two tables of edited values for '09' above where one has default value of '09' and other one has '03' LVDS value.

 

Also i don't have HD4000 hardware with me to understand every value, but i wanted to give some insight about HD4000 connectors for everyone for a start in patching these with my guide which is based on the HD3000 connectors experiment understanding and experience with HD4000 from other users and web. So, I will try to improve this guide when i get my hands on HD4000 and find any details that's related to this.

Link to comment
Share on other sites

Oh sorry didn't mean to criticize! Yes there's lots of great info here. And amazing you managed to figure it all out even though you don't have the hardware. I just wanted to note where I had been confused so that when others read this post they don't think that the rev number 9 means they should use that as their platform. That killed a lot of time for me. I think the best way to choose platform is match video ram and capabilities. And most people reading this will probably want to start with 3. So I figured contributing this info was my way of giving back for all the great info you had here.

Link to comment
Share on other sites

Hi!

 

I own a laptop (ASUS N56VZ) with Intel HD4000.

 

I used to connect it to my external monitor through VGA since HDMI is not working because Nvidia GT650M does not work. I used a patched IntelFramebufferCapri.kext and a string Injection in Chameleon (I made it work on Clover too). Everything worked fine on Mountain Lion (10.8.5) but as I updated to Mavericks it does not work anymore. Would you have a solution to my problem? Is there a workaround to use VGA on Mavericks?

 

I included all the files I used into a zip archive so that you can see it.
VGA.zip

 

Thanks in advance!
Regards!

Link to comment
Share on other sites

I followed this guide and finally enabled HDMI audio output on an asus x301a laptop. My system specs suggest hd4000 id 01660009 so I put that in the dsdt instead of 01660003. Then applied these patches:

for lvds internal video to work
AppleIntelFramebufferCapri 010000000200000030000000 to 050300000200000030000000

for hdmi and dvi (I don't really know if dvi in needed at all)
DVI
AppleIntelFramebufferCapri 020500000004000007010000 to 020500000008000006000000

HDMI
AppleIntelFramebufferCapri 030400000004000007010000 to 030400000008000006000000

HDMI audio now works. The only problem is that I don't get extended display. When I plug the HDMI external monitor, the built-in screen lights up but no picture is displayed.

Link to comment
Share on other sites

  • Administrators

The mobile HiRes framebuffer 0x01660004, used for laptops with built-in LCD with a resolution greater or equal to 1600x900, only carries 1 x LVDS output port by default. It must therefore be patched to support additional video outputs and HDMI audio:
 
In the case of Sierra 10.12, the vanilla framebuffer 0x01660004 is defined as follows:

04006601 01030101 00000002     // 1 x display output port
00000001 00000060 10070000
10070000 00000000 60290400
00000000 00000000 00000000
05030000 02000000 30020000     // LVDS port
00000000 01000000 40000000
00000000 01000000 40000000
00000000 01000000 40000000
00000000 00000000 00000000

and, building on the patch for LoRes FB 0x01660003, it can be patched to this:

04006601 01020402 00000004     // /!\ patch: 4 x display output port
00000001 00000060 10070000     // *** unmodified ***
10070000 00000000 60290400     // *** unmodified ***
00000000 00000000 00000000     // *** unmodified ***
05030000 02000000 30020000     // *** unmodified *** LVDS
02050000 00080000 07040000     // /!\ patch: HDMI (for audio)
03040000 00040000 81000000     // /!\ patch: DP/DVI (untested)
04060000 00040000 81000000     // /!\ patch: DP/DVI (untested)
00000000 00020011 00000000     // /!\ patch

:excl: The patch is not a mirror copy or copy/paste of the contents of the LoRes FB. In particular, it's critical to leave the LVDS port definition unchanged (code line starting with 05030000...).
 
In a nutshell, the AppleIntelFramebufferCapri patch consists of:

Find:    040066010103010100000002
Replace: 040066010102040200000004

+

Find:    0503000002000000300200000000000001000000400000000000000001000000400000000000000001000000400000000000000000000000
Replace: 0503000002000000300200000205000000080000070400000304000000040000810000000406000000040000810000000000000000020011
  • Like 1
Link to comment
Share on other sites

  • Administrators

Better later than never... As explained in past system/model-specific threads, there are further patches that may be used to modify the framebuffer memory size (useful on Latitude E6x30) and the VRAM allocation (nice to increase). Of course, WhateverGreen supports property injection (through DSDT/SSDT patches or bootloader configs) as a more efficient alternative to rather old-fashioned framebuffer kext binary patching.

 

Those parameters are defined in the 2nd line of the sample Capri layouts we've illustrated throughout this thread (bearing in mind the reversed byte order of kexts' binary code). For instance:

  • LoRes mobile layout 0x01660003:
03006601 01020402 00000004
00000001 00000060 10070000
  • HiRes mobile layout 0x01660004:
04006601 01030101 00000002
00000001 00000060 10070000
  • Desktop layout 0x0166000a:
0A006601 00020302 00000002
00000001 00000060 10070000
  • Desktop layout 0x0166000b:
0B006601 00020302 00000002
00000001 00000060 10070000

 

1) Framebuffer memory size:

This is defined in the 4th 32bit parameter of the layouts. Default value is 0x01000000 (reversed code 00000001), i.e. 16777216 in decimal which, when divided by 1024*1024 (=1MBytes), equates to 16MB. Some laptops such as the Dell Latitude E6x30 models suffer from corrupt/garbled display on screen unless this value is reduced to 8MB, i.e. 0x00800000. The patch required to change this is:

Find:   xxxxxxxx [...] xxxxxxxx 00000001 xxxxxxxx [...] xxxxxxxx
Replace xxxxxxxx [...] xxxxxxxx 00008000 xxxxxxxx [...] xxxxxxxx

 

For instance, to reduce the FB mem. size of layout 0x01660003 to 8MB, use this patch:

                                     \/\/
Find:    03006601010204020000000400000001
Replace: 03006601010204020000000400008000
                                     /\/\

 

Alternative property injection:

framebuffer-patch-enable    1               NUMBER
framebuffer-fbmem           00008000        DATA

 

2) VRAM allocation:

This is defined in the 5th 32bit parameter of the layouts. In most recent versions of OS X/macOS, the default value usually is 0x60000000 (reversed code 00000060), i.e. 1610612736 in decimal which, when divided by 1024*1024 (=1MBytes), equates to 1536MB (i.e. 1.5GB). This is shared memory and systems with, say, 8GB of RAM, may want to increase this. The patch required to do this is:

Find:   xxxxxxxx [...] xxxxxxxx 00000060 xxxxxxxx [...] xxxxxxxx
Replace xxxxxxxx [...] xxxxxxxx 000000YY xxxxxxxx [...] xxxxxxxx    -> where YY = desired VRAM Qty

Reminder:

  •   256MB = 1000 0000 in hex
  •   384MB = 1800 0000 in hex 
  •   512MB = 2000 0000 in hex
  •   768MB = 3000 0000 in hex
  • 1024MB = 4000 0000 in hex
  • 1536MB = 6000 0000 in hex
  • 1792MB = 7000 0000 in hex
  • 2048MB = 8000 0000 in hex

 

For instance, to increase VRAM allocation of layout 0x01660003 to 2048MB (i.e. 2GB), use this patch:

                                               \/
Find:    0300660101020402000000040000000100000060
Replace: 0300660101020402000000040000000100000080
                                               /\

Alternative property injection:

framebuffer-patch-enable      1               NUMBER
framebuffer-unifiedmem        00000080        DATA

 

Naturally, those framebuffer modifications can be combined in a single patch. For instance, to reduce FB mem. size to 8MB and increase VRAM to 2GB, layout 0x01660003 is patched as follows:

                                     \/\/      \/
Find:    030066010102040200000004000000010000006010070000
Replace: 030066010102040200000004000080000000008010070000
                                     /\/\      /\

 

Alternative property injection:

framebuffer-patch-enable      1               NUMBER
framebuffer-fbmem             00008000        DATA
framebuffer-unifiedmem        00000080        DATA

 

  • Like 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...