Information collection thread: Graphics drivers, xorg.conf etc.

freebsd_noob

Active Member

Reaction score: 84
Messages: 227

the real purpose is to provide a basis to easily do all this fine tuning (sysctl, dev, rc.conf etc) so no step gets forgotten, and administer things like network, pf and jails in an easy way, without need for CLI.
Reminds me of sysutils/desktop-installer:
Desktop-installer is a post-install script that embodies the extensive knowledge needed to configure a clean, reliable FreeBSD desktop system. It automates the process of configuring a FreeBSD workstation or laptop computer, allowing typical users to set up a fully functional desktop environment in less than an hour.
 

hruodr

Aspiring Daemon

Reaction score: 171
Messages: 644

Didn't know one can use even Tcl for web serving...

The important part: tcl's socket and wait commands. The rest is simple because http is simple. The
difficult part is rendering html/css, running javascript, etc, but that is done by the client, not the server.
You do not need to implement cgi, as you see in the examples, you can run other things than puts
(write to stdout). And I find tcl easier than perl.
 

SlySven

Member

Reaction score: 3
Messages: 25

I am using the FreeBSD port of the NVidia drivers and seem to have to use the (FreeBSD branded!) NVidia configuration tool to set up my displays the way I like it (this seems to involves inserting a NVidia custom line into the xorg.conf file - when one clicks the save to Xorg.conf option and which does, obviously required permissions if not root and one wants to write to the system one) in order to get all (three) screens to show the greeter before login.

However, I believe that afterwards there is a separate, per-user dot-file used to save the details (when one clicks the "Apply" button) - but the two are definitely separate actions. So, doing without the Xorg.conf file might indeed be what one ought to be doing...
 

JAW

Member

Reaction score: 32
Messages: 78

pciconf -lv | grep -A4 vgapci
Code:
vgapci0@pci0:0:2:0:     class=0x030000 card=0x011b106b chip=0x16268086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 6000'
    class      = display
    subclass   = VGA


loader.conf
Code:
# Try to skip unnecessary mode sets at boot time
compat.linuxkpi.i915_fastboot=1

# Enable power-saving display C-states (0=disable; 1=up to DC5; 2=up to DC6)
compat.linuxkpi.i915_enable_dc=2

# Disable display power wells when possible (0=power wells always on, 1=power wells disabled when possible)
compat.linuxkpi.i915_disable_power_well=1

# Enable frame buffer compression for power savings
compat.linuxkpi.i915_enable_fbc=1


rc.conf
Code:
# Enable Linux emulation layer
linux_enable="YES"

# Load Intel GPU kernel modesetting module
kld_list="/boot/modules/i915kms.ko"


xorg.conf
Code:
Section "ServerLayout"
    Identifier    "X.org Configured"
    Screen    0    "Screen0"        0    0
    InputDevice    "Mouse0"        "CorePointer"
    InputDevice    "Keyboard0"        "CoreKeyboard"
    Option        "AutoAddDevices"    "false"
EndSection

Section "Files"
    ModulePath   "/usr/local/lib/xorg/modules"
    FontPath     "/usr/local/share/fonts/misc/"
#    FontPath     "/usr/local/share/fonts/TTF/"
#    FontPath     "/usr/local/share/fonts/OTF/"
#    FontPath     "/usr/local/share/fonts/Type1/"
#    FontPath     "/usr/local/share/fonts/100dpi/"
#    FontPath     "/usr/local/share/fonts/75dpi/"
#    FontPath     "/usr/local/share/fonts/cantarell/"
    FontPath     "/usr/local/share/fonts/dejavu/"
    FontPath     "/usr/local/share/fonts/inconsolata/"
    FontPath     "/usr/local/share/fonts/Liberation/"
    FontPath     "/usr/local/share/fonts/font-awesome/"
    FontPath     "/usr/local/share/fonts/terminus-font/"
    FontPath     "/usr/local/share/fonts/webfonts/"
EndSection

#Section "Module"
#    Load  "glx"
#    Load  "freetype"
#EndSection

Section "InputDevice"
    Identifier      "Keyboard0"
    Driver          "keyboard"
    Option        "XkbRules"    "xorg"
    Option        "XkbModel"    "pc105"
    Option        "XkbLayout"    "gb"
    Option        "XkbVariant"    "mac"
EndSection

Section "InputDevice"
    Identifier    "Mouse0"
    Driver        "mouse"
    Option        "Protocol"    "auto"
    Option        "Device"    "/dev/sysmouse"
#    Option        "Device"    "/dev/wsp0"
    Option        "Buttons"    "5"
    Option        "ButtonMapping"    "1 2 3 4 5"
    Option        "ZAxisMapping"    "4 5"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Apple"
    ModelName    "MacBook"
#    DisplaySize  288 180
    DisplaySize  284 178    
EndSection

# See "man modesetting" for full list of options
#Section "Device"
#    Identifier  "Device0"
#    Driver      "modesetting"
#    Option      "AccelMethod"    "glamor"
#    Option      "PageFlip"        "true"
#EndSection

# See "man intel" for full list of options
Section "Device"
    Identifier      "Device0"
    Driver          "intel"
    Option          "Accel"            "true"
    Option          "AccelMethod"        "sna"
##    Option          "AccelMethod"        "uxa"
#    Option        "VSync"            "true"
#    Option        "PageFlip"        "true"
#    Option        "SwapbuffersWait"    "true"
    Option        "TearFree"        "true"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Device0"
    Monitor    "Monitor0"
    SubSection "Display"
        Viewport      0 0
        Depth         24
        Modes        "1440x900"
    EndSubSection
EndSection


Enjoy! :cool:
 

mickey

Aspiring Daemon

Reaction score: 227
Messages: 642

pciconf -lv | grep -A4 vgapci
Code:
vgapci0@pci0:0:2:0:     class=0x030000 card=0x86941043 chip=0x19128086 rev=0x06 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 530'
    class      = display
    subclass   = VGA


rc.conf
Code:
kld_list="/boot/modules/i915kms.ko"


xorg.conf
Code:
# Set up additional font paths.

Section "Files"
        FontPath                "/usr/local/share/fonts/terminus-font"
        FontPath                "/usr/local/share/fonts/urwfonts"
        FontPath                "/usr/local/share/fonts/dejavu"
        FontPath                "/usr/local/share/fonts/webfonts/"
EndSection

# X server settings.

Section "ServerFlags"
        Option                  "BlankTime"     "10"
        Option                  "StandbyTime"   "23"
        Option                  "SuspendTime"   "23"
        Option                  "OffTime"       "23"
EndSection

# Assume some sane defaults for all keyboards.

Section "InputClass"
        Identifier              "Keyboard Defaults"
        MatchIsKeyboard         "yes"
        Option                  "XkbLayout"     "de"
        Option                  "XkbVariant"    "nodeadkeys"
        Option                  "XkbOptions"    "numpad:pc,kpdl:dot"
EndSection

# PS/2 system keyboard is a 102-key model.

Section "InputClass"
        Identifier              "PS/2 System Keyboard"
        MatchIsKeyboard         "yes"
        MatchProduct            "AT keyboard"
        Option                  "XkbModel"      "pc102"
EndSection

# Assume some sane defaults for all pointing devices.

Section "InputClass"
        Identifier              "Mouse Defaults"
        MatchIsPointer          "yes"
#       Option                  "Buttons"               "3"
        Option                  "MiddleEmulation"       "no"
EndSection

# Graphics card configuration.

Section "Device"
        Identifier              "HD530"
        Driver                  "modesetting"
        VendorName              "Intel"
        BoardName               "HD 530"
EndSection

# Monitor configuration.

Section "Monitor"
        Identifier              "PLE2472HD"
EndSection

# Screen configuration.

Section "Screen"
        Identifier              "Screen0"
        Device                  "HD530"
        Monitor                 "PLE2472HD"
        DefaultDepth            24

        SubSection "Display"
                Depth           24
        EndSubSection
EndSection

sysctl.conf
Code:
# Configure kernel evdev support:
# 0x01  Enable sysmouse
# 0x02  Enable kbdmux
# 0x04  Enable hardware mouse devices
# 0x08  Enable hardware keyboard devices
kern.evdev.rcpt_mask=0xC
 
Last edited:

richardtoohey2

Well-Known Member

Reaction score: 194
Messages: 384

I guess it won't do damage having the Linux emulation active in case any app wants it.
Are there any security implications in doing that? I don't know, just wondering. Might not be important in the context of a desktop set-up (lots of other things being installed and enabled, so one more thing won't really make a difference).
 

SlySven

Member

Reaction score: 3
Messages: 25

Ah, back in FreeBSD land and I tried removing /etc/X11/xorg.conf and it didn't work - looking through /var/log/Xorg.0.log I see that it tried to load the nv module (and left me with a set of blank screens) instead of the nvidia one that was used when I put the file back and got the sddm greeter back.
 

Mjölnir

Daemon

Reaction score: 1,056
Messages: 1,492

I would suggest to call it sysutils/autoSnurg ;)
As I currently only have computers with Nvidia graphics, I need information how other graphics chips are set up, in particular Intel and ATI/AMD.
In case anybody is willing to help me, I would be grateful if you can post the following information of your working configuration: pciconf -lv | grep -A4 vgapci
psearch -c sysutils hardware Oh, looks interesting: portell hw-probe
Code:
The tool is intended to simplify collecting of logs necessary for investigating hardware related problems. [...]
WWW: https://bsd-hardware.info/

You might wanto to ask the maintainer of that site to provide you with tons of vgapci device snippets. In the meantime...
pciconf -lv | fgrep -A1 -B3 display
Code:
vgapci0@pci0:0:2:0:     class=0x030000 card=0x503617aa chip=0x16168086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 5500'
    class      = display
    subclass   = VGA

/boot/loader.conf
Code:
# System tunables/sysctl(8) knobs.  Please keep sorted to avoid duplicates.
#
# INTEL DRM WITH graphics/drm-kmod PACKAGE (NEW)
compat.linuxkpi.enable_rc6="7"  # ENABLE POWER SAVING RENDER C-STATE 6
compat.linuxkpi.enable_dc="2"   # ENABLE POWER SAVING DISPLAY C-STATES
compat.linuxkpi.enable_fbc="1"  # ENABLE FRAME BUFFER COMPRESSION FOR POWER SAVINGS
compat.linuxkpi.i915_fastboot="1" # SKIP UNNECESSARY MODE SETS AT BOOT TIME
compat.linuxkpi.i915_nuclear_pageflip="1"
compat.linuxkpi.semaphores="1"  # USE SEMAPHORES FOR INTER RING SYNC

/etc/rc.conf
Code:
kld_list="/boot/modules/i915kms.ko ${kld_list} dpms"
kld_list="$kld_list sem"                # for firefox?
dbus_enable="YES"
hald_enable="YES"                       # obsolete, still webcamd(8) needs it
linux_enable="YES"                      # some KDE apps need that?
linux_mounts_enable="NO"          # want tmpfs(5) mount option size=XY for /compat/linux/tmp in fstab(5)
sddm_enable="YES"                     # sddm(1) graphical login & sddm-greeter(1)
sddm_nice="0"                              # because we have priority=-5 for root in login.conf(5)
webcamd_enable="YES"
webcamd_flags="-H"
kld_list="${kld_list} cuse"             # cuse(4) for webcamd(8)

/etc/sysctl.conf
Code:
# nothing related to graphics adapter

/usr/local/etc/X11/xorg.conf.d/{monitors,server-layout,video}.conf
Code:
#
# The Xserver(8) recognizes the dimensions of the monitor correctly, but
# later the intel(5) driver sets them to much larger values.  I guess this
# is considered a feature, intended to shrink the output on very small
# screens like subnotebooks/tablets/phones. NOTE this sizing stuff is
# slightly complex (pixel size, distance eye-display, etc...).
# Pro:
#       + for the GUI it appears like a larger monitor, and more items can be
#         placed on the sceen -- this improves the usability of these devices.
#       + for developers it's much simpler to agree on a standard resolution
#         (nowadays 96 DPI), and write their programs just for that.
#         Then the requirements of different use-cases are done by scaling.
# Contra:
#       - the server lies (intentionally) about the DPI, thus all the fonts are
#         shrinked and often difficult to read, esp. when browsing the internet.
#
# While this may make sense on a smartphone/tablet, I want "the truth" on
# my 14" laptop.
#
# The key is to link the monitor to the card in the device section of the
# graphics card: e.g. in /usr/local/etc/X11/xorg.conf.d/intel-HD-5500.conf
# Option "Monitor-LVDS1"        "<Notebook internal LCD>" or
# Option "Monitor-eDP1"         "<Notebook internal TFT>"
# Option "Monitor-DP2"          "<external monitor (needs setup)>"
# NOTE: beware, naturally in a docking station the numbering changes:
# Option "Monitor-DP2-3"        "<external LCD [VGA,docked]>"
#
Section "Monitor"
    Identifier          "<default monitor>"
    #these two should be enabled if DisplaySize is set below
    VendorName          "CMN"
    ModelName           "1482"
    Option              "primary"       "yes"
    # This monitor does not report power management features...
    #    Option             "DPMS"          "off"
    # You can grep(1) these values from /var/log/Xorg.0.log
    # Although the Xserver(8) detects it, we have to tell intel(5) explicitely
    # to use this and not setting the wrong DPI.
    DisplaySize         309     174     # also in Xorg.0.log
EndSection
Section "Monitor"
    Identifier          "<external LCD [Philips]>"
    # If you coment out the next two lines, this will match any monitor...
    VendorName          "PHL"           # Philips
    ModelName           "81d"           # Philips 170b
    # tell the GPU driver to use this and do not set the wrong DPI.
    DisplaySize         338     270     # grep(1) from Xorg.0.log: "Image size"
    Option              "PreferedMode"  "1280x1024"
    # For multihead-setup:
    Option              "primary"       "no"
    Option              "LeftOf"        "<default monitor>"
EndSection
Section "Monitor"
    Identifier          "<external monitor (needs setup)>"
    #Option             "Ignore"        "yes"
    Option              "primary"       "no"
    Option              "leftOf"        "<default monitor>"
    # tell the GPU driver to use this and do not set the wrong DPI.
    #DisplaySize        horiz   vert    # TODO: grep(1) from Xorg.0.log: "Image size"
EndSection
Section "Screen"
    Identifier  "<default Screen>"
    Device      "<Intel HD Graphics 5500>"
    Monitor     "<default monitor>"
EndSection
Section "Screen"
    Identifier  "<external Screen [Philips]>"
    Device      "<Intel HD Graphics 5500>"
    Monitor     "<external LCD [Philips]>"
EndSection
Section "Screen"
    Identifier  "<external Screen [unknown]>"
    Device      "<Intel HD Graphics 5500>"
    Monitor     "<external monitor (needs setup)>"
EndSection
Section "ServerLayout"
    Identifier  "<Multi Screen Layout [Philips]>"
    Screen      0 "<default Screen>"
    Screen      1 "<external Screen [Philips]>" leftOf "<default Screen>"
EndSection
Section "ServerLayout"
    Identifier  "<Multi Screen Layout [unknown]>"
    Screen      0 "<default Screen>"
    Screen      1 "<external Screen [unknown]>" leftOf "<default Screen>"
EndSection
Section "ServerLayout"
Identifier  "<Default Screen Layout [solo]>"
Screen      "<default Screen>"
EndSection
#
# Here we switch between layouts -- TODO: find out out to do that from sddm(8)
#
Section "ServerFlags"
#    Option     "DefaultServerLayout"   "<Default Screen Layout [solo]>"
    Option      "DefaultServerLayout"   "<Multi Screen Layout [Philips]>"
#    Option     "DefaultServerLayout"   "<Multi Screen Layout [unknown]>"
EndSection
Section "Module"
#    load "glamoregl"                                      # for Option "AccelMethod" "glarmor"
EndSection
Section "Device"
    Identifier  "<Intel HD Graphics 5500>"
    Driver      "intel"
    Option      "TripleBuffer"  "on"
    Option      "TearFree"      "on"
    Option      "UseEDIDDpi"    "yes"
#    Option     "AccelMethod"   "glamor"        # Default: UXA
# These are now in monitors.conf
    Option      "Monitor-eDP-1" "<default monitor>"
    Option      "Monitor-DP-1"  "<external monitor (needs setup)>"
    Option      "Monitor-DP-2"  "<external LCD [Philips]>"
    Option      "Monitor-HDMI-1" "<external LCD [Philips]>"
    Option      "Monitor-HDMI-2" "<external LCD [Philips]>"
EndSection
# RTFM xorg.conf(5) says: one "Device" section for each head.
# That's definitely bullshit! This fails:
#Section "Device"
#    Identifier "<Intel HD Graphics 5500 [Philips]>"
#    Driver     "intel"
#    Screen     1
#    Option     "TearFree"      "on"
#    Option     "Monitor-DP2-1" "<external LCD [Philips]>"
#EndSection
#Section "Device"
#    Identifier "<Intel HD Graphics 5500 [VGA,internal]>"
#    Driver     "intel"
#    Screen     2
#    Option     "TearFree"      "on"
#    Option     "Monitor-DP2"   "<external monitor (needs setup)>"
#EndSection

Thx to mickey, I'll add a keyboard.conf to the xorg.conf.d(5) folder.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,126
Messages: 35,604

Ah, back in FreeBSD land and I tried removing /etc/X11/xorg.conf and it didn't work - looking through /var/log/Xorg.0.log I see that it tried to load the nv module (and left me with a set of blank screens) instead of the nvidia one that was used when I put the file back and got the sddm greeter back.
You only need a small file to fix that, /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf:
Code:
Section "Device"
        Identifier "Card0"
        Driver     "nvidia"
EndSection
 

tyson

Member

Reaction score: 21
Messages: 54

Here is my setup. Output of pciconf -lv | fgrep -A1 -B3 display :
Code:
vgapci0@pci0:1:0:0:    class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1c02 subvendor=0x19da subdevice=0x2438
    vendor     = 'NVIDIA Corporation'
    device     = 'GP106 [GeForce GTX 1060 3GB]'
    class      = display
    subclass   = VGA

I have 2 monitors and im setting up keyboard layout for X too.
/usr/local/etc/X11/xorg.conf.d/10-nvidia.conf
Code:
ection "Device"
    Identifier     "NvidiaGFX"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 1060 3GB"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "NvidiaGFX"
    Monitor        "DFP-6"
    DefaultDepth    24
#    Option         "Coolbits" "8"
    Option         "DPI" "94x94"
    Option         "UseEdidDpi" "False"
#    Option         "metamodes" "DFP-6: nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}, DFP-4: nvidia-auto-select +1920+432 {ForceFullCompositionPipeline=On}"
    Option         "MetaModes" "DFP-6: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, DFP-4: nvidia-auto-select +1920+432 {ForceCompositionPipeline=On}"
#    Option        "HardDPMS" "false"
#    Option         "AllowIndirectGLXProtocol" "off"
#    Option        "RenderAccel" "false"
    Option         "TripleBuffer" "on"
#    Option        "AllowUnofficialGLXProtocol" "True"
#    Option        "UseCompositeWrapper" "True"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

usr/local/etc/X11/xorg.conf.d/20-keyboard.conf:
Code:
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"    # Limit these settings to keyboards
        Driver "evdev"
        Option "XkbModel" "pc101"
        Option "XkbLayout" "pl"
        Option "XkbOptions" "lv3:ralt_switch"
EndSection

usr/local/etc/X11/xorg.conf.d/30-mouse.conf:
Code:
Section "InputClass"
        Identifier "Evdev Mouse"
        Driver "evdev"
        MatchProduct    "COMPANY USB Device"
        MatchIsPointer  "yes"
        #Option "evBits"  "+1-2"
        #Option "keyBits" "~272-287"
        #Option "relBits" "~0-2 ~6 ~8"
        #Option "Pass"   "3"
        MatchDevicePath  "/dev/input/event*"
EndSection

As u can see there is plenty of settings u can use evdev to configure.
 
OP
Snurg

Snurg

Daemon

Reaction score: 411
Messages: 1,009

Thank you all for your help! 👍

What is awesome is the usefulness of not only the data you provided, but also the many important side details!

For example, [USER=37644]Mjölnir[/USER] 's hint to https://bsd-hardware.info/ is a wonderful source to make sure one gets the detection right even for hardware nobody here has.

Or, for example, [USER=2588]tyson[/USER] showed that evdev() can still be used without hacking into the system.
This is very good! On Linux, re-enabling evdev fixes some of the problems libinput() causes in particular with scroll wheels and the like, and explicitly using evdev instad of libinput is way easier than to modify the sources to completely get rid of libinput.
So there will be an option to use evdev instead of libinput :)

Ladies and gents, thank you all again 👍 👍 👍
 

Trihexagonal

Daemon

Reaction score: 1,242
Messages: 1,877

I just added this to mine. No reason you can't use it if it will help your effort:

If you have a boxen with Switichable Graphics drivers for both chips should be checked to be installed at the Driver Selection screen. I have a Thinkpad T400 that has Switchable Graphics with Intel GMA 4500MHD and ATI Mobility Radeon HD 3470 chips. Both the Intel and ATI driver need to be checked for install at the driver selection screen during the install of x11/xorg.

Before you boot to the desktop it needs to be put into "Discreet" graphics mode in the BIOS. It then defaults to the Radeon chip and runs fine without any tweaking.
 
OP
Snurg

Snurg

Daemon

Reaction score: 411
Messages: 1,009

If you have a boxen with Switichable Graphics drivers for both chips should be checked to be installed at the Driver Selection screen. [...] Both the Intel and ATI driver...

... "Discreet" graphics mode in the BIOS. It then defaults to the Radeon chip and runs fine without any tweaking.
Thank you very much for this! 👍
The information regarding dual GPU notebooks is particularly important, to avoid user frustration, so I am particularly grateful for this information how to handle these combos correctly.

The information how to set up BIOS in these cases is crucial, too!
There will have to be big red info boxes alerting the user what must not be forgotten before proceeding!

So thanks to you the mystery of Intel/ATI combo is lifted :)
Does anybody here have found out how to make other dual GPU combos like Intel/NvidiaOptimus etc work reliably, too?
 

Trihexagonal

Daemon

Reaction score: 1,242
Messages: 1,877

Does anybody here have found out how to make other dual GPU combos like Intel/NvidiaOptimus etc work reliably, too?

I'm guessing but would think the process for all dual GPU combos would be the same procedure, select driver install for both chips, then set the BIOS to reflect the proper Graphics Mode. Most likely to "Discreet" Graphics. Some make need Linux base, others not.

This is what I have for making Nvidia work on older chips that aren't dual core and all I ever do to make it work. If it helps feel free to use it:

If your box uses an older nvidia chip, maybe a Quardo NVS 140M or Quadro 1000M with Optimus, we have easy work first. Your card will need x11/nvidia-driver-304 or x11/nvidia-driver-340, emulators/linux_base-c7, x11/nvidia-settings and x11/nvidia-xconfig.

As root, run nvidia-xconfig
Run ee /ect/rc.conf
Edit in linux_enable="YES", save and exit.
Run ee /boot/loader.conf
To cover all chips, Edit in:

Code:
linux_load="YES"
nvidia_load="YES"
nvidia-modset_load="YES"

Now save file, exit editor and reboot.

Optimus still needs set to Discreet. After login run startx, the Nvidia splash screen will display briefly and it's "Straight On Till Desktop". (A Hammer film reference.)
 
Top