You are not logged in.

#1 2025-05-07 19:11:37

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Screen is flashing when watching video

Hi,
I have a very annoying bug - my screen is flashing when I'm watching a video. It's not very stable, usually it begins few minutes after starting playback and can continue few minutes after closing a video player. Sometimes it's flashing hard and fast, sometimes barely visible. Only happens when watching in fullscreen. I've recorded a small video clip - https://mega.nz/file/5fpAFDiT#W1PMYiMGB … FqbFCWqqLw
I had this issue on Fedora, now I'd like to fix it in Arch.
I have Lenovo ThinkPad P1 Gen 4 20Y3 with Intel and NVIDIA GPUs, both of them are prone to the bug, though flashing on NVIDIA (using prime-run) is much less noticeable.
I'm using mpv, it should have native Wayland support (no XWayland). When switching to X, the issue is gone.
Did you see this issue before? Any ideas? Where should I start?
Thanks!

Offline

#2 2025-05-07 20:26:58

Xephon
Member
Registered: 2024-12-22
Posts: 95

Re: Screen is flashing when watching video

Does it happen only in mpv or other players are also affected?

Try to run mpv using the following options

mpv --gpu-api=opengl <your-video-file-name.ext>
mpv --gpu-context=drm <your-video-file-name.ext>

Offline

#3 2025-05-07 23:18:05

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

Does it happen only in mpv or other players are also affected?

Yes! VLC, Glide (GStreamer) and every other video player I tried are also affected.

mpv --gpu-api=opengl <your-video-file-name.ext>

Omg, that works! I've been playing a video for 5min and it's not flashing.

mpv --gpu-context=drm <your-video-file-name.ext>

It outputs error and then frozes my system completely, so I have to reboot.
I'm using mpv from offical repo, is drm broken there?
What are recommended options for using mpv with Intel or NVIDIA GPUs? Do I need to install other dependencies?

[vo/gpu/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/gpu/drm] Failed to set up VT switcher: Terminal switching will be unavailable.
[vo/gpu/drm] Failed to acquire DRM master: Permission denied
[vo/gpu/drm] Failed to commit ModeSetting atomic request: Permission denied
[vo/gpu/drm] Failed to set CRTC for connector 313: Permission denied
[vo/gpu/drm] Failed to commit ModeSetting atomic request: Permission denied
[vo/gpu/drm] Failed to restore previous mode
[vo/gpu/drm] Failed to drop DRM master: Permission denied
[vo/gpu-next/drm] Can't handle vt 0: VT_ACTIVATE failed: Inappropriate ioctl for device
[vo/gpu-next/drm] Failed to set up VT switcher: Terminal switching will be unavailable.
[vo/gpu-next/drm] Failed to acquire DRM master: Permission denied
[vo/gpu-next/drm] Failed to commit ModeSetting atomic request: Permission denied
[vo/gpu-next/drm] Failed to set CRTC for connector 313: Permission denied
[vo/gpu-next/drm] Failed to commit ModeSetting atomic request: Permission denied
[vo/gpu-next/drm] Failed to restore previous mode
[vo/vdpau] Warning: this compatibility VO is low quality and may have issues with OSD, scaling, screenshots and more.
[vo/vdpau] vo=gpu is the preferred choice in any case and includes VDPAU support via hwdec=vdpau or vdpau-copy.

Offline

#4 2025-05-08 07:45:37

Xephon
Member
Registered: 2024-12-22
Posts: 95

Re: Screen is flashing when watching video

Prior to v 0.40 mpv had used --gpu-api=opengl by default. In 0.40 mpv that was changed to --gpu-api=vulkan. It led to glitches on some systems.
That's why it's a good idea to use mpv.conf.

But you said every other player is affected.
Provide output of

vainfo
vulkaninfo --summary
glxinfo -B

Offline

#5 2025-05-08 11:47:32

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

Prior to v 0.40 mpv had used --gpu-api=opengl by default. In 0.40 mpv that was changed to --gpu-api=vulkan. It led to glitches on some systems.
That's why it's a good idea to use mpv.conf.

But you said every other player is affected.

It must be a Wayland bug, the only common denominator here.

vainfo

Trying display: wayland
vaInitialize failed with error code -1 (unknown libva error),exit

Looks like VA-API is not configured but it shouldn't be a problem, I can reproduce the issue with software decoding.

vulkaninfo --summary

name of display: :1
display: :1  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) UHD Graphics (TGL GT1) (0x9a60)
    Version: 25.0.5
    Accelerated: yes
    Video memory: 31999MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics (TGL GT1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 25.0.5-arch1.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 25.0.5-arch1.1
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 25.0.5-arch1.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

denis@arch ~> LIBVA_DRIVER_NAME="i915" vainfo
Trying display: wayland
vaInitialize failed with error code -1 (unknown libva error),exit
denis@arch ~ [3]> LIBVA_DRIVER_NAME="i965" vainfo
Trying display: wayland
vaInitialize failed with error code -1 (unknown libva error),exit
denis@arch ~ [3]> vainfo
Trying display: wayland
vaInitialize failed with error code -1 (unknown libva error),exit
denis@arch ~ [3]> vainfo
Trying display: wayland
vaInitialize failed with error code -1 (unknown libva error),exit
denis@arch ~ [3]> vulkaninfo --summary
==========
VULKANINFO
==========

Vulkan Instance Version: 1.4.309


Instance Extensions: count = 25
-------------------------------
VK_EXT_acquire_drm_display             : extension revision 1
VK_EXT_acquire_xlib_display            : extension revision 1
VK_EXT_debug_report                    : extension revision 10
VK_EXT_debug_utils                     : extension revision 2
VK_EXT_direct_mode_display             : extension revision 1
VK_EXT_display_surface_counter         : extension revision 1
VK_EXT_headless_surface                : extension revision 1
VK_EXT_surface_maintenance1            : extension revision 1
VK_EXT_swapchain_colorspace            : extension revision 5
VK_KHR_device_group_creation           : extension revision 1
VK_KHR_display                         : extension revision 23
VK_KHR_external_fence_capabilities     : extension revision 1
VK_KHR_external_memory_capabilities    : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2         : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2       : extension revision 1
VK_KHR_portability_enumeration         : extension revision 1
VK_KHR_surface                         : extension revision 25
VK_KHR_surface_protected_capabilities  : extension revision 1
VK_KHR_wayland_surface                 : extension revision 6
VK_KHR_xcb_surface                     : extension revision 6
VK_KHR_xlib_surface                    : extension revision 6
VK_LUNARG_direct_driver_loading        : extension revision 1
VK_NV_display_stereo                   : extension revision 1

Instance Layers: count = 7
--------------------------
VK_LAYER_FROG_gamescope_wsi_x86_64 Gamescope WSI (XWayland Bypass) Layer (x86_64) 1.3.221  version 1
VK_LAYER_MANGOHUD_overlay_x86_64   Vulkan Hud Overlay                             1.3.0    version 1
VK_LAYER_NV_optimus                NVIDIA Optimus layer                           1.4.303  version 1
VK_LAYER_VALVE_steam_fossilize_32  Steam Pipeline Caching Layer                   1.3.207  version 1
VK_LAYER_VALVE_steam_fossilize_64  Steam Pipeline Caching Layer                   1.3.207  version 1
VK_LAYER_VALVE_steam_overlay_32    Steam Overlay Layer                            1.3.207  version 1
VK_LAYER_VALVE_steam_overlay_64    Steam Overlay Layer                            1.3.207  version 1

Devices:
========
GPU0:
        apiVersion         = 1.4.303
        driverVersion      = 570.144.0.0
        vendorID           = 0x10de
        deviceID           = 0x24b6
        deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
        deviceName         = NVIDIA RTX A5000 Laptop GPU
        driverID           = DRIVER_ID_NVIDIA_PROPRIETARY
        driverName         = NVIDIA
        driverInfo         = 570.144
        conformanceVersion = 1.4.1.0
        deviceUUID         = 08955ebe-393c-a089-7f46-ad013972b82e
        driverUUID         = eaf4e390-464c-5ed9-8723-edf7c86851f3
GPU1:
        apiVersion         = 1.4.305
        driverVersion      = 25.0.5
        vendorID           = 0x8086
        deviceID           = 0x9a60
        deviceType         = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
        deviceName         = Intel(R) UHD Graphics (TGL GT1)
        driverID           = DRIVER_ID_INTEL_OPEN_SOURCE_MESA
        driverName         = Intel open-source Mesa driver
        driverInfo         = Mesa 25.0.5-arch1.1
        conformanceVersion = 1.4.0.0
        deviceUUID         = 8680609a-0100-0000-0002-000000000000
        driverUUID         = 9e68a309-edf1-55c7-b312-787ebe175ef8

glxinfo -B

name of display: :1
display: :1  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) UHD Graphics (TGL GT1) (0x9a60)
    Version: 25.0.5
    Accelerated: yes
    Video memory: 31999MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics (TGL GT1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 25.0.5-arch1.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 25.0.5-arch1.1
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 25.0.5-arch1.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

Offline

#6 2025-05-08 11:58:08

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

Running mpv with --vo=gpu-next also solves the issue.

Offline

#7 2025-05-08 12:44:22

Xephon
Member
Registered: 2024-12-22
Posts: 95

Re: Screen is flashing when watching video

Looks like VA-API is not configured but it shouldn't be a problem, I can reproduce the issue with software decoding.

Flashes in fullscreen could be a manifestation of screen tearing. So it could be a problem.

Configure vaapi for your iGPU as described here
https://wiki.archlinux.org/title/Hardwa … tion#Intel

Offline

#8 2025-05-08 13:14:21

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

Xephon wrote:

Flashes in fullscreen could be a manifestation of screen tearing. So it could be a problem.

Alright, done. Here's output of vainfo:

Trying display: wayland
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 25.2.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointEncSlice
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointEncSlice
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP

The issue is still present.

Honestly it doesn't look like tearing, more like flickering.

Offline

#9 2025-05-08 13:46:53

seth
Member
Registered: 2012-09-03
Posts: 63,501

Re: Screen is flashing when watching video

I'm using mpv, it should have native Wayland support (no XWayland). When switching to X, the issue is gone.

What "wayland" (which compositor)?
The fullscreen window is probably being unredirected - how many monitors do you have and are any of them attached to the nvidia GPU?

Offline

#10 2025-05-08 14:41:27

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

seth wrote:

What "wayland" (which compositor)?

I'm on KDE, so it must be KWin

seth wrote:

The fullscreen window is probably being unredirected - how many monitors do you have and are any of them attached to the nvidia GPU?

Sometimes I connect my laptop to external display, the issue persists with and without monitor. Though it's less noticeable when it's disconnected.
How do I know to which GPU it's attached?

Offline

#11 2025-05-08 16:18:02

Xephon
Member
Registered: 2024-12-22
Posts: 95

Re: Screen is flashing when watching video

Play flickering videos in all the players you have and then post the output of

journalctl -b --no-pager

Last edited by Xephon (2025-05-08 16:18:56)

Offline

#12 2025-05-08 18:02:23

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

Xephon wrote:

Play flickering videos in all the players you have and then post the output of

journalctl -b --no-pager

https://paste.c-net.org/GunshotFraction
Nothing interesting...

Offline

#13 2025-05-08 18:21:15

Xephon
Member
Registered: 2024-12-22
Posts: 95

Re: Screen is flashing when watching video

Do you have Adaptive Sync enabled in System Settings->Display & Monitor by any chance?

Offline

#14 2025-05-08 20:50:49

seth
Member
Registered: 2012-09-03
Posts: 63,501

Re: Screen is flashing when watching video

How do I know to which GPU it's attached?

The xorg log will know.

Though

Sometimes I connect my laptop to external display, the issue persists with and without monitor.

Ftr, kwin_x11 however will most likely be unredirecting fullscreen windows (is this configurable in systemsettings?) what makes things less comparable from that direction.
Certainly check the VRR condition as Xephon suggested.

Offline

#15 2025-05-09 00:49:33

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

Adaptive Sync was enabled.
I disabled it and looks like the issue is gone...

Offline

#16 2025-05-09 00:56:13

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

black_dragon wrote:

Running mpv with --vo=gpu-next also solves the issue.

I was wrong, the issue still persists. It took a while to show up.

Offline

#17 2025-05-09 06:07:54

Xephon
Member
Registered: 2024-12-22
Posts: 95

Re: Screen is flashing when watching video

I'm confused. Does the issue persist for all players? Then why did you quote your own post?
Or it persists only for mpv with that option?

Last edited by Xephon (2025-05-09 08:04:09)

Offline

#18 2025-05-09 06:51:43

seth
Member
Registered: 2012-09-03
Posts: 63,501

Re: Screen is flashing when watching video

He asserted gpu-next to be fine and figured he was wrong about that.
More importantly

Adaptive Sync was enabled.
I disabled it and looks like the issue is gone...

and there're indeed several reports about that being a pot. issue.

Offline

#19 2025-05-09 08:51:18

black_dragon
Member
Registered: 2025-04-18
Posts: 25

Re: Screen is flashing when watching video

seth wrote:

He asserted gpu-next to be fine and figured he was wrong about that.

Yes, exactly.

So it is the VRR flicker problem.
I'd like to report this to upstream, is it KWin's issue? How to isolate it more?

Offline

#20 2025-05-09 09:08:36

Xephon
Member
Registered: 2024-12-22
Posts: 95

Re: Screen is flashing when watching video

Then it was mpv vulkan issue on top of VRR flickering issue

There is a bug report already on VRR flickering
https://bugs.kde.org/show_bug.cgi?id=477016

It's 1.5 years old and still unresolved

Offline

Board footer

Powered by FluxBB