Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Sep 2014 12:16:36 +0200
From:      "O. Hartmann" <ohartman@zedat.fu-berlin.de>
To:        "freebsd-acpi@FreeBSD.org" <freebsd-acpi@FreeBSD.org>
Subject:   Support for Lenovo acpi_video and nVidia GT740M Optimus video adaptor
Message-ID:  <20140923121636.6e4021db.ohartman@zedat.fu-berlin.de>

next in thread | raw e-mail | index | archive | help
--Sig_/PqX=oLGYNrJN6sFmc1swdyl
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable


I have a Lenovo ThinkPad E540 which has the following CPU:


FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
VT: running with driver "efifb".
info: [drm] Initialized drm 1.1.0 20060810
CPU: Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz (2494.28-MHz K8-class CPU)
  Origin=3D"GenuineIntel"  Id=3D0x306c3  Family=3D0x6  Model=3D0x3c  Steppi=
ng=3D3
  Features=3D0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PG=
E,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=3D0x7fdafbbf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3=
,<b11>,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,AESNI,XSAV=
E,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=3D0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=3D0x21<LAHF,ABM>
  Structured Extended Features=3D0x27ab<FSGSBASE,TSCADJ,BMI1,AVX2,SMEP,BMI2=
,ERMS,INVPCID>
  XSAVE Features=3D0x1<XSAVEOPT>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  =3D 9636413440 (9190 MB)
avail memory =3D 8149209088 (7771 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <LENOVO TP-J9   >
[...]

This laptop has a integrated HD4600 iGPU (Haswell CPU) as well as a nVidia =
GT 740M GPU,
which is supposed to be with Optimus technology. I will refer to this issue=
 later in this
post.

ACPI_VIDEO/ACPI_IBM:

loading both of these ACPI kernel modules seem not to provide any fiunction=
ality as
expected. The laptop runs with 100% brightness of the LCD and consumes the =
battery very
quickly. Trying=20
#
#       Display
#
hw.acpi.video.lcd0.fullpower=3D75
hw.acpi.video.lcd1.fullpower=3D75
hw.acpi.video.lcd0.econony=3D50
hw.acpi.video.lcd1.econony=3D50
hw.acpi.video.lcd0.brigthness=3D75
hw.acpi.video.lcd1.brigthness=3D75

in /etc/sysctl remains without effect. I presume this is due to the laptop =
is neither
supported by the acpi_ibm.ko nor acpi_video.ko modules either?

Is there a way to manipulate the LCD brightnes? The Firmware Lenovo provide=
s doesn't
allow without operating system running the change of the brightness or muti=
ng the
speakers with FN + FXX key, as it is provided by many other EFI/UEFI firmwa=
res.


iGPU/GPU/Optimus:


Another serious issue is the built-in video adaptor. In UEFI, I have the op=
portunity of
selecting either "integrated" or "nVidia Optimus". Selecting "integrated" i=
s supposed to
utilize the built in iGPU HD4600 - which is since Haswell's dawn unsupporte=
d in FreeBSD.
So, for some reasons along with my work, I'd like to have the dedicated GPU=
 anyway, the
nVidia GT 740M.
And here is the culprit.

First, I do not know whether this device is a hybrid or real discrete GPU w=
ith the
ability of sharing, what nVidia calls Optimus.
Starting X11 with any of the nVidia provided BLOBs (xf86-video-nv doesn't s=
upport modern
GPUs like that and FreeBSD doesn't have, in contrary to many Linux distribu=
tions, modern
xf86-video-nouveau: the driver is simply extinct from the ports) with 340.2=
4, 340.32 and
343.13 gives a blank vt() console screen with a carrett in the uppermost le=
fthand corner.

Checking the the Xorg.log I realize, that the driver recognizes the existen=
ce of the GPU,
but it doesn't reveal any(!) display sockets, not even the built-in LCD. Wh=
enever the
nvidia driver tries to access the video hardware, I see this messages poppi=
ng up on the
console, indicating that there is something wrong, I presume:

[...]
Sep 21 09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Ar=
gument #4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument =
#4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument =
#4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument =
#4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument =
#4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument =
#4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument =
#4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument =
#4 type
mismatch - Found [Buffer], ACPI requires [Package] (20130823/nsarguments-97=
) Sep 21
09:38:30 hermann kernel: ACPI Error: Field [TBF3] at 270336 exceeds Buffer =
[NULL] size
262144 (bits) (20130823/dsopcode-249) Sep 21 09:38:30 hermann kernel: ACPI =
Error: Method
parse/execution failed [\_SB_.PCI0.PEG_.VID_.GETB] (Node 0xfffff800044ef740=
),
AE_AML_BUFFER_LIMIT (20130823/psparse-553) Sep 21 09:38:30 hermann kernel: =
ACPI Error:
Method parse/execution failed [\_SB_.PCI0.PEG_.VID_._ROM] (Node 0xfffff8000=
44ef780),
AE_AML_BUFFER_LIMIT (20130823/psparse-553) Sep 21 09:38:30 hermann kernel: =
ACPI Warning:
\_SB_.PCI0.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI=
 requires
[Package] (20130823/nsarguments-97)
[...]

Checking the existence of VGA devices via pciconf, I receive this:

vgapci0@pci0:1:0:0:     class=3D0x030200 card=3D0x502a17aa chip=3D0x129210d=
e rev=3D0xa1 hdr=3D0x00
    vendor     =3D 'NVIDIA Corporation'
    class      =3D display
    subclass   =3D 3D
    bar   [10] =3D type Memory, range 32, base 0xf0000000, size 16777216, e=
nabled
    bar   [14] =3D type Prefetchable Memory, range 64, base 0xc0000000, siz=
e 268435456,
enabled
    bar   [1c] =3D type Prefetchable Memory, range 64, base 0xd0000000, siz=
e 33554432,
enabled
    bar   [24] =3D type I/O Port, range 32, base 0x5000, size 128, enabled


and looking for VGA devices in the ACPI OID range, I find those:

dev.vgapci.%parent:=20
dev.vgapci.0.%desc: VGA-compatible display
dev.vgapci.0.%driver: vgapci
dev.vgapci.0.%location: slot=3D0 function=3D0 handle=3D\_SB_.PCI0.PEG_.VID_
dev.vgapci.0.%pnpinfo: vendor=3D0x10de device=3D0x1292 subvendor=3D0x17aa s=
ubdevice=3D0x502a
class=3D0x030200 dev.vgapci.0.%parent: pci1
dev.vgapci.1.%desc: VGA-compatible display
dev.vgapci.1.%driver: vgapci
dev.vgapci.1.%location: slot=3D2 function=3D0 handle=3D\_SB_.PCI0.VID_
dev.vgapci.1.%pnpinfo: vendor=3D0x8086 device=3D0x0416 subvendor=3D0x17aa s=
ubdevice=3D0x502a
class=3D0x030000 dev.vgapci.1.%parent: pci0
dev.acpi_video.0.%parent: vgapci0
dev.acpi_video.1.%parent: vgapci1
dev.nvidia.0.%parent: vgapci0

Two VGA devices which has as their parents the other one?

I found several Howtos written for Linux specific cases to enable or disabl=
e explicitely
the nVidia GPU within the Optimus tandem, but none of the shown command seq=
uences, which
could be applied via the ACPI module acpi_call, seems to work, due to obvio=
us different
object identifiers.

I'd like to aske in this list whether there is a chance to have a switch an=
d how it might
be used. I can provide the ACPI dump, if requested.

If there is anything I can provide further, please ask.

Thanks in advance,

Oliver

--Sig_/PqX=oLGYNrJN6sFmc1swdyl
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJUIUiKAAoJEOgBcD7A/5N8bqIIAMI59a2dt+lx9gfUgzKNjPKG
+bluDB/T0frN250xRTCtXDQGM6X3KF9YgjZH/3bmvS63FF4IHK+KD//lD493Y7jp
kkv42Bisg4wpRkBWjfOnKR2yhDyrHMCLRkw2tEGicW3QUuBMGNClMFUAHUcOXEHX
nw4nzugJj+EmymvCrECuKqzuXyW8TPsNEuOg1pXw9cLwTPzGeX6IHLKnEKdPt/o3
9JUACHZ3Z8NGPp4w3W8x5q3hMwTPPxPWrIPsd7g5vJyuiCATk1rT6phnUZ2XuDa9
2DOape13QO3EVJ7I+xne2K9oFty+YIi/DP5yKWcXduQ9sh1VJKPy9QeOc6whkno=
=iBPC
-----END PGP SIGNATURE-----

--Sig_/PqX=oLGYNrJN6sFmc1swdyl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140923121636.6e4021db.ohartman>