# FreeBSD/X.org in an Optimus enabled laptop



## CalBear96 (Jan 18, 2011)

Greetings,

I just got my new laptop (Sager NP5135) and it has the i7 640M with Intel GMA HD iGPU and an Nvidia GT425M Optimus card.  I know that I cannot use this card in FreeBSD, but I thought that I could just use the onboard Intel graphics with either their driver or Vesa.  

I installed FreeBSD 8.1 Release x64 a few days ago and updated the ports tree and installed X.  Or at least tried.  I got a few error messages so I updated the pkgdb and installed it successfully with pkg_add.  When I tried to configure or startx, I get errors talking about multiple primary devices found and fatal errors, etc.  

The /var/log/Xorg.0.log, /root/xorg.conf.new are attached.  Please help.  I had initially tried PCBSD but it complained of Xorg issues after I installed and could not get anywhere, so I went with FreeBSD knowing the forums could help me figure it out.  

I have also updated /etc/rc.conf with hald and dbus.

http://pastebin.com/embed_js.php?i=GLQbS1Pi
http://pastebin.com/embed_js.php?i=nduMKmii

Just to clarify, this is a laptop, with one screen.  Not using the HDMI out to have a second screen.  I saw something in a linux forum about deleting the nVidia driver to allow the intel or vesa driver to take over.

Also, when I try `X -configure` I get a list of video drivers including: radeon, radeonhd, r128, openchrome, nv, mach64, inntel, ati, fbev, and vesa.  It tries to use my /root/xorg.conf.new settings and fails with a 
	
	



```
Number of created screens does not match number of detected devices
```
 error.

Thanks for the help and I apologize if my formatting sucks, but I just copied 400 lines of code and do not have the energy to format this too.


----------



## wblock@ (Jan 19, 2011)

Either www/links or www/lynx will run in console mode; it's an acquired taste but beats retyping.

Removing lines 55 through 78 of your xorg.conf will leave just the vesa driver.


----------



## CalBear96 (Jan 19, 2011)

Anything beats retyping all those lines. I did that and tried startx and it gave the same error log.  Still no devices detected and no screens found and two potential primary devices.  Would deleting the nVidia drivers from my system help?  Or how can I prevent the "nv" module from loading?

How do I designate the Intel device as the primary.  Do I need to `cp /root/xorg.conf.new /etc/x11/xorg.conf` for the Xserver to find the files?


----------



## wblock@ (Jan 19, 2011)

If you edited the /root/xorg.conf.new, that will only be used if you specify it.  The real xorg.conf has to be in /etc/X11/ or /usr/local/etc/X11/.

If that was the file you edited, please post a link to the latest version of /var/log/Xorg.0.log.


----------



## CalBear96 (Jan 19, 2011)

Wow, that is bizarre.  Ok, stupid question.  How do I cut and paste my new /var/log/Xorg.0.log into the pastebin site?


----------



## DutchDaemon (Jan 19, 2011)

misc/pastebinit


----------



## wblock@ (Jan 19, 2011)

CalBear96 said:
			
		

> Wow, that is bizarre.  Ok, stupid question.  How do I cut and paste my new /var/log/Xorg.0.log into the pastebin site?



With lynx, looks like you go to http://pastebin.com, move to the text area after "Post a new Pastebin", then type ctrl-x i, enter the filename, fill in any of the other fields, move to Submit and press enter.  (Untested.)


----------



## CalBear96 (Jan 19, 2011)

Wow, I am slow tonight.  Finally got that all squared away.  Here is the link.  By the way, using the site in lynx is the way to go.  I spent way too long trying to use the `pastebinit -i [FILE]var/log/Xorg.0.log[/FILE]` only to have the output not reflect a unique URL.  Surely user error, but want to give a heads up.

http://pastebin.com/mENpnuaN

And my apologies to DutchDaemon for my breach of etiquette.  I reread the sticky and re-familiarized myself with how to format.


----------



## JokerBoy (Jan 19, 2011)

```
Section "Screen"
	[B]Indentifier	"Screen1"[/B]
	Device		"Card0"
	Monitor		"Monitor0"
End Section

Section "Screen"
	Identifier	"Screen1"
	Device		"Card1"
	Monitor		"Monitor1"
EndSection
```
This is correct?


----------



## wblock@ (Jan 19, 2011)

Now it's loading the nv driver.  Of course nineteen trillion drivers are installed, because they're part of the package, because packages have everything.

`# pkg_delete -f xf86-video-nv\*`


----------



## CalBear96 (Jan 19, 2011)

JokerBoy said:
			
		

> ```
> Section "Screen"
> [B]Indentifier	"Screen1"[/B]
> Device		"Card0"
> ...



Actually no.  It is `Screen0`


----------



## CalBear96 (Jan 19, 2011)

I deleted the nVidia driver and ran `# X -configure` and `# startx`.  The results are linked below.  As is my /etc/X11/xorg.conf

http://pastebin.com/Sv6WJKzD
http://pastebin.com/L8Ng780S
http://pastebin.com/iWDbSyGv


----------



## wblock@ (Jan 19, 2011)

Don't run -configure any more, it is not helping.  Here is my suggestion for xorg.conf:

```
Section "ServerLayout"
	Identifier     "Not X.org Configured"
	Screen      0  "Screen0" 0 0
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Device"
	Identifier  "Card0"
	Driver      "vesa"
	VendorName  "Intel Corporation"
	BoardName   "Intel nVidia Thingy"
	BusID       "PCI:0:2:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Modes "1024x768"
		Virtual 1024 768
	EndSubSection
EndSection
```


----------



## CalBear96 (Jan 19, 2011)

Woohoo!!!  I changed the driver to the vesa driver and ran `# startx`and it launched xterm.  Does that mean I am good to go?

Argh, I can get the xterm up but cannot get KDE to boot.  I applied `# echo "exec startkde" > ~/.xinitrc` but when it launches it back out and says`exec : startkde : not found`

Also, why did you take out all the modules to load?  Are they unnecessary?


----------



## wblock@ (Jan 19, 2011)

CalBear96 said:
			
		

> Woohoo!!!  I changed the driver to the vesa driver and ran `# startx`and it launched xterm.  Does that mean I am good to go?



If it works, well, yes.  It would be good to post the xorg.conf you used, if it wasn't the one above.


----------



## CalBear96 (Jan 19, 2011)

Figured it out.  I had the wrong code.  I changed ~/.xinit to `# echo exec /usr/local/kde4/bin/startkde` and it now brings it up.


----------



## CalBear96 (Jan 19, 2011)

Here is my configuration.  I have one problem remaining.  KDE is only allowing 1280x1024 resolution and I have a FHD screen at 1920x1080.  Is there a depth change I can make to get the full HD or is the vesa driver not capable of that?

http://pastebin.com/n06K68A2


----------



## adamk (Jan 19, 2011)

Interestingly, there are two Optimus threads going on here at once.  You may want to check what I said here:

http://forums.freebsd.org/showthread.php?t=20664

Essentially, vesa is a very, very basic driver, supports vesa specificed resolutions, and is not intended for day to day use.

Adam


----------



## wblock@ (Jan 19, 2011)

CalBear96 said:
			
		

> Here is my configuration.  I have one problem remaining.  KDE is only allowing 1280x1024 resolution and I have a FHD screen at 1920x1080.  Is there a depth change I can make to get the full HD or is the vesa driver not capable of that?
> 
> http://pastebin.com/n06K68A2



The one I posted is a bit less misleading.  Should work the same.

As Adam posts, vesa is a stopgap.  It's better than nothing, and ISTR someone here got some resolutions higher than 1280x1024 to work, but don't expect much.  That it works at all on an Optimus system is a little surprising.

I'd think it's technically possible to have a utility that would disable either of the two video systems, but it would be up to Intel (maybe) or nVidia (fat chance) to provide it.


----------



## adamk (Jan 19, 2011)

I've actually read that some versions of the vesa driver can use resolutions that are programmed directly into the cards BIOS.  I've never seen an intel GPU with HD resolutions programmed into the BIOS (though I have seen a few nvidia GPUs like that).  

EDIT:  But that's not to say such an intel GPU doesn't exist.

Adam


----------



## CalBear96 (Jan 20, 2011)

@Adamk:   That was actually my thread that I started.  Then I saw this one and added my two cents and it spiraled from there.  Unfortunately on my computer I cannot disable the NVidia chip in BIOS and the research  did on the vesa BIOS did not yield much in the way of help.  I decided that until this GMA HD issue is fixed (GEM/KMS) added to the kernel or I get another laptop without Optimus (they were about 500 bucks more), I will revert back to Linux.  I am sad to say that, but I will keep exploring FreeBSD on a mail server I want to configure for my business.

Also, the legacy driver I found offers no acceleration so it is a waste of system hardware I think, in my case anyway.  Thanks for everyone's help.


----------

