# Incorrect screen resolution when DM is autostarted



## maddog39 (Feb 4, 2017)

I'm trying to get SLIM / MATE going on my laptop (details, logs below) and have run into a snag I can't get to the bottom of. If I've mis-categorized this thread, please forgive me.

When SLIM is started manually via `service slim onestart', the display manager starts properly and works as expected. If I set SLIM to autostart in rc.conf and reboot the system, all the graphics are slightly off the top edge of the screen and forces a 1024x768 resolution. The native resolution of the display is 1366x768. Also noteworthy, is that I can't use any of my TTYs when this happens either as they all print garbage to the screen.

Hardware
Lenovo ThinkPad T420 / Core i5-2520U / 6GB RAM / Integrated Graphics

Software
FreeBSD 11.0-RELEASE-p1 / SLIM 1.3.6_13 / MATE 1.12.1

Logs

(autostart) dmesg | grep drm

```
info: [drm] Initialized drm 1.1.0 20060810
drmn0: <Intel SandyBridge (M)> on vgapci0
info: [drm] Memory usable by graphics device = 2048M
info: [drm] MTRR allocation failed.  Graphics performance may suffer.
info: [drm] MSI enabled 1 message(s)
info: [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
info: [drm] Driver supports precise vblank timestamp query.
info: [drm] GMBUS [i915 gmbus dpb] timed out, falling back to bit banging on pin 5
drmn0: taking over the fictitious range 0xe0000000-0xf0000000
info: [drm] Connector LVDS-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.LVDS-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector VGA-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.VGA-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-2: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-2
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-3: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-3
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-2: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-2
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-3: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-3
info: [drm]   - kern.vt.fb.default_mode
fbd0 on drmn0
info: [drm] Initialized i915 1.6.0 20080730 for drmn0 on minor 0
info: [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
```

(onestart) dmesg | grep drm

```
info: [drm] Initialized drm 1.1.0 20060810
drmn0: <Intel SandyBridge (M)> on vgapci0
info: [drm] Memory usable by graphics device = 2048M
info: [drm] MTRR allocation failed.  Graphics performance may suffer.
info: [drm] MSI enabled 1 message(s)
info: [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
info: [drm] Driver supports precise vblank timestamp query.
info: [drm] GMBUS [i915 gmbus dpb] timed out, falling back to bit banging on pin 5
drmn0: taking over the fictitious range 0xe0000000-0xf0000000
info: [drm] Connector LVDS-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.LVDS-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector VGA-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.VGA-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-2: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-2
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-3: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-3
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-2: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-2
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-3: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-3
info: [drm]   - kern.vt.fb.default_mode
fbd0 on drmn0
info: [drm] Initialized i915 1.6.0 20080730 for drmn0 on minor 0
info: [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
info: [drm] Initialized drm 1.1.0 20060810
drmn0: <Intel SandyBridge (M)> on vgapci0
info: [drm] Memory usable by graphics device = 2048M
info: [drm] MTRR allocation failed.  Graphics performance may suffer.
info: [drm] MSI enabled 1 message(s)
info: [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
info: [drm] Driver supports precise vblank timestamp query.
info: [drm] GMBUS [i915 gmbus dpb] timed out, falling back to bit banging on pin 5
drmn0: taking over the fictitious range 0xe0000000-0xf0000000
info: [drm] Connector LVDS-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.LVDS-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector VGA-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.VGA-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-1: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-1
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-2: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-2
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector HDMI-A-3: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.HDMI-A-3
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-2: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-2
info: [drm]   - kern.vt.fb.default_mode
info: [drm] Connector DP-3: get mode from tunables:
info: [drm]   - kern.vt.fb.modes.DP-3
info: [drm]   - kern.vt.fb.default_mode
fbd0 on drmn0
info: [drm] Initialized i915 1.6.0 20080730 for drmn0 on minor 0
info: [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
```

(autostart) cat Xorg.0.log | tail -75

```
[    12.580]    compiled for 1.17.4, module version = 1.0.0
[    12.580]    ABI class: X.Org ANSI C Emulation, version 0.4
[    12.580] (==) Depth 24 pixmap format is 32 bpp
[    12.580] (II) Loading sub module "int10"
[    12.580] (II) LoadModule: "int10"
[    12.580] (II) Loading /usr/local/lib/xorg/modules/libint10.so
[    12.580] (II) Module int10: vendor="X.Org Foundation"
[    12.580]    compiled for 1.17.4, module version = 1.0.0
[    12.580]    ABI class: X.Org Video Driver, version 19.0
[    12.580] (II) VESA(0): initializing int10
[    12.580] (II) VESA(0): Bad V_BIOS checksum
[    12.580] (II) VESA(0): Primary V_BIOS segment is: 0xc000
[    12.580] (II) VESA(0): VESA BIOS detected
[    12.580] (II) VESA(0): VESA VBE Version 3.0
[    12.580] (II) VESA(0): VESA VBE Total Mem: 65472 kB
[    12.580] (II) VESA(0): VESA VBE OEM: Intel(R)Sandybridge Mobile Graphics Chipset Accelerated VGA BIOS
[    12.580] (II) VESA(0): VESA VBE OEM Software Rev: 1.0
[    12.580] (II) VESA(0): VESA VBE OEM Vendor: Intel Corporation
[    12.580] (II) VESA(0): VESA VBE OEM Product: Intel(R)Sandybridge Mobile Graphics Controller
[    12.580] (II) VESA(0): VESA VBE OEM Product Rev: Hardware Version 0.0
[    12.581] (II) VESA(0): virtual address = 0x806e00000,
   physical address = 0xe0000000, size = 67043328
[    12.588] (II) VESA(0): Setting up VESA Mode 0x118 (1024x768)
[    12.662] (==) VESA(0): Default visual is TrueColor
[    12.665] (==) VESA(0): Backing store enabled
[    12.666] (==) VESA(0): DPMS enabled
[    12.666] (==) RandR enabled
[    12.668] (II) AIGLX: Screen 0 is not DRI2 capable
[    12.668] (EE) AIGLX: reverting to software rendering
[    13.192] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    13.193] (II) AIGLX: Loaded and initialized swrast
[    13.193] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[    13.326] (II) config/devd: probing input devices...
[    13.327] (II) config/devd: adding input device (null) (/dev/kbdmux)
[    13.327] (II) LoadModule: "kbd"
[    13.327] (II) Loading /usr/local/lib/xorg/modules/input/kbd_drv.so
[    13.328] (II) Module kbd: vendor="X.Org Foundation"
[    13.328]    compiled for 1.17.4, module version = 1.8.1
[    13.328]    Module class: X.Org XInput Driver
[    13.328]    ABI class: X.Org XInput driver, version 21.0
[    13.328] (II) Using input driver 'kbd' for 'kbdmux'
[    13.328] (**) kbdmux: always reports core events
[    13.328] (**) kbdmux: always reports core events
[    13.328] (**) Option "Protocol" "standard"
[    13.328] (**) Option "XkbRules" "base"
[    13.328] (**) Option "XkbModel" "pc105"
[    13.328] (**) Option "XkbLayout" "us"
[    13.328] (**) Option "config_info" "devd:kbdmux"
[    13.328] (II) XINPUT: Adding extended input device "kbdmux" (type: KEYBOARD, id 6)
[    13.332] (II) config/devd: kbdmux is enabled, ignoring device atkbd0
[    13.332] (II) config/devd: adding input device (null) (/dev/sysmouse)
[    13.332] (II) LoadModule: "mouse"
[    13.332] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[    13.335] (II) Module mouse: vendor="X.Org Foundation"
[    13.335]    compiled for 1.17.4, module version = 1.9.1
[    13.335]    Module class: X.Org XInput Driver
[    13.335]    ABI class: X.Org XInput driver, version 21.0
[    13.335] (II) Using input driver 'mouse' for 'sysmouse'
[    13.335] (**) sysmouse: always reports core events
[    13.335] (**) Option "Device" "/dev/sysmouse"
[    13.335] (==) sysmouse: Protocol: "Auto"
[    13.335] (**) sysmouse: always reports core events
[    13.335] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[    13.335] (**) sysmouse: ZAxisMapping: buttons 4 and 5
[    13.335] (**) sysmouse: Buttons: 5
[    13.335] (**) Option "config_info" "devd:sysmouse"
[    13.335] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[    13.335] (**) sysmouse: (accel) keeping acceleration scheme 1
[    13.335] (**) sysmouse: (accel) acceleration profile 0
[    13.335] (**) sysmouse: (accel) acceleration factor: 2.000
[    13.335] (**) sysmouse: (accel) acceleration threshold: 4
[    13.335] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[    13.335] (II) sysmouse: SetupAuto: protocol is SysMouse
[    13.335] (II) config/devd: device /dev/ums0 already opened
[    13.335] (II) config/devd: device /dev/psm0 already opened
```

(onestart) cat Xorg.0.log | tail -75

```
[    60.569] (==) intel(0): Intel XvMC decoder enabled
[    60.569] (II) intel(0): Set up textured video
[    60.570] (II) intel(0): [XvMC] xvmc_vld driver initialized.
[    60.570] (II) intel(0): direct rendering: DRI2 Enabled
[    60.584] (--) RandR disabled
[    60.617] (II) AIGLX: enabled GLX_MESA_copy_sub_buffer
[    60.618] (II) AIGLX: enabled GLX_ARB_create_context
[    60.618] (II) AIGLX: enabled GLX_ARB_create_context_profile
[    60.618] (II) AIGLX: enabled GLX_EXT_create_context_es2_profile
[    60.618] (II) AIGLX: enabled GLX_INTEL_swap_event
[    60.618] (II) AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control
[    60.618] (II) AIGLX: enabled GLX_EXT_framebuffer_sRGB
[    60.618] (II) AIGLX: enabled GLX_ARB_fbconfig_float
[    60.618] (II) AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects
[    60.618] (II) AIGLX: Loaded and initialized i965
[    60.618] (II) GLX: Initialized DRI2 GL provider for screen 0
[    60.618] (II) intel(0): Setting screen physical size to 361 x 203
[    60.703] (II) config/devd: probing input devices...
[    60.703] (II) config/devd: adding input device (null) (/dev/kbdmux)
[    60.703] (II) LoadModule: "kbd"
[    60.704] (II) Loading /usr/local/lib/xorg/modules/input/kbd_drv.so
[    60.704] (II) Module kbd: vendor="X.Org Foundation"
[    60.704]    compiled for 1.17.4, module version = 1.8.1
[    60.704]    Module class: X.Org XInput Driver
[    60.704]    ABI class: X.Org XInput driver, version 21.0
[    60.704] (II) Using input driver 'kbd' for 'kbdmux'
[    60.704] (**) kbdmux: always reports core events
[    60.704] (**) kbdmux: always reports core events
[    60.704] (**) Option "Protocol" "standard"
[    60.704] (**) Option "XkbRules" "base"
[    60.704] (**) Option "XkbModel" "pc105"
[    60.704] (**) Option "XkbLayout" "us"
[    60.704] (**) Option "config_info" "devd:kbdmux"
[    60.704] (II) XINPUT: Adding extended input device "kbdmux" (type: KEYBOARD, id 6)
[    60.707] (II) config/devd: kbdmux is enabled, ignoring device atkbd0
[    60.708] (II) config/devd: adding input device (null) (/dev/sysmouse)
[    60.708] (II) LoadModule: "mouse"
[    60.708] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[    60.709] (II) Module mouse: vendor="X.Org Foundation"
[    60.709]    compiled for 1.17.4, module version = 1.9.1
[    60.709]    Module class: X.Org XInput Driver
[    60.709]    ABI class: X.Org XInput driver, version 21.0
[    60.709] (II) Using input driver 'mouse' for 'sysmouse'
[    60.709] (**) sysmouse: always reports core events
[    60.709] (**) Option "Device" "/dev/sysmouse"
[    60.709] (==) sysmouse: Protocol: "Auto"
[    60.709] (**) sysmouse: always reports core events
[    60.709] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[    60.709] (**) sysmouse: ZAxisMapping: buttons 4 and 5
[    60.709] (**) sysmouse: Buttons: 5
[    60.709] (**) Option "config_info" "devd:sysmouse"
[    60.709] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[    60.709] (**) sysmouse: (accel) keeping acceleration scheme 1
[    60.709] (**) sysmouse: (accel) acceleration profile 0
[    60.709] (**) sysmouse: (accel) acceleration factor: 2.000
[    60.709] (**) sysmouse: (accel) acceleration threshold: 4
[    60.709] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[    60.709] (II) sysmouse: SetupAuto: protocol is SysMouse
[    60.709] (II) config/devd: device /dev/ums0 already opened
[    60.709] (II) config/devd: device /dev/psm0 already opened
[    66.112] (II) intel(0): EDID vendor "LGD", prod id 16544
[    66.112] (II) intel(0): Printing DDC gathered Modelines:
[    66.112] (II) intel(0): Modeline "1366x768"x0.0   69.30  1366 1398 1430 1470  768 771 776 786 -hsync -vsync (47.1 kHz eP)
[    66.225] (II) intel(0): EDID vendor "LGD", prod id 16544
[    66.225] (II) intel(0): Printing DDC gathered Modelines:
[    66.225] (II) intel(0): Modeline "1366x768"x0.0   69.30  1366 1398 1430 1470  768 771 776 786 -hsync -vsync (47.1 kHz eP)
[    66.339] (II) intel(0): EDID vendor "LGD", prod id 16544
[    66.339] (II) intel(0): Printing DDC gathered Modelines:
[    66.339] (II) intel(0): Modeline "1366x768"x0.0   69.30  1366 1398 1430 1470  768 771 776 786 -hsync -vsync (47.1 kHz eP)
[    66.452] (II) intel(0): EDID vendor "LGD", prod id 16544
[    66.452] (II) intel(0): Printing DDC gathered Modelines:
[    66.452] (II) intel(0): Modeline "1366x768"x0.0   69.30  1366 1398 1430 1470  768 771 776 786 -hsync -vsync (47.1 kHz eP)
[    67.011] (II) intel(0): EDID vendor "LGD", prod id 16544
[    67.011] (II) intel(0): Printing DDC gathered Modelines:
[    67.011] (II) intel(0): Modeline "1366x768"x0.0   69.30  1366 1398 1430 1470  768 771 776 786 -hsync -vsync (47.1 kHz eP)
```

I've searched around but was unable to find anything or anyone with exactly the same symptoms as this so any insight would very be much appreciated.

[Edit]
Fixed laptop model.


----------



## ASX (Feb 11, 2017)

From autostart:

```
[    12.668] (II) AIGLX: Screen 0 is not DRI2 capable
[    12.668] (EE) AIGLX: reverting to software rendering
```

from onestart:

```
[    60.618] (II) GLX: Initialized DRI2 GL provider for screen 0
```

To make use of hardware acceleration your user need to be a member of the 'video' group (that will enable access to /dev/dri/card0), not sure if that error is a consequence of something else, but it was the most significant difference I was able to spot.

Where are you loading i915kms module from ? rc.conf or loader.conf, or simply automatically ?
In doubt, load it from rc.conf:

```
kldlist="i915kms"
```


----------



## maddog39 (Feb 13, 2017)

Hey ASX, thanks for the response. I got discouraged and stopped checking back on this thread as frequently. I almost went back to Linux on this computer but decided to stick with it (other issues I'm working through as well).

Anyway, as to your suggestions. As I expected I was already a member of the `video' group. Furthermore, I noticed that if I run `startx' as my regular user, MATE starts and works as expected. This issue really only occurs when the display manager is autostarted it seems.

```
[alec@laptop ~]$ groups
alec wheel tty operator staff video network haldaemon vboxusers
```

Previously, I was letting the kernel autoload the GPU driver. Just to be safe, I took your suggestion and added the i915kms module to kldlist. I set slim to autostart again and rebooted the system. Upon restart I encountered the same symptoms.

Ultimately I think I've come to terms with the issue and it's not the end of the world to add startx to my .profile and to use the TTY as my login manager. I really think its just curious and I would like to understand why this is happening because the circumstances in which it happens seem to be weird and nonsensical.


----------



## ASX (Feb 13, 2017)

maddog39 said:


> I really think its just curious and I would like to understand why this is happening because the circumstances in which it happens seem to be weird and nonsensical.


I agree and am curious too.
On a second reading I realized that I gave you the wrong command, should have been:

```
kld_list="i915kms"
```
(the underscore character was missed).

EDIT: kld_list is documented in rc.conf(5)


----------



## maddog39 (Feb 13, 2017)

ASX said:


> I agree and am curious too.
> On a second reading I realized that I gave you the wrong command, should have been:
> 
> ```
> ...


Yup, I eventually figured that out last night  and sure enough, that fixed the problem. So thanks for the help!

Also, for anyone else who may run into this thread in the future and uses a ThinkPad T400/500, I found the following post on a blog which helped me resolve most of the remaining issues with this system (particularly to do with the mouse and center click scrolling).

https://www.banym.de/freebsd/install-freebsd-11-on-thinkpad-t420


----------



## chrbr (Feb 14, 2017)

Dear ASX,
before I had in /boot/loader.conf

```
i915kms_load="YES"
```
With your method of modifying /etc/rc.conf by adding

```
kld_list="i915kms"
```
results is much shorter flickering of the screen. The negotiation of the best mode seems to be significantly faster. Thank you for this idea!


----------



## ASX (Feb 14, 2017)

chrbr said:


> Thank you for this idea!


Sorry, not a "my" idea! It is documented in several places that loading modules from rc.conf instead of loader.conf is faster.
Addditionally, by loading a module from rc.conf all dependecies modules are also loaded automatically.


----------

