# IvyBridge graphics and FreeBSD 9.1



## agottem (Dec 21, 2012)

I have a laptop with an IvyBridge CPU and Intel HD 4000 Graphics.  I previously tried installing FreeBSD 9.0 and was unable to get X working due to the lack of KMS support.

Will FreeBSD 9.1 support KMS and Intel HD graphics?


----------



## Beastie (Dec 21, 2012)

It's been supported in STABLE for months, provided you build Xorg properly. And obviously 9.1 will include those changes.


----------



## MasterOne (Dec 22, 2012)

Is the addition of WITH_NEW_XORG=yes and WITH_KMS=yes to make.conf still needed, or is this already the default now?


----------



## zspider (Dec 22, 2012)

It will work, but you need the relevant lines in /etc/make.conf, a few ports that are not presently mainstream, and a proper Xorg.conf. All of which can be found here, http://forums.freebsd.org/showthread.php?t=35623 post #8, I wrote this post from an Ivybridge laptop.


----------



## scottro (Jan 13, 2013)

Following the linked post worked for me, thank you.  

The steps I took.  
I'd already installed x11-servers/xorg-server and a few others.  I first deinstalled them all as I was running into errors, such as needing higher version of dri.  I deinstalled xorg-server, xf86-video-intel the synaptics and keyboard drivers and graphics/dri and graphics/libGL.  (I'm not sure how much of this was necessary.)

Added the two lines to /etc/make.conf


```
WITH_NEW_XORG=yes

WITH_KMS=yes
```

I then used svn as suggested at https://wiki.freebsd.org/Xorg 

svn co https://trillian.chruetertee.ch/svn/ports/trunk

Then got the suggested merge script

fetch http://people.freebsd.org/~miwi/xorg/xorgmerge

Ran the script with sh xorgmerge.  It then suggested running portmaster -a, which I did.  (That's when I got a second error on one of the graphics programs mentioned above, the reason I ran make deinstall)  Note this was on a very fresh install so there wasn't anything else to upgrade.)

Then, I reinstalled some of the ones I'd removed, which pulled in other necessarys.  x11-servers/xorg-server, x11-drivers/xf86-video-intel, xf86-input-keyboard xf86-input-synatics.  This pulled in the necessary graphics libraries that I'd deinstalled.  I then installed a few fonts, as per http://forums.freebsd.org/showpost.php?p=75821&postcount=11, a window manager, and all was good.  

This is on a fairly new 9.1 RELEASE install.  After that, it's worked without problems.   (This is on a laptop, and I used the wiki post on synaptics for the trackpad, which involved enabling moused(8) and a line to loader.conf.  

Also, though this might go without saying, made sure hald was running.

I've been away from FreeBSD for several years, so don't know how much could have been eliminated from what I did, but I'm now happily running dwm on the machine.

https://wiki.freebsd.org/SynapticsTouchpad


----------



## wblock@ (Jan 13, 2013)

Very little of that is needed.  With 9.1 or 9-STABLE, add to /etc/make.conf:

```
WITH_KMS=yes
WITH_NEW_XORG=yes
```
Rebuild and reinstall the kernel, reboot.
Update ports tree.
Rebuild graphics/drm.
Rebuild xf86-video and xf86-input ports.  Maybe also x11-servers/xorg-server, I can't recall.

This worked.  Unfortunately, my HD4000 was noticeably slower than a Radeon 4650, so I switched back.


----------



## scottro (Jan 14, 2013)

Just tried on fresh install.  First I edited /etc/make.conf with the two lines mentioned.  Then, I ran 

```
make kernel
```
and rebooted. 

Next I ran 
	
	



```
portsnap fetch extract
```
(I hadn't installed ports during installation.)

At that point, I went into /usr/ports/x11-servers/xorg-server but when I ran

```
make install
```
 it was unable to fetch the distfile.

At that point, I once again checked out the subversion repo as mentioned in my previous post, along with downloading the merge script, also mentioned in the previous post, and running it too. 

Remember, I hadn't yet installed any ports at all, including those for X.


So, after running subversion fetching the merge script and running that, running portmaster -a (which didn't find anything to be updated, I was able to install xorg-server

So, it seems that, at least for me, on a fresh 9.1 install, it was necessary to get the extra repository.

Therefore, I would think that soon enough, it will become transparent to the user. 

Thanks for your help. (As I said, I've been away from FreeBSD for a few years, and am just doing some dabbling this weekend--in the course of reminding myself how to do things I've come across several of your posts and other writings, which have been of great help).


----------



## wblock@ (Jan 14, 2013)

I just used the standard ports tree.  But adding RANDOMIZE_MASTER_SITES=yes to /etc/make.conf might have helped to find the distfiles.


----------



## scottro (Jan 14, 2013)

Well, it's getting late here, but I just tried another quick fresh install. Added the lines to /etc/make.conf, including 
	
	



```
RANDOMIZE_MASTER_SITES=yes.
```

Ran 
	
	



```
make kernel
```
 and rebooted

Ran 
	
	



```
portsnap fetch extract
```

Then, (as I said, it's getting late, so was just checking) ran 

```
make fetch
```
 from /usr/ports/x11-servers/xorg-server and it worked.  
So, it's either the 
	
	



```
RANDOMIZE_MASTER_SITES=yes
```
 or possibly the fact that last time, I downloaded ports before redoing the kernel.  Though I did run 
	
	



```
portsnap fetch extract
```
 a second time after rebooting with the rebuilt kernel.
Once again, many thanks.  We now have somewhat of an answer to the issue.


----------



## MasterOne (Jan 14, 2013)

wblock@ said:
			
		

> Very little of that is needed.  With 9.1 or 9-STABLE, add to /etc/make.conf:
> 
> ```
> WITH_KMS=yes
> ...


Are you sure about that? On a fresh 9.1-RELEASE installation I just added the two lines to make.conf and then installed Xorg without any kernel rebuild, and it seemed to have worked just fine.


----------



## Beastie (Jan 14, 2013)

KMS is already included in the 9.1 kernel by default (AFAIK).


----------



## wblock@ (Jan 14, 2013)

I had not even considered that, but yes.  So even less to do.


----------



## Davsjo (Jan 14, 2013)

What happens when X is terminated now? Are you returned to console or does the screen go blank? (The latter has been the case earlier, hasn't it?)


----------



## MasterOne (Jan 14, 2013)

It still goes just black, console is not included in KMS.


----------



## scottro (Jan 15, 2013)

wblock@ said:
			
		

> Very little of that is needed.  With 9.1 or 9-STABLE, add to /etc/make.conf:
> 
> ```
> WITH_KMS=yes
> ...



This time, trying to do as little as possible, I did a fresh install, and added the above lines to make.conf.  (Actually, I tried leaving out the KMS line, but although xorg-server installed successfully, xf86-video-intel failed--I've forgotten the listed error, possibly libdrm but I may be wrong.)

I didn't rebuild the kernel, and as I hadn't yet installed any ports, I didn't rebuild anything

So, did another fresh install, added both lines to /etc/make.conf.

Then ran 
portsnap(8) fetch extract. 
EDIT:  I probably should have formatted the above as code, rather than the man tag for portsmap.  The exact command is

```
portsnap fetch extract
```

 After that, installing the various ports went without 
error.  In addition to the server and video driver, I also added some fonts, dwm, xterm and xinit

Everything worked without problems.  At least for 9.1, it seems that all one has to do is add the two lines to make.conf, then install the needed ports.  (If the ports have already been installed, I haven't confirmed which ones have to be reinstalled and which can be ignored.)


----------



## scottro (Jan 17, 2013)

Having also tried with CURRENT, in my experience, one still has to add the KMS and NEW_XORG lines to make.conf for it to work.  Can anyone confirm or contradict?  This was on a fresh install of 9.1, including ports, which I used for subversion, then updating to CURRENT, reinstalling ports with 
	
	



```
portsnap make extract
```
 and then installing the various xorg packages, with, I would guess, xorg-server and xf86-video-intel being the relevant ones.  

When I did this without adding the two lines to make.conf, I got the no screens found error.  This was only tested on one install, but I'm guessing, (and looking at the wiki indicates this is the case) that the two lines are still needed in make.conf 

Wiki link: https://wiki.freebsd.org/Intel_GPU

EDIT:  I'm sleepy and using too much mental shorthand. I should point out that as long as the two lines are added to make.conf, X works fine with Ivy Bridge Intel in CURRENT.


----------



## doalwa (Nov 19, 2013)

Sorry for resurrecting this old thread, but is any of this still relevant with FreeBSD10?

I've just installed FreeBSD 10-BETA3 on an Lenovo Thinkpad L530, which also uses the Intel HD4000 graphics. Using the binary package of Xorg, I was able to start X after adding 
	
	



```
hald_enable="YES"
```
 and 
	
	



```
dbus_enable="YES"
```
 to /etc/rc.conf.

X started fine after that, my only problem is: I can't stop X :\ I suppose this is also somehow KMS related? Will I have to rebuild Xorg from source, or should stuff just work out of the box and I'm doing something wrong?


----------



## free-and-bsd (Nov 30, 2013)

*Re:*



			
				doalwa said:
			
		

> X started fine after that, my only problem is: I can't stop X :\ I suppose this is also somehow KMS related? Will I have to rebuild Xorg from source, or should stuff just work out of the box and I'm doing something wrong?


 You can read #4 and #5 in the KMS module FAQ at the bottom of that page, which seems to contain the answer to your question.


----------

