Bumblebee-Project/bumblebeed — Issue #21: Alternative for determining "ConnectedMonitor" for xorg.conf.nvidia
Author: Lekensteyn
Created: 2012-01-02 23:32:46+00:00
State: open

The nvidia blob is that stupid that it cannot always detect the correct monitor setting. Therefore something like the below must be used for determining the monitor setting:

```
$ /usr/lib/nvidia-current/bin/nvidia-xconfig --query-gpu-info --nvidia-cfg-path=/usr/lib/nvidia-current
Number of GPUs: 1

GPU #0:
Name : GeForce GT 425M
PCI BusID : PCI:1:0:0

Number of Display Devices: 1

Display Device 0 (CRT-0):
No EDID information available.
```

The above output came from a Clevo B7130 which has an external VGA and HDMI connector and of course an internal connector to the LCD display.

At first I thought of some hardcoded table in the nvidia driver, but then it occured to me that it seeks access to /dev/nvidiactl which is a kernel interface. Searching for "DFP" in the ACPI Spec v4 pointed me at sect. `B.4.2 _DOD (Enumerate All Devices Attached to the Display Adapter)`.

For the above output (Clevo B7130), the `\_SB.PCI0.GFX0._DOD` method returns a package containing three values:

- 0x80010100 (binary `1000 0000 0000 0001 0000 0001 0000 0000`)
- 0x80010300 (binary `1000 0000 0000 0001 0000 0011 0000 0000`)
- 0x80010410 (binary `1000 0000 0000 0001 0000 0100 0001 0000`)

An explanation of all bits can be found in table B-2 on page 699 of the ACPI Spec v4. Explanation of the above values (bits are counted from right and zero-based):

- 0 - 3: display index (which is 0 in this case)
- 4 - 7: Display Port attachment. In this case, 1 and 0 (this is possibly not useful for us)
- 8 - 11: Display Type, for my case:

- `0001` (1): "VGA, CRT or VESA compatible analog monitor" (external VGA?)
- `0011` (3): "External Digital Monitor (see note 1)" (external HDMI?)
- `0100` (4): "Internal/Integrated Digital Flat Panel (see note 2)" (internal LCD?)

Notes (taken from the ACPI Spec v4, page 701:

> 1. An “External Digital Monitor” is an external display device attachable via a user-accessible connector standard (e.g. DFP* or DVI* Compatible Monitors).
> 2. An “Internal Flat Panel” is a non-detachable fixed pixel display device, including a backlight, and is internally associated, without user-accessible connectors, to the Video Chip (e.g. TFT LCD via TMDS*, LVDS* interface).

Now, how could this be useful? I'll check it later this day.