Screen flashes quickly before playing every video

I’m having an issue with my screen flashing very quickly before starting any video. The videos I open from the web browser or the videos I play on the desktop with the player cause this problem. Below you can see the Display properties of my computer.

-Session-
Type : wayland
-Wayland-
Current Display Name : wayland-0
-X Server-
Current Display Name : :0
Vendor : The X.Org Foundation
Version : (Unknown)
Release Number : 12201003
-Screens-
Screen 0 : 1366x768 pixels
-Outputs (XRandR)-
XWAYLAND0 : Connected; 1366x768 pixels, offset (0, 0)
-OpenGL (GLX)-
Vendor : Intel
Renderer : Mesa Intel(R) HD Graphics 520 (SKL GT2)
Direct Rendering : Yes
Version (Compatibility) : 4.6 (Compatibility Profile) Mesa 22.1.4
Shading Language Version (Compatibility) : 4.60
Version (Core) : 4.6 (Core Profile) Mesa 22.1.4
Shading Language Version (Core) : 4.60
Version (ES) : OpenGL ES 3.2 Mesa 22.1.4
Shading Language Version (ES) : OpenGL ES GLSL ES 3.20
GLX Version : 1.4

Additionally my Linux hardware info: HW probe of ASUSTek X555UB #db33232b90

Can you try the following.

  1. Create/update your Firefox configuration file
  2. Install codecs (provides FFmpeg) from Clear Fraction
  3. Install the enhanced-h264ify extension in Firefox
  4. Enable ‘media.ffmpeg.vaapi.enabled’ in about:config
  5. Restart Firefox

The following tee command will refresh ~/.config/firefox.conf, supporting Intel, AMD, and NVIDIA graphics.

$ tee ~/.config/firefox.conf >/dev/null <<'EOF'
export FONTCONFIG_PATH=/usr/share/defaults/fonts

# Clear Fraction provides FFmpeg supporting VA-API acceleration.
# https://clearfraction.cf
# sudo swupd 3rd-party bundle-add codecs
if [[ -d /opt/3rd-party/bundles/clearfraction/usr/lib64 ]]; then
    export LD_LIBRARY_PATH=/opt/3rd-party/bundles/clearfraction/usr/lib64
fi

# Using NVIDIA graphics?
# https://github.com/marioroy/nvidia-driver-on-clear-linux
if [[ -d /opt/nvidia && -f /usr/lib64/dri/nvdec_drv_video.so ]]; then
    export LIBVA_DRIVER_NAME=nvdec
    export MOZ_DISABLE_RDD_SANDBOX=1
fi

# Otherwise, uncomment one of the following matching your configuration
# if needed. Try 'vainfo' first using the command-line. Optionally, install
# the enhanced-h264ify extension to block {VP8, VP9, AV1}.
# export LIBVA_DRIVER_NAME=iHD
# export LIBVA_DRIVER_NAME=i965
# export LIBVA_DRIVER_NAME=r600
# export LIBVA_DRIVER_NAME=radeonsi

if [[ $XDG_SESSION_TYPE == wayland ]]; then
    export EGL_PLATFORM=wayland
    export MOZ_ENABLE_WAYLAND=1
else
    export MOZ_DISABLE_WAYLAND=1
    export MOZ_X11_EGL=1
fi

export MOZ_ACCELERATED=1
export MOZ_USE_XINPUT2=1
export MOZ_WEBRENDER=1
END

Do not forget steps 4 and 5 to enable media.ffmpeg.vaapi.enabled.

HW acceleration verification is possible using the intel_gpu_top or nvidia-settings utility.

$ sudo swupd bundle-add igt-gpu-tools
$ sudo intel_gpu_top (or)
$ /opt/nvidia/bin/nvidia-settings &

I experience the screen flashing very quickly using Wayland. But no flashing using GNOME on Xorg.

I use Brave browser. (but problem also same in Firefox) Also I have same problem for local videos when I play them with gnome videos or mpv etc. I didn’t experienced this problem with other distros (what i tried) on Wayland and I want to use Wayland (Xwayland).

I tried the Brave browser. It works better using GNOME on Xorg. Like you say, it flickers in Wayland. Well, I used the following steps to test Brave.

  1. Install Brave using the 3rd-party repository
  2. Obtain launch script for Brave
  3. Obtain desktop file for Brave
  4. Install enhanced-h264ify extension in Brave
sudo swupd 3rd-party install brave

git clone https://github.com/marioroy/nvidia-driver-on-clear-linux
cd nvidia-driver-on-clear-linux/HWAccel/brave
mkdir -p ~/bin && cp run-brave-stable ~/bin/.
cp brave-browser.desktop ~/.local/share/applications/.

I then launched Brave and installed the enhanced-h264ify extension to block { VP8, VP9, and AV1 }. Hardware acceleration works well in Xorg, although i965 works better for my Intel box (default iHD if not set).

export LIBVA_DRIVER_NAME=i965

Today, I witnessed Brave utilized the Video engine using Intel Graphics. It works flawlessly in Xorg. But drops frames in Wayland.

Thanks for help. I just run:

export LIBVA_DRIVER_NAME=i965

and it fixed. Thanks for your tactics for Brave too.

2 Likes