====== Configure X & graphics for Lenovo Yoga 3 14 ======
* [[Laptops/Lenovo_Yoga_3_14/DualBoot|DualBoot]]
* [[Laptops/Lenovo_Yoga_3_14/X|X]]
===== tl;dr =====
- The Intel driver should work just fine.
- It is still possible to control brightness.
===== Background information =====
Lenovo Yoga 3 14 has 2 graphic cards natively: Nvidia %%GeForce%% 940M and Intel HD Graphics 5500 (Broadwell). Here's the output of ''%%pciconf -lv | grep display -B 3 -A 1%%'':
vgapci0@pci0:0:2:0: class=0x030000 card=0x391717aa chip=0x16168086 rev=0x09 hdr=0x00
vendor = 'Intel Corporation'
device = 'HD Graphics 5500'
class = display
subclass = VGA
--
vgapci1@pci0:3:0:0: class=0x030200 card=0x391717aa chip=0x134710de rev=0xa2 hdr=0x00
vendor = 'NVIDIA Corporation'
device = 'GM108M [GeForce 940M]'
class = display
subclass = 3D
I tested the X server with the [[https://www.freshports.org/x11-wm/dwm/|dwm]] window manager. Here are the steps to set it up:
* Install [[https://www.freshports.org/x11/dmenu/|x11/dmenu]], [[https://www.freshports.org/x11/sterm/|x11/sterm]] and [[https://www.freshports.org/x11-wm/dwm|x11-wm/dwm]]
* ''%%echo exec dwm > ~/.xinitrc%%''
* Now test the X server executing by ''%%startx%%''
----
===== Using the Intel card =====
==== Using the Intel driver ====
//It is now supported as of %%FreeBSD%% 12.0-CURRENT r323983. (Brightness control finally works!)//
I'm using the latest %%FreeBSD%% 12.0-CURRENT r323983. It works on %%FreeBSD%% 11-STABLE. Remember to update your kernel, userland and ports before following the steps below:
- Install ''%%graphics/drm-next-kmod%%''.
- Add ''%%kld_list="/boot/modules/i915kms.ko"%%'' to ''%%/etc/rc.conf%%''.
=== Backlight ===
* Backlight could be controlled using [[https://www.freshports.org/graphics/intel-backlight/|intel-backlight]].
* The brightness control keys work if you load the [[https://www.freebsd.org/cgi/man.cgi?query=acpi_video&sektion=4|acpi_video(4)]] kernel module. They are too precise however (it takes too long to make a significant brightness change using those keys).
* For some reason [[https://www.freshports.org/x11/xbacklight/|xbacklight]] does not work:
$ xbacklight
No outputs have backlight property
=== Related issues ===
* [[https://github.com/freebsd/freebsd-base-graphics/issues/21|Getting "kldxref: error while reading //boot/modules/i915_bxt_huc_ver01_07_1398_bin.ko: Bad address" on drm-next-kmod update from g20180117_2 to g20180117_3 (github.com/freebsd/freebsd-base-graphics)]]
* [[https://github.com/freebsd/freebsd-base-graphics/issues/20|HDMI external monitor doesn't work with drm-next-kmod on Intel HD Graphics 5500 (github.com/freebsd/freebsd-base-graphics)]]
==== Using the VESA driver ====
//Really slow and laggy.//
I ran ''%%X -configure%%'' (which is not recommended by the handbook) and copied the resulting file over to ''%%/usr/local/etc/X11/%%''. Then I deleted the other non-VESA device from the file.
I guess that the following configuration is sufficient for X to run using VESA (put those into some ''%%xorg.conf%%''):
Section "Device"
Identifier "Card0"
Driver "vesa"
BusID "PCI:0:2:0"
EndSection
==== Using the SCFB driver ====
//It works but it doesn't support some features like brightness control.//
VESA is slow and I could get Nvidia to work, so before some recent changes to the kernel (as of more or less %%FreeBSD%% 12.0-CURRENT r323983: Mon Sep 25 08:04:12 CEST 2017) I used the SCFB driver for a while. Now it is not necessary as the support for the Intel driver is already available in %%FreeBSD%% 12.0-CURRENT and probably in %%FreeBSD%% 11.1-RELEASE (at least that's what the ''%%graphics/drm-next-kmod%%'' port requires).
Add this to ''%%xorg.conf%%'' and make sure there are no other files configuring X:
Section "Device"
Identifier "Card0"
Driver "scfb"
BusID "PCI:0:2:0"
EndSection
=== References ===
* UEFI Xorg (EE) no screens found on %%FreeBSD%% 11.0-RELEASE: https://lists.freebsd.org/pipermail/freebsd-stable/2017-January/086560.html
* System Console Frame Buffer (SCFB): [[Graphics/SCFB|Graphics/SCFB]]
----
===== Using the Nvidia card =====
//Black screen with a white cursor in the upper left corner (broken and unusable).//
Here's what I've tried.
- Install ''%%x11/nvidia-driver%%''.
- Make sure to delete ''%%/etc/X11/xorg.conf%%'', ''%%/usr/local/etc/X11/xorg.conf%%'' and any files in ''%%/usr/local/etc/X11/xorg.conf.d/%%''.
- Add the following to ''%%/etc/rc.conf%%'':
kld_list="i915kms drmn nvidia-modeset"
hald_enable="YES"
dbus_enable="YES"
linux_enable="YES"
- Add the following to ''%%/usr/local/etc/X11/xorg.conf.d/10-nvidia.conf%%''
Section "Device"
Identifier "NVIDIA Card"
VendorName "NVIDIA Corporation"
Driver "nvidia"
BusID "PCI:3:0:0"
EndSection
As a result I got:
[ 242.977] (EE) No devices detected.
[ 242.977] (EE)
Fatal server error:
[ 242.977] (EE) no screens found(EE)
[ 242.977] (EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
[ 242.978] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[ 242.978] (EE)
[ 242.985] (EE) Server terminated with error (1). Closing log file.
I've tried to solve it with:
* ''%%X -configure%%'' and some additional tweaking the ''%%xorg.conf%%'' file;
* both ''%%nvidia-xconfig%%'' and ''%%nvidia-xconfig --enable-all-gpus%%'';
but nothing worked.
From what I read, the ''%%nvidia%%'' driver is supporting this card. I've got no idea what went wrong.
==== References ====
* [[http://cn.download.nvidia.com/XFree86/FreeBSD-x86/375.39/README/editxconfig.html|NVIDIA Accelerated FreeBSD Graphics Driver README and Installation Guide: Installation and Configuration Instructions: Chapter 6. Configuring X for the NVIDIA Driver (cn.download.nvidia.com)]]
* [[https://forums.freebsd.org/threads/56483/|Solved (EE) No devices detected. (EE) no screens found(EE) (FreeBSD Forums)]]
* [[https://forums.freebsd.org/threads/52311/|HOWTO: Setup Xorg with NVIDIA's driver (FreeBSD Forums)]]
* [[https://www.freebsd.org/doc/handbook/x-config.html|FreeBSD Handbook: Chapter 5. The X Window System (5.4. Xorg Configuration)]]
===== Troubleshooting =====
* [[https://unix.stackexchange.com/a/399352/128489|Missing GL support on FreeBSD with Intel graphics.]]
----
{{tag>Laptop Lenovo}}