From owner-freebsd-acpi@FreeBSD.ORG Tue Sep 23 14:44:21 2014 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9FEED8B for ; Tue, 23 Sep 2014 14:44:21 +0000 (UTC) Received: from mail-wg0-x22b.google.com (mail-wg0-x22b.google.com [IPv6:2a00:1450:400c:c00::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32EDF88D for ; Tue, 23 Sep 2014 14:44:21 +0000 (UTC) Received: by mail-wg0-f43.google.com with SMTP id y10so4755813wgg.26 for ; Tue, 23 Sep 2014 07:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Pp+sr2ANS2FiCn/1uORJDnvv2cJUQqlSiXFMKOu3pfw=; b=bWiT09AkDgpyvQFlQw7hqGd8e1RLm5FtCJqI8NwzVNZezl4xa0j4zqqDAa4Vo72Aft CijfT66uiOKvsPUJZkANJ+FZgD15A4t/vohUOr3vN6dkM6malE1js9Ah326ThcS152Gm wA0XDZuvS/Fs/NBndd/x8OgCopMF6htJfk7mtM/qBaYBY1rMTgy8eDxmDi4gW2GbJ7ph YVZl2vx5TX+/zYGTp5EAw/fcuRSK/dwxJSEgs/qpAZgAAwISoaa8NYGE69UHflC2p0BG b/hO+71X4ufSu7r6d1hv2bak/qpTHFD37cpBSaGj/NIcXFyr6iGvAF9wlm5UgagDfuOI UcVg== MIME-Version: 1.0 X-Received: by 10.180.9.144 with SMTP id z16mr22274862wia.26.1411483459380; Tue, 23 Sep 2014 07:44:19 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.199 with HTTP; Tue, 23 Sep 2014 07:44:19 -0700 (PDT) In-Reply-To: <20140923121636.6e4021db.ohartman@zedat.fu-berlin.de> References: <20140923121636.6e4021db.ohartman@zedat.fu-berlin.de> Date: Tue, 23 Sep 2014 07:44:19 -0700 X-Google-Sender-Auth: fUtauX8RZsW1KanFzm9N9_VnnZA Message-ID: Subject: Re: Support for Lenovo acpi_video and nVidia GT740M Optimus video adaptor From: Adrian Chadd To: "O. Hartmann" Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-acpi@FreeBSD.org" X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Sep 2014 14:44:21 -0000 Hi, A lot of the management of this stuff got offloaded to the architecture specific stuff in DRI. So, brightness controls likely require some plumbing from i915kms. I think half of your problems will be solved with the haswell DRI module. The Optimus side of things will require a little more investigation. -a On 23 September 2014 03:16, O. Hartmann wrote: > > 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="GenuineIntel" Id=0x306c3 Family=0x6 Model=0x3c Stepping=3 > Features=0xbfebfbff > Features2=0x7fdafbbf,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND> > AMD Features=0x2c100800 > AMD Features2=0x21 > Structured Extended Features=0x27ab > XSAVE Features=0x1 > VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID > TSC: P-state invariant, performance statistics > real memory = 9636413440 (9190 MB) > avail memory = 8149209088 (7771 MB) > Event timer "LAPIC" quality 600 > ACPI APIC Table: > [...] > > 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 fiunctionality as > expected. The laptop runs with 100% brightness of the LCD and consumes the battery very > quickly. Trying > # > # Display > # > hw.acpi.video.lcd0.fullpower=75 > hw.acpi.video.lcd1.fullpower=75 > hw.acpi.video.lcd0.econony=50 > hw.acpi.video.lcd1.econony=50 > hw.acpi.video.lcd0.brigthness=75 > hw.acpi.video.lcd1.brigthness=75 > > 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 provides doesn't > allow without operating system running the change of the brightness or muting the > speakers with FN + FXX key, as it is provided by many other EFI/UEFI firmwares. > > > iGPU/GPU/Optimus: > > > Another serious issue is the built-in video adaptor. In UEFI, I have the opportunity of > selecting either "integrated" or "nVidia Optimus". Selecting "integrated" is supposed to > utilize the built in iGPU HD4600 - which is since Haswell's dawn unsupported 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 with the > ability of sharing, what nVidia calls Optimus. > Starting X11 with any of the nVidia provided BLOBs (xf86-video-nv doesn't support modern > GPUs like that and FreeBSD doesn't have, in contrary to many Linux distributions, modern > xf86-video-nouveau: the driver is simply extinct from the ports) with 340.24, 340.32 and > 343.13 gives a blank vt() console screen with a carrett in the uppermost lefthand corner. > > Checking the the Xorg.log I realize, that the driver recognizes the existence of the GPU, > but it doesn't reveal any(!) display sockets, not even the built-in LCD. Whenever the > nvidia driver tries to access the video hardware, I see this messages popping 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: 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 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 0xfffff800044ef780), > 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=0x030200 card=0x502a17aa chip=0x129210de rev=0xa1 hdr=0x00 > vendor = 'NVIDIA Corporation' > class = display > subclass = 3D > bar [10] = type Memory, range 32, base 0xf0000000, size 16777216, enabled > bar [14] = type Prefetchable Memory, range 64, base 0xc0000000, size 268435456, > enabled > bar [1c] = type Prefetchable Memory, range 64, base 0xd0000000, size 33554432, > enabled > bar [24] = 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: > dev.vgapci.0.%desc: VGA-compatible display > dev.vgapci.0.%driver: vgapci > dev.vgapci.0.%location: slot=0 function=0 handle=\_SB_.PCI0.PEG_.VID_ > dev.vgapci.0.%pnpinfo: vendor=0x10de device=0x1292 subvendor=0x17aa subdevice=0x502a > class=0x030200 dev.vgapci.0.%parent: pci1 > dev.vgapci.1.%desc: VGA-compatible display > dev.vgapci.1.%driver: vgapci > dev.vgapci.1.%location: slot=2 function=0 handle=\_SB_.PCI0.VID_ > dev.vgapci.1.%pnpinfo: vendor=0x8086 device=0x0416 subvendor=0x17aa subdevice=0x502a > class=0x030000 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 disable explicitely > the nVidia GPU within the Optimus tandem, but none of the shown command sequences, which > could be applied via the ACPI module acpi_call, seems to work, due to obvious different > object identifiers. > > I'd like to aske in this list whether there is a chance to have a switch and 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