mpv player crashes if Intel tearfree is turned on

I'm using mpv on Ubuntu 20.04 LTS. I was facing screen tearing when playing videos, therefore to fix this I enabled the "TearFree" option by adding the following line to the configuration file: /etc/X11/xorg.conf.d/20-intel.conf

Section "Device"
  Identifier "Intel Graphics"
  Driver "intel"

  Option "TearFree" "true"
EndSection

But after doing so the videos wouldn't play at all. mpv crashes everytime with 'Segmentation fault'. If I revert the changes it would play again but the screen tearing reappears.

Output of lspci -nn | egrep -i "3d|display|vga"

00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 5500 [8086:1616] (rev 09)
04:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Venus XTX [Radeon HD 8890M / R9 M275X/M375X] [1002:6820] (rev 81)

Solution 1:

I had the same problem. I opened an issue in mpv repository and it turned out that the problem is not about mpv but my drivers.

Try this:

MESA_LOADER_DRIVER_OVERRIDE=i965 mpv some_video.mp4

If it works, congratulations. You can create a script to pass this option and use that script instead of directly using mpv. Do not forget to make it executable.

#!/usr/bin/env bash
export MESA_LOADER_DRIVER_OVERRIDE=i965
/usr/bin/mpv "$@"

And here is the related part from Github issue for this answer. You might find some useful information even if above commands didn't work for you.