Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 2017 15:26:50 +0300
From:      Arto Pekkanen <isoa@kapsi.fi>
To:        freebsd-x11@freebsd.org
Subject:   The Intel driver updates broke TearFree option at some point, here is a workaround
Message-ID:  <37a7d2b3-d56e-746b-edfc-98259404a3ff@kapsi.fi>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--tBAL0wud0I7A85fL95NA2kdB3lOMqitQ4
Content-Type: multipart/mixed; boundary="8LvmAXs4a1Q5dF47bWFj0GmWDjFx9QwEL";
 protected-headers="v1"
From: Arto Pekkanen <isoa@kapsi.fi>
To: freebsd-x11@freebsd.org
Message-ID: <37a7d2b3-d56e-746b-edfc-98259404a3ff@kapsi.fi>
Subject: The Intel driver updates broke TearFree option at some point, here is
 a workaround

--8LvmAXs4a1Q5dF47bWFj0GmWDjFx9QwEL
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

So, I updated base system and ports weekly, and at some point I found
out that while playing videos full screen, the video would jump back to
some previously played frame every now and then.

My X.org was configured as such:

Section "Device"
    Driver "intel"
    Option "AccelMethod" "SNA"
    Option "TearFree" "True"
EndSection

The above configuration previously yield a tear-free VSynced video
output with all applications (including video playback via VAAPI). But
this broke, and video playback started flickering with some video player
applications, namely mpv.

After mucking around I realized that the TearFree option is NOT even
listed in the current intel man page! You can see it for yourself, no
TearFree option there. I dug around in Google, and it seem the option
has been deprecated for quite some time. The reasoning for this
deprecation mostly seems to be that it should be up to the application
to use VSync, either via OpenGL extensions (which there are at least 3)
or by using the DRI specific device IOCTLs.

Unfortunately, mpv and many other video players do not VSync. They just
=2E.. don't. Probably the developers decided that it was up to graphics
drivers and/or X.org.

Yet again, drivers devs think one thing, app devs think other. And thing
break horribly for the end user. My brilliant and simple solution has
been deemed obsolete yet again by the Linux graphics driver developers.
I was not pleased.

Then I decided to fix the problem with a standard method used in most
Linuxen: run a compositor, and let compositor do VSync for you.

Thus, I reconfigured file /usr/local/etc/X11/xorg.conf.d/10-intel.conf

Section "Device"
    Driver "intel"
    Option "AccelMethod" "SNA"
EndSection

Use SNA, no TearFree. The default in FreeBSD is UXA, and we don't want
that, SNA works better for IGPUs in Sandy Bridge and newer.

Then as root:
pkg install compton

Then I created configuration for Compton, file ~/.compton.conf
backend =3D "glx";
paint-on-overlay =3D true;
glx-swap-method =3D 1;
glx-no-stencil =3D true;
sw-opti =3D true;
vsync =3D "opengl-mswc";
shadow =3D false;
fading =3D false;
unredir-if-possible =3D true;

Then I just restarted X (pkill xorg)

After this the Compton compositor will buffer every frame from every
application and sync them on vertical blank. Basically the same as
TearFree, but CPU usage is a bit higher.

--=20
Arto Pekkanen


--8LvmAXs4a1Q5dF47bWFj0GmWDjFx9QwEL--

--tBAL0wud0I7A85fL95NA2kdB3lOMqitQ4
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iF4EAREIAAYFAlj/QI4ACgkQTBivhqtJa26RHQEAuVW3j9ewlCC9MRzfIYqH1mvY
0Vmrz0sufibG8dpQEEIBAJ2A5Az83V6BnzyAkmYLEBffNsg3s45eO3gHKfvkTjIg
=UUph
-----END PGP SIGNATURE-----

--tBAL0wud0I7A85fL95NA2kdB3lOMqitQ4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37a7d2b3-d56e-746b-edfc-98259404a3ff>