Bug 271390

Summary: Playing back high resolution video file causes video signal loss
Product: Ports & Packages Reporter: Tommy Johnson <bsd>
Component: Individual Port(s)Assignee: freebsd-x11 (Nobody) <x11>
Status: Open ---    
Severity: Affects Some People CC: grahamperrin
Priority: --- Keywords: needs-qa, performance
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
labrat dmesg
none
labrat pciconfig none

Description Tommy Johnson 2023-05-13 14:54:35 UTC
Created attachment 242141 [details]
labrat dmesg

When one plays back a video file of sufficient resolution (I tested with 4096x2160), on a display of sufficient resolution (tested with 3840x2160), the video signal is irregularly lost, generally for 2 or 3 seconds.  The entire video signal is lost, the monitor acts like the video cable is unplugged.

To reproduce:
        get the file http://www.bobdbob.com/~tjohnson/line_finders.mkv
        mplayer -fs -zoom -lavdopts threads=16 -vo gl line_finders.mkv
        using a 3840x2160 display

I have reproduced the problem on two separate but more or less identical machines.  It seems to be dependent on the model of video card.

It does not occur on a 1920x1080 display.  If a machine has two monitors, only the high resolution monitor will glitch, even if it is not showing any of the video.  

It does not occur when the video file is low resolution.  A 704x480 pixel file or a 1920x1080 pixel file will play back full screen on a 3840x2160 display without glitching.

Disabling acceleration fixes it, but results in a useless frame rate.  (Accel off) AccelMethod None has the same effect.  "-vo x11" has the same result, stable but with a frame rate of about 1 Hz.

machine 1 is FreeBSD labrat 13.2-STABLE FreeBSD 13.2-STABLE stable/13-n254799-aa728e209458 GENERIC amd64

/usr/src:
        git branch -v
        main        a7eac018437e [behind 3577] stty(1): provide details about interaction with job
 control
        releng/13.0 5fe9c9de03ef Add UPDATING entries and bump version
        releng/13.1 752f813d6ccc [behind 24] Add UPDATING entries and bump version
        * stable/13   aa728e209458 sqlite3: Vendor import of sqlite3 3.41.0
       
/usr/ports:
        * main 032128651c44 graphics/vulkan-extension-layer: update to 1.3.243

vgapci0@pci0:2:0:0:     class=0x030000 rev=0xc7 hdr=0x00 vendor=0x1002 device=0x699f subvendor=0x1
545 subdevice=0x0550
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X]'
    class      = display
    subclass   = VGA

$pkg info | grep drm
drm-510-kmod-5.10.163_2        DRM drivers modules
drm-kmod-20220907_1            Metaport of DRM modules for the linuxkpi-based KMS components
gpu-firmware-kmod-20230210_1,1 Firmware modules for the drm-kmod drivers
libdrm-2.4.115,1               Userspace interface to kernel Direct Rendering Module services

machine 2 is FreeBSD edison 13.0-RELEASE-p5 FreeBSD 13.0-RELEASE-p5 #1 releng/13.0-n244765-2646dd66590: Sat Nov 20 16:24:30 EST 2021     protius@edison:/usr/src/sys/amd64/compile/EDISON  amd64

        /usr/src
                git branch -v
                * releng/13.0 2646dd66590 Add UPDATING entries and bump version.

        /usr/ports
                git branch -v
                * main 4019e413fc13 security/vuxml: add an entrey for ReDoS in graphics/py-pillow

video card:
vgapci0@pci0:4:0:0:     class=0x030000 rev=0xc7 hdr=0x00 vendor=0x1002 device=0x699f subvendor=0x1
545 subdevice=0x0550
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X]'
    class      = display
    subclass   = VGA


$pkg info | grep drm
drm-fbsd13-kmod-5.4.144.g20211013 DRM modules for the linuxkpi-based KMS components
drm-kmod-g20190710_1           Metaport of DRM modules for the linuxkpi-based KMS components
libdrm-2.4.108,1               Userspace interface to kernel Direct Rendering Module services
Comment 1 Tommy Johnson 2023-05-13 14:55:32 UTC
Created attachment 242142 [details]
labrat pciconfig
Comment 2 Jan Beich freebsd_committer freebsd_triage 2023-05-13 15:50:02 UTC
^Triage: replacing CC list with Assignee to a maillist most familar with graphics issues.

Sorry, I'm *not* familar with AMD GPUs, VDPAU, Xorg or mplayer and don't have issues on my Intel Skylake iGPU watching 2160p60 videos with "mpv --hwdec=vaapi --gpu-api=vulkan" under Sway.

Maybe try to rule out Xorg by playing a video directly on KMS console (e.g., switch to /dev/ttyv0 via Ctrl+Alt+F1).

  $ mpv --no-config --hwdec=vaapi --gpu-context=drm /path/to/foo.mp4
or
  $ mpv --no-config --hwdec=vaapi --gpu-api=vulkan --gpu-context=displayvk /path/to/foo.mp4
Comment 3 Tommy Johnson 2023-05-14 03:00:15 UTC
I am similarly unfamiliar with mpv...

I installed it, and executed the two commands you specified with both line_finders.mkv and a couple of other lower resolution files.  I ran it on VTY0, with no X loaded.

Instead of 2-3 second glitches, it just does not display anything at all (the same loss of signal, not a signal carrying black).  However the display returns after the expected duration of the file.

I believe this is more of an AMD issue than an Xorg issue.