fcitx / fcitx5

maybe a new fcitx.
1.5k stars 111 forks source link

Laggy input, videos stutter during conversion #453

Open Munzu opened 2 years ago

Munzu commented 2 years ago

Describe the bug The input is laggy during conversion, a little like what I described in #440 but not as bad. However, I have also noticed that when I input something in Japanese, any video that is currently playing starts to stutter while the conversion is taking place. Every character conversion, for example "ka" to "か", takes a split second to happen and, during that split second, videos freeze and resume after the conversion. This happens both with and without hardware acceleration.

To Reproduce Steps to reproduce the behavior:

  1. Play any video, could be on YouTube or a local video
  2. Activate fcitx5-mozc
  3. Type Japanese anywhere
  4. Observe stuttering video

Expected behavior I expect the video playback to not stutter when I type.

Desktop (please complete the following information):

# System Info:
1.  `uname -a`:

        Linux arwing 5.16.11-arch1-1 #1 SMP PREEMPT Thu, 24 Feb 2022 02:18:20 +0000 x86_64 GNU/Linux

2.  `lsb_release -a`:

        LSB Version:    n/a
        Distributor ID: Arch
        Description:    Arch Linux
        Release:    rolling
        Codename:   n/a

3.  `lsb_release -d`:

        Description:    Arch Linux

4.  `/etc/lsb-release`:

        DISTRIB_ID="Arch"
        DISTRIB_RELEASE="rolling"
        DISTRIB_DESCRIPTION="Arch Linux"

5.  `/etc/os-release`:

        NAME="Arch Linux"
        PRETTY_NAME="Arch Linux"
        ID=arch
        BUILD_ID=rolling
        ANSI_COLOR="38;2;23;147;209"
        HOME_URL="https://archlinux.org/"
        DOCUMENTATION_URL="https://wiki.archlinux.org/"
        SUPPORT_URL="https://bbs.archlinux.org/"
        BUG_REPORT_URL="https://bugs.archlinux.org/"
        LOGO=archlinux-logo

6.  Desktop Environment:

    Desktop environment is `kde`.

7.  XDG SESSION TYPE:

        XDG_SESSION_TYPE='x11'

8.  Bash Version:

        BASH_VERSION='5.1.16(1)-release'

# Environment:
1.  DISPLAY:

        DISPLAY=':0'

        WAYLAND_DISPLAY=''

2.  Keyboard Layout:

    1.  `setxkbmap`:

            xkb_keymap {
                xkb_keycodes  { include "evdev+aliases(qwerty)" };
                xkb_types     { include "complete"  };
                xkb_compat    { include "complete"  };
                xkb_symbols   { include "pc+us+inet(evdev)" };
                xkb_geometry  { include "pc(pc105)" };
            };

    2.  `xprop`:

            _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us", "", ""

3.  Locale:

    1.  All locales:

            C
            en_US
            en_US.iso88591
            en_US.utf8
            POSIX

    2.  Current locale:

            LANG=en_US.UTF-8
            LC_CTYPE="en_US.UTF-8"
            LC_NUMERIC="en_US.UTF-8"
            LC_TIME="en_US.UTF-8"
            LC_COLLATE="en_US.UTF-8"
            LC_MONETARY="en_US.UTF-8"
            LC_MESSAGES="en_US.UTF-8"
            LC_PAPER="en_US.UTF-8"
            LC_NAME="en_US.UTF-8"
            LC_ADDRESS="en_US.UTF-8"
            LC_TELEPHONE="en_US.UTF-8"
            LC_MEASUREMENT="en_US.UTF-8"
            LC_IDENTIFICATION="en_US.UTF-8"
            LC_ALL=

4.  Directories:

    1.  Home:

            /home/tai

    2.  `${XDG_CONFIG_HOME}`:

        Environment variable `XDG_CONFIG_HOME` is not set.

        Current value of `XDG_CONFIG_HOME` is `~/.config` (`/home/tai/.config`).

    3.  Fcitx5 Settings Directory:

        Current fcitx5 settings directory is `~/.config/fcitx5` (`/home/tai/.config/fcitx5`).

5.  Current user:

    The script is run as tai (1000).

# Fcitx State:
1.  executable:

    Found fcitx5 at `/usr/bin/fcitx5`.

2.  version:

    Fcitx version: `5.0.14`

3.  process:

    Found 1 fcitx5 process:

           1202 fcitx5

4.  `fcitx5-remote`:

    `fcitx5-remote` works properly.

5.  DBus interface:

    Using `dbus-send` to check dbus.

    Owner of DBus name `org.fcitx.Fcitx5` is `:1.48`.

    PID of DBus name `org.fcitx.Fcitx5` owner is `1202`.

    Debug information from dbus:

           Group [x11::0] has 14 InputContext(s)
          IC [4990ad8cff494b6ab6e4bfabba705a43] program:konsole frontend:dbus cap:6000800072 focus:1
          IC [f05ecc0f059e414693017cbbfabac79a] program:kate frontend:dbus cap:6000800072 focus:0
          IC [aa389b833afd486093c3f54be5ed437d] program:dolphin frontend:dbus cap:6000800072 focus:0
          IC [c2bac7f96c024822b287a02a3a9e091a] program:firefox frontend:dbus cap:6000000012 focus:0
          IC [e633173ef5654e1183ad03a8f1ce3c56] program:firefox frontend:dbus cap:6000000012 focus:0
          IC [e978f9d1944241aaaa67fd8e29974b69] program:firefox frontend:dbus cap:6000000012 focus:0
          IC [b4dd0e06515a422da7ef36f1036060a6] program:firefox frontend:dbus cap:6000000012 focus:0
          IC [959dac2bc4dd41e5a0b51153d30046b9] program:firefox frontend:dbus cap:6000000052 focus:0
          IC [68ea9967aee24b428119a53614d77345] program:signal-desktop frontend:dbus cap:6000000012 focus:0
          IC [5bea118488ae49459f0d3b45de8a345e] program:plasmashell frontend:dbus cap:6000800072 focus:0
          IC [3be81a832cb340bf81f67e63ee512714] program:plasmashell frontend:dbus cap:6000820072 focus:0
          IC [c7210dbf0cf34b608d8928a681bee8d0] program:firefox frontend:dbus cap:6000000012 focus:0
          IC [64c1d4b86c2a4653acb6f03c560da189] program:plasmashell frontend:dbus cap:6000800072 focus:0
          IC [bd3669f7b50d4d68a3742951d1df51ab] program:discord frontend:dbus cap:6000000012 focus:0
        Input Context without group

# Fcitx Configure UI:
1.  Config Tool Wrapper:

    Found fcitx5-configtool at `/usr/bin/fcitx5-configtool`.

2.  Config GUI for qt:

    Found `fcitx5-config-qt` at `/usr/bin/fcitx5-config-qt`.

3.  Config GUI for kde:

    Found fcitx5 kcm module.

        kcm_fcitx5                     - Configure Input Method

# Frontends setup:
## Xim:
1.  `${XMODIFIERS}`:

    Environment variable XMODIFIERS is set to "@im=fcitx" correctly.
    Xim Server Name from Environment variable is fcitx.

2.  XIM_SERVERS on root window:

    Xim server name is the same with that set in the environment variable.

## Qt:
1.  qt4 - `${QT4_IM_MODULE}`:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

2.  qt5 - `${QT_IM_MODULE}`:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

3.  Qt IM module files:

    Found fcitx5 im module for qt: `/usr/lib/qt/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so`.
    Found unknown fcitx qt module: `/usr/lib/qt/plugins/kcms/kcm_fcitx5.so`.
    Found fcitx5 qt5 module: `/usr/lib/fcitx5/qt5/libfcitx-quickphrase-editor5.so`.
    Found fcitx5 im module for qt6: `/usr/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so`.
    **Cannot find fcitx5 input method module for Qt4.**

## Gtk:
1.  gtk - `${GTK_IM_MODULE}`:

    Environment variable GTK_IM_MODULE is set to "fcitx" correctly.

2.  `gtk-query-immodules`:

    1.  gtk 2:

        Found `gtk-query-immodules` for gtk `2.24.33` at `/usr/bin/gtk-query-immodules-2.0`.
        Version Line:

            # Created by /usr/bin/gtk-query-immodules-2.0 from gtk+-2.24.33

        Found fcitx5 im modules for gtk `2.24.33`.

            "/usr/lib/gtk-2.0/2.10.0/immodules/im-fcitx5.so" 
            "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
            "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 

    2.  gtk 3:

        Found `gtk-query-immodules` for gtk `3.24.31` at `/usr/bin/gtk-query-immodules-3.0`.
        Version Line:

            # Created by /usr/bin/gtk-query-immodules-3.0 from gtk+-3.24.31

        Found fcitx5 im modules for gtk `3.24.31`.

            "/usr/lib/gtk-3.0/3.0.0/immodules/im-fcitx5.so" 
            "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
            "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 

3.  Gtk IM module cache:

    1.  gtk 2:

        Found immodules cache for gtk `2.24.33` at `/usr/lib/gtk-2.0/2.10.0/immodules.cache`.
        Version Line:

            # Created by /usr/bin/gtk-query-immodules-2.0 from gtk+-2.24.33

        Found fcitx5 im modules for gtk `2.24.33`.

            "/usr/lib/gtk-2.0/2.10.0/immodules/im-fcitx5.so" 
            "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
            "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 

    2.  gtk 3:

        Found immodules cache for gtk `3.24.31` at `/usr/lib/gtk-3.0/3.0.0/immodules.cache`.
        Version Line:

            # Created by /usr/bin/gtk-query-immodules-3.0 from gtk+-3.24.31

        Found fcitx5 im modules for gtk `3.24.31`.

            "/usr/lib/gtk-3.0/3.0.0/immodules/im-fcitx5.so" 
            "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
            "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 

    3.  gtk 4:

        **Cannot find immodules cache for gtk 4**

        **Cannot find fcitx5 im module for gtk 4 in cache.**

4.  Gtk IM module files:

    1.  gtk 2:

        All found Gtk 2 immodule files exist.

    2.  gtk 3:

        All found Gtk 3 immodule files exist.

    3.  gtk 4:

        All found Gtk 4 immodule files exist.

# Configuration:
## Fcitx Addons:
1.  Addon Config Dir:

    Found fcitx5 addon config directory: `/usr/share/fcitx5/addon`.

2.  Addon List:

    1.  Found 20 enabled addons:

            Classic User Inteface 5.0.14
            Clipboard 5.0.14
            DBus 5.0.14
            DBus Frontend 5.0.14
            Emoji 5.0.14
            Fcitx4 Frontend 5.0.14
            IBus Frontend 5.0.14
            Input method selector 5.0.14
            Keyboard 5.0.14
            KDE Input Method Panel 5.0.14
            Mozc 
            Status Notifier 5.0.14
            Notification 5.0.14
            Quick Phrase 5.0.14
            Spell 5.0.14
            Unicode 5.0.14
            Wayland 5.0.14
            Wayland Input method frontend 5.0.14
            XCB 5.0.14
            X Input Method Frontend 5.0.14

    2.  Found 0 disabled addons:

3.  Addon Libraries:

    All libraries for all addons are found.

4.  User Interface:

    Found 2 enabled user interface addons:

        Classic User Inteface
        KDE Input Method Panel

## Input Methods:
1.  `/home/tai/.config/fcitx5/profile`:

        [Groups/0]
        # Group Name
        Name="Group 2"
        # Layout
        Default Layout=us
        # Default Input Method
        DefaultIM=keyboard-us

        [Groups/0/Items/0]
        # Name
        Name=keyboard-us
        # Layout
        Layout=

        [Groups/1]
        # Group Name
        Name="Group 1"
        # Layout
        Default Layout=eu
        # Default Input Method
        DefaultIM=mozc

        [Groups/1/Items/0]
        # Name
        Name=keyboard-eu
        # Layout
        Layout=

        [Groups/1/Items/1]
        # Name
        Name=mozc
        # Layout
        Layout=

        [GroupOrder]
        0="Group 1"
        1="Group 2"

# Log:
1.  `date`:

        Sun Feb 27 06:28:27 PM CET 2022

2.  `/home/tai/.config/fcitx5/crash.log`:

    `/home/tai/.config/fcitx5/crash.log` not found.

**Warning: the output of fcitx5-diagnose contains sensitive information, including the distribution name, kernel version, name of currently running programs, etc.**

**Though such information can be helpful to developers for diagnostic purpose, please double check and remove as necessary before posting it online publicly.**

Additional context I'm using the fcitx5 arch package, last updated 2022-02-04. However, I also tried the fcitx5-git AUR package that builds from source and I had the same problem.

wengxt commented 2 years ago

That sounds weird. Have you tried anything else setup?

For example, can you try openbox (just login into the openbox session and you can launch application by right click on the desktop)?

Also, when the stuttering happens, which application is playing video? Which application is being typed? Can you give any concrete example?

Munzu commented 2 years ago

I've noticed the stuttering with YouTube videos and Twitch streams on Firefox, but also local videos with MPV.

Unfortunately, I don't have time to setup a new WM, sorry.

wengxt commented 2 years ago

@Munzu You don’t need to set up anything, just install openbox, choose session type openbox from sddm(I assume you use sddm since you’re using kde). The default openbox config should allow you to right click desktop and launch application from the menu.

Munzu commented 2 years ago

Thanks for the help. I tried it out in Openbox and the issue does not seem to happen there.

Edit: I've also just tried Wayland and the issue doesn't happen on Wayland either.

wengxt commented 2 years ago

I doubt it's related to mozc though but some graphics related issue.

Can you try ctrl + alt + shift + u (which will gives you a unicode popup) and see if stuttering is happening?

Also, are you using kimpanel as UI?

And when you mention "with / without hardware acceleration", do you mean "playing video with hardware acceleration", or turn off kwin's compositing?

Munzu commented 2 years ago

No stuttering with ctrl + alt + shift + u.

I don't think I'm using kimpanel since I don't know what it is. I have the following Arch packages installed and did the rest of the setup in the Plasma settings.

With hardware acceleration I meant playing video with hardware acceleration. My GPU can basically only decode the h264 codec. Since YouTube videos use the VP9 codec by default, my GPU can't decode them. To force hardware acceleration, I have the Firefox plugin h264ify, which forces YouTube to use the h264 codec instead of the default VP9 codec. So I tested the stutter by enabling and disabling the h264ify plugin.

wengxt commented 2 years ago

There isn't anything special in fcitx that may cause things like GPU. I suspect it could be the effect triggered by kwin or sth?

I suggest you try these things:

  1. alt + shift + f12 to suspend kwin effect, see if this help. That we could somehow rule out some possibility
  2. does fcitx's popup window have fade-in/fade-out animation in your setup? if so you could also try to disable that effect to see if it helps
Munzu commented 2 years ago

I've tried what you suggested. Neither helped.

  1. I disabled kwin effects with alt + shift + f12. I verified that kwin effects are off. Still same problem.
  2. My popup window did have a fade-in/fade-out animation. I disabled it in KDE with here by unchecking "Fading Popups". I verified that the fade-in/fade-out was off. Still same problem.

image