Thursday, June 14, 2018

Screen tearing in Ubuntu with xfce4 using intel HD4000 graphics

Recently I switched back from Unity desktop environment to xfce4 and I noticed a screen tearing when watching movies and even slightly when scrolling through websites. Needless to say, it is quite annoying and it should not be happening.

My laptop has a decent Intel core i5 CPU with Intel HD4000 graphics, which should be more than capable of playing back movies perfectly, let alone dispay websites. Hence the newly discovered screen tearing must be a side-effect of switching to xfce4. Initially I thought it was caused by some new driver that got installed or rather replaced during the switch, but there were no signs.

lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
dpkg -l | grep intel
ii  xserver-xorg-video-intel                                    2:2.99.917+git20160325-1ubuntu1.2                 amd64        X.Org X server -- Intel i8xx, i9xx display driver

Solution

After scouring the internet for possible causes such as malconfigured xorg config or wrong drivers and trying to fix these, I saw vertical sync mentioned somewhere and enabling it might help. In xfce4 this feature is found in Settings/Window Manager Tweaks/Compositor/Synchronize drawing to the vertical blank, see in the screenshot below.

Synchronize drawing to the vertical sync
Window manager Tweaks
Make sure to tick the selected "Synchronize drawing to the vertical blank" tickbox and the tearing should be gone.

Tuesday, June 12, 2018

Set date and time in raspbian

Problem

My new installation of raspbian stretch had its time off. The easiest way of setting this right I found was using timedatectl.

timedatectl
      Local time: Tue 2018-06-12 18:27:41 UTC
  Universal time: Tue 2018-06-12 18:27:41 UTC
        RTC time: n/a
       Time zone: Etc/UTC (UTC, +0000)

Network time on: yes
NTP synchronized: yes

RTC in local TZ: no

The date was correct but the actual time was off. Checking the output of timedatectl, the time zone was here off, so that was the obvious problem.

Solution

Checking the help of timedatectl quickly led to a resolution.

timedatectl -h
timedatectl [OPTIONS...] COMMAND ...

Query or change system time and date settings.

  -h --help                Show this help message
     --version             Show package version
     --no-pager            Do not pipe output into a pager
     --no-ask-password     Do not prompt for password
  -H --host=[USER@]HOST    Operate on remote host
  -M --machine=CONTAINER   Operate on local container
     --adjust-system-clock Adjust system clock when changing local RTC mode

Commands:
  status                   Show current time settings
  set-time TIME            Set system time
  set-timezone ZONE        Set system time zone
  list-timezones           Show known time zones
  set-local-rtc BOOL       Control whether RTC is in local time
  set-ntp BOOL             Enable or disable network time synchronization

  1. List the available timezones that can be set with,
    timedatectl list-timezones
    and scroll through the list to find the correct one.
  2. Set your current timezone with,
    timedatectl set-timezone Zone/City
No reboot is required, changes take effect right away.