Display, Graphics, and Multi-Monitor SetupStart with the driver that supports your exact GPU, then configure displays in the running desktop session. Avoid creating an xorg.conf unless automatic configuration fails; modern Xorg normally detects the monitor, input devices, and the appropriate modesetting driver itself.
Find the graphics adapter and record the device description before installing a driver:
pciconf -lv | less
dmesg | grep -Ei 'drm|i915|amdgpu|radeon|nvidia'
Look for a display or VGA controller in the pciconf output. On laptops with both integrated and discrete graphics, record both adapters. Display connectors wired to a different GPU may not be available to the desktop session you started.
The MidnightBSD AMD GPU wiki, NVIDIA GPU wiki, and recommended-hardware list provide compatibility reports. They are useful guidance, not a substitute for checking the current release and the exact chipset.
Xorg is the established default for MidnightBSD desktops. The Xorg and Desktop Environments page covers installing and starting a desktop. Wayland is a separate path with its own compositor and session requirements.
For a basic display, first try Xorg without an extra Xorg video driver. The built-in modesetting driver is often sufficient. Hardware acceleration for supported Intel and AMD GPUs uses DRM/KMS kernel modules, firmware, and Mesa. The relevant current mports are:
graphics/drm-515-kmod
graphics/gpu-firmware-kmod
graphics/mesa-dri
x11/xrandr
x11/nvidia-driver
drm-515-kmod requires MidnightBSD 4.1 or later and conflicts with other DRM kmod versions. Choose the DRM port appropriate for your operating-system release; do not install multiple DRM kmod packages together.
For compatible Intel or AMD hardware on MidnightBSD 4.1 or later, install the DRM driver, firmware collection, and Mesa drivers:
doas mport install drm-515-kmod gpu-firmware-kmod mesa-dri
Load one module for the GPU type, then confirm that DRM devices were created:
doas kldload i915kms # Intel
doas kldload amdgpu # newer AMD
doas kldload radeonkms # older AMD
ls /dev/dri
kldstat | grep -E 'i915|amdgpu|radeon'
Use only one of the three kldload commands. If it works, arrange for that same module to load at boot without replacing existing entries in kld_list:
doas sysrc kld_list+=" i915kms"
Replace i915kms with amdgpu or radeonkms when applicable. Log out and back in, or restart the graphical session, after changing a graphics module.
Supported NVIDIA cards use the binary driver from the x11/nvidia-driver mport on amd64. The NVIDIA wiki lists known working series and notes that support depends on the driver branch. Older cards may need one of the versioned legacy driver mports rather than the current driver.
Install the driver only after confirming that it supports the card and MidnightBSD release:
doas mport install nvidia-driver
nvidia-smi
Do not combine an NVIDIA driver configuration with Intel or AMD DRM instructions unless you understand the hybrid-graphics design of the machine. A black screen after switching drivers is best investigated from a text console using the Xorg log and dmesg.
Run xrandr inside the Xorg desktop session. It lists output names, connection state, available modes, the current mode (marked with *), and the preferred mode (marked with +):
xrandr --query
Use the names reported by your system, not the sample names below. Enable a connected external display to the right of the internal display:
xrandr --output HDMI-1 --auto --right-of eDP-1
Set a primary display and a known mode when needed:
xrandr --output HDMI-1 --primary --mode 1920x1080
xrandr --output HDMI-1 --off
The first command changes only the current session. The second example disables the output. To test a longer command without applying it, add --dryrun. If a mode leaves a screen unusable, wait a moment and use a text console to restart the graphical session; do not reboot blindly.
Many desktop environments provide a display settings panel that saves the arrangement for the logged-in user. Prefer that panel when it works. For a window manager or a session without display settings, put a tested xrandr command in the desktop session's startup file, such as ~/.xprofile or the window manager's autostart configuration.
Do not place an xrandr command in system boot configuration: it needs a running Xorg session and the logged-in user's display. Keep a known-good one-monitor command so you can recover after docking or disconnecting an external display.
xrandr --query and dmesg before and after connection./dev/dri devices: confirm the intended DRM module loaded with kldstat and inspect dmesg for firmware or attachment errors.xrandr --verbose. Avoid forcing modelines until the driver and monitor detection are known to work.dmesg, and undo only the driver configuration you just added.See Desktop Troubleshooting for logs, recovery, and reporting guidance, and Laptop Use and Power Management for suspend and external-display considerations.