Bug 103063 - YUV I420 SHM broken with GStreamer/Weston
Summary: YUV I420 SHM broken with GStreamer/Weston
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-02 15:36 UTC by Fabien Lahoudere
Modified: 2018-06-04 07:04 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Fabien Lahoudere 2017-10-02 15:36:44 UTC
There is artefacts when I use "gst-launch-1.0 videotestsrc ! waylandsink"

Video: https://drive.google.com/file/d/0BxOZkTa_NtY-bFloR2IyUDRveU0/view?usp=sharing

I am using wayland 1.14.0, weston 3.0.0 and have no X support installed.
I can reproduce the same issue on two hardware imx6 riotboard and raspberrypi3.

I can provide an sdcard image with debug symbol if needed.
I can also do some tests.
Comment 1 Daniel Stone 2017-10-02 16:03:43 UTC
Something's wrong with either Weston's I420/SHM import path (wouldn't be surprised if it was that), or GStreamer's usage of the same. This works around it, with obvious performance consequences:
gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,format=(string)RGB ! waylandsink
Comment 2 Daniel Stone 2017-10-03 10:04:25 UTC
First, it would be interesting to validate how GStreamer is rendering the buffer. It should be laid out, in order:
Y plane: offset == 0, stride == (width * 1), i.e. 1bpp, size == (stride * height), i.e. full height
U plane: offset == size[Y], stride == (width/2 * 1), i.e. 1bpp but half width, size == (stride * height/2), i.e. half height
V plane: offset == offset[U] + size[U], stride == (width/2 * 1), size == (stride * height/2), i.e. half width/height

If GStreamer is rendering correctly, this comes in to Weston at libweston/gl-renderer.c's gl_renderer_attach_shm(). In the YUV420 case (aka GStreamer's I420), this sets up the textures as described above. It then uploads the content in gl_renderer_flush_damage(), where it uploads according to the parameters set in attach_shm.

It looks from a quick inspection of the code that this is done correctly (i.e. dividing by hsub/vsub to halve the dimensions of the U/V planes), but it would be good to validate the parameters passed to glTex(Sub)Image2D() for the upload, after validating GStreamer's buffer layout.
Comment 3 Daniel Stone 2017-10-05 14:45:47 UTC
Weston fix: https://patchwork.freedesktop.org/patch/180767/
Comment 4 Fabien Lahoudere 2017-10-06 19:55:49 UTC
I test the patch and everything works fine now.
Comment 5 Daniel Stone 2018-06-04 07:04:01 UTC
This landed in the tree a while ago.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.