Избавляемся от тиринга в Linux
Большинство пользователей Линукс систем, конечно же знают о существовании такой проблемы, как разрыв экрана или tearing. Основной, и наиболее вероятной причиной данного «недуга», является X-сервер. Да, Wayland уже вполне себе работоспособен, но от Иксов пока ещё способны отказаться не все. Но не одним X-сервером жив тиринг. Следующей причиной оного может послужить драйвер GPU. Наиболее частым виновником разрывов является, как ни странно, самый популярный производитель видеокарт — NVIDIA и его видеодрайвера. Третьим виновником возниковения тиринга в Linux является окружение рабочего стола, со своими багами и фичами. Ну вот мы вкратце разобрались с классическим вопросом: «Кто виноват?», далее попробуем разобраться с не менее класическим: «Что делать?».
Тиринг NVIDIA
Сразу обращу ваше внимание, что это не единственное решение для NVIDIA, и, конечно, найдутся десятки ситуаций, в которых этот метод не поможет, но это один из наиболее часто спасающих вариантов, и он не полагается на графическую утилиту NVIDIA, которая иногда ломает конфигурацию среды рабочего стола.
Для начала вам нужно включить настройку модуля NVIDIA DRM (modsetting). Начните с создания файла конфигурации в каталоге modprobe:
Затем правим его в любом удобном вам текстовом редакторе, и добавляем там следующую строку:
Затем чтобы ядро получило информацию о наших манипуляциях делаем в терминале:
После перезагрузки разрывы должны пропасть. Радуемся но это не точно . Если не исчезло то попробуйте в /etc/X11/xorg.conf.d/20-nvidia.conf в разделе «Device», добавить такие строки:
Тиринг Intel
Графика Intel в Linux обычно не составляет больших проблем. Вероятно, это связано с тем, что интегрированная графика обычно имеет меньше функций, а стек драйверов Intel вообще поставляется с открытым исходным кодом. Для устранения тиринга на Intel найдите и исправьте у себя конфигурационный файл, примерно по такому пути /etc/X11/xorg.conf.d/20-intel.conf (в различных системах он может находиться в различных каталогах). Исправьте в нём раздел «Device» таким образом:
После чего сохраните и перезагрузитесь.
Тиринг AMD
Тиринг на видеокартах от AMD в Linux тоже хоть и не так часто, но бывает. Этот способ подходит как для проприетарных, так и для свободных драйверов. К сожалению этот способ не подходит для окружения рабочего стола KDE. Итак создайте или, если он есть, исправьте файл /etc/X11/xorg.conf.d/20-radeon.conf , доведя раздел «Device», до следующего сосостояния:
xfce тиринг
XFCE славится своим замечательным тирингом . Это всегда было проблемой данного рабочего окружения, благодаря своему композитному менеджеру. Поэтому для решения этой проблемы заменим дефолтный композитор на Compton.
Для начала отключим стандартный композитный менеджер «Крыски» для этого выполним в терминале:
Или пройдём в настройки XFCE, в настройки менеджера окон, и снимем чекбокс с Enable display compositing, как на изображении ниже.
далее установим Compton, независимый композитор, который очень хорошо работает с легковесными окружениями рабочего стола. Дам команды для двух веток Linux, но думаю что ни для кого ни составит труда установить пакет в свой дистрибутив.
Debian и производные
Arch linux и производные
Вернёмся к настройкам XFCE. На этот раз нажмите “Сеанс и запуск.” (Session and Startup) Добавить Compton в автозапуск, для этого добавим в атвозапуск комптон со следующим ключем:
После чего перезагружаемся и проверяем работает ли Compton:
Если всё норм, проверяем работает ли тиринг =)
Если тиринг в XFCE не пропал, то пробуем отредактировать файл
/.config/compton.conf, в моём случае он такой:
По идее разрывы должны пропасть, если не пропали, значит что-то пошло не так. Ищите дальше, ведь это Линукс, за всё нужно платить=)
kde тиринг
KDE, является моим любим рабочим окружением. В нём есть такое огромное количество, так нужных пользователям, элементов управления, что с помощью GUI Панели управления можно настроить практически всё. Откройте приложение Настройки и найдите «Display and Monitor». Там выберите «Compositor». Найдите параметр «Предотвращение разрыва vsync»(Tearing prevention «vsync» и установите для него значение «Перерисовка всего экрана” (Full screen repaints). После этого нажмите «Применить» (Apply).
Нередко Kwin, оконный менджер KDE, тоже становится причиной тиринга. Если не после предыдущих манипуляци разры картинки не пропал, то создалим файл /etc/profile.d/kwin.sh следующего содержания:
export KWIN_TRIPLE_BUFFER=1
Перелогиньтесь и всё должно стать гладко.
Firefox тиринг
Удостоверьтесь, что тиринг у вас присутствует только в браузере Firefox, с помощью данного видео выполните проверку на тиринг просмотрев в 1080p60:
если при просмотре видео, изображение будет рваться то переходите к следующим манипуляциям:
1) Откройте about:config в Firefox
2) Найдите layers.acceleration.force-enabled
3) Измените значение(Value) на true.
4) Перезагрузите браузер
Гик, хакинтошник, линуксоид, считаю себя flutter разработчиком. Завёл канал, в котором изначально хотел показывать как я с нуля и до бесконечности погрузился в дорвей тематику, а в итоге просто рассказываю о себе, своих успехах и неудачах в сайтах, приложениях, офлайн проектах. Добро пожаловать в https://www.youtube.com/channel/UCbrTUrElICx4pewX0NbolmQ
3 thoughts on “ Избавляемся от тиринга в Linux ”
Спасибо за руководства. Избавился от тиринга в фаерфокс. Как поменять настройки для AMD не понял. Не хватает информации.
Думал, что дело именно в firefox но менять настройки в about:config ничем успешным не закончились, решил попробовать compton и вся система стала супер плавно скролиться. Автору огромное спасибо!
Debian 10 stable и KDE, видюха Nvidia RTX 2060, монитор 144 гц. В общем имеется полный набор этих проблем: тиринг и тормозной фпс интерфейса (окон и анимаций). Но, вроде как починил (думаю по поводу тормозного фпс способ поможет и на Intel с AMD). Чтобы фиксануть тиринг, все как в статье, ставим дрова нвидиа, ставим там ForceCompositionPipeline, после этого в принципе тиринга нет, но полоска на этом видео (Video tearing and smoothness test @60fps) как будто бы дергается, ну и интерфейс тормозной все равно. Если в KDE включить в эффектах «График производительности», то он показывает 72 фпс. В общем, чтобы интерфейс стал плавным на 144 гц, нужно отредактировать файл оконного менеджера KWin от рута (например через sudo nano) по адресу /home/user/.config/kwinrc (разумеется вместо user имя вашего пользователя), и там в конец секции [Compositing] добавить следующие строки: MaxFPS = 200, RefreshRate = 200. Наверное фпс можно и больше, но я разницы с 500 не заметил, а 200 поставил чтоб заведомо было больше частоты монитора. В любом случае, этот график kdeшный показывает 100 фпс максимум, так что я не знаю, мб выше 100 он и не становится, но плавнее в разы становится, как на 10 винде (и ролик тоже стал плавным).
Источник
Screen tearing in Ubuntu with Nvidia/Intel graphics
I really hope someone here can help, because I’m very close to giving up and moving back to Windows. I have an MSI GT70 Dominator with an i7-4710MQ 2.5 GHz, Intel HD 4000 (I’m pretty sure) integrated graphics card, and a GeForce GTX 970M/PCle/SSE2 dedicated graphics card. I started with a stock install of Ubuntu 14.04.3, and there is terrible screen tearing in every program I’ve tried, from Chrome to Minecraft to L4D2. I’m using the proprietary Nvidia drivers (version 346.82 from nvidia-346) because I’ve heard they get the best performance. By screen tearing, I mean that it’s as though vsync is off- when something is moving, you can see horizontal lines where the frames are off.
I’ve tried going to Nvidia X Server Settings to turn on «Sync to VBlank», but the problem persists.
I tried installing Bumblebee as well, but when using the optirun command to open a browser and going to a Youtube video, the screen tearing is still there.
I’ve also tried going to usr/share/lightdm/lightdm.conf.d and editing the 5-xserver-command.conf to have the -bs option.
After some advice from reddit, I upgraded to 15.04, but that didn’t work.
I tried setting my Nvidia power settings to high, no luck.
I’ve tried Compton and Compiz, neither did squat.
In nvidia-settings, the X Server Display Configuration, there is no screen displayed in «Layout», X Screen 0 is the only thing selectable in «Model», and whenever I try to Save to X Configuration File, it says «Failed to generate X config file!»
I’ve tried this link, nada.
I’ve rebooted after every attempted fix. I really want to use Ubuntu, but if this screen tearing persists, I might just have to go back to Windows, it’s horribly distracting. Please, please, please help me. Any help anyone can give will be greatly appreciated, thanks!
Источник
What Is Screen Tearing and How to Get Rid of It on Linux
Unfortunately for Linux fans, screen tearing is, and has been, a persistent annoyance that doesn’t seem to be going anywhere. There are a couple of factors enabling the longevity of the screen tearing issue.
First, and probably most obviously, is the dated, broken, and bloated X server. Even with the progress of Wayland, X is here to stay for the immediate future. Next is the strange and inconsistent graphics driver picture. One of the biggest offenders in causing screen tearing is also the most popular GPU manufacturer on Linux, NVIDIA. Throw in different desktop environments with their own display settings and compositors, and you have a real mess.
These methods will hopefully eliminate screen tearing in most situations, but it’s impossible to provide a one-size-fits-all solution, thanks to the amount of variables involved. Try what applies to your system, and keep in mind that there might be new factors involved.
NVIDIA
This isn’t the only solution for NVIDIA, and there are certainly situations that it doesn’t apply to, but it’s one of the better options, and it doesn’t rely on NVIDIA’s graphical utility that doesn’t always play nice with desktop environment configurations.
To start, you’ll need to enable setting for the NVIDIA DRM module (modsetting). Start by making a configuration file in the modprobe directory.
Open that file with your favorite text editor, and insert the following line:
Update your kernel’s initramfs to apply your change.
When that’s done, reboot. Your computer will come back up, and everything should be smoother, but you aren’t quite done yet.
Swap can save you in a pinch, but for something like graphics, its pretty terrible. The best thing you can do here to increase performance is reduce your computer’s tendency to use swap space. Start by checking your current “swappiness.”
That will probably return “60.” That’s the default value, but you can set it much lower. Open “/etc/sysctl.conf,” and add the following line at the bottom of the file:
You can set the value based on how much RAM you have. 5 to 15 is usually the range you can safely work with. Reset your computer, and everything should be smoother.
Intel
Intel graphics on Linux usually aren’t too much of a problem. That’s probably because integrated graphics usually have fewer features, and the Intel driver stack is mostly open source. For screen tearing on Intel, the solution usually comes in the form of some additional configuration.
Because Intel uses open source drivers, the Xorg configuration is going to be your most direct route. Create a file at “/etc/X11/xorg.conf.d/20-intel.conf,” then place the following block of code inside:
When you’re done, save and reboot.
VSYNC
Vsync is an attempt to synchronize your software refresh rate to your monitor hardware’s default refresh rate. In theory, it’s a great idea to make everything as smooth as possible. In reality, sometimes it lives up to its potential, and others, it makes your graphics an unstable mess. If you are using Vsync, and you’re experiencing screen tearing, try disabling it. If you aren’t using Vsync, it might be the very thing that gets things in line.
KDE has some fantastic controls, so this can all be done through the KDE Plasma Settings. Open the Settings application, and find “Hardware” on the side. Under that heading you’ll find the display settings. Click on those. The main body of the window will fill up with display settings. The tabs on the side will switch. Pick “Compositor.” Locate the “Tearing prevention” option, and set it to “Full screen repaints.” When you’re done, apply the change.
Kwin, the KDE compositor is sometimes part of the problem, too. It follows its own rules. There’s a simple bit of configuration that you can add to make Kwin smoother.
Create a new file at “/etc/profile.d/kwin.sh.” Open that file, and place the line below in it:
Log out of KDE, and log back in for the change to take effect.
GNOME
This is a pretty terrible answer, but there isn’t a setting directly in GNOME to manage vsync, but it can still really help. If you’re running GNOME with either Intel or NVIDIA graphics, follow the above instructions. If you’re on AMD, add the following line to your Xorg configuration:
XFCE is notorious for screen tearing. It’s always been a problem, and it can seriously get in the way. However, there’s a fairly simple solution. All you need to do is rip out XFCE’s compositor and replace it with a different one, in this case Compton.
Open the XFCE settings, then locate the window manager settings. Click on the “Compositor” tab, and uncheck the box to “Enable display compositing.” Apply the settings.
Next, install Compton. It’s an independent compositor that works very well with lightweight desktops. The command here is for Debian-based distributions, but Compton is available on just about every popular distro.
Return to the XFCE settings. This time, click on “Session and Startup.” Add a new application to run at startup. In case you haven’t guessed, that application is Compton. Paste the following in as your command. It contains several key options to run Compton optimally.
Save and exit. You can either log out and log back in or run the command to start Compton.
These methods are all excellent ways to try and solve your screen tearing problems under Linux. They might not work for everyone, but with any luck, they’ll work for you. Hopefully, as more progress is made in Linux graphics drivers, desktop environments, and Wayland, the screen tearing problem will finally be resolved permanently.
Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.
Источник