# Set up multi-head environment on FreeBSD running X.Org



## Steve17 (Apr 3, 2015)

My goal is to set up a multi-head environnement: I need to have an extended desktop available on both screens with the ability to drag and drop windows from one screen to another. The left screen is on VGA port and the right one is plugged into the HDMI port.

I tried playing around with xorg.conf but it appears I cannot set up the proper configuration for the multi-head to work.

Here is my xorg.conf:


```
Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    ModulePath   "/usr/local/lib/xorg/modules"
    FontPath     "/usr/local/lib/X11/fonts/misc/"
    FontPath     "/usr/local/lib/X11/fonts/TTF/"
    FontPath     "/usr/local/lib/X11/fonts/OTF"
    FontPath     "/usr/local/lib/X11/fonts/Type1/"
    FontPath     "/usr/local/lib/X11/fonts/100dpi/"
    FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
    Load  "dbe"
    Load  "dri"
    Load  "dri2"
    Load  "extmod"
    Load  "record"
    Load  "glx"
EndSection

Section "InputDevice"
    Identifier   "Keyboard0"
    Driver      "evdev"
        Option       "XkbLayout" "fr"
        #Option      "XkbModel" "pc105"
        #Option      "Device" "/dev/ukbd0"
        #Option      "CoreKeyboard"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option       "Protocol" "auto"
    Option       "Device" "/dev/sysmouse"
    Option       "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "ShadowFB"               # [<bool>]
        #Option     "DefaultRefresh"         # [<bool>]
        #Option     "ModeSetClearScreen"     # [<bool>]
    Identifier  "Card0"
    Driver      "vesa"
    VendorName  "Intel Corporation"
    BoardName   "Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller"
    BusID       "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
    SubSection "Display"
        Viewport   0 0
        Depth     1
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection
```

I've read somewhere that I need both the Virtual and Modes directives set up so I've amended the configuration as such :


```
Section "Screen"
# ...
SubSection "Display"
Viewport 0 0
Depth 24
Virtual 3600 1080
Modes "1920x1080" "1680x1050"
EndSubSection
EndSection
```

The result was a fuzzy image running on the main screen. I was able to move the mouse though and see that the desktop is actually extended. But it's unusable and running on one screen only.

I also have installed XRandr as per this documentation but the output of `$ xrandr -q` is as such:


```
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 1920 x 1200, maximum 1920 x 1200
default connected 1920x1200+0+0 0mm x 0mm
1920x1200 0.00*
1600x1200 0.00
1280x1024 0.00
1024x768 0.00
800x600 0.00
640x480 0.00
```

So I see there's only one screen detected and therefore, I cannot run the following command to display both screen as per my will:

`$ xrandr --output <RightScreen> --right-of default`

As I don't know the name of <RightScreen>.

The weirdest thing being that, on reboot with right HDMI screen plugged in, the boot appears on the right screen and nothing appears on the main (left) screen. When I log in, XFCE is unable to display anything on the right screen and I'm left with both screens unusable. The only solution is to manually shutdown the computer (by pressing the button), unplug the right screen and boot again.

What am I missing? I am completely new in Linux world, let alone FreeBSD so bear with me if I am doing something completely wrong.

Any help would be kindly appreciated. Thanks!


----------



## wblock@ (Apr 3, 2015)

vesa is a fall-back driver, not as powerful as specific drivers.  It might not support multihead at all.

Only the Virtual entry is really needed.  X will use the native resolution for each monitor by default.  But again, vesa is limited and might not be able to drive a monitor at full resolution.


----------



## Steve17 (Apr 3, 2015)

Thanks wblock@ for replying.

Do you mean I need to change this value in xorg.conf?

When Virtual entry is set up, I'm left with my default left screen all fuzzy but with an extended desktop. The right screen is showing nothing though.

Can I change the value for another driver? Do I have to install another driver?

Here is the output for `$ pkg info -a -o | grep video`:

```
videoproto-2.3.2               x11/videoproto
xf86-video-ati-6.14.6_3        x11-drivers/xf86-video-ati
xf86-video-intel-2.7.1_8       x11-drivers/xf86-video-intel
xf86-video-mach64-6.9.4_3      x11-drivers/xf86-video-mach64
xf86-video-nv-2.1.20_4         x11-drivers/xf86-video-nv
xf86-video-openchrome-0.3.3_3  x11-drivers/xf86-video-openchrome
xf86-video-r128-6.9.2_3        x11-drivers/xf86-video-r128
xf86-video-vesa-2.3.3_3        x11-drivers/xf86-video-vesa
```

As per this thread, it seems that VESA driver does not support multi-head at all.


----------



## wblock@ (Apr 4, 2015)

When autoconfiguration picks the vesa driver, it usually means that the video hardware is not directly supported.  Which exact Intel processor do you have?


----------



## Steve17 (Apr 7, 2015)

Hi wblock@, I'm back again on my workstation. Here's the output for `$ sysctl hw.model hw.machine hw.ncpu`:


```
hw.model: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
hw.machine: amd64
hw.ncpu: 8
```

Thanks for helping me out.


----------



## wblock@ (Apr 7, 2015)

Interesting.  That is a third-generation i7 from 2012, with "Intel® HD Graphics 4000".  The intel driver should support that.  So why does your xorg.conf show it detected a Xeon E3-1200?  Was that xorg.conf copied from another machine?


----------



## Steve17 (Apr 7, 2015)

Hi wblock@.

That is, in fact, interesting.
No, that xorg.conf was the very one generated with the `$ Xorg -configure` command on my workstation.

I tried in fact to switch from vesa to intel in xorg.conf but with no success.


----------



## Oko (Apr 7, 2015)

There is a second way to play with multi-head. Forget about xorg.conf all together and play with `xrandr` once you are already logged in GUI. The second way has advantage that you can experiment more easily. Once you get appropriate `xrandr` commands parameters put them into a script and execute them upon first login.


----------



## Steve17 (Apr 7, 2015)

Many thanks Oko for participating in my issue.

I've already been able to play around with xrandr. Unfortunately, this command returns me only one screen when the both screens are, in fact, plugged in.

Here the output for `$ xrandr`:


```
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 1920 x 1200, maximum 1920 x 1200
default connected 1920x1200+0+0 0mm x 0mm
1920x1200 0.00*
1600x1200 0.00
1280x1024 0.00
1024x768 0.00
800x600 0.00
640x480 0.00
```


----------



## wblock@ (Apr 7, 2015)

Please show the output of `pciconf -lv`.


----------



## Steve17 (Apr 7, 2015)

Here's the output of `$ pciconf -lv`:


```
hostb0@pci0:0:0:0:    class=0x060000 card=0x05771028 chip=0x01508086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:0:2:0:    class=0x030000 card=0x05771028 chip=0x01628086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller'
    class      = display
    subclass   = VGA
xhci0@pci0:0:20:0:    class=0x0c0330 card=0x05771028 chip=0x1e318086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family USB xHCI Host Controller'
    class      = serial bus
    subclass   = USB
none0@pci0:0:22:0:    class=0x078000 card=0x05771028 chip=0x1e3a8086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family MEI Controller'
    class      = simple comms
em0@pci0:0:25:0:    class=0x020000 card=0x052c1028 chip=0x15028086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82579LM Gigabit Network Connection'
    class      = network
    subclass   = ethernet
ehci0@pci0:0:26:0:    class=0x0c0320 card=0x05771028 chip=0x1e2d8086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family USB Enhanced Host Controller'
    class      = serial bus
    subclass   = USB
hdac0@pci0:0:27:0:    class=0x040300 card=0x05771028 chip=0x1e208086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family High Definition Audio Controller'
    class      = multimedia
    subclass   = HDA
ehci1@pci0:0:29:0:    class=0x0c0320 card=0x05771028 chip=0x1e268086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family USB Enhanced Host Controller'
    class      = serial bus
    subclass   = USB
isab0@pci0:0:31:0:    class=0x060100 card=0x05771028 chip=0x1e478086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Q77 Express Chipset LPC Controller'
    class      = bridge
    subclass   = PCI-ISA
ahci0@pci0:0:31:2:    class=0x010601 card=0x05771028 chip=0x1e028086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
none1@pci0:0:31:3:    class=0x0c0500 card=0x05771028 chip=0x1e228086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7 Series/C210 Series Chipset Family SMBus Controller'
    class      = serial bus
    subclass   = SMBus
```


----------



## wblock@ (Apr 7, 2015)

The i7-3770 appears to be a variation of the E3, possibly an E3-1230.  What happens when you remove the entire xorg.conf and replace it with just this:

```
Section "Device"
  Identifier  "Card0"
  Driver  "intel"
  VendorName  "Intel Corporation"
  BoardName  "Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller"
EndSection
```

That is the whole file, no other entries.


----------



## Steve17 (Apr 8, 2015)

Hi wblock@, I've properly set up xorg.conf as per your recommendation. Here's the output.

On reboot, with both screens plugged in, the boot process shows in the right screen (the additional one). However, the GUI is not starting and I'm left with the login prompt. I do so, then use `$ startx` to start X.org and here's the error:

```
(==) Using config file: "/etc/X11/xorg.conf"
(EE) No devices detected.

Fatal server error:
no screens found

Please consult ...

xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
$ _
```


----------



## wblock@ (Apr 8, 2015)

Please post /var/log/Xorg.0.log on a public site (like www.pastebin.com) and give a link.  After that, I think this needs either a PR or a consultation with the freebsd-x11 mailing list.  It could be a bug introduced in the FreeBSD version of the driver, or possibly something that will be fixed when the driver is updated.


----------



## Steve17 (Apr 9, 2015)

Hi wblock@.

Here is what you asked: http://pastebin.com/1MRZq850

Many thanks for helping me out.


----------



## abishai (Apr 9, 2015)

This is the log with VESA driver. What about Intel one? Maybe it throws some obvious errors.


----------



## Steve17 (Apr 9, 2015)

Right. Where can I find the log with intel driver?

wblock@ asked me for the /var/log/Xorg.0.log file. Shouldn't this log show intel driver trials?

Thanks.


----------



## wblock@ (Apr 9, 2015)

Each time X is started, the log file is rotated.  So change the driver in xorg.conf, then `startx`, then save the log file.


----------

