1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

NVidia Optimus on FreeBSD

Discussion in 'Mobile Computing' started by phpwolf, Mar 8, 2012.

  1. phpwolf

    phpwolf New Member

    Messages:
    24
    Likes Received:
    0
    Hello guys,

    I have an Asus laptop who has a video card with NVidia Optimus Technology. I found some recent posts regarding GEM/KMS support on FreeBSD9 & X updates to v7.5.2.

    I made some research and I found very important stuff about this update here:

    http://blogs.freebsdish.org/

    Unfortunately, I found many errors when I tried to apply the drm patches to the kernel.

    I'm not an experienced FreeBSD user but I really want to run BSD on my laptop. I'm a game developer and I want to make games for FreeBSD, that's why I need acceleration on my video card.

    Can you help me, please?

    Also, I opened a similar thread on PC-BSD forum:

    http://forums.pcbsd.org/showthread.php?t=14782


    Thanks in advance,
    phpwolf
     
  2. xibo

    xibo New Member

    Messages:
    383
    Likes Received:
    0
    If you need graphics just use the geforce card of that laptop, which should work with the x11/nvidia-driver and don't bother with the igp ;)

    The KMS effort is primarily for those who don't have a dedicated nvidia chip. X11 doesnot support nVidia optimus because it's bound the the adapter it was started with. You can of cause start X11 on both adapters and switch the active contexts, but I doubt that serves power saving which is what optimus is there for.
     
  3. Beastie

    Beastie Member

    Messages:
    1,917
    Likes Received:
    3
    NVidia said they won't provide support for the Optimus technology on Linux and since Xorg is mostly developed by Linux people and only then ported to other systems...

    Actually I believe it's barely supported on Windows XP and only has full support on Windows 7.

    From what I've read on the subject, some machines let you disable Optimus in the BIOS, others have a hardware switch (e.g. some Lenovo IdeaPads?), and some provide no option and will just blackout if you try to disable the IGP.
     
  4. phpwolf

    phpwolf New Member

    Messages:
    24
    Likes Received:
    0
    Thank you for your suggestions. Unfortunately, the NVidia driver doesn't work, the VESA driver doesn't work ether. My laptop is an ASUS X53-S with NVidia GT520M + an Intel video card (maybe i950, but I'm not very sure). From what I understand, it seems my only option on FreeBSD is to use the Intel driver instead of NVida's one (the Torvalds OS use also the Intel video card via Bumblebee project). Is quite funny, even the win7 native driver use the Intel chipset by default for d3d rendering, and this is happen because the NVidia driver crashes random (there is nothing wrong with my laptop, the culprit is the NVidia native driver, many guys has the same problem as me).

    One more note: my laptop hasn't the BIOS swith from Intel to Nvidia. I know, this is happen when you try to buy cheap stuff and/or you don't have a choice to buy good one :(

    Because I'm a new FreeBSD user, I was blocked when I tried to apply the drm patch to the FreeBSD kernel. Yesterday I search on all threads from this forum and I found some precious informations - I hope I'll spend my weekend trying to solve this annoying problem.

    If everything goes well, my plan is to start a personal project - making casual games for FreeBSD. I love the BSD license and I think is a very good opportunity for me to make games for this platform.

    Thanks a lot for your answers, any suggestion is welcome. I'll continue to post my progress here, but please, don't forget I'm new to BSD and maybe I'll made some basic mistakes, so please, be gentle with me If I ask you stupid things.
     
  5. xibo

    xibo New Member

    Messages:
    383
    Likes Received:
    0
    Have you tried using the VESA driver for both the geforce and the intel ipg? If not, try to use VESA on Intel Card.
    Maybe something useful can be found in /var/log/xorg.log and/or by running dmesg.
     
  6. dennylin93

    dennylin93 New Member

    Messages:
    784
    Likes Received:
    0
    @phpwolf: I also have an Asus laptop (A53SV). Specs are very similar to yours.

    GNOME is running fine for me, so I think the patches should work on your laptop, too.

    Steps:
    1. Grab 10-CURRENT using csup or SVN
    2. Apply the latest all.X.Y.patch in http://people.freebsd.org/~kib/drm/
    3. Rebuild world and kernel
    4. Fetch Ports using csup or portsnap
    5. Fetch the development repo for X11: http://wiki.freebsd.org/Xorg
    6. Add
      Code:
      WITH_NEW_XORG=YES
      WITH_KMS=YES
      to /etc/make.conf
    7. Install the required ports (X.Org, GNOME/KDE/XFCE, etc.)

    I've tried installing x11/nvidia-driver, but it causes my computer to reboot when X.Org starts. Anyway, it will work fine without the GPU.

    There's also a backport of all.X.Y.patch for 9-STABLE (it isn't maintained by kib@), so you don't have to run 10-CURRENT. There's a link to it in a post on this forum.
     
  7. phpwolf

    phpwolf New Member

    Messages:
    24
    Likes Received:
    0
    Thanks. I just compiled all the stuff using the Toto's instructions (see this post:
    http://forums.freebsd.org/showthread.php?t=21852&page=5), everything was compiled without errors.

    The X initialization with Intel driver seems to work, but now I have two BIG problems:

    1. the display has a lot of artifacts at the top of the screen (random pixels).
    2. the mouse buttons don't work (the mouse cursor moves as it should but the buttons don't trigger anything).

    I tried this with XFce4, fvwm2, fluxbox and twm. Another strange behavior: if I press some keys (for example alt+f2 in XFce4 to open the run dialog window) nothing happens and the random pixels (screen artifacts) seem to multiply - I'm a happy guy with so many random pixels :))))

    Any idea how can I fix this?
     
  8. nemysis

    nemysis New Member Developer

    Messages:
    12
    Likes Received:
    0
    I have asked on the PC-BSD forum about new port of x11/bumblebee. Please test it because I don't have a laptop with Nvidia Optimus technology.
     
  9. TommyC7

    TommyC7 New Member

    Messages:
    7
    Likes Received:
    0
    Hi phpwolf,

    I too have a laptop with Nvidia Optimus technology (except it's HP instead of ASUS). What I did was similar to what you have done. However, I opted to use just the Intel GPU instead of both (and my BIOS, even after being flashed in Windows 7 doesn't come with an option to disable one or the other either).

    FreeBSD 9.0 did not have enough support for the Intel GPU in an Nvidia Optimus setup, but 9.1 did so with my 9.0 installation (with X11 installed) I just simply upgraded to 9.1 as per the FreeBSD documentation.

    (This is the first difference since I'm assuming you followed dennylin93's advice and upgraded to 10-CURRENT).

    Then I added
    Code:
    WITH_NEW_XORG=YES
    WITH_KMS=YES
    to my /etc/make.conf and then I just rebuilt X11 (as per the FreeBSD documentation) and installed x11-drivers/xf86-video-intel.

    Then I just ran (as root) Xorg -configure, put the configuration file in the proper location (of which I have heard can be either /usr/local/etc/X11 or /etc/X11 and then startx worked like a charm.

    One DE I would not recommend you use an Intel GPU with is KDE4 (not sure about KDE3). A few problems I ran into were that sometimes when KDE's screensaver daemon was running and I was trying to log back in, instead of showing me a login prompt it would just freeze the screen (and the animated screensaver) and render the system unusable. Shutting down via KDE would sometimes hang and just never shutdown. I want to clarify that the screensaver and shutting down did still work on some occasions but it was about a 50% chance of working properly.

    One thing about the Intel GPU (at least in 9.1 anyways, not sure about 10-CURRENT) is that you definitely shouldn't try to switch tty's (no matter the DE or WM) because this too will render the system unusable (this has already been reported in the past, so perhaps there is a fix for it in 10-CURRENT but as previously stated I do not follow 10-CURRENT).