Sublime Forum

Hardware Acceleration issues on ST 4

#1

Hi,

So I tried to enable hardware acceleration on Arch Linux x86_64 with NVIDIA GeForce GTX 1070 Ti and OpenGL 4.6 provided by NVIDIA driver 465.31 running in i3 WM. The results were very mixed.

Starting Sublime Text 4 with "hardware_acceleration" : "opengl" set resulted in a startup time of 1 min. That was the first try. Then subsequent tries took longer and longer. For example, I had to restart ST to update some of the new settings and configuration. This eventually resulted in ST4 just getting stuck and never fully loading at all. At the same time, the debug log showed that the driver, hardware and OpenGL API version were all recognized correctly and time to first draw was 0.7. However, ST4 was completely unresponsive and no other output was shown in the console after the GPU logs. No extensions were loaded, nothing. I couldn’t even open the preferences dialog to disable hardware acceleration. Thus, I had to force quit and manually edit the preferences file.

Could you help me diagnose the issue preventing ST4 startup with hardware acceleration. Thanks.

0 Likes

ST4 issues I found, but have no time to write proper bug reports (yet)
#2

In what state does it get stuck starting up (is the window showing, what is it showing, etc)? If you run ST with the options --multiinstance --debug what console output does it get when it’s stuck?

0 Likes

#3

Oh, somehow didn’t get a notification about this. It gets stuck immediately after it opens the window, text is showing and the sidebar too. However, I cannot click anywhere not can I type anything. I cannot interact with it at all and it uses 100% of computer resources. If I kill it from the command line, all is good. I’ll run the debug steps and give feedback.

0 Likes

#4

Here’s the log

subl --multiinstance --debug
:0                                                                startup, version: 4107 linux x64 channel: stable
:0                                                                executable: /opt/sublime_text/sublime_text
:0                                                                application: /opt/sublime_text
:0                                                                working dir: /home/gizdov
:0                                                                packages path: /home/gizdov/.config/sublime-text/Packages
:0                                                                state path: /home/gizdov/.config/sublime-text/Local
:0                                                                zip path: /opt/sublime_text/Packages
:0                                                                zip path: /home/gizdov/.config/sublime-text/Installed Packages
:0                                                                ignored_packages: ["Vintage"]
:0                                                                pre session restore time: 0.108628
:0                                                                loading dictionary Packages/Language - English/en_GB.dic
:0                                                                git: using configuration from system git install
:0                                                                OpenGL Context Information:
:0                                                                  GL API Version: 4.1.0 NVIDIA 465.31
:0                                                                  GLSL Version: 4.10 NVIDIA via Cg compiler
:0                                                                  Vendor: NVIDIA Corporation
:0                                                                  Renderer: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
:0                                                                startup time: 0.532316

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.336: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.336: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.338: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.338: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.476: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.476: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.477: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.477: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.491: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.491: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.492: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.492: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.504: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.504: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.505: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.505: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.517: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.517: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.519: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.519: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed
:0                                                                first paint time: 0.77801

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.635: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.635: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:32:56.637: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:32:56.637: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:05.823: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:05.824: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:05.825: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:05.825: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:07.675: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:07.675: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:07.677: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:07.677: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:08.221: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:08.221: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:08.222: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:08.222: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:08.950: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:08.950: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:08.951: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:08.951: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:10.396: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:10.396: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:10.397: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:10.397: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:12.663: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:12.663: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:12.664: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:12.664: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed
:0                                                                git: tracking working dir /home/gizdov/Git/BsJpsiPhi

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:58.221: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:58.221: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:58.225: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:58.225: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:58.988: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:58.988: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:33:58.989: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:33:58.989: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:40.356: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:40.356: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:40.357: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:40.357: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:45.451: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:45.451: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:45.452: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:45.452: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:48.380: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:48.380: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:48.381: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:48.381: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:52.650: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:52.650: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:52.652: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:52.652: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:54.651: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

(sublime_text:9326): Gtk-CRITICAL **: 16:35:54.651: gtk_check_menu_item_set_active: assertion 'GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed

(sublime_text:9326): GLib-GObject-WARNING **: 16:35:54.653: invalid cast from 'GtkSeparatorMenuItem' to 'GtkCheckMenuItem'

So sublime text loads, paints, shows he text files, but never loads any extensions and never finishes loading some subfolders in projects:
sub_stuck
It becomes increasingly laggy with time and never actually finishes loading. I’ve been waiting for more than 30 min now.

However, it’s important to note that I can get it to work if I kill it and restart it several times until it works. I think one out of every five start-kill-restart attempts or so is fully successful and presents no issues.

Maybe important to note that I’ve got Sublime Text open with multiple projects at the same time.

0 Likes

#5

Does it happen in safe mode on the latest development build (4111)? Those GTK criticals could also be the cause, what version of GTK are you using?

0 Likes

#6

So since I run Arch Linux x86_64, I’ve got a few gtk versions on my system:

gtk2 2.24.33
gtk3 3.24.30
gtk4 4.2.1

However, I believe Sublime Text is loading the gtk3 3.24.30 version. It seems running the dev 4111 does have the same issue although, it does load fully more often than not. And if I leave it for long long time, then it loads. So 4111 does behave better, but I cannot link it to anything in particular. The only error/warning I get are the GTK stuff from above and this:

reloading python 3.3 plugin Unicode Character Highlighter.sublime_unicode_nbsp
Traceback (most recent call last):
  File "/opt/sublime_text/Lib/python33/sublime_plugin.py", line 310, in reload_plugin
    load_module(m)
  File "/opt/sublime_text/Lib/python33/sublime_plugin.py", line 343, in load_module
    decorate_handler(t, method_name)
  File "/opt/sublime_text/Lib/python33/sublime_plugin.py", line 226, in decorate_handler
    method = cls.__dict__[method_name]
KeyError: 'on_activated'
0 Likes

#7

Does it happen in safe mode?

0 Likes

#8

Oh, snap, no, it doesn’t. I missed that step - so it must be some plugin then?!

0 Likes

#9

Start disabling half of your installed packages and go from there.

0 Likes

#10

So I disabled all my packages one by one (lots of them). Nothing changed. Then got a complete list by sifting through my sublime text directory and removed old package repos and things that might interfere. Then I did a clean install. Nothing helped. If I have "hardware_acceleration": "opengl" set, then the UI hangs on startup right after the debug info about my GPU.

It doesn’t happen if I have it running in safe mode because there is no way to force safe mode to use GPU (opengl) acceleration. It’s not printed in the debug log as it gets the preferences from the system Default package, which has "hardware_acceleration": "none".

The only plugin that loads immediately after UI hanging is the Git built-in integration, which suggests it is something to do with that or something internal that happens before. It’s not something a user can fix. I believe this is an actual bug somewhere.

I’ve also discovered that simply using subl --multiinstance solves the issue even when using all my packages. That is proof that something funny is going on internally. But at least it’s a workaround.

I also noticed that those command-line options are undocumented. It seems like it would be helpful to include these in the docs and possibly add one where users can force GPU acceleration on command-line, or specify options, to improve the debug options.

@bschaaf @rwols would anyone of you be able to ping this to the devs, please. It would be much appreciated. Thanks in advance.

0 Likes

#11

would anyone of you be able to ping this to the devs, please.

I’m one of the devs.

Could you run strace -r suble --multiinstance --debug.

0 Likes

#12

I ran a few of those. Hope they help. https://paste.xinu.at/m-8T0m3/

0 Likes

#13

From the logs it looks like you didn’t run it with --multiinstance. That won’t provide anything useful as you’re just getting logs from the command line tool, not the application.

0 Likes

#14

There are three logs; the first one which you cannot see a preview of (you have to download it as a file), is the one with --multiinstance. Direct link is here.

0 Likes

#15

Thanks, that log looks pretty normal (no long pauses between syscalls or anything like that). My guess is it’s either GTK or mesa/nvidia causing that behavior. What version of GTK are you running?

0 Likes