# FreeBSD on recent Lenovo Thinkpad W541



## priyadarshan (Sep 23, 2015)

I would like to share my experience in trying to have a working Xorg on FreeBSD, on a recent (August 2015) Lenovo Thinkpad w541.

The laptop model I tried it on has a Intel Quad Core i7-4810MQ cpu (Intel HD Graphics 4600) and Nvidia card.

The gist of it: FreeBSD installs fine, but Xorg will not find a display on this particular machine.

Even when the Haswell driver will be available to drive recent Intel graphics, like the HD4600, Xorg will still not be able to work, because of the Optimus combination.

See section «5.4.1. Caveats», Paragraph about Optimus: https://www.freebsd.org/doc/handbook/x-config.html



> Optimus: currently there is no switching support between the two graphics adapters provided by Optimus. Optimus implementations vary, and FreeBSD will not be able to drive all versions of the hardware. Some computers provide a BIOS option to disable one of the graphics adapters or select a discrete mode.



The real problem is that Lenovo disabled the functionality to switch off Intel or Nvidia graphics via BIOS:
https://forums.lenovo.com/t5/ThinkP...tegrated-graphics-in-WoW-instead/td-p/2042979



> If you want to force use the K1100m on the W541, it will need to be (a) on an external monitor and (b) controlled through a dock, rather than via the video connectors on the laptop itself.  According to "the specs", the laptop screen is always handled by the Intel Graphics... no matter whether the W540/W541 BIOS is set to "basic" or "advanced" graphics mode.



So, there is no way Xorg will be able to run with native Intel nor Nvidia drivers.

On Linux, that can be fixed by using Bumblebee:
https://mbogochow.wordpress.com/2015/07/28/linux-on-a-lenovo-thinkpad-w541/

Unfortunately, Bumblebee is not available on FreeBSD yet.

So, for now, any new Lenovo Thinkpad with Haswell processors, using Optimus will not be able to run a desktop on FreeBSD.

At this pont I am not sure if to sell this model and just get a Thinkpad 450 (with no Nvidia), or wait for Bumblebee on FreeBSD and use Linux in the meanwhile. The only thing that would make Linux bearable for me would be ZOL (ZFS-on-Linux).


----------



## gofer_touch (Sep 23, 2015)

This is interesting. Haswell chips have been out for a while now. AFAIK, only DragonflyBSD works well with Haswell graphics (including acceleration) out of the box. Your Nvidia card would not be supported though. Its a pity because this looks like a killer machine otherwise!


----------



## priyadarshan (Sep 23, 2015)

Thank you, it is a very good machine indeed, it has also 32GB ram and 512GB  SSD. I like it very much. I could do without the numeric keypad, as it makes the keyboard a little off-centered, but the screen (3k) is excellent. Too bad Xorg-on-FreeBSD does not work. I am afraid I will have to sell it and downgrade to a T450s.

I am trying hard, but I can't force myself to use Linux.

It seems I got addicted to FreeBSD.


----------



## protocelt (Sep 23, 2015)

Depending on the hardware, some people are able to get usable graphics on some Nvidia Optimus Laptops by creating an xorg.conf file and configuring it to use one graphics adapter or the other. It doesn't always work, but it's worth a shot IMO as it has worked in the past for some people with similar hybrid graphics.


----------



## priyadarshan (Sep 23, 2015)

protocelt said:


> Depending on the hardware, some people are able to get usable graphics on some Nvidia Optimus Laptops by creating an xorg.conf file and configuring it to use one graphics adapter or the other. It doesn't always work, but it's worth a shot IMO as it has worked in the past for some people with similar hybrid graphics.



Thank you for the comment. I tried to set up xorg.conf to use only the Intel driver. The problem is that this is a Haswell GPU (Intel HD Graphics 4600), and the driver is not there yet (https://wiki.freebsd.org/Graphics/Update i915 GPU driver to Linux 3.8)


----------



## Juanitou (Sep 23, 2015)

priyadarshan said:


> So, for now, any new Lenovo Thinkpad with Haswell processors, using Optimus will not be able to run a desktop on FreeBSD.


It’s a pity, because the Haswell HD Graphics 4400 (without Optimus) of my Lenovo ThinkPad S440, driven by the x11-drivers/xf86-video-scfb, is working reasonably well.


----------



## priyadarshan (Sep 23, 2015)

Juanitou said:


> It’s a pity, because the Haswell HD Graphics 4400 (without Optimus) of my Lenovo ThinkPad S440, driven by the x11-drivers/xf86-video-scfb, is working reasonably well.



Thanks, I would like to try that. I looked at https://wiki.freebsd.org/Intel_GPU, but I can't quite understand it. How do you specify the driver for x11-drivers/xf86-video-scfb in xorg.conf? Would you mind sharing the related tidbit? Is there any other special settings to be done?

What about this part, 





> Since the syscons is not integrated with KMS, screen goes blank after i915kms is loaded. Use startx to let ddx driver load the right kernel module. Set sysctl hw.dri.debug=0 to reduce verbosity of the driver at runtime.


----------



## Juanitou (Sep 23, 2015)

I have just this in xorg.conf:

```
Section "Device"
   Identifier "Generic FB"
   Driver "scfb"
   Option "NoAccel" "True"
EndSection
```
I have not explored the effect of the NoAccel option: both True and False seem to work. I just copied it from some blog post…


----------



## gofer_touch (Sep 23, 2015)

There is a thread entitled "what would you like to see in FreeBSD". Updating drm is one of the most requested items. Haswell graphics support would be awesome.


----------



## Juanitou (Sep 23, 2015)

I take a look every day at how this support is coming, it’s happening right now:
https://github.com/freebsd/freebsd-base-graphics/commits/drm-i915-update-38


----------



## priyadarshan (Sep 25, 2015)

I decided I am not going to sell this, and I shall wait. Meanwhile I could use FreeBSD in pure text more. My workflow use Emacs 80% in any case, and Emacs can work quite well fron the shell. I think I can survive pretty well until drivers are ready.

Now, I need to find out how to setup vt() to display 1920x1080.


----------



## priyadarshan (Oct 8, 2015)

The wiki page has been updated. I tested it on the Thinkpad w541 using FreeBSD 11-CURRENT, but with no sucess yet.
The X.Org server does not start, as it does not recognise any device on the laptop.
But there is progress, looking at the logs, now the HD4600 GPU (among others) is recognised.


----------



## kattadaemon (Jul 30, 2016)

I plan on buying w541 so wondering if xorg is working. Any update ?


----------



## priyadarshan (Jul 31, 2016)

Yes, I was able to run X.org with FreeBSD 11-BETA.

Also, back in June PC-BSD was able to give working KDE. July version broke, but I am sure by the time FreeBSD 11-RELEASE is out, it will be good again.

The trick with w541 is the Optimus architecture (ie, they offer Intel GPU + nVidia GPU). Even on Linux is giving no end of trouble.

If I would have to get a laptop again, I would avoid nvidia optimus, especially on Lenovo, since one cannot even shut it off via BIOS anymore.


----------



## kattadaemon (Jul 31, 2016)

Thanks for the reply. I'm a power user so like the specs of this laptop but will take your advise into consideration.
Does suspend/resume work, does graphics recover from resume?


----------



## priyadarshan (Jul 31, 2016)

Suspend/resume was working as of PC-BSD of June, then broke with July's image. I am sure it will be fixed by September, as well.

One thing I still have to find a fix is the fan's noise.

Perhaps because of nVidia GPU, the fan  kicks in almost always, unless one uses less resource-hungry DE, like XFCE.

That happens with Linux as well (no matter which distro, I literally tried dozens), so it is definitely not FreeBSD's fault.

If one really like to use Gnome 3, or Cinnamon, etc, one should be ready to live with a very hot laptop, and its noisy fan always going.

Since our company works mainly with Common Lisp, I switched to using StumpWM, sometimes XFCE, and I do not notice that as much now.

PS: Just noticed this on r/BSD: https://www.reddit.com/r/BSD/comments/4vg1po/powerd_a_dropin_replacement_avoiding_some_of_the/


----------



## scottro (Jul 31, 2016)

Thanks for that, going to try powerdxx.


----------



## Atsuri (Jul 31, 2016)

priyadarshan said:


> Yes, I was able to run X.org with FreeBSD 11-BETA.
> 
> Also, back in June PC-BSD was able to give working KDE. July version broke, but I am sure by the time FreeBSD 11-RELEASE is out, it will be good again.
> 
> ...



I was always wondering about this. FreeBSD has many more obvious interfaces to hardware components than GNU/Linux. Would there be no way to simply turn the card off after the system is loaded or during boot time? The display is driven via the Intel iGPU anyway. 

That's essentially what bumblebee does, I think (launching the card only for a per--application X11 session), though in a more user-controlled manner.


----------



## kpa (Jul 31, 2016)

Atsuri said:


> I was always wondering about this. FreeBSD has many more obvious interfaces to hardware components than GNU/Linux. Would there be no way to simply turn the card off after the system is loaded or during boot time? The display is driven via the Intel iGPU anyway.
> 
> That's essentially what bumblebee does, I think (launching the card only for a per--application X11 session), though in a more user-controlled manner.



The questions you have to ask are "Are those interfaces documented anywhere? Does the hardware allow such thing?". The answers so far have been negative and that's why the only way to turn off controllers is to use the BIOS/UEFI firmware for the purpose if that's even possible there.


----------

