Bug 12936

Summary: xserver upgrade probably broke video rendering using vaapisink
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Anuj Mittal <anuj.mittal>
Component: coreAssignee: Anuj Mittal <anuj.mittal>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod, ross.burton
Version: 2.6   
Target Milestone: 4.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Anuj Mittal 2018-09-27 08:36:12 UTC
gst-launch-1.0 videotestsrc ! vaapisink

This results in a non responsive display with 1.20.1 version. Tried reverting the upgrade and didn't see any issues after that. Using glimagesink works.
Comment 1 Ross Burton 2018-10-04 15:05:34 UTC
Updates from Anuj:

I was looking at this bug and it looks like a problem with glamor
acceleration in the latest xserver/mesa upstream when using dri2 when
both dri2 and dri3 are enabled.

* As an example, this also fails (with no error in Xorg.log or in dmesg)
with poky master:

LIBGL_DRI3_DISABLE=1 glxgears

when dri2 and dri3 are built-in with modesetting driver using glamor 2D
acceleration (all default). vaapi apps fail probably because libva
relies on dri2.

* I built the latest X/mesa/xcb with 4.18 kernel and it doesn't seem to
have been fixed yet upstream. Will log a bug after debugging the code
some more to see if I can fix this.

* Using intel driver with dri3/dri2 works. Using wayland or xwayland
instead of X also works with dri3/glamor. Disabling glamor to switch to
software rendering also works.
Comment 2 Ross Burton 2018-10-04 15:24:54 UTC
Best thing I can recommend so far is to chase this with the libva upstream.  They're Intel so we should have a good route there.

Also https://github.com/intel/intel-vaapi-driver/pull/369 is interesting, and worth applying as an experiment.
Comment 3 Anuj Mittal 2018-10-09 09:03:26 UTC
I did a bisect to see what changed that is resulting in this behaviour and this is the bad commit:

commit 86b2d8740a330deafe8a9bbf0402705a43efbb42
Author: Daniel Stone <daniels@collabora.com>
Date:   Wed Apr 4 16:16:36 2018 +0100

    glamor: Reallocate pixmap storage without modifiers if necessary
    
    If we need a pixmap's storage to be exported to a context in which we
    aren't aware of modifiers, reallocate the buffer again without
    modifiers.
    
    This makes it possible to run a compositing manager on an old GLX/EGL
    stack on top of an X server which allocates internal buffer storage
    using exotic modifiers from modifier-aware GBM/EGL/KMS.

I think I have a fix:

https://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=anujm/wip&id=cfab34da2b73eb229c61b39fa443fb66b954e9ed
Comment 4 Ross Burton 2018-10-09 10:44:40 UTC
I spoke to Daniel earlier and he says that your fix isn't right, and:

[11:39:46]  <daniels>	i have the inkling of an idea what this might be
[11:39:52]  <daniels>	but it gets into some seriously unpleasant parts of glx

Such fun!
Comment 5 Anuj Mittal 2018-10-15 02:10:51 UTC
Thanks Ross. I have filed a bug upstream. Looks like FreeBSD has the same problem:

https://bugs.freebsd.org/bugzilla/attachment.cgi?id=197417&action=diff#x11-servers/xorg-server/Makefile_sec5
Comment 6 Ross Burton 2018-11-15 14:25:43 UTC
Anuj: can you file a detailed bug upstream at https://gitlab.freedesktop.org/xorg/xserver/issues.  Include a minimal reproducer, the works/fails matrix, as much context as possible.  Please CC me and llandwerlin (Intel VPG developer here in London), we'll try to rope others in too.
Comment 7 Anuj Mittal 2018-11-16 08:50:18 UTC
(In reply to comment #6)
> Anuj: can you file a detailed bug upstream at
> https://gitlab.freedesktop.org/xorg/xserver/issues.  Include a minimal
> reproducer, the works/fails matrix, as much context as possible.  Please CC
> me and llandwerlin (Intel VPG developer here in London), we'll try to rope
> others in too.

Done, thanks! 

https://gitlab.freedesktop.org/xorg/xserver/issues/13
Comment 8 Anuj Mittal 2018-12-04 02:00:58 UTC
Ross was able to reproduce this on Fedora 29 (more details in xserver bug report n comment above) and it was decided that we should reduce the rank of vaapisink for now so playbin works. 

The patch was merged:

https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit?id=67f5aac7dfe90f3d2c527fe6387ffc3256aa8065

Changing milestone to 2.7 so we know that this still needs to be fixed and this patch should also be reverted then.
Comment 9 Anuj Mittal 2021-01-22 04:29:13 UTC
Upstream also reduced the rank of vaapisink

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/commit/13d090b5660a2e2e2c997db44ba9a391101e8bd6